:root {
  --bg: #ffffff;
  --fg: #16181d;
  --muted: #5b616e;
  --faint: #8a909c;
  --rule: #e4e6eb;
  --soft: #f5f6f8;
  --accent: #b3261e;       /* laser red */
  --accent-ink: #ffffff;
  --link: #1f4fbf;
  --pass: #2e7d4f;
  --fail: #b3261e;
  --code-bg: #f4f5f7;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --serif: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --col: 960px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --fg: #e8eaee;
    --muted: #a4abb8;
    --faint: #7c8391;
    --rule: #262a33;
    --soft: #171a20;
    --accent: #ff5a4f;
    --accent-ink: #120404;
    --link: #8fb0ff;
    --pass: #5cc48a;
    --fail: #ff7a70;
    --code-bg: #171a20;
    --shadow: none;
  }
  /* charts and diagrams are drawn on white: keep them on a light card */
  figure.paperfig img, .catalog img.thumb { background: #fff; border-radius: 6px; }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 400 17px/1.65 var(--sans);
  font-feature-settings: "cv11", "ss01";
  overflow-x: hidden;
}
img, video { max-width: 100%; height: auto; display: block; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font-family: var(--mono); }
code { font-size: .88em; background: var(--code-bg); padding: .08em .35em; border-radius: 4px; }

.wrap { max-width: var(--col); margin: 0 auto; padding: 0 24px; }
@media (max-width: 600px) { .wrap { padding: 0 16px; } body { font-size: 16px; } }

/* ---------- header ---------- */
header.hero { padding: 64px 0 20px; text-align: center; }
.venue { font: 600 12px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin-bottom: 18px; }
h1.title {
  font-family: var(--serif); font-weight: 600; font-size: clamp(32px, 5.4vw, 54px);
  line-height: 1.08; letter-spacing: -.015em; margin: 0 auto 14px; max-width: 880px;
}
h1.title .name { display: block; font-size: 1.18em; letter-spacing: -.02em; }
.subtitle { font-family: var(--serif); font-style: italic; color: var(--muted); font-size: clamp(18px, 2.3vw, 22px); margin: 0 auto 26px; max-width: 760px; line-height: 1.4; }
.authors { font-size: 18px; margin: 0 0 4px; }
.authors a { color: var(--fg); border-bottom: 1px dotted var(--faint); }
.affil { color: var(--muted); font-size: 15px; margin: 0; }
.affil-note { color: var(--faint); font-size: 13px; margin: 6px 0 0; }

.pills { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 28px 0 8px; }
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px; border-radius: 999px; background: var(--fg); color: var(--bg);
  font: 500 15px/1 var(--sans); border: 1px solid var(--fg); cursor: pointer;
  transition: transform .12s ease, opacity .12s ease;
}
.pill:hover { text-decoration: none; transform: translateY(-1px); opacity: .9; }
.pill svg { width: 17px; height: 17px; flex: none; }
.pill.ghost { background: transparent; color: var(--fg); }
.pill.disabled { opacity: .45; pointer-events: none; }
.pill small { font-size: 11px; opacity: .75; }

