/* StageVLN project page */

:root {
  --bg: #ffffff;
  --bg-alt: #f5f8f8;
  --surface: #ffffff;
  --text: #1b2326;
  --muted: #56636a;
  --border: #dfe6e8;
  --accent: #0d7468;
  --accent-strong: #0a5d54;
  --accent-soft: #e5f3f1;
  --accent-bar: #14a08f;
  --bar-other: #b9c4c8;
  --on-accent: #ffffff;
  --ours-row: #e9f5f3;
  --group-row: #f1f4f5;
  --code-bg: #f3f6f7;
  --figure-bg: #ffffff;
  --rw-act: #7a2ea0;
  --rw-goal: #16803a;
  --shadow: 0 1px 2px rgba(16, 24, 28, .06), 0 4px 16px rgba(16, 24, 28, .06);
  --radius: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --font-math: "Cambria Math", "STIX Two Math", "Latin Modern Math", "Times New Roman", serif;
  --nav-h: 52px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1416;
    --bg-alt: #121a1d;
    --surface: #162024;
    --text: #e3eaec;
    --muted: #9eabb0;
    --border: #26343a;
    --accent: #4fd1bd;
    --accent-strong: #7fe0d0;
    --accent-soft: #12302c;
    --accent-bar: #3cc4b0;
    --bar-other: #4a5a60;
    --on-accent: #062420;
    --ours-row: #133029;
    --group-row: #182327;
    --code-bg: #121b1e;
    --figure-bg: #ffffff;
    --rw-act: #d3a6ef;
    --rw-goal: #7fdb98;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .3);
  }
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-padding-top: calc(var(--nav-h) + 12px);
  -webkit-text-size-adjust: 100%;
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-strong); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
sup { line-height: 0; }
.nw { white-space: nowrap; }
code { font-family: var(--font-mono); font-size: .88em; background: var(--code-bg); padding: .1em .35em; border-radius: 5px; }

.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 100;
  background: var(--accent); color: var(--on-accent); padding: 8px 14px; border-radius: 8px; text-decoration: none;
}
.skip-link:focus { top: 8px; }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.container.narrow { max-width: 860px; }
@media (min-width: 720px) { .container { padding: 0 28px; } }

/* ------------------------------------------------------------------ nav */
.site-nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1180px; margin: 0 auto; height: var(--nav-h);
  display: flex; align-items: center; gap: 20px; padding: 0 16px;
}
@media (min-width: 720px) { .nav-inner { padding: 0 28px; } }
.nav-brand { font-weight: 750; letter-spacing: -.01em; color: var(--text); text-decoration: none; flex: none; }
.site-nav nav { min-width: 0; flex: 1; }
.nav-links {
  list-style: none; margin: 0; padding: 0;
  display: flex; gap: 4px; justify-content: flex-end;
  overflow-x: auto; scrollbar-width: none;
}
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a {
  display: block; padding: 6px 10px; border-radius: 8px; white-space: nowrap;
  color: var(--muted); text-decoration: none; font-size: 15px;
}
.nav-links a:hover { color: var(--text); background: var(--bg-alt); }
.nav-links a[aria-current="true"] { color: var(--accent); background: var(--accent-soft); }
@media (max-width: 719px) {
  .nav-links { justify-content: flex-start; }
}

/* ----------------------------------------------------------------- hero */
.hero { padding: 48px 0 24px; text-align: center; }
.title { margin: 0 0 22px; line-height: 1.15; }
.title-name {
  display: block; font-size: clamp(2.6rem, 7vw, 4rem); font-weight: 800; letter-spacing: -.03em;
  color: var(--accent);
}
.title-sub {
  display: block; margin-top: 10px; font-size: clamp(1.25rem, 3vw, 1.9rem); font-weight: 650; letter-spacing: -.015em;
  text-wrap: balance;
}

