/* VOICE   academic project page: calm, exact, a little warm
   IDEA    the paper's own pipeline drawing: one stream of audio tokens forks into speech and a face
   PICTURE the teaser figure up top; a live latency timeline where the face lane runs beside the audio lane
   COLOUR  white ground, ink #0f1a24, TokTalk cyan (#0a7ea4 ink, #7fd3ea bars, #e3f6fb bands), decoder peach, LLM grey
   TYPE    Inter Tight 700 for display, Inter for text, JetBrains Mono for BibTeX
   LAYOUT  centred masthead, full-width teaser, 1120px grid of paired columns; one column below 860px */

:root {
  color-scheme: light dark;
  --bg: light-dark(#ffffff, #0d141a);
  --ink: light-dark(#0f1a24, #e6edf2);
  --muted: light-dark(#4b5a68, #a2b3c0);
  --line: light-dark(#dbe4ea, #25323d);
  --tint: light-dark(#e3f6fb, #0f222c);
  --cyan: light-dark(#0a7ea4, #62cbeb);
  --face: light-dark(#7fd3ea, #3fb5d9);
  --aud: light-dark(#f7cda3, #d9a676);
  --llm: light-dark(#d3dae0, #9aa8b4);
  --bar-ink: #0b1a22;
  --ours: light-dark(#d4f0f8, #133140);
  --code: light-dark(#f3f7f9, #131d25);
  --plate-line: light-dark(#e3eaef, #0d141a);
  --display: "Inter Tight", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --text: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
:root[data-theme=light] { color-scheme: light; }
:root[data-theme=dark] { color-scheme: dark; }

* { box-sizing: border-box; min-width: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 64px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.6 var(--text); overflow-x: clip; }
img { display: block; max-width: 100%; height: auto; }
a { color: var(--cyan); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; border-radius: 4px; }
b, strong { font-weight: 600; }
sub, sup { line-height: 0; }
code { font-family: var(--mono); font-size: .88em; overflow-wrap: anywhere; }

h1, h2, h3 { font-family: var(--display); letter-spacing: -0.02em; line-height: 1.1; margin: 0; text-wrap: balance; }
h2 { font-size: clamp(28px, 3.4vw, 40px); margin-bottom: 22px; }
h3 { font-size: 20px; margin-bottom: 8px; }
p { margin: 0 0 14px; }

.wrap { max-width: 1120px; margin: 0 auto; }
.wrap-wide { max-width: 1320px; margin: 0 auto; }
.narrow { max-width: 760px; }
.band { padding: clamp(40px, 6vw, 80px) max(5vw, 16px); }
.tint { background: var(--tint); }
.note { color: var(--muted); font-size: 14px; line-height: 1.5; margin-top: 10px; }
.scroll { overflow-x: auto; }

/* navigation */
.topnav { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topnav-in { max-width: 1320px; margin: 0 auto; display: flex; align-items: center; gap: 20px; padding: 0 max(5vw, 16px); height: 52px; }
.brand { font: 700 18px/1 var(--display); color: var(--ink); text-decoration: none; letter-spacing: -0.02em; flex: none; }
.navlinks { display: flex; gap: 4px; margin-left: auto; scrollbar-width: none; }
.navlinks::-webkit-scrollbar { display: none; }
.navlinks a { flex: none; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; padding: 8px 10px; border-radius: 8px; }
.navlinks a:hover { color: var(--ink); background: var(--tint); }

/* masthead */
.hero { padding: clamp(40px, 7vw, 88px) max(4vw, 16px) clamp(8px, 2vw, 24px); text-align: center; }
.hero h1 { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.title-name { font-size: clamp(56px, 9vw, 104px); line-height: 1; letter-spacing: -0.035em; }
.title-sub { font-size: clamp(22px, 2.8vw, 32px); font-weight: 600; max-width: 820px; }
.authors { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 26px; margin: 30px 0 4px; font-size: 19px; font-weight: 500; }
.authors a, .authors span { color: var(--ink); }
.authors a { text-decoration-color: var(--cyan); }
.affil { color: var(--muted); margin-bottom: 14px; }
.venue { display: inline-block; margin: 0 0 26px; padding: 7px 16px; border-radius: 999px; background: var(--tint); font-size: 15px; }
.venue strong { color: var(--cyan); margin-right: 6px; }
.buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 10px 18px; border-radius: 999px; background: var(--ink); color: var(--bg); text-decoration: none; font-weight: 600; font-size: 15px; transition: transform .15s ease, background .15s ease; }
.btn:hover { transform: translateY(-1px); background: color-mix(in srgb, var(--ink) 82%, var(--cyan)); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn small { font-weight: 500; font-size: 12px; opacity: .8; }
.btn.is-soon { background: transparent; color: var(--muted); border: 1.5px dashed color-mix(in srgb, var(--muted) 60%, transparent); }
.btn.is-soon:hover { transform: none; color: var(--ink); }

.teaser { margin: clamp(36px, 5vw, 56px) auto 0; }
.teaser figcaption { max-width: 900px; margin: 18px auto 0; color: var(--muted); font-size: 15px; text-align: left; }
.teaser figcaption b { color: var(--ink); }

/* figures */
figure { margin: 0; }
.plate { background: #fff; border: 1px solid var(--plate-line); border-radius: 14px; padding: clamp(8px, 1.6vw, 18px); overflow: hidden; }
.fig-block figcaption { color: var(--muted); font-size: 14px; margin-top: 10px; }
.fig-block { margin: 8px 0 28px; }

.video { position: relative; aspect-ratio: 16 / 9; max-width: 980px; border-radius: 14px; overflow: hidden; background: #000; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.poster { position: absolute; inset: 0; display: block; color: #fff; text-decoration: none; }
.poster img { width: 100%; height: 100%; object-fit: cover; transition: filter .2s ease; }
.poster:hover img { filter: brightness(.82); }
.poster:focus-visible { outline-offset: -4px; }
.play { position: absolute; left: 50%; top: 50%; width: 76px; height: 54px; transform: translate(-50%, -50%); transition: transform .2s ease; }
.poster:hover .play { transform: translate(-50%, -50%) scale(1.08); }
.play svg { display: block; width: 100%; height: 100%; }
.play-label { position: absolute; left: 16px; bottom: 14px; padding: 6px 12px; border-radius: 999px; background: rgba(0, 0, 0, .65); font-size: 15px; font-weight: 600; }

/* two-column blocks */
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 48px; align-items: start; }
.cols + .cols { margin-top: 48px; }
.cols-tables h3 { margin-top: 4px; }
.method { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: center; }
.study { grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); align-items: center; }
.qual { grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); }
.qual h3 + p + h3, .qual p + h3 { margin-top: 28px; }
.director { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: center; margin-top: 40px; }
.steps { display: grid; gap: 22px; }
.step { padding-left: 18px; border-left: 3px solid var(--face); }
.step p { margin: 0; color: var(--muted); }
.facts { padding-left: 20px; margin: 0 0 14px; }
.facts li { margin-bottom: 8px; }

/* tables */
table { width: 100%; border-collapse: collapse; font-size: 15px; margin-top: 10px; }
th, td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
thead th { font-weight: 600; border-bottom: 2px solid var(--ink); vertical-align: bottom; }
.num td:not(:first-child), .num th:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.grid th[colspan] { text-align: center; border-bottom: 1px solid var(--line); }
.grid td:first-child, .grid th:first-child { text-align: right; }
tr.group td { padding-top: 14px; color: var(--muted); font-size: 13px; font-style: italic; border-bottom: 0; }
tr.ours td { background: var(--ours); }
tr.ours td:first-child { font-weight: 600; }
.checks td:not(:first-child), .checks th:not(:first-child) { text-align: center; }
.checks td.y { color: var(--cyan); font-weight: 700; }
.checks td.n { color: var(--muted); opacity: .6; }
.checks thead th { white-space: normal; line-height: 1.25; }
.tint table td, .tint table th { border-color: color-mix(in srgb, var(--line) 70%, var(--cyan)); }

/* latency timeline */
.panel { background: var(--bg); border: 1px solid color-mix(in srgb, var(--line) 60%, var(--cyan)); border-radius: 16px; padding: clamp(16px, 3vw, 28px); margin: 8px 0 48px; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin-bottom: 16px; }
.panel-head h3 { margin: 0; font-size: 22px; }
.seg-ctl { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.seg-label { font-size: 14px; color: var(--muted); margin-right: 4px; }
.seg-ctl button { min-width: 44px; min-height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: 600 15px var(--text); cursor: pointer; font-variant-numeric: tabular-nums; }
.seg-ctl button:hover { border-color: var(--cyan); }
.seg-ctl button[aria-pressed=true] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.legend { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 14px; color: var(--muted); margin-bottom: 12px; }
.legend .key { display: inline-flex; align-items: center; gap: 8px; }
.sw { display: inline-block; width: 14px; height: 14px; border-radius: 4px; flex: none; }
.sw.llm, .bar.llm { background: var(--llm); }
.sw.aud, .bar.aud { background: var(--aud); }
.sw.face, .bar.face { background: var(--face); }

.tl-row { display: grid; grid-template-columns: 200px minmax(0, 1fr) 84px; gap: 16px; align-items: center; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.tl-row.axis-row { border-bottom: 0; padding: 4px 0 0; }
.tl-name b { display: block; font-size: 15px; }
.tl-name span { display: block; font-size: 13px; color: var(--muted); }
.tl-track { position: relative; }
.lane { position: relative; height: 32px; margin: 4px 0; }
.bar { position: absolute; top: 0; bottom: 0; left: calc(var(--a) * 100% / 650); width: calc((var(--b) - var(--a)) * 100% / 650); border-radius: 6px; color: var(--bar-ink); font-size: 13px; font-weight: 600; display: flex; align-items: center; justify-content: center; overflow: hidden; white-space: nowrap; transition: left .45s ease, width .45s ease; }
.mark { position: absolute; top: -6px; bottom: -6px; left: calc(var(--a) * 100% / 650); width: 0; border-left: 2px solid var(--ink); transition: left .45s ease; }
.mark.tall { top: -2px; bottom: -2px; }
.tl-total { font: 700 20px/1 var(--display); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tl-total.accent { color: var(--cyan); }
.axis { position: relative; height: 20px; border-top: 1px solid var(--muted); }
.axis span { position: absolute; top: 4px; transform: translateX(-50%); font-size: 13px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.axis.sparse span.odd { display: none; }
.axis span::before { content: ""; position: absolute; left: 50%; top: -5px; height: 4px; border-left: 1px solid var(--muted); }

.readouts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-top: 20px; }
.readouts div { background: var(--tint); border-radius: 12px; padding: 12px 16px; }
.readouts .k { display: block; font-size: 13px; color: var(--muted); }
.readouts .v { display: block; font: 700 24px/1.2 var(--display); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* applications */
.apps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; }
.app .plate { padding: 0; }
.app img { width: 100%; aspect-ratio: 8 / 7; object-fit: cover; }
.app h3 { margin-top: 16px; }
.app p { color: var(--muted); margin: 0; }

/* code */
.code-panel { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 24px 56px; align-items: start; }
.soon { display: inline-flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 10px; background: var(--tint); font-weight: 600; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--cyan); flex: none; animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
pre { overflow-x: auto; margin: 0; }
.cmd, .bib { background: var(--code); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; font: 14px/1.6 var(--mono); }
.cmd code, .bib code { font-size: inherit; overflow-wrap: normal; }
.cmd code { white-space: pre-wrap; overflow-wrap: anywhere; }
.stats { display: grid; gap: 18px; }
.stats > div { border-top: 2px solid var(--ink); padding-top: 10px; }
.stats .v { display: block; font: 700 clamp(28px, 3.2vw, 38px)/1.1 var(--display); color: var(--cyan); white-space: nowrap; }
.stats .k { display: block; color: var(--muted); font-size: 15px; }

/* bibtex */
.bib-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.bib-head h2 { margin: 0; }
.copy { min-height: 44px; padding: 0 20px; border-radius: 999px; border: 1.5px solid var(--ink); background: var(--bg); color: var(--ink); font: 600 15px var(--text); cursor: pointer; }
.copy:hover { background: var(--ink); color: var(--bg); }
.copy.done { background: var(--cyan); border-color: var(--cyan); color: #fff; }

.foot { border-top: 1px solid var(--line); padding: 28px max(5vw, 16px) 40px; color: var(--muted); font-size: 14px; }
.foot p { margin: 0 0 6px; }

@media (max-width: 860px) {
  .cols, .method, .study, .qual, .director, .code-panel { grid-template-columns: minmax(0, 1fr); }
  .apps { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .topnav-in { gap: 10px; }
  .tl-row { grid-template-columns: minmax(0, 1fr) 72px; gap: 6px 12px; }
  .tl-name { grid-column: 1 / -1; }
  .tl-name b, .tl-name span { display: inline; }
  .tl-name span::before { content: " · "; }
  .axis-row > div:first-child { display: none; }
  .tl-total { font-size: 17px; }
  .readouts { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .readouts div { padding: 10px; }
  .readouts .v { font-size: 19px; }
  .teaser .plate { overflow-x: auto; }
  .teaser .plate img { width: 760px; max-width: none; }
  .teaser figcaption::before { content: "Scroll the figure sideways to see every panel. "; color: var(--ink); }
  .buttons { gap: 8px; }
  .btn { padding: 10px 15px; font-size: 14px; }
  table { font-size: 13px; }
  th, td { padding: 6px 6px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .bar, .mark, .btn, .poster img, .play { transition: none; }
  .dot { animation: none; }
}
