:root {
  --bg: #0a0c10;
  --bg-soft: #10131a;
  --panel: #12151d;
  --line: #232836;
  --text: #e9e6de;
  --muted: #9aa0ad;
  --accent: #f0b429;
  --accent-2: #ffd97a;
  --ego: #3ee6e0;
  --maxw: 1060px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 84px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ---------- nav ---------- */
.topnav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand {
  font-family: "Fraunces", serif;
  font-weight: 650; font-size: 20px;
  color: var(--accent); text-decoration: none;
  letter-spacing: 0.01em;
}
.navlinks { display: flex; gap: 22px; flex-wrap: wrap; }
.navlinks a {
  color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500;
  transition: color .15s;
}
.navlinks a:hover { color: var(--accent-2); }

/* ---------- table of contents (left rail) ---------- */
.toc {
  position: fixed;
  left: 24px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 40;
  width: 190px;
}
.toc ol { list-style: none; counter-reset: toc; position: relative; }
.toc ol::before {
  content: "";
  position: absolute; left: 5px; top: 8px; bottom: 8px;
  width: 1px; background: var(--line);
}
.toc li { counter-increment: toc; position: relative; }
.toc a {
  display: flex; align-items: center; gap: 14px;
  padding: 6px 0;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px; font-weight: 500;
  transition: color .2s;
}
.toc a::before {
  content: "";
  flex: none;
  width: 7px; height: 7px;
  margin-left: 2px;
  border-radius: 50%;
  background: var(--line);
  border: 1px solid var(--line);
  transition: background .2s, border-color .2s, transform .2s;
}
.toc a::after {
  content: counter(toc, decimal-leading-zero);
  order: -1;
  display: none;
}
.toc a:hover { color: var(--text); }
.toc li.active a { color: var(--accent); font-weight: 600; }
.toc li.active a::before {
  background: var(--accent);
  border-color: var(--accent);
  transform: scale(1.5);
  box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 60%, transparent);
}
.toc li.passed a::before { background: color-mix(in srgb, var(--accent) 45%, var(--bg)); border-color: transparent; }
@media (max-width: 1420px) { .toc { display: none; } }

