/* Sandwich-Residuals project page */

/* ===== tokens ========================================================== */
:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-soft: #f6f6f3;
  --bg-elev: #ffffff;
  --ink: #15171a;
  --ink-2: #3b4046;
  --ink-3: #6b7279;
  --rule: #e6e5e1;
  --rule-strong: #1f2226;
  --accent: #b8491a;        /* text-safe orange: >= 4.5:1 on white and on --accent-bg */
  --accent-mark: #eb6834;   /* fills: matches the residual blocks in the figures */
  --accent-bg: #fdf0e8;
  --accent-line: #f3c9b1;
  --shadow: 0 1px 2px rgba(20, 22, 26, .05), 0 10px 30px -12px rgba(20, 22, 26, .14);
  --good: #116b34;
  --bad: #a83a0c;
  --nav-bg: rgba(255, 255, 255, .82);

  /* chart roles, consumed by charts.js (validated light palette) */
  --surface-1: var(--bg);
  --text-primary: var(--ink);
  --text-secondary: #5b6168;
  --grid: #ecebe7;
  --axis: #b9bab5;
  --series-1: #2a78d6;  /* Frozen    */
  --series-2: #1baf7a;  /* PredLast  */
  --series-3: #6250d6;  /* PredFirst */
  --series-4: #eb6834;  /* Ours      */

  --text: 720px;
  --wide: 1120px;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: "Source Serif 4", "Source Serif Pro", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121416; --bg-soft: #1a1d20; --bg-elev: #1d2024;
    --ink: #eceef0; --ink-2: #c3c8cd; --ink-3: #8e969d;
    --rule: #2a2f34; --rule-strong: #c9ced3;
    --accent: #f39a66; --accent-mark: #d95926; --accent-bg: #2a1e17; --accent-line: #5a3826;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px -12px rgba(0, 0, 0, .6);
    --good: #4ade80; --bad: #fb923c;
    --nav-bg: rgba(18, 20, 22, .82);
    --text-secondary: #a9b0b6; --grid: #262b30; --axis: #4a535a;
    --series-1: #3987e5; --series-2: #199e70; --series-3: #9085e9; --series-4: #d95926;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121416; --bg-soft: #1a1d20; --bg-elev: #1d2024;
  --ink: #eceef0; --ink-2: #c3c8cd; --ink-3: #8e969d;
  --rule: #2a2f34; --rule-strong: #c9ced3;
  --accent: #f39a66; --accent-mark: #d95926; --accent-bg: #2a1e17; --accent-line: #5a3826;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px -12px rgba(0, 0, 0, .6);
  --good: #4ade80; --bad: #fb923c;
  --nav-bg: rgba(18, 20, 22, .82);
  --text-secondary: #a9b0b6; --grid: #262b30; --axis: #4a535a;
  --series-1: #3987e5; --series-2: #199e70; --series-3: #9085e9; --series-4: #d95926;
}

/* ===== base ============================================================ */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0; background: var(--bg); color: var(--ink-2);
  font: 16px/1.7 var(--sans); font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  transition: background-color .2s ease, color .2s ease;
}
img, video { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
p { margin: 0 0 1em; }
strong { color: var(--ink); font-weight: 600; }
sub { line-height: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* One grid for every band: a reading column and a wider figure column. */
.band {
  display: grid;
  grid-template-columns:
    [full-start] minmax(18px, 1fr)
    [wide-start] minmax(0, calc((var(--wide) - var(--text)) / 2))
    [text-start] min(var(--text), calc(100% - 36px))
    [text-end] minmax(0, calc((var(--wide) - var(--text)) / 2))
    [wide-end] minmax(18px, 1fr) [full-end];
}
.band > * { grid-column: text; min-width: 0; }
.band > .wide { grid-column: wide; }

/* ===== nav ============================================================= */
.nav {
  position: sticky; top: 0; z-index: 40;
  background: var(--nav-bg); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--rule);
}
.nav-inner { grid-column: wide; display: flex; align-items: center; gap: 22px; height: 56px; }
.brand { flex: 0 0 auto; margin-right: auto; color: var(--ink); font: 600 1rem var(--serif); text-decoration: none; letter-spacing: -.01em; }
.nav-links { display: flex; gap: 20px; overflow-x: auto; scrollbar-width: none; }
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a {
  position: relative; padding: 4px 0; color: var(--ink-3); font-size: .84rem; text-decoration: none; white-space: nowrap;
  transition: color .15s ease;
}
.nav-links a:hover, .nav-links a.active { color: var(--ink); }
.nav-links a.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px; border-radius: 2px; background: var(--accent-mark); }
.theme-toggle {
  display: inline-grid; place-items: center; flex: 0 0 auto; width: 34px; height: 34px; padding: 0;
  border: 1px solid var(--rule); border-radius: 999px; background: var(--bg-elev); color: var(--ink-2); cursor: pointer;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--ink-3); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: block; }
}

