/* Layout: a dark control-room page. One centred text column (max 880px), wide media (max 1120px), the demo video with
   a soft accent glow behind it, instrument-style tiles for the headline numbers. Single dark theme, matching the demo
   video's own palette. */
:root {
  --bg: #0b0f14; --bg-2: #0f141b; --surface: #131a24; --surface-2: #1a2330;
  --line: #233041; --line-2: #2f3f54;
  --text: #eceff3; --text-2: #c3cad4; --muted: #8e99a7;
  --accent: #52c4ff; --accent-2: #ffaa3c; --accent-soft: #15283a; --ours: #14253a;
  --daf: #52c4ff; --cfm: #5fcab8; --sddl: #b89ae6;
  --glow: rgba(82, 196, 255, 0.22); --shadow: rgba(0, 0, 0, 0.55);
  --font-display: "Barlow", "Helvetica Neue", Arial, sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --radius: 12px; --maxw: 880px; --maxw-wide: 1120px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 17px/1.65 var(--font-body); -webkit-font-smoothing: antialiased; overflow-x: hidden;
  background-image: radial-gradient(1200px 600px at 50% -220px, #16263a 0%, rgba(22, 38, 58, 0) 70%);
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, video:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; letter-spacing: -0.01em; }
h2 { font-size: clamp(1.7rem, 3.2vw, 2.3rem); font-weight: 600; margin: 8px 0 16px; }
h3 { font-size: 1.25rem; font-weight: 600; margin: 0 0 8px; }
p { margin: 0 0 14px; }

.wrap { max-width: var(--maxw); margin-left: auto; margin-right: auto; padding: 0 20px; }
.wrap.wide { max-width: var(--maxw-wide); }
.narrow { max-width: calc(var(--maxw) - 40px); margin-left: auto; margin-right: auto; }
section { margin: 72px auto; }
.eyebrow { font-family: var(--font-mono); font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0; }
.center { text-align: center; }

/* Hero */
.hero { text-align: center; padding: 76px 0 8px; }
.hero h1 { font-size: clamp(3rem, 8.5vw, 6.2rem); font-weight: 700; line-height: .95; letter-spacing: -0.02em; margin: 18px auto 0; }
.hero h1 .brand { color: var(--accent); }
.hero .sub { font-family: var(--font-display); font-weight: 500; font-size: clamp(1.25rem, 2.6vw, 1.9rem); line-height: 1.25; color: var(--text-2); margin: 16px auto 0; max-width: 820px; text-wrap: balance; }
.authors { color: var(--muted); font-size: 1rem; margin: 22px 0 0; }
.links { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 22px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 18px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--text);
  font-family: var(--font-display); font-weight: 600; font-size: 1rem; letter-spacing: .01em;
  transition: border-color .15s ease, background .15s ease;
}
.btn:hover { text-decoration: none; border-color: var(--accent); background: var(--accent-soft); }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn.disabled { color: var(--muted); border-color: var(--line); background: transparent; cursor: default; }
.btn.disabled:hover { border-color: var(--line); background: transparent; }
.facts { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 26px; margin: 26px 0 0; padding: 0; list-style: none; font-family: var(--font-mono); font-size: .82rem; color: var(--muted); }
.facts b { color: var(--text-2); font-weight: 500; }
@media (prefers-reduced-motion: no-preference) {
  .hero > * { animation: rise .9s cubic-bezier(.2,.7,.2,1) both; }
  .hero > *:nth-child(2) { animation-delay: .08s; } .hero > *:nth-child(3) { animation-delay: .16s; }
  .hero > *:nth-child(4) { animation-delay: .24s; } .hero > *:nth-child(5) { animation-delay: .32s; } .hero > *:nth-child(6) { animation-delay: .4s; }
  @keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
}

/* Demo video */
.stage { position: relative; margin-top: 36px; }
.stage::before { content: ""; position: absolute; inset: -5% -3% -10%; background: radial-gradient(55% 60% at 50% 45%, var(--glow), rgba(82,196,255,0) 70%); filter: blur(30px); pointer-events: none; z-index: 0; }
.frame { position: relative; z-index: 1; border-radius: 14px; overflow: hidden; background: #000; border: 1px solid var(--line-2); box-shadow: 0 30px 80px var(--shadow); }
.frame video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; max-width: 100%; }
.frame .tick { position: absolute; width: 22px; height: 22px; border: 2px solid var(--accent); opacity: .85; pointer-events: none; z-index: 2; }
.frame .tick.tl { top: 10px; left: 10px; border-right: 0; border-bottom: 0; }
.frame .tick.tr { top: 10px; right: 10px; border-left: 0; border-bottom: 0; }
.frame .tick.bl { bottom: 10px; left: 10px; border-right: 0; border-top: 0; }
.frame .tick.br { bottom: 10px; right: 10px; border-left: 0; border-top: 0; }
.stage-caption { position: relative; z-index: 1; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 24px; margin: 14px 0 0; font-family: var(--font-mono); font-size: .8rem; color: var(--muted); }
.stage-caption .live { color: var(--accent); }

