/* Dubbing Studio landing page. Apple-like: black and light-grey fields, system type, one accent. */
:root {
  --bg: #000;
  --surface: #121214;
  --surface-2: #1d1d1f;
  --light: #f5f5f7;
  --ink: #f5f5f7;
  --ink-dark: #1d1d1f;
  --muted: #a1a1a6;
  --muted-dark: #515154;
  --accent: #c8f540;
  --accent-ink: #0b0d05;
  /* The app's own interface colours, used only inside its fragments. */
  --ui-bg: #0f1116;
  --ui-card: #161921;
  --ui-line: #262b37;
  --ui-text: #f2f4f8;
  --ui-soft: #a8afbd;
  --s1: #a594ff;
  --s2: #ffd25e;
  --s3: #3ddbc1;
  --s4: #ff8cc6;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", "Segoe UI", system-ui, sans-serif;
  --khmer: "Noto Sans Khmer", "Khmer Sangam MN", var(--font);
  --t-small: 14px;
  --t-body: 17px;
  --t-state: clamp(20px, 1.7vw, 24px);
  --t-head: clamp(32px, 3.6vw, 56px);
  --t-display: clamp(44px, 5.6vw, 92px);
  --m: clamp(20px, 2.8vw, 40px);
  --r: 18px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; margin: 0; }
html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--ink); font: 400 var(--t-body)/1.5 var(--font); -webkit-font-smoothing: antialiased; }
img { display: block; max-width: 100%; height: auto; border-radius: var(--r); }
a { color: inherit; }
[lang="km"] { font-family: var(--khmer); }
h1, h2 { font-weight: 600; letter-spacing: -0.03em; line-height: 1.02; text-wrap: balance; }
h1 { font-size: var(--t-display); }
h2 { font-size: var(--t-head); }
h3 { font-size: var(--t-state); font-weight: 600; letter-spacing: -0.015em; line-height: 1.2; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.button { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 26px; border: 0; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font: 600 var(--t-body)/1 var(--font); text-decoration: none; cursor: pointer; transition: transform 160ms var(--ease), background-color 160ms; }
.button:hover { transform: scale(1.03); }
.button:active { transform: scale(0.97); }
.button.dark { background: var(--ink-dark); color: var(--light); }

/* ---------- the app's own interface, in fragments ---------- */
.ui { background: var(--ui-bg); color: var(--ui-text); border: 1px solid var(--ui-line); /* taste-skill-ignore: the app's own panel */ border-radius: 16px; font-size: var(--t-small); line-height: 1.4; }
.tag { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 24px; padding: 0 7px; border: 0; border-radius: 5px; background: var(--s1); color: #0b0d05; font: 700 13px/1 var(--font); }
.tag[data-s="2"] { background: var(--s2); }
.tag[data-s="3"] { background: var(--s3); }
.tag[data-s="4"] { background: var(--s4); }
button.tag { cursor: pointer; min-height: 30px; min-width: 40px; transition: transform 140ms var(--ease); }
button.tag:hover { transform: scale(1.12); }
button.tag:active { transform: scale(0.94); }
.seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--ui-card); border: 1px solid var(--ui-line); } /* taste-skill-ignore: the app's own control */
.seg button { min-height: 40px; padding: 0 16px; border: 0; border-radius: 8px; background: transparent; color: var(--ui-soft); font: 500 14px/1 var(--font); cursor: pointer; transition: background-color 160ms, color 160ms, transform 140ms var(--ease); }
.seg button:hover { color: var(--ui-text); }
.seg button:active { transform: scale(0.96); }
.seg button[aria-checked="true"] { background: var(--ui-text); color: #0b0d05; }

/* ---------- hero: two tones, words bottom-left, the cue table live on the right ---------- */
.hero { display: grid; grid-template-columns: 1fr 1fr; min-height: 100svh; }
.hero-words { position: relative; display: flex; flex-direction: column; justify-content: flex-end; padding: var(--m); }
.mark { position: absolute; top: var(--m); left: var(--m); display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--accent); color: var(--accent-ink); }
.hero-link { position: absolute; top: calc(var(--m) + 10px); right: var(--m); font-size: var(--t-small); text-decoration: none; }
.hero-link:hover { text-decoration: underline; }
.lede { max-width: 40ch; margin: 22px 0 28px; color: var(--muted); }
.hero-stage { display: grid; place-items: center; padding: var(--m); background: var(--surface); }
.stage-in { display: grid; justify-items: center; gap: 16px; width: min(100%, 380px); }
.stage-in .demo-film { width: min(100%, 34svh); }
.stage-in .said { width: 100%; margin: 0; min-height: 84px; }
.cues { width: min(100%, 600px); padding: 6px 0 14px; }
.ui-head { display: flex; justify-content: space-between; gap: 12px; padding: 12px 18px; color: var(--ui-soft); }
.ui-head b { color: var(--ui-text); font-weight: 600; }
.cues table { width: 100%; border-collapse: collapse; }
.cues th { padding: 8px 10px; text-align: left; font-weight: 400; color: var(--ui-soft); }
.cues td { padding: 9px 10px; border-top: 1px solid var(--ui-line); vertical-align: middle; } /* taste-skill-ignore: the app's own table */
.cues th:first-child, .cues td:first-child { padding-left: 18px; color: var(--ui-soft); font-variant-numeric: tabular-nums; }
.cues td[lang="km"] { font-size: 16px; padding-right: 18px; }
.cues tbody tr { transition: background-color 160ms; }
.cues tbody tr:hover { background: var(--ui-card); }
.ui-foot { padding: 14px 18px 0; border-top: 1px solid var(--ui-line); font-weight: 600; } /* taste-skill-ignore: inside the app fragment */
.ui-hint { padding: 2px 18px 0; color: var(--ui-soft); }