/* ===== hero ============================================================ */
.hero { padding: 76px 0 40px; text-align: center; }
.venue { margin: 0 0 18px; color: var(--accent); font-size: .78rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
h1 {
  grid-column: wide; max-width: 900px; margin: 0 auto;
  color: var(--ink); font: 500 clamp(2rem, 4.4vw, 3.05rem)/1.12 var(--serif); letter-spacing: -.022em; text-wrap: balance;
}
h1 .h1-name { display: block; margin-bottom: .1em; }
h1 .h1-sub { display: block; color: var(--ink-2); font-size: .72em; font-weight: 400; letter-spacing: -.01em; }
.authors { margin: 26px 0 0; color: var(--ink); font-size: 1.05rem; }
.affil { margin: 2px 0 0; color: var(--ink-3); font-size: .88rem; }
.links { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 28px 0 0; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 17px;
  border: 1px solid var(--rule); border-radius: 999px; background: var(--bg-elev); color: var(--ink);
  font: 500 .88rem var(--sans); text-decoration: none; box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
  transition: border-color .15s ease, transform .15s ease;
}
a.btn:hover { border-color: var(--ink-3); transform: translateY(-1px); }
.btn svg { width: 16px; height: 16px; flex: 0 0 auto; }
.btn.primary { border-color: var(--rule-strong); background: var(--rule-strong); color: var(--bg); }
.btn.muted { color: var(--ink-3); box-shadow: none; background: transparent; border-style: dashed; }
.tagline {
  max-width: 640px; margin: 30px auto 0; color: var(--ink-2);
  font: italic 400 1.18rem/1.55 var(--serif); text-wrap: balance;
}

/* ===== animated overview (Figure 1) ==================================== */
.anim-figure { margin: 8px 0 0; }
.anim-panels { display: grid; gap: 22px; align-items: end; grid-template-columns: 1.3251fr 1.1461fr; }
.anim-panel { min-width: 0; }
.anim-label { display: flex; align-items: center; gap: 10px; margin: 0 0 10px 2px; color: var(--ink); font: 500 1rem var(--serif); }
.tag {
  display: inline-grid; place-items: center; width: 22px; height: 22px; flex: 0 0 auto;
  border-radius: 6px; background: var(--accent-bg); color: var(--accent);
  font: 600 .74rem/1 var(--sans); border: 1px solid var(--accent-line);
}
.anim-media { padding: 3%; border: 1px solid var(--rule); border-radius: 14px; background: #fff; box-shadow: var(--shadow); overflow: hidden; }
.anim-media video { width: 100%; height: auto; aspect-ratio: var(--ar); background: #fff; }
/* Dark theme: same figure, dimmed so the white card doesn't glare. */
:root[data-theme="dark"] .anim-media { filter: brightness(.95); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .anim-media { filter: brightness(.95); } }
.anim-controls { display: flex; align-items: center; gap: 12px; width: min(380px, 100%); margin: 20px auto 0; }
.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; flex: 0 0 auto; padding: 0;
  border: 1px solid var(--rule); border-radius: 999px; background: var(--bg-elev); color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { color: var(--ink); border-color: var(--ink-3); }
.icon-btn svg { width: 14px; height: 14px; fill: currentColor; }
.icon-btn .i-play { display: none; }
.anim-figure.paused .i-play { display: block; }
.anim-figure.paused .i-pause { display: none; }
.anim-track { position: relative; flex: 1; height: 3px; overflow: hidden; border-radius: 3px; background: var(--rule); }
.anim-track span { position: absolute; inset: 0; background: var(--accent-mark); transform: scaleX(0); transform-origin: left center; }

/* ===== sections ======================================================== */
section.band { padding: 84px 0 0; }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: .74rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
h2 { margin: 0 0 18px; color: var(--ink); font: 500 2.05rem/1.18 var(--serif); letter-spacing: -.02em; text-wrap: balance; }
h3 { margin: 0 0 6px; color: var(--ink); font: 500 1.14rem/1.35 var(--serif); }
.lead { margin: 0 0 30px; color: var(--ink-2); font-size: 1.05rem; text-wrap: pretty; }
.prose p { text-wrap: pretty; }
.abstract { color: var(--ink-2); font: 400 1.14rem/1.75 var(--serif); text-wrap: pretty; }

figcaption, .caption { margin: 16px 0 0; color: var(--ink-3); font-size: .86rem; line-height: 1.6; text-wrap: pretty; }
figcaption .fig-no, .caption .fig-no { color: var(--ink); font-weight: 600; }
.wide > figcaption, figure.wide figcaption { max-width: var(--text); margin-inline: auto; }
.note { margin: 12px 0 0; color: var(--ink-3); font-size: .82rem; }

/* ===== method: adaptation loop ======================================== */
.loop-figure { margin: 4px 0 0; }
.loop { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 30px; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.loop-step {
  position: relative; display: flex; flex-direction: column; padding: 12px 12px 14px;
  border: 1px solid var(--rule); border-radius: 14px; background: var(--bg-elev); box-shadow: var(--shadow);
  counter-increment: step;
}
.loop-step:not(:first-child)::before {
  content: ""; position: absolute; top: 50%; left: -23px; width: 16px; height: 16px; transform: translateY(-50%);
  background: var(--ink-3);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2 8h11M9 4l4 4-4 4' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2 8h11M9 4l4 4-4 4' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.step-art {
  height: 92px; margin: 0 0 14px; padding: 8px 6px; border-radius: 10px; background: var(--bg-soft);
}
.step-art svg { display: block; width: 100%; height: 100%; overflow: visible; font-family: var(--sans); }
.a-mute { stroke: var(--ink-3); opacity: .55; }
.a-ink { stroke: var(--ink); }
.a-acc { stroke: var(--accent-mark); }
.f-ink { fill: var(--ink); }
.f-mute { fill: var(--ink-3); opacity: .28; }
.t-ink { fill: var(--ink); font-weight: 600; }
.t-mute { fill: var(--ink-3); }
.t-acc { fill: var(--accent); }
.res { fill: var(--accent-bg); stroke: var(--accent-mark); }
.frozen { fill: var(--bg-elev); stroke: var(--ink-3); }
.loop-step.adapt .step-art { background: var(--bg-elev); }
.loop-step h4 { margin: 0 0 6px; color: var(--ink); font-size: .95rem; font-weight: 600; line-height: 1.25; }
.loop-step h4::before { content: counter(step) " · "; color: var(--ink-3); font-weight: 500; }
.loop-step p { margin: 0 6px 14px; color: var(--ink-2); font-size: .86rem; line-height: 1.55; }
.loop-spec { margin: auto 6px 0; padding-top: 10px; border-top: 1px dashed var(--rule); color: var(--ink-3); font: .76rem/1.45 var(--mono); }
.loop-step.adapt { border-color: var(--accent-line); background: var(--accent-bg); }
.loop-step.adapt h4 { color: var(--accent); }
.loop-step h4 { margin-inline: 6px; }
.loop-step.adapt .loop-spec { border-top-color: var(--accent-line); color: var(--accent); }
.loop-return {
  position: relative; height: 26px; margin: 8px 12.5% 0;
  border: 1.5px dashed var(--accent-mark); border-top: 0; border-radius: 0 0 14px 14px; opacity: .9;
}
.loop-return::before {
  content: ""; position: absolute; top: -8px; left: -6.5px;
  border: 5.5px solid transparent; border-bottom: 8px solid var(--accent-mark); border-top: 0;
}
.loop-return span {
  position: absolute; left: 50%; bottom: -.78em; transform: translateX(-50%);
  padding: 0 12px; background: var(--bg); color: var(--accent); font-size: .8rem; font-weight: 500; white-space: nowrap;
}
.loop-figure figcaption { margin-top: 34px; }

/* parameter budget */
.budget { margin: 44px 0 0; padding: 24px 26px 22px; border: 1px solid var(--rule); border-radius: 16px; background: var(--bg-soft); }
.budget-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 34px; align-items: center; }
.budget h3 { margin-bottom: 8px; }
.budget p { margin: 0; color: var(--ink-2); font-size: .92rem; }
.budget-bars { display: grid; gap: 13px; margin: 0; }
.bb-row { display: grid; grid-template-columns: 11.5em minmax(0, 1fr) 4.2em; gap: 12px; align-items: center; font-size: .84rem; }
.bb-row dt { color: var(--ink-2); white-space: nowrap; }
.bb-row dd { margin: 0; display: contents; }
.bb-track { height: 12px; border-radius: 0 4px 4px 0; background: transparent; position: relative; }
.bb-fill { display: block; height: 100%; min-width: 3px; border-radius: 0 4px 4px 0; background: var(--axis); }
.bb-row.bb-ours dt { color: var(--accent); font-weight: 600; }
.bb-row.bb-ours .bb-fill { background: var(--accent-mark); }
.bb-val { color: var(--ink); font-variant-numeric: tabular-nums; text-align: right; font-weight: 500; }
.budget .bb-axis { margin: 6px 0 0; color: var(--ink-3); font-size: .74rem; text-align: right; }

/* ===== results ========================================================= */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 6px 0 40px; border-block: 1px solid var(--rule); }
.stat { padding: 26px 24px 24px; text-align: center; }
.stat + .stat { border-left: 1px solid var(--rule); }
.stat strong { display: block; color: var(--ink); font: 500 2.5rem/1 var(--serif); letter-spacing: -.02em; }
.stat strong em { color: var(--accent); font-style: normal; }
.stat span { display: block; max-width: 250px; margin: 12px auto 0; color: var(--ink-3); font-size: .84rem; line-height: 1.5; }

.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; color: var(--ink-2); font-size: .9rem; font-variant-numeric: tabular-nums; text-align: right; }
th, td { padding: 10px 14px; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead th { color: var(--ink); font-weight: 600; font-size: .8rem; border-bottom: 1px solid var(--rule-strong); }
tbody th { color: var(--ink); font-weight: 500; }
tbody tr + tr > * { border-top: 1px solid var(--rule); }
.booktabs { border-top: 1.5px solid var(--rule-strong); border-bottom: 1.5px solid var(--rule-strong); }
.ours { background: var(--accent-bg); color: var(--accent); }
thead th.ours { color: var(--accent); }
td.ours strong { color: var(--accent); }
.summary table th:first-child { width: 36%; }

.dashboard { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 36px; margin: 56px 0 0; }
.chart { min-width: 0; margin: 0; }
.chart h3 { font-size: 1.06rem; }
.chart-sub { margin: 0 0 14px; color: var(--ink-3); font-size: .82rem; line-height: 1.5; min-height: 2.4em; }
.viz { min-width: 0; overflow-x: auto; }
.viz-svg { display: block; overflow: visible; min-width: 0; }
.viz-svg text { paint-order: stroke; stroke: var(--bg); stroke-width: 3px; stroke-linejoin: round; }
.viz-bar { transition: opacity .12s ease; }
.viz-bar:hover { opacity: .78; cursor: pointer; }
.viz-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; margin-top: 10px; }
.viz-legend-item { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-3); font-size: .76rem; }
.viz-legend-item i, .viz-tip i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.viz-tip {
  position: fixed; top: 0; left: 0; z-index: 90; pointer-events: none; opacity: 0;
  max-width: 280px; padding: 9px 12px; border: 1px solid var(--rule); border-radius: 10px;
  background: var(--bg-elev); color: var(--ink); font-size: .8rem; line-height: 1.5;
  box-shadow: var(--shadow); transition: opacity .12s ease;
}
.viz-tip .dim { color: var(--ink-3); }
.wide-legend { margin-top: 26px; }

/* full tables */
.full-results { margin: 48px 0 0; border: 1px solid var(--rule); border-radius: 14px; background: var(--bg-elev); }
.full-results summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px; color: var(--ink); cursor: pointer; font-weight: 500; font-size: .92rem; list-style: none;
}
.full-results summary::-webkit-details-marker { display: none; }
.full-results summary::after {
  content: ""; width: 9px; height: 9px; flex: 0 0 auto; margin-right: 4px;
  border-right: 1.5px solid var(--ink-3); border-bottom: 1.5px solid var(--ink-3); transform: rotate(45deg) translateY(-3px);
  transition: transform .2s ease;
}
.full-results[open] summary::after { transform: rotate(-135deg) translateY(-3px); }
.full-results[open] summary { border-bottom: 1px solid var(--rule); }
.full-results-body { padding: 18px 20px 22px; }
.segmented {
  display: inline-flex; gap: 3px; padding: 3px; max-width: 100%;
  border: 1px solid var(--rule); border-radius: 999px; background: var(--bg-soft);
}
.seg {
  height: 32px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent;
  color: var(--ink-3); cursor: pointer; font: 500 .8rem var(--sans); white-space: nowrap;
  transition: background-color .15s ease, color .15s ease;
}
.seg:hover { color: var(--ink); }
.seg[aria-selected="true"] { background: var(--bg-elev); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 0 0 1px var(--rule); }
.table-block { margin-top: 20px; }
.table-block > p { margin: 0 0 12px; color: var(--ink-3); font-size: .82rem; }
.table-scroll { max-height: min(500px, 60vh); overflow: auto; border-top: 1.5px solid var(--rule-strong); border-bottom: 1.5px solid var(--rule-strong); }
.table-scroll table { font-size: .82rem; }
.table-scroll th, .table-scroll td { padding: 8px 11px; }
.table-scroll thead th { position: sticky; top: 0; z-index: 3; background: var(--bg-elev); }
.table-scroll tr > :first-child { position: sticky; left: 0; z-index: 2; background: var(--bg-elev); }
.table-scroll thead tr > :first-child { z-index: 4; }
.table-scroll .group-row th { background: var(--bg-soft); color: var(--ink); font-weight: 600; }
.table-scroll .group-row th:first-child { background: var(--bg-soft); }