/* ---------- hero ---------- */
.hero {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 64px 24px 24px;
  text-align: center;
}
.kicker {
  font-size: 13px; font-weight: 600; letter-spacing: .22em;
  text-transform: uppercase; color: var(--accent);
  margin-bottom: 18px;
}
h1 {
  font-family: "Fraunces", serif;
  font-weight: 550;
  font-size: clamp(28px, 4.2vw, 46px);
  line-height: 1.18;
  letter-spacing: -0.01em;
  max-width: 980px;
  margin: 0 auto 20px;
}
.grad {
  background: linear-gradient(100deg, var(--accent) 10%, var(--accent-2) 60%, #fff0c8 95%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.authors { color: var(--text); font-size: 16.5px; margin-bottom: 8px; }
.authors sup { color: var(--accent); font-size: .7em; }
.authors .dot { margin: 0 10px; color: var(--muted); }
.affil { color: var(--muted); font-size: 14.5px; margin-bottom: 28px; }
.affil .contrib { display: block; font-size: 12.5px; margin-top: 4px; }
.affil .contrib sup { color: var(--accent); }

.linkrow { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-bottom: 46px; }
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 11px 22px;
  border-radius: 999px;
  font-size: 15px; font-weight: 600;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  text-decoration: none;
  transition: border-color .15s, transform .15s;
}
a.btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.btn svg { width: 17px; height: 17px; fill: var(--accent); flex: none; }
.btn em {
  font-style: normal; font-size: 12px; font-weight: 600;
  color: var(--bg);
  background: var(--accent);
  padding: 2px 9px; border-radius: 999px;
}
.btn.soon { cursor: default; opacity: .85; }
.btn.soon:hover { border-color: var(--line); }

/* ---------- video frames ---------- */
.showcase { margin: 0 auto; max-width: 940px; }
.frame {
  position: relative;
  background: #000;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 70px -28px rgba(0,0,0,.9);
}

/* buffering spinner (hero only, while data-loading is set) */
.frame[data-loading]::after {
  content: "";
  position: absolute;
  top: 18px; right: 18px;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 3px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
  pointer-events: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* animated-image fallback covering a video whose autoplay is blocked */
.vanim {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  background: #000;
}

/* explicit play button, shown only when autoplay is blocked */
.playhint {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(5, 6, 9, 0.35);
  border: none; cursor: pointer;
  transition: background .2s;
}
.playhint:hover { background: rgba(5, 6, 9, 0.2); }
.playhint .pbtn {
  width: 88px; height: 88px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 12px 40px -8px rgba(240, 180, 41, 0.55);
  position: relative;
  transition: transform .15s;
}
.playhint:hover .pbtn { transform: scale(1.07); }
.playhint .pbtn::after {
  content: "";
  position: absolute; top: 50%; left: 54%;
  transform: translate(-50%, -50%);
  border-style: solid;
  border-width: 17px 0 17px 28px;
  border-color: transparent transparent transparent var(--bg);
}
.frame video { display: block; width: 100%; height: auto; }
.showcase .frame video { max-height: 74vh; object-fit: contain; }
.showcase figcaption {
  color: var(--muted);
  font-size: 15px;
  margin: 16px 6px 0;
}
.showcase figcaption strong { color: var(--text); }

/* ---------- sections ---------- */
main { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.band { padding: 64px 0 8px; border-top: 1px solid transparent; }
.band + .band { margin-top: 36px; border-top-color: var(--line); }
main .band:first-child { margin-top: 40px; border-top-color: var(--line); }

h2 {
  font-family: "Fraunces", serif;
  font-weight: 550;
  font-size: clamp(26px, 3vw, 34px);
  margin-bottom: 14px;
  display: flex; align-items: baseline; gap: 16px;
}
.secno {
  font-family: "JetBrains Mono", monospace;
  font-size: 14px; font-weight: 500;
  color: var(--accent);
}
.subtitle { color: var(--muted); font-size: 15px; margin-bottom: 28px; }
.note { color: var(--muted); font-size: 15px; margin-top: 18px; }
.mono { font-family: "JetBrains Mono", monospace; font-size: .92em; color: var(--accent-2); }
.egochip { color: var(--ego); font-weight: 600; }

/* ---------- tl;dr ---------- */
.tldr { max-width: 56em; display: flex; flex-direction: column; gap: 14px; }
.tldr p { font-size: 19px; line-height: 1.6; color: var(--muted); }
.tldr strong { color: var(--accent-2); font-weight: 600; }

/* ---------- method cards ---------- */
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 26px 26px 22px;
}
.card h3 {
  font-family: "Fraunces", serif;
  font-weight: 550; font-size: 20px;
  color: var(--accent-2);
  margin-bottom: 12px;
}
.card p { color: var(--muted); font-size: 15.5px; }
.card strong { color: var(--text); }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 34px; }
.stat {
  background: linear-gradient(160deg, var(--panel), var(--bg-soft));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px 20px;
  display: flex; flex-direction: column; gap: 8px;
}
.stat .big {
  font-family: "Fraunces", serif;
  font-size: 36px; font-weight: 650;
  color: var(--accent);
  line-height: 1;
}
.stat .big sup { font-size: .5em; }
.stat .label { color: var(--muted); font-size: 13.5px; line-height: 1.45; }

/* ---------- figures ---------- */
.figblock { margin: 0 0 30px; }
.figpanel {
  background: #fdfcf9;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
}
.figpanel img { display: block; width: 100%; height: auto; }
.shot {
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 70px -28px rgba(0,0,0,.9);
}
.shot img { display: block; width: 100%; height: auto; }
.figblock figcaption { color: var(--muted); font-size: 14.5px; margin: 14px 4px 0; }
.figblock figcaption strong { color: var(--text); }
.figblock figcaption a { color: var(--accent); text-decoration: none; font-weight: 600; }
.figblock figcaption a:hover { color: var(--accent-2); text-decoration: underline; }
.figrow { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
.figrow .figblock { margin-bottom: 8px; }

/* ---------- intent entropy chart ---------- */
.gtchip { color: #ff2ec4; font-weight: 600; }
.entropyChart {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px 24px 26px;
}
.entropyChart .chartTitle { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.entropyChart .chartTitle span {
  display: block; font-weight: 400; font-size: 12.5px; color: var(--muted);
  margin-top: 3px; line-height: 1.4;
}
.erow {
  display: grid; grid-template-columns: 128px 1fr 46px;
  align-items: center; gap: 12px; margin-top: 16px;
}
.elabel { font-size: 13.5px; color: var(--muted); text-align: right; line-height: 1.3; }
.erow.ours .elabel { color: var(--text); font-weight: 600; }
.etrack {
  position: relative; height: 18px;
  background: color-mix(in srgb, var(--line) 45%, transparent);
  border-radius: 4px; overflow: hidden;
}
.ebar {
  position: absolute; top: 0; bottom: 0; left: 0;
  border-radius: 0 4px 4px 0;
  background: var(--muted);
}
.erow.ours .ebar { background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.eval { font-family: "JetBrains Mono", monospace; font-size: 13px; color: var(--text); }

/* ---------- tables ---------- */
.tablewrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  margin-top: 8px;
}
table { width: 100%; border-collapse: collapse; font-size: 14.5px; white-space: nowrap; }
thead th {
  text-align: left;
  font-weight: 600;
  color: var(--text);
  background: var(--bg-soft);
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
}
tbody td { padding: 10px 18px; color: var(--muted); border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent); }
tbody tr:last-child td { border-bottom: none; }
td.type {
  color: var(--muted); font-size: 12.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em;
  border-right: 1px solid var(--line);
  vertical-align: middle;
}
tr.ours td { background: color-mix(in srgb, var(--accent) 9%, transparent); color: var(--text); }
tr.ours td strong { color: var(--accent-2); }
table u {
  text-decoration: none;
  font-weight: 700;
  color: var(--accent);
}
td.dim, th.dim { color: color-mix(in srgb, var(--muted) 55%, transparent); }
tr.ours td.dim { color: color-mix(in srgb, var(--muted) 80%, transparent); }
th.hl, td.hl { border-left: 1px solid var(--line); }
th.hl { color: var(--accent-2); }
td.rank, th.rank { text-align: center; width: 46px; color: var(--muted); }
tr.ours td.rank { color: var(--accent); font-weight: 700; }
.erd-note {
  display: inline-block;
  font-size: 11.5px; font-weight: 600;
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  padding: 2px 10px; border-radius: 999px;
  margin-left: 10px; vertical-align: middle;
}
.erd-note .arrow { color: var(--accent-2); font-weight: 700; }

/* ---------- gallery ---------- */
.groupTitle {
  font-family: "Fraunces", serif;
  font-weight: 550; font-size: 21px;
  color: var(--accent-2);
  margin: 40px 0 18px;
}
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
/* let the gallery videos break out of the text column so they read larger */
#gallery .grid {
  width: min(1400px, calc(100vw - 48px));
  position: relative;
  left: 50%;
  transform: translateX(-50%);
}
@media (min-width: 1421px) {
  /* keep clear of the fixed table of contents on the left */
  #gallery .grid { width: clamp(1012px, calc(100vw - 480px), 1400px); }
}
.cell { display: flex; flex-direction: column; }
.cell .frame { border-radius: 14px; }
.cell .frame video { aspect-ratio: 1 / 1; object-fit: contain; }
.cell figcaption { color: var(--muted); font-size: 14px; margin: 12px 4px 0; }
.cell figcaption strong { color: var(--text); }

/* ---------- abstract / bibtex ---------- */
.abstract {
  color: var(--muted);
  max-width: 62em;
  font-size: 16px;
  border-left: 3px solid var(--accent);
  padding-left: 22px;
}
.bib {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px 24px;
  overflow-x: auto;
}
.bib code {
  font-family: "JetBrains Mono", monospace;
  font-size: 13.5px;
  color: var(--accent-2);
  line-height: 1.6;
}

/* ---------- footer ---------- */
footer {
  border-top: 1px solid var(--line);
  margin-top: 80px;
  padding: 34px 24px 46px;
  text-align: center;
}
footer p { color: var(--muted); font-size: 13.5px; max-width: 54em; margin: 0 auto; }

/* ---------- reveal ---------- */
.band, .showcase { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.band.in, .showcase.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .band, .showcase, .toc a, .toc a::before { opacity: 1; transform: none; transition: none; }
}

/* ---------- responsive ---------- */
@media (max-width: 880px) {
  .stats { grid-template-columns: 1fr; }
  .cards, .grid, .figrow { grid-template-columns: 1fr; }
  .navlinks { display: none; }
  .tldr p { font-size: 17px; }
  .erow { grid-template-columns: 104px 1fr 44px; }
}