.authors {
  list-style: none; margin: 0 auto; padding: 0; max-width: 780px;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px;
  font-size: 1.05rem;
}
.authors sup { font-size: .7em; color: var(--muted); margin-left: 1px; }
.affiliations {
  margin: 10px 0 0; color: var(--muted);
  display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 22px;
}
.affiliations sup, .equal-note sup { font-size: .7em; }
.equal-note { margin: 2px 0 0; color: var(--muted); font-size: .92rem; }

.links { margin: 26px 0 34px; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px; border-radius: 999px;
  background: var(--accent); color: var(--on-accent);
  font-weight: 600; font-size: 15px; text-decoration: none; line-height: 1.2;
  border: 1px solid transparent;
  transition: background-color .15s ease, transform .15s ease;
}
.btn:hover { background: var(--accent-strong); color: var(--on-accent); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-ghost { background: transparent; color: var(--accent); border-color: var(--border); }
.btn-ghost:hover { background: var(--accent-soft); color: var(--accent-strong); }
.btn-disabled {
  background: var(--bg-alt); color: var(--muted); border-color: var(--border); cursor: default;
}
.btn-disabled:hover { background: var(--bg-alt); color: var(--muted); }

/* -------------------------------------------------------------- figures */
.figure { margin: 0 0 8px; }
.figure > a, .figure > picture {
  display: block; background: var(--figure-bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow);
}
.figure > a { cursor: zoom-in; }
.figure > a:focus-visible { outline-offset: 4px; }
.figure img { width: 100%; border-radius: 4px; }
.figure figcaption {
  max-width: 860px; margin: 14px auto 0; color: var(--muted); font-size: .95rem; line-height: 1.55; text-align: left;
}
.figure figcaption strong { color: var(--text); }
.teaser figcaption { text-align: center; }
.teaser img { image-rendering: auto; }

.swatch { display: inline-block; width: 18px; height: 4px; border-radius: 2px; vertical-align: middle; margin: 0 4px 2px 2px; }
.swatch.blue { background: #1f2fd1; }
.swatch.green { background: #22b33a; }

/* ------------------------------------------------------------- sections */
.section { padding: 64px 0; }
.section.alt { background: var(--bg-alt); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section h2 { font-size: clamp(1.6rem, 3.4vw, 2.1rem); letter-spacing: -.02em; line-height: 1.2; margin: 0 0 18px; }
.section h3 { font-size: 1.22rem; letter-spacing: -.01em; margin: 32px 0 10px; }
.section p { margin: 0 0 16px; }
.section .figure { margin-top: 28px; margin-bottom: 28px; }

.lead { font-size: 1.12rem; color: var(--text); }
#overview h3 { margin-top: 36px; }
@media (min-width: 720px) { #overview p:last-child { text-align: justify; hyphens: auto; } }

.stats {
  list-style: none; margin: 4px 0 28px; padding: 0;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px;
}
@media (min-width: 720px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 16px 14px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 4px;
}
.stat-value { font-size: 1.85rem; font-weight: 750; letter-spacing: -.02em; color: var(--accent); line-height: 1.1; }
.stat-value .unit { font-size: .6em; font-weight: 650; }
.stat-label { color: var(--muted); font-size: .9rem; line-height: 1.35; }

.takeaways { margin: 0 0 8px; padding-left: 1.2em; }
.takeaways li { margin: 6px 0; }
.takeaways li::marker { color: var(--accent); }
.takeaways.compact { margin-top: 22px; font-size: .95rem; }

/* --------------------------------------------------------------- method */
.cards {
  list-style: none; margin: 8px 0 28px; padding: 0;
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px;
}
@media (min-width: 860px) { .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.card {
  position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 22px 18px; box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.card h3 { margin: 10px 0 8px; font-size: 1.12rem; }
.card p { margin: 0 0 12px; font-size: .97rem; color: var(--muted); }
.card .card-loss {
  margin: auto 0 0; padding-top: 6px; color: var(--accent); font-family: var(--font-math); font-size: 1.25rem;
}
.card-step {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-weight: 750; font-size: .95rem;
}

.objective {
  margin: 0 0 24px; padding: 18px 20px; text-align: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.equation { margin: 0 0 6px; font-family: var(--font-math); font-size: clamp(1.1rem, 2.6vw, 1.45rem); line-height: 1.5; }
.equation sub { font-size: .62em; }
.equation-note { margin: 0; color: var(--muted); font-size: .92rem; }

.callout {
  margin: 0 0 20px; padding: 16px 20px; border-left: 4px solid var(--accent);
  background: var(--accent-soft); border-radius: 0 var(--radius) var(--radius) 0;
}
.callout h3 { margin: 0 0 6px; font-size: 1.05rem; color: var(--accent); }
.callout p { margin: 0; }

.details { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.details summary {
  cursor: pointer; padding: 12px 18px; font-weight: 650; list-style-position: inside;
}
.details summary:hover { color: var(--accent); }
.details ul { margin: 0; padding: 0 22px 14px 40px; font-size: .95rem; }
.details li { margin: 6px 0; }

/* --------------------------------------------------------------- tables */
.table-block { margin: 26px 0 0; min-width: 0; }
.table-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.table-title { margin: 0; font-weight: 700; font-size: 1.02rem; }
.table-block > .table-title { margin-bottom: 10px; }
.toggle {
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--accent);
}
.toggle:hover { background: var(--accent-soft); }

.table-scroll {
  overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  box-shadow: var(--shadow);
}
table.data { width: 100%; border-collapse: collapse; font-size: 14.5px; font-variant-numeric: tabular-nums; }
table.data th, table.data td { padding: 7px 10px; text-align: center; white-space: nowrap; border-bottom: 1px solid var(--border); }
table.data thead th { font-weight: 650; background: var(--bg-alt); color: var(--text); vertical-align: bottom; }
table.data thead th.group { border-bottom: 1px solid var(--border); }
table.data tbody tr:last-child > * { border-bottom: 0; }
table.data tbody th[scope="row"] { text-align: left; font-weight: 500; }
table.data .col-method { text-align: left; }
table.data tr.group-row th {
  text-align: left; font-size: 12.5px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted); background: var(--group-row); padding-top: 6px; padding-bottom: 6px;
}
table.data tr.ours > * { background: var(--ours-row); }
table.data tr.ours th { font-weight: 750; color: var(--accent); }

/* sticky first column for the wide comparison table */
table.main tbody th[scope="row"], table.main thead tr:first-child th:first-child {
  position: sticky; left: 0; z-index: 1; background: var(--surface);
  box-shadow: inset -1px 0 0 var(--border);
}
table.main thead tr:first-child th:first-child { background: var(--bg-alt); z-index: 2; }
table.main tr.ours th[scope="row"] { background: var(--ours-row); }
table.main tr.group-row th { position: static; box-shadow: none; }
/* hide the two non-RGB groups until expanded */
.table-block:not(.expanded) tbody.extra { display: none; }

.best { font-weight: 750; }
.second { text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.scroll-hint { display: none; margin: 0 2px 8px; color: var(--muted); font-size: .85rem; }
@media (max-width: 719px) { .scroll-hint { display: block; } }
.table-note { margin: 10px 2px 0; color: var(--muted); font-size: .88rem; line-height: 1.5; }
.table-note.center { text-align: center; }
.table-note .best { color: var(--text); }

/* efficiency bars */
.eff-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px 24px; }
@media (min-width: 900px) { .eff-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
table.eff td { text-align: left; min-width: 150px; }
table.eff th:not(.col-method) { text-align: left; white-space: normal; min-width: 150px; }
table.eff .bar {
  display: inline-block; vertical-align: middle; height: 10px; border-radius: 5px;
  width: calc(var(--v) * 0.62); min-width: 4px; background: var(--bar-other); margin-right: 8px;
}
table.eff tr.ours .bar { background: var(--accent-bar); }
table.eff .val { vertical-align: middle; }
table.eff .oom { color: #c03a2b; font-weight: 650; }
@media (prefers-color-scheme: dark) { table.eff .oom { color: #ff8a7a; } }

/* ablations */
.abl-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px 32px; align-items: start; }
@media (min-width: 960px) { .abl-grid { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); } }

/* ------------------------------------------------------------- rollouts */
.setup-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 36px; align-items: center; margin-top: 12px; }
@media (min-width: 900px) { .setup-grid { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); } }
.setup-text { max-width: 640px; }
.setup-grid .figure { margin-top: 12px; margin-bottom: 12px; }
.setup-grid figcaption { text-align: center; }
.episode { margin: 28px 0 0; }
.episode + .episode { margin-top: 32px; }
.video-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; margin-top: 14px; }
@media (min-width: 760px) { .video-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 759px) { .vcard { width: 100%; max-width: 420px; margin: 0 auto; } }
.vbox {
  position: relative; aspect-ratio: 4 / 5; overflow: hidden; background: #000;
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.vbox video { display: block; width: 100%; height: 100%; object-fit: cover; }
.vbox .badge {
  position: absolute; top: 10px; left: 10px; padding: 3px 9px; border-radius: 6px;
  background: rgba(0, 0, 0, .62); color: #fff; font-size: .8rem; font-weight: 650;
}
.video-grid .vcard .instr { margin: 10px 0 0; font-size: .95rem; }
.video-note { margin: 14px 0 0; color: var(--muted); font-size: .95rem; }
.episode .instr, .vcard .instr {
  margin: 0 0 10px; padding: 12px 16px; border: 1px solid var(--border); border-left: 4px solid var(--accent);
  border-radius: 8px; background: var(--surface); line-height: 1.55;
}
.episode .instr b { font-weight: 650; }
.episode .figure { margin: 0; }
.episode .figure > a { padding: 8px; }
.rw-act { color: var(--rw-act); font-weight: 650; }
.rw-goal { color: var(--rw-goal); font-weight: 650; }

/* ------------------------------------------------------------- citation */
.bibtex { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--code-bg); }
.bibtex-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 10px 8px 18px; border-bottom: 1px solid var(--border); background: var(--bg-alt);
  font-size: 13px; font-weight: 650; color: var(--muted);
}
.bibtex pre {
  margin: 0; padding: 16px 18px; white-space: pre-wrap; overflow-wrap: anywhere;
  font-size: 13.5px; line-height: 1.6;
}
.bibtex code { background: none; padding: 0; font-size: inherit; }
.copy {
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  padding: 5px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--accent);
}
.copy:hover { background: var(--accent-soft); }

/* --------------------------------------------------------------- footer */
.site-footer { padding: 28px 0 40px; border-top: 1px solid var(--border); color: var(--muted); font-size: .92rem; text-align: center; }
.site-footer p { margin: 0; }
.site-footer p + p { margin-top: 6px; }

/* ------------------------------------------------------------- lightbox */
.lightbox {
  width: min(96vw, 1800px); max-width: none; max-height: 94vh; padding: 0; border: 0; border-radius: var(--radius);
  background: #ffffff; box-shadow: 0 20px 60px rgba(0, 0, 0, .45); overflow: auto;
}
.lightbox::backdrop { background: rgba(8, 12, 14, .82); }
.lightbox img { width: 100%; height: auto; }
.lightbox-close {
  position: sticky; top: 8px; float: right; margin: 8px 8px -48px 0; z-index: 1;
  width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(20, 28, 31, .78); color: #fff; font-size: 26px; line-height: 40px;
}
.lightbox-close:hover { background: rgba(20, 28, 31, .95); }

@media print {
  .site-nav, .links, .toggle, .copy, .skip-link { display: none !important; }
  .table-block tbody.extra { display: table-row-group !important; }
  .section.alt { background: none; }
}