/* Headline numbers */
.stats { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stats li { min-width: 0; background: var(--bg-2); border: 1px solid var(--line); border-top: 2px solid var(--accent); border-radius: 10px; padding: 18px 20px 20px; }
.stats strong { display: block; font-family: var(--font-display); font-size: 2.2rem; font-weight: 700; line-height: 1.05; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.stats small { font-family: var(--font-body); font-size: .95rem; font-weight: 400; color: var(--text-2); margin-left: 6px; }
.stats span { display: block; color: var(--muted); font-size: .86rem; line-height: 1.45; margin-top: 8px; }

/* Abstract */
#abstract p { color: var(--text-2); font-size: 1.04rem; }

/* Figures */
figure { margin: 0; }
figure img { border-radius: var(--radius); background: #fff; }
figcaption { color: var(--muted); font-size: .92rem; margin-top: 12px; line-height: 1.55; }
.teaser figcaption { max-width: calc(var(--maxw) - 40px); margin-left: auto; margin-right: auto; text-align: center; }
.rule { height: 1px; background: linear-gradient(90deg, rgba(82,196,255,0), var(--line-2), rgba(82,196,255,0)); margin: 72px auto; max-width: var(--maxw-wide); }

/* Method */
#method figure { margin-bottom: 26px; }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.card { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--c); border-radius: var(--radius); padding: 18px 20px 20px; }
.card h3 { font-size: 1.15rem; }
.card p { font-size: .95rem; color: var(--muted); margin: 0; line-height: 1.55; }
.card .tag { display: inline-block; font-family: var(--font-mono); font-size: .78rem; letter-spacing: .1em; color: var(--c); margin-right: 10px; }
.c-daf { --c: var(--daf); }
.c-cfm { --c: var(--cfm); }
.c-sddl { --c: var(--sddl); }

/* Videos */
.video-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 8px; }
.video-grid figure { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: transform .25s ease, border-color .25s ease; }
@media (hover: hover) and (prefers-reduced-motion: no-preference) { .video-grid figure:hover { transform: translateY(-3px); border-color: var(--line-2); } }
.video-grid video { width: 100%; height: auto; aspect-ratio: 16 / 9; display: block; background: #000; }
.video-grid figcaption { margin: 0; padding: 12px 16px 16px; font-size: .9rem; }
.placeholder { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 28px 16px; text-align: center; color: var(--muted); }

/* Tables */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-2); }
table.results { width: 100%; border-collapse: collapse; font-size: .92rem; font-variant-numeric: tabular-nums; min-width: 560px; }
.results th, .results td { padding: 9px 12px; text-align: center; white-space: nowrap; }
.results th:first-child, .results td:first-child { text-align: left; }
.results thead th { background: var(--surface-2); color: var(--text-2); font-weight: 600; border-bottom: 1px solid var(--line); }
.results thead tr:first-child th[colspan] { border-bottom: 1px solid var(--line); }
.results tbody tr + tr td { border-top: 1px solid var(--line); }
.results tr.ours td { background: var(--ours); }
.results tr.ours td:first-child { font-weight: 600; color: var(--accent); }
.results tr.group td { background: var(--surface-2); color: var(--muted); font-family: var(--font-mono); font-size: .76rem; letter-spacing: .1em; text-transform: uppercase; }
.results b { font-weight: 700; color: var(--text); }
.note { color: var(--muted); font-size: .9rem; margin-top: 12px; }

/* Qualitative viewer */
.qual { margin-top: 8px; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 10px; }
.tabs button {
  font: inherit; font-family: var(--font-display); font-size: .98rem; font-weight: 600;
  padding: 7px 16px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--muted);
}
.tabs button[aria-selected="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.tabs.sub button { font-weight: 500; padding: 5px 14px; }
.tabs.sub button[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.qual-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.qual-grid figure { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px; }
.qual-grid figure.ours { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.qual-grid img { width: 100%; height: auto; border-radius: 8px; background: #000; }
.qual-grid figcaption { text-align: center; font-family: var(--font-display); font-weight: 600; color: var(--text); margin: 8px 0 2px; font-size: .95rem; }
.qual-grid figure.ours figcaption { color: var(--accent); }

/* BibTeX */
.bib { position: relative; }
.bib pre { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 0; overflow-x: auto; font: 400 .85rem/1.6 var(--font-mono); color: var(--text-2); }
.copy { position: absolute; top: 10px; right: 10px; font: inherit; font-family: var(--font-mono); font-size: .78rem; padding: 4px 12px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--muted); cursor: pointer; }
.copy:hover { color: var(--text); border-color: var(--accent); }

footer { color: var(--muted); font-family: var(--font-mono); font-size: .78rem; text-align: center; padding-bottom: 48px; }
footer p { border-top: 1px solid var(--line); padding-top: 22px; }

@media (max-width: 900px) {
  .cards, .video-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  body { font-size: 16px; }
  section { margin: 52px auto; }
  .hero { padding-top: 48px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* A 2.6:1 diagram at phone width is unreadable, so let it scroll inside its figure
     instead of shrinking to fit. The page itself still never scrolls sideways. */
  #method figure.diagram { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  #method figure.diagram img { min-width: 680px; }
  .qual-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) { .stats { grid-template-columns: 1fr; } }