.lines .line { display: block; overflow: hidden; padding-bottom: 0.1em; margin-bottom: -0.1em; }
.lines [data-line] { display: block; }
@media (prefers-reduced-motion: no-preference) {
  .js .lines [data-line] { transform: translateY(105%); animation: line-up 900ms var(--ease) forwards; animation-delay: calc(var(--i) * 110ms + 150ms); }
  .js .after { opacity: 0; animation: fade-up 700ms var(--ease) 700ms forwards; }
  .js .hero-stage .stage-in { opacity: 0; animation: fade-up 900ms var(--ease) 400ms forwards; }
  .js .reveal, .js .field > * { opacity: 0; transform: translateY(26px); transition: opacity 700ms var(--ease) var(--d, 0ms), transform 800ms var(--ease) var(--d, 0ms); }
  .js .reveal.in, .js .field.in > * { opacity: 1; transform: none; }
  .js .field.in > :nth-child(2) { transition-delay: 90ms; }
  .js .field.in > :nth-child(3) { transition-delay: 180ms; }
}
@keyframes line-up { to { transform: none; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

/* ---------- the demo scene: one picture, two sounds ---------- */
.demo { display: grid; grid-template-columns: 1fr 1fr; gap: calc(var(--m) * 2); align-items: center; padding: clamp(72px, 9vw, 140px) var(--m); }
.demo-film { position: relative; border-radius: var(--r); overflow: hidden; background: var(--bg); }
.demo .cues { justify-self: start; }
.demo-words { justify-self: end; }
.demo-film video { display: block; width: 100%; height: auto; cursor: pointer; }
.play { position: absolute; left: 50%; top: 50%; display: grid; place-items: center; width: 84px; height: 84px; margin: -42px 0 0 -42px; border: 0; border-radius: 50%; background: var(--accent); color: var(--accent-ink); cursor: pointer; transition: transform 200ms var(--ease), opacity 300ms; }
.play:hover { transform: scale(1.08); }
.play:active { transform: scale(0.94); }
.demo-film.on .play { opacity: 0; }
.demo-film.on:hover .play, .demo-film.on .play:focus-visible { opacity: 1; }
.demo-words { max-width: 46ch; }
.demo-words > p { margin: 20px 0 28px; color: var(--muted); }
.seg.big button { min-height: 48px; padding: 0 22px; font-size: var(--t-body); }
.said { display: flex; align-items: flex-start; gap: 12px; margin-top: 20px; padding: 16px; min-height: 92px; }
.said p { font-size: var(--t-body); line-height: 1.55; }
.said p[lang="km"] { line-height: 1.7; }

/* ---------- scroll animation: parts move with the page, by --p and --e from app.js ---------- */
.scrolls [data-p] { --p: 0; --e: 0; }
.scrolls img[data-p] { transform: translateY(calc((1 - var(--e)) * 90px)) scale(calc(0.88 + var(--e) * 0.12)); opacity: calc(0.2 + var(--e) * 0.8); transform-origin: 50% 0; will-change: transform; }
.scrolls .screen img[data-p] { transform: scale(calc(0.8 + var(--e) * 0.2)); transform-origin: 50% 100%; }
.scrolls .hero .stage-in { translate: 0 calc((var(--p) - 0.5) * -160px); }
.scrolls .hero .hero-foot { translate: 0 calc((var(--p) - 0.5) * 70px); }
.scrolls .demo .cues { transform: translateY(calc((1 - var(--e)) * 120px)) scale(calc(0.9 + var(--e) * 0.1)); }
.scrolls .strip .card { translate: 0 calc((1 - var(--e)) * 140px); }
.scrolls .strip .field:nth-child(2) .card { translate: 0 calc((1 - var(--e)) * 210px); }
.scrolls .strip .field:nth-child(3) .card { translate: 0 calc((1 - var(--e)) * 280px); }
.scrolls .strip .field:nth-child(4) .card { translate: 0 calc((1 - var(--e)) * 350px); }
.scrolls .strip .field:nth-child(5) .card { translate: 0 calc((1 - var(--e)) * 420px); }
.scrolls .half-in .half-title { translate: calc((1 - var(--e)) * -18vw) 0; }
.scrolls .half-out .half-title { translate: calc((1 - var(--e)) * 18vw) 0; }
.scrolls .halves, .scrolls .get { overflow: hidden; }
.scrolls .get h2 { translate: calc((1 - var(--e)) * -14vw) 0; }
.scrolls .get .dialog { translate: 0 calc((1 - var(--e)) * 160px); }
.scrolls .t-name { scale: calc(0.8 + var(--e) * 0.2); }
.scrolls .t-go svg { translate: calc((1 - var(--e)) * -40px) calc((1 - var(--e)) * 40px); }

/* ---------- five tools: five fields, the film's file further along in each ---------- */
.strip { display: grid; grid-template-columns: repeat(5, 1fr); min-height: 84svh; }
.field { position: relative; display: flex; flex-direction: column; justify-content: flex-end; gap: 28px; padding: 28px; }
.field:nth-child(1) { background: #0a0a0b; }
.field:nth-child(2) { background: #161618; }
.field:nth-child(3) { background: #232326; }
.field:nth-child(4) { background: #323236; }
.field:nth-child(5) { background: var(--light); color: var(--ink-dark); }
.field h2 { position: absolute; top: 28px; left: 28px; right: 28px; font-size: var(--t-state); letter-spacing: -0.02em; line-height: 1.15; }
.field > p { font-size: var(--t-state); font-weight: 500; letter-spacing: -0.015em; line-height: 1.2; min-height: 3.6em; }
.card { display: grid; gap: 4px; padding: 16px; margin-bottom: auto; margin-top: 30svh; transition: transform 150ms var(--ease); }
.field:hover .card { transform: translateY(-6px); }
.card b { font-size: var(--t-small); }
.card span { color: var(--ui-soft); margin-top: 10px; }
.card em { font-style: normal; font-weight: 600; overflow-wrap: anywhere; }
.card i { font-style: normal; color: var(--ui-soft); }

/* ---------- their words, in Khmer ---------- */
.halves { position: relative; display: grid; grid-template-columns: 1fr 1fr; min-height: 90svh; }
.half-in, .half-out { position: relative; display: flex; flex-direction: column; padding: 22svh var(--m) 0; }
.half-in { background: var(--bg); padding-left: calc(var(--m) * 3); }
.half-out { background: var(--light); color: var(--ink-dark); align-items: flex-start; }
.sources { display: grid; gap: 6px; justify-items: start; }
.sources button { padding: 8px 14px; margin-left: -14px; border: 0; border-radius: 12px; background: transparent; color: var(--muted); font: 500 var(--t-state)/1.3 var(--font); text-align: left; cursor: pointer; transition: color 180ms, background-color 180ms, transform 140ms var(--ease); }
.sources button:hover { color: var(--ink); }
.sources button:active { transform: scale(0.98); }
.sources button[aria-checked="true"] { color: var(--ink); background: var(--surface-2); }
.cue { width: min(100%, 480px); padding: 22px; }
.cue-top { display: flex; align-items: center; gap: 10px; color: var(--ui-soft); }
.cue-km { margin: 22px 0 26px; font-size: 30px; line-height: 1.6; }
.cue-bar { height: 6px; border-radius: 3px; background: var(--ui-line); overflow: hidden; }
.cue-bar span { display: block; height: 100%; border-radius: 3px; background: var(--ui-soft); transition: width 400ms var(--ease); }
.cue-time { margin-top: 10px; color: var(--ui-soft); font-variant-numeric: tabular-nums; }
.cue-time b { color: var(--ui-text); font-weight: 500; }
.half-title { margin-top: auto; padding: 48px 0 32px; font-size: var(--t-display); font-weight: 600; letter-spacing: -0.03em; line-height: 1; }

/* ---------- one whole screen, on the light field ---------- */
.screen { padding: clamp(96px, 12vw, 180px) var(--m) clamp(64px, 8vw, 120px); }
.light { background: var(--light); color: var(--ink-dark); }
.light p { color: var(--ink-dark); }
.screen-words { display: grid; grid-template-columns: 5fr 7fr; gap: var(--m); align-items: end; margin-bottom: clamp(40px, 5vw, 72px); }
.screen-words p { max-width: 54ch; }

/* ---------- pinned: the export on the left, its controls scrolling on the right ---------- */
.pinned { display: grid; grid-template-columns: 1fr 1fr; background: var(--light); color: var(--ink-dark); }
.pinned > h2 { grid-column: 2; grid-row: 1; max-width: 12ch; padding: 72px var(--m) 0 calc(var(--m) * 2); }
.pin { grid-column: 1; grid-row: 1 / span 2; }
.blocks { grid-column: 2; grid-row: 2; }
.pin { position: sticky; top: 0; height: 100svh; display: grid; place-items: center; padding: var(--m); background: var(--surface-2); }
.out { width: min(100%, 420px); padding: 16px; }
.thumb { position: relative; display: flex; align-items: flex-end; aspect-ratio: 16 / 9; padding: 16px; border-radius: 10px; background: #2b3140; overflow: hidden; }
.thumb-badge { position: absolute; top: 14px; left: 14px; padding: 5px 10px; border-radius: 6px; background: #e11d2e; color: #fff; font-size: 14px; font-weight: 600; }
.thumb-line { color: #ffe600; font-size: 34px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.05; transition: color 220ms; }
.out dl { margin-top: 8px; }
.out dl div { display: flex; justify-content: space-between; gap: 16px; padding: 11px 4px; border-top: 1px solid var(--ui-line); } /* taste-skill-ignore: inside the app fragment */
.out dl div:first-child { border-top: 0; }
.out dt { color: var(--ui-soft); }
.out dd { font-weight: 500; text-align: right; font-variant-numeric: tabular-nums; }
.out-state { margin-top: 8px; padding: 12px; border-radius: 10px; background: var(--ui-card); color: var(--ui-text); }
.blocks { padding: 0 var(--m) 30vh calc(var(--m) * 2); }
.block { max-width: 44ch; margin-top: 44vh; }
.blocks > .block:first-child { margin-top: 22vh; }
.block p { margin: 12px 0 22px; }
.light .seg, .pinned .seg { background: #e4e4e9; border-color: transparent; }
.pinned .seg button { color: var(--muted-dark); }
.pinned .seg button:hover { color: var(--ink-dark); }
.pinned .seg button[aria-checked="true"] { background: var(--ink-dark); color: var(--light); }
.range { display: grid; gap: 10px; font-size: var(--t-small); color: var(--muted-dark); }
.range b { color: var(--ink-dark); font-size: var(--t-state); }
.range input { width: 100%; height: 44px; accent-color: var(--ink-dark); }

/* ---------- statement beside a crop of the app ---------- */
.pair { display: grid; grid-template-columns: 5fr 7fr; gap: calc(var(--m) * 2); align-items: center; padding: clamp(80px, 10vw, 160px) var(--m); }
.pair.flip { grid-template-columns: 7fr 5fr; background: var(--surface); }
.pair-words p { max-width: 44ch; margin-top: 20px; color: var(--muted); }
.pair:nth-of-type(odd) img { justify-self: end; }

/* ---------- download ---------- */
.get { display: grid; grid-template-columns: 6fr 5fr; gap: var(--m); align-items: end; min-height: 90svh; padding: var(--m); background: var(--accent); color: var(--accent-ink); }
.get h2 { font-size: var(--t-display); line-height: 0.94; max-width: 9ch; }
.get-words p { margin-top: 20px; max-width: 38ch; }
.dialog { align-self: center; justify-self: center; display: grid; gap: 16px; justify-items: start; width: min(100%, 440px); padding: 26px; box-shadow: 0 30px 60px -20px rgb(0 0 0 / 0.45); } /* taste-skill-ignore: the app's dialog, open above the page */
.dialog b { font-size: var(--t-body); }
.dialog p { color: var(--ui-soft); }
.dialog .button.dark { width: 100%; min-height: 52px; background: var(--accent); color: var(--accent-ink); }
.dialog .button[aria-disabled] { background: var(--ui-card); color: var(--ui-soft); cursor: default; transform: none; }
.dialog .other[hidden] { display: none; }
.dialog .other { font-size: var(--t-small); color: var(--ui-soft); min-height: 44px; display: inline-flex; align-items: center; }
.dialog .other:hover { color: var(--ui-text); }

/* ---------- footer: a board of tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(12, 1fr); gap: 8px; padding: 8px; }
.tile { display: flex; flex-direction: column; justify-content: space-between; min-height: 220px; padding: 22px; border-radius: var(--r); background: var(--surface); }
.tile small { font-size: var(--t-small); color: var(--muted); }
.t-say { grid-column: span 5; }
.t-say p { font-size: var(--t-state); line-height: 1.25; max-width: 26ch; }
.t-nav { grid-column: span 4; justify-content: flex-start; gap: 6px; }
.t-nav a { text-decoration: none; min-height: 32px; }
.t-nav a:hover { text-decoration: underline; }
.t-lang { grid-column: span 3; background: var(--surface-2); font-size: var(--t-state); line-height: 1.25; }
.t-lang p[lang] { font-size: var(--t-head); }
.t-name { grid-column: span 8; min-height: 320px; justify-content: center; align-items: center; background: var(--light); color: var(--ink-dark); font-size: var(--t-display); font-weight: 600; letter-spacing: -0.04em; white-space: nowrap; }
.t-go { grid-column: span 4; min-height: 320px; background: var(--accent); color: var(--accent-ink); text-decoration: none; font-size: var(--t-state); font-weight: 600; transition: transform 200ms var(--ease); }
.t-go svg { align-self: flex-end; transition: transform 200ms var(--ease); }
.t-go:hover svg { transform: translate(6px, -6px); }

/* ---------- tablet and phone: each section recomposed, not shrunk ---------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; position: relative; }
  .hero-words { position: static; }
  .hero-stage { order: -1; padding-top: calc(var(--m) + 64px); }
  .hero-words { padding-top: 32px; }
  .hero-link { color: var(--ink); }
  h1 { font-size: clamp(40px, 11vw, 80px); }
  .cues th:first-child, .cues td:first-child { display: none; }
  .cues th:nth-child(2), .cues td:nth-child(2) { padding-left: 14px; }
  .strip { grid-template-columns: 1fr; }
  .scrolls .strip .field .card { translate: none; }
  .scrolls .hero .hero-foot, .scrolls .hero .stage-in { translate: none; }
  .stage-in .demo-film { width: min(66%, 23svh); }
  .play { width: 64px; height: 64px; margin: -32px 0 0 -32px; }
  .stage-in .said { display: none; }
  .demo-words { justify-self: start; }
  .demo { grid-template-columns: 1fr; gap: 36px; }
  .field { min-height: 0; justify-content: flex-start; gap: 24px; padding: 44px var(--m) 56px; }
  .field h2 { position: static; }
  .field > p { order: -1; min-height: 0; }
  .field h2 { order: -2; }
  .card { margin: 0; width: min(100%, 300px); }
  .halves { grid-template-columns: 1fr; }
  .half-in, .half-out { min-height: 62svh; padding: 48px var(--m) 0; }
  .half-title { padding: 32px 0 20px; font-size: 11vw; }
  .half-out { flex-direction: column-reverse; justify-content: flex-end; }
  .half-out .half-title { margin-top: 0; padding: 0 0 28px; }
  .screen-words, .pair, .pair.flip, .get { grid-template-columns: 1fr; }
  .pair.flip img { order: 2; }
  .pinned { grid-template-columns: 1fr; }
  .pinned > h2, .pin, .blocks { grid-column: 1; grid-row: auto; }
  .pinned > h2 { padding: 64px var(--m) 40px; }
  .hero-link { position: static; order: 2; margin-top: 20px; min-height: 44px; }
  .pin { height: 46svh; z-index: 1; place-items: start center; overflow: hidden; }
  .blocks { padding: 0 var(--m) 20vh; }
  .block, .blocks > .block:first-child { margin-top: 30vh; }
  .blocks > .block:first-child { margin-top: 48px; }
  .get { align-items: start; gap: 40px; padding-bottom: 48px; }
  .get h2 { font-size: 13vw; }
  .dialog { justify-self: stretch; width: 100%; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 6px; }
  .tile { grid-column: span 1; min-height: 180px; padding: 20px; }
  .t-name, .t-go, .t-say { grid-column: span 2; }
  .t-name { order: -2; min-height: 160px; font-size: 11vw; }
  .t-go { order: -1; min-height: 180px; }
}