/* ===== rollouts ======================================================== */
.video-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin: 0 0 18px; }
.video-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.video-card { position: relative; min-width: 0; margin: 0; }
.video-frame { position: relative; overflow: hidden; border: 1px solid var(--rule); border-radius: 12px; background: #fff; box-shadow: var(--shadow); }
.video-card.is-ours .video-frame { border-color: var(--accent-mark); box-shadow: 0 0 0 1px var(--accent-mark), var(--shadow); }
.video-card video { width: 100%; aspect-ratio: 1; object-fit: cover; background: #fff; transform: scale(var(--crop, 1)); }
.video-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }
.video-name { display: inline-flex; align-items: center; gap: 7px; color: var(--ink); font-size: .88rem; font-weight: 600; }
.video-name i { width: 9px; height: 9px; border-radius: 3px; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px 3px 7px; border-radius: 999px; font-size: .74rem; font-weight: 600; white-space: nowrap; }
.badge svg { width: 12px; height: 12px; }
.badge.success { background: color-mix(in srgb, var(--good) 12%, transparent); color: var(--good); }
.badge.failure { background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad); }
#video-caption { margin-top: 20px; }

/* ===== ablation / cube ================================================ */
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px; }
.cube-chart { width: min(100%, 600px); margin: 0 auto; }
.prose-after { margin-top: 34px; }