/* ---------- teaser ---------- */
.teaser { margin: 28px auto 0; max-width: 1120px; padding: 0 24px; }
@media (max-width: 600px) { .teaser { padding: 0 16px; } }
.teaser-frame { position: relative; border-radius: 12px; overflow: hidden; background: #000; aspect-ratio: 16 / 9; box-shadow: 0 12px 40px rgba(0,0,0,.18); }
.teaser-frame video, .teaser-frame img.poster { width: 100%; height: 100%; object-fit: cover; }
.teaser-frame .badge {
  position: absolute; left: 14px; bottom: 14px; display: flex; gap: 8px; flex-wrap: wrap;
}
.teaser-frame .badge button, .teaser-frame .badge span {
  font: 500 14px/1 var(--sans); padding: 10px 14px; border-radius: 999px; border: 0;
  background: rgba(255,255,255,.92); color: #111; cursor: pointer; display: inline-flex; gap: 8px; align-items: center;
}
.teaser-frame .badge span { background: rgba(0,0,0,.55); color: #eee; cursor: default; font-size: 12px; }
.teaser-frame .badge svg { width: 15px; height: 15px; }
.teaser figcaption { text-align: center; }

.tldr {
  max-width: 820px; margin: 34px auto 0; padding: 18px 22px; border-left: 3px solid var(--accent);
  background: var(--soft); border-radius: 0 8px 8px 0; font-size: 18px; line-height: 1.55;
}
.tldr b { font-family: var(--serif); }

/* ---------- sections ---------- */
section { padding: 52px 0 8px; }
section + section { border-top: 1px solid var(--rule); margin-top: 44px; }
h2 { font-family: var(--serif); font-weight: 600; font-size: 30px; letter-spacing: -.01em; margin: 0 0 18px; text-align: center; }
h3 { font-family: var(--serif); font-weight: 600; font-size: 21px; margin: 34px 0 10px; }
p { margin: 0 0 14px; }
.abstract p { text-align: justify; hyphens: auto; }
.lead { color: var(--muted); text-align: center; max-width: 720px; margin: -6px auto 24px; }

figure { margin: 26px 0; }
figure img { margin: 0 auto; border-radius: 6px; }
figure.paperfig img { padding: 6px; }
figcaption, .caption { font-size: 14px; line-height: 1.5; color: var(--muted); margin-top: 10px; }
figcaption b { color: var(--fg); font-weight: 600; }
.fig-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; align-items: start; }
.fig-pair figure { margin: 10px 0; }
@media (max-width: 720px) { .fig-pair { grid-template-columns: 1fr; } }

/* method steps */
ol.steps { counter-reset: s; list-style: none; padding: 0; margin: 20px 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 14px; }
ol.steps li { counter-increment: s; padding: 14px 16px 14px 50px; position: relative; background: var(--soft); border-radius: 10px; font-size: 15px; line-height: 1.5; }
ol.steps li::before { content: counter(s); position: absolute; left: 14px; top: 13px; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font: 600 13px/24px var(--sans); text-align: center; }
ol.steps b { display: block; font-size: 15px; margin-bottom: 2px; }

.callout { font-family: var(--serif); font-size: 20px; text-align: center; margin: 26px auto; max-width: 680px; }
.callout em { color: var(--accent); font-style: normal; }

/* metrics strip */
.metrics { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; border: 1px solid var(--rule); border-radius: 12px; overflow: hidden; margin: 10px 0 8px; }
.metric { padding: 18px 14px 16px; text-align: center; border-right: 1px solid var(--rule); }
.metric:last-child { border-right: 0; }
.metric .v { font: 600 30px/1.05 var(--serif); letter-spacing: -.01em; white-space: nowrap; }
.metric .v small { font-size: 15px; color: var(--muted); font-weight: 400; }
.metric .k { font-size: 13px; color: var(--muted); line-height: 1.35; margin-top: 8px; }
@media (max-width: 860px) {
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metric { border-bottom: 1px solid var(--rule); }
  .metric:nth-child(2n) { border-right: 0; }
  .metric:last-child { grid-column: 1 / -1; border-bottom: 0; }
}
.metrics-note { font-size: 13px; color: var(--faint); text-align: center; margin: 6px 0 0; }

/* tables */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 16px 0; }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
th { font-weight: 600; border-bottom: 1.5px solid var(--fg); white-space: nowrap; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ok { color: var(--pass); font-weight: 600; }
.bad { color: var(--fail); font-weight: 600; }
table.kv td:first-child { color: var(--muted); }
table.kv td:last-child { font-weight: 600; white-space: nowrap; }

.limits { background: var(--soft); border-radius: 10px; padding: 18px 22px; margin: 26px 0 0; }
.limits h3 { margin-top: 0; }
.limits ul { margin: 0; padding-left: 20px; }
.limits li { margin: 6px 0; font-size: 15.5px; }

/* gallery */
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 18px; }
.gallery figure { margin: 0; }
.gallery button { all: unset; cursor: zoom-in; display: block; width: 100%; }
.gallery button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.gallery img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; background: var(--soft); }
.gallery img.contain { object-fit: contain; background: #fff; }
.gallery figcaption { font-size: 12.5px; margin-top: 6px; }
.gallery .wide { grid-column: span 2; }
.gallery .wide img { aspect-ratio: 8.2 / 3; }
@media (max-width: 720px) { .gallery { grid-template-columns: 1fr 1fr; } .gallery .wide { grid-column: 1 / -1; } }
.gallery-h { font-family: var(--sans); font-size: 13px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); margin: 30px 0 0; }

/* provenance */
.prov { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 10px; }
.prov > div { border: 1px solid var(--rule); border-radius: 12px; padding: 18px 20px; }
.prov h3 { margin: 0 0 10px; font-size: 19px; }
.prov .tag { display: inline-block; font: 600 11px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; padding: 5px 8px; border-radius: 4px; margin-bottom: 10px; }
.prov .built .tag { background: var(--accent); color: var(--accent-ink); }
.prov .pre .tag { background: var(--fg); color: var(--bg); }
.prov p, .prov li { font-size: 15px; }
.prov ul { padding-left: 18px; margin: 0; }
.prov li { margin: 7px 0; }
@media (max-width: 760px) { .prov { grid-template-columns: 1fr; } }

.credit-box { display: flex; gap: 18px; align-items: center; border: 1.5px solid var(--fg); border-radius: 12px; padding: 16px 20px; margin: 22px 0; }
.credit-box img { width: 180px; flex: none; border-radius: 6px; background: #fff; }
.credit-box p { margin: 0; font-size: 15px; }
@media (max-width: 600px) { .credit-box { flex-direction: column; align-items: stretch; } .credit-box img { width: 100%; } }

/* bibtex */
.bib { position: relative; }
.bib pre { background: var(--code-bg); border: 1px solid var(--rule); border-radius: 10px; padding: 18px 20px; overflow-x: auto; font-size: 13.5px; line-height: 1.55; margin: 0; }
.bib button { position: absolute; top: 10px; right: 10px; font: 500 13px/1 var(--sans); padding: 7px 12px; border-radius: 6px; border: 1px solid var(--rule); background: var(--bg); color: var(--fg); cursor: pointer; }
.bib button:hover { border-color: var(--fg); }

.ack p, .ack li { font-size: 15px; }
.ack ul { padding-left: 20px; }

footer { margin-top: 60px; padding: 30px 0 50px; border-top: 1px solid var(--rule); color: var(--faint); font-size: 13px; text-align: center; }
footer p { margin: 4px 0; }

/* lightbox */
.lb { position: fixed; inset: 0; background: rgba(8,9,12,.92); display: none; align-items: center; justify-content: center; z-index: 50; padding: 24px; cursor: zoom-out; }
.lb.open { display: flex; }
.lb img { max-width: 100%; max-height: 86vh; border-radius: 6px; background: #fff; }
.lb .lb-cap { color: #d6d9df; font-size: 14px; text-align: center; margin-top: 12px; max-width: 800px; }
.lb > div { display: flex; flex-direction: column; align-items: center; }

/* narration modal */
.modal { position: fixed; inset: 0; background: rgba(8,9,12,.92); display: none; align-items: center; justify-content: center; z-index: 60; padding: 16px; }
.modal.open { display: flex; }
.modal .box { width: min(1100px, 100%); }
.modal video { width: 100%; border-radius: 8px; background: #000; }
.modal .close { display: block; margin: 0 0 10px auto; font: 500 14px/1 var(--sans); padding: 8px 14px; border-radius: 999px; border: 0; background: #fff; color: #111; cursor: pointer; }

.toc { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px; font-size: 14px; margin: 26px 0 0; }
.toc a { color: var(--muted); }
.disabled { opacity: .5; pointer-events: none; }
img[data-zoom] { cursor: zoom-in; }
[hidden] { display: none !important; }
table.catalog td:last-child { white-space: nowrap; }
@media (max-width: 600px) {
  table.kv td:last-child { white-space: normal; }
  table.kv td:first-child { width: 48%; }
  .metric .v { font-size: 26px; }
}