/* ===== citation ======================================================== */
.cite { position: relative; }
pre {
  margin: 0; padding: 22px 24px; overflow-x: auto;
  border: 1px solid var(--rule); border-radius: 12px; background: var(--bg-soft);
  color: var(--ink-2); font: 13px/1.65 var(--mono); white-space: pre;
}
.copy {
  position: absolute; top: 10px; right: 10px; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px;
  border: 1px solid var(--rule); border-radius: 8px; background: var(--bg-elev); color: var(--ink-2);
  cursor: pointer; font: 500 .76rem var(--sans);
}
.copy:hover { color: var(--ink); border-color: var(--ink-3); }
.copy svg { width: 13px; height: 13px; }
footer.band { margin-top: 96px; padding: 28px 0 44px; border-top: 1px solid var(--rule); color: var(--ink-3); font-size: .82rem; }
footer .foot { grid-column: wide; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; }
footer a { color: var(--ink-3); }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.table-scroll-hint { display: none; margin: 10px 0 0; color: var(--ink-3); font-size: .76rem; text-align: center; }

/* ===== responsive ====================================================== */
@media (max-width: 1020px) {
  .dashboard { grid-template-columns: 1fr; gap: 44px; width: min(100%, 560px); margin-inline: auto; }
  .chart-sub { min-height: 0; }
}
@media (max-width: 900px) {
  .anim-panels { grid-template-columns: 1fr; gap: 30px; }
  .anim-panel { width: min(100%, 580px); margin-inline: auto; }
  .loop { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .loop-step:nth-child(3)::before { display: none; }
  .loop-return { height: auto; margin: 18px 0 0; border: 0; text-align: center; }
  .loop-return::before { display: none; }
  .loop-return span { position: static; transform: none; white-space: normal; padding: 0; }
  .loop-return span::before { content: "↺ "; }
  .video-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pair { grid-template-columns: 1fr; gap: 36px; }
  .budget-grid { grid-template-columns: 1fr; gap: 22px; }
}
@media (max-width: 640px) {
  .nav-links { display: none; }
  .hero { padding: 52px 0 30px; }
  section.band { padding-top: 64px; }
  h2 { font-size: 1.7rem; }
  .abstract { font-size: 1.05rem; }
  .stats { grid-template-columns: 1fr; }
  .stat + .stat { border-left: 0; border-top: 1px solid var(--rule); }
  .loop { grid-template-columns: 1fr; gap: 28px; }
  .loop-step:not(:first-child)::before { display: block; top: -22px; left: 50%; transform: translateX(-50%) rotate(90deg); }
  .budget { padding: 20px 18px; }
  .table-scroll-hint { display: block; }
  .bb-row { grid-template-columns: 9.6em minmax(0, 1fr) 3.6em; gap: 8px; font-size: .78rem; }
  .summary .tbl-wrap { overflow: visible; }
  .summary table { table-layout: fixed; font-size: .72rem; }
  .summary th, .summary td { padding: 9px 4px; white-space: normal; line-height: 1.3; }
  .summary thead th { font-size: .66rem; }
  .summary table th:first-child { width: 31%; }
  .segmented { display: grid; grid-template-columns: 1fr 1fr; border-radius: 14px; }
  .seg { border-radius: 10px; }
  .video-head { flex-wrap: nowrap; align-items: flex-start; }
  .video-head .segmented { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
