/* ============================================================
   VideoSTF project page
   ============================================================ */
:root {
  --bg: #fbfaf8;
  --bg-alt: #f3f1ec;
  --surface: #ffffff;
  --ink: #16181d;
  --ink-2: #454a55;
  --ink-3: #7a808c;
  --line: #e4e1da;
  --accent: #d9482b;
  --accent-2: #f08a24;
  --accent-soft: #fde8e1;
  --teal: #0f8b8d;
  --violet: #6b4fd8;
  --heat-0: #fff5eb;
  --shadow: 0 1px 2px rgba(20, 20, 30, .04), 0 8px 24px rgba(20, 20, 30, .06);
  --radius: 16px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  /* repetition highlight palette (light) */
  --h0: #fde2dc; --h0t: #b3261e;
  --h1: #dceafe; --h1t: #1f4fbf;
  --h2: #fdefd3; --h2t: #9a5b00;
  --h3: #e3f5e1; --h3t: #1f7a33;
  --h4: #f6e1fb; --h4t: #8a2aa8;
  --h5: #d9f4f3; --h5t: #0b6f71;
  --h6: #ffe0ee; --h6t: #b0185f;
  --h7: #e7e4ff; --h7t: #4b3bc2;
  --h8: #f1f0d6; --h8t: #6a6a00;
  --h9: #e2eef4; --h9t: #2e5f7a;
  --h10: #ffe8cc; --h10t: #a14a00;
  --h11: #e0f2d4; --h11t: #3d6b12;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111317; --bg-alt: #16191e; --surface: #1c2027; --ink: #eceef2; --ink-2: #b9bec8; --ink-3: #868d99;
    --line: #2a2f38; --accent-soft: #3a1f19; --heat-0: #2a211b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
    --h0: #4a211c; --h0t: #ffb4a6; --h1: #1c2c4a; --h1t: #a9c6ff; --h2: #43320f; --h2t: #ffd38a;
    --h3: #1d3a22; --h3t: #9fe0a8; --h4: #3b1f45; --h4t: #e8b3fa; --h5: #143a3a; --h5t: #8fe3e1;
    --h6: #4a1c30; --h6t: #ffb0d2; --h7: #28244d; --h7t: #c4bcff; --h8: #38381a; --h8t: #e3e38f; --h9: #1d3140; --h9t: #a8d3ec;
    --h10: #45301a; --h10t: #ffc98f; --h11: #26351a; --h11t: #bfe39a;
  }
}

* { box-sizing: border-box; }
html { scroll-beh
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #111317; --bg-alt: #16191e; --surface: #1c2027; --ink: #eceef2; --ink-2: #b9bec8; --ink-3: #868d99;
    --line: #2a2f38; --accent-soft: #3a1f19; --heat-0: #2a211b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
    --h0: #4a211c; --h0t: #ffb4a6; --h1: #1c2c4a; --h1t: #a9c6ff; --h2: #43320f; --h2t: #ffd38a;
    --h3: #1d3a22; --h3t: #9fe0a8; --h4: #3b1f45; --h4t: #e8b3fa; --h5: #143a3a; --h5t: #8fe3e1;
    --h6: #4a1c30; --h6t: #ffb0d2; --h7: #28244d; --h7t: #c4bcff; --h8: #38381a; --h8t: #e3e38f; --h9: #1d3140; --h9t: #a8d3ec;
    --h10: #45301a; --h10t: #ffc98f; --h11: #26351a; --h11t: #bfe39a;
}avior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans);
  font-size: 16.5px; line-height: 1.65; -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
sup { font-size: .68em; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 50; display: flex; align-items: center; justify-content: space-between;
  padding: 12px clamp(16px, 4vw, 40px); background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(160%) blur(12px); border-bottom: 1px solid transparent; transition: border-color .2s;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.brand { font-weight: 800; color: var(--ink); letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; font-size: 11px;
  color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.topbar nav { display: flex; gap: 4px; flex-wrap: wrap; }
.topbar nav a { color: var(--ink-2); padding: 6px 12px; border-radius: 999px; font-size: 14.5px; font-weight: 500; }
.topbar nav a:hover { background: var(--bg-alt); text-decoration: none; }
.topbar nav a.nav-cta { background: var(--ink); color: var(--bg); }
@media (max-width: 640px) { .topbar nav a:not(.nav-cta) { display: none; } }

/* ---------- layout ---------- */
.wrap { max-width: 1440px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 32px); }
.wrap.narrow { max-width: 980px; }
.section { padding: clamp(56px, 8vw, 96px) 0; }
.section.alt { background: var(--bg-alt); }
.kicker {
  font-size: clamp(28px, 3.6vw, 40px); font-weight: 800; letter-spacing: -.02em; margin-bottom: 14px;
}
.section-intro { color: var(--ink-2); max-width: 780px; margin: 0 0 32px; font-size: 17px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.pad { padding: clamp(18px, 2.4vw, 28px); }
.note { color: var(--ink-3); font-size: 13.5px; margin: 12px 0 0; }
.scroll-x { overflow-x: auto; }
/* let grid children shrink below their content width, so wide formulas and heatmaps scroll inside their card */
.grid3 > *, .split > *, .compare > *, .ex-grid > *, .demo > *, .stats > *, .result-block > * { min-width: 0; }
body { overflow-x: clip; }

/* ---------- hero ---------- */
.hero { padding: clamp(40px, 7vw, 88px) clamp(16px, 4vw, 32px) clamp(40px, 6vw, 72px); text-align: center;
  background:
    radial-gradient(1200px 400px at 50% -80px, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%),
    var(--bg); }
.hero-inner { max-width: 980px; margin: 0 auto; }
.venue {
  display: inline-block; padding: 5px 14px; border-radius: 999px; font-weight: 700; font-size: 13px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--accent); background: var(--accent-soft); margin-bottom: 20px;
}
.hero h1 { font-size: clamp(30px, 5vw, 54px); font-weight: 800; letter-spacing: -.03em; line-height: 1.08; }
.grad { background: linear-gradient(100deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.authors { margin: 26px 0 6px; font-size: 18px; font-weight: 600; display: flex; flex-wrap: wrap; gap: 6px 22px; justify-content: center; }
.affils { margin: 0; color: var(--ink-3); font-size: 14.5px; display: flex; flex-wrap: wrap; gap: 4px 18px; justify-content: center; }
.buttons { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 28px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 11px 20px; border-radius: 999px; font-weight: 600; font-size: 15px;
  color: var(--bg); background: var(--ink); transition: transform .15s, box-shadow .15s;
}
.btn svg { width: 18px; height: 18px; }
.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0, 0, 0, .15); }
.btn-accent { background: linear-gradient(100deg, var(--accent), var(--accent-2)); color: #fff; }
.teaser { max-width: 1060px; margin: clamp(32px, 5vw, 56px) auto 0; padding: 14px; }
.teaser img { border-radius: 10px; background: #fff; }
.teaser figcaption { color: var(--ink-3); font-size: 14px; margin-top: 10px; }

/* ---------- overview ---------- */
.lead { font-size: clamp(18px, 2vw, 21px); line-height: 1.6; color: var(--ink); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 36px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px 16px; text-align: center; }
.stat-num { font-size: clamp(26px, 3.4vw, 36px); font-weight: 800; letter-spacing: -.02em; color: var(--accent); }
.stat-lbl { color: var(--ink-3); font-size: 13.5px; line-height: 1.35; margin-top: 4px; }
@media (max-width: 720px) { .stats { grid-template-columns: repeat(2, 1fr); } }

/* ---------- framework ---------- */
.figure-wide { padding: 14px; margin: 0 0 28px; }
.figure-wide img { border-radius: 10px; background: #fff; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 18px; }
@media (max-width: 900px) { .grid3 { grid-template-columns: 1fr; } }
.grid3 h3, .split h3 { font-size: 19px; margin: 10px 0 8px; }
.grid3 p, .split p { color: var(--ink-2); margin: 0; font-size: 15px; }
.pill {
  display: inline-block; font-size: 11.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  padding: 3px 10px; border-radius: 999px; color: var(--accent); background: var(--accent-soft);
}
.pill-teal { color: var(--teal); background: color-mix(in srgb, var(--teal) 13%, transparent); }
.pill-violet { color: var(--violet); background: color-mix(in srgb, var(--violet) 13%, transparent); }
.formula { margin-top: 16px; padding: 12px; border-radius: 10px; background: var(--bg-alt); overflow-x: auto; text-align: center; font-size: 14px; min-height: 52px; }
.split { display: grid; grid-template-columns: 1fr 1.25fr; gap: 18px; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }
.inline-fig { margin-top: 16px; border-radius: 10px; background: #fff; padding: 6px; }

/* segmented control */
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 12px; background: var(--bg-alt); border: 1px solid var(--line); }
.section.alt .seg { background: var(--surface); }
.seg button {
  border: 0; background: transparent; color: var(--ink-2); font: inherit; font-size: 13.5px; font-weight: 600;
  padding: 6px 12px; border-radius: 9px; cursor: pointer; transition: background .15s, color .15s;
}
.seg button:hover { color: var(--ink); }
.seg button.active { background: var(--ink); color: var(--bg); }
.seg button:disabled { opacity: .35; cursor: not-allowed; }
.wrap-seg { display: flex; }
.split .seg { margin-top: 16px; }

/* frame strips */
.strip-demo { display: grid; grid-template-columns: repeat(9, 1fr); gap: 4px; margin-top: 16px; }
.fr { position: relative; border-radius: 6px; overflow: hidden; aspect-ratio: 16/10; background: var(--bg-alt); animation: pop .35s both; }
.fr img { width: 100%; height: 100%; object-fit: cover; }
.fr .idx {
  position: absolute; left: 4px; top: 4px; font: 600 10.5px/1 var(--mono); padding: 3px 5px; border-radius: 5px;
  color: #fff; background: rgba(0, 0, 0, .55);
}
.fr.added { outline: 3px solid #2e9e5b; outline-offset: -3px; }
.fr.replaced { outline: 3px solid var(--accent-2); outline-offset: -3px; }
.fr.moved .idx { background: var(--violet); }
.fr.gap { background: repeating-linear-gradient(45deg, var(--bg-alt), var(--bg-alt) 6px, var(--line) 6px, var(--line) 12px); display: grid; place-items: center; color: var(--ink-3); font: 600 11px var(--mono); }
@keyframes pop { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
.legend-inline { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-3); margin-top: 10px; }
.legend-inline i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 5px; }

/* ---------- results ---------- */
.result-block { margin-bottom: 56px; }
.result-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 18px; flex-wrap: wrap; }
.result-head > div:first-child { max-width: 700px; }
.result-head h3 { font-size: 24px; letter-spacing: -.01em; margin: 4px 0 8px; }
.result-head p { margin: 0; color: var(--ink-2); font-size: 15.5px; }
.step { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.controls { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
@media (max-width: 720px) { .controls { align-items: flex-start; } }

.bars { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: minmax(150px, 290px) 1fr; gap: 14px; align-items: center; }
.bar-name { font-size: 14px; font-weight: 600; text-align: right; line-height: 1.25; }
.bar-name small { display: block; color: var(--ink-3); font-weight: 500; font-size: 12px; }
.bar-track { position: relative; height: 26px; border-radius: 8px; background: var(--bg-alt); overflow: hidden; }
.bar-fill {
  height: 100%; border-radius: 8px; width: 0; transition: width .7s cubic-bezier(.2, .8, .2, 1);
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
}
.bar-val { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font: 600 13px var(--mono); color: var(--ink); }
.bar-na { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 12.5px; color: var(--ink-3); }
.family-sep { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin: 10px 0 2px; }
@media (max-width: 640px) { .bar-row { grid-template-columns: 1fr; gap: 4px; } .bar-name { text-align: left; } }

.heat { display: grid; gap: 3px; min-width: 820px; }
.heat .h-cell, .heat .h-col, .heat .h-row {
  display: grid; place-items: center; font: 600 13px var(--mono); border-radius: 6px; min-height: 36px;
}
.heat .h-col { font-family: var(--sans); font-size: 12.5px; color: var(--ink-2); min-height: 28px; }
.heat .h-row { justify-items: end; font-family: var(--sans); font-size: 13.5px; font-weight: 600; padding-right: 8px; text-align: right; white-space: nowrap; }
.heat .h-cell { transition: background .35s, color .35s, transform .12s; cursor: default; }
.heat .h-cell:hover { transform: scale(1.07); box-shadow: 0 4px 14px rgba(0, 0, 0, .18); z-index: 2; }
.heat .h-cell.orig { outline: 2px solid var(--ink); outline-offset: -2px; }
.heat .h-cell.na { background: var(--bg-alt) !important; color: var(--ink-3) !important; }
.legend { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-size: 12.5px; color: var(--ink-3); flex-wrap: wrap; }
.legend .ramp { width: 200px; height: 10px; border-radius: 5px; }

/* ---------- examples ---------- */
.sub { font-size: 22px; margin: 8px 0 14px; letter-spacing: -.01em; }
.sub-intro { color: var(--ink-2); margin: -4px 0 16px; font-size: 15.5px; }
.model-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.model-tabs button {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font: inherit; font-size: 13.5px; font-weight: 600;
  padding: 7px 13px; border-radius: 999px; cursor: pointer;
}
.model-tabs button.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.ex-grid { display: grid; grid-template-columns: 1fr; gap: 18px; margin-bottom: 56px; }
.ex-card { padding: 20px 22px; }
.ex-meta { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.ex-meta .tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--bg-alt); color: var(--ink-2); }
.tag.bad { background: var(--accent-soft); color: var(--accent); }
.tag.good { background: color-mix(in srgb, #2e9e5b 14%, transparent); color: #2e9e5b; }
.text-out { font-size: 14.5px; line-height: 1.7; color: var(--ink); max-height: 360px; overflow-y: auto; padding-right: 6px; }
.text-out.expanded { max-height: none; }
.more { margin-top: 10px; background: none; border: 0; color: var(--accent); font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; padding: 0; }
mark.rep { border-radius: 4px; padding: 1px 2px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
mark.c0 { background: var(--h0); color: var(--h0t); } mark.c1 { background: var(--h1); color: var(--h1t); }
mark.c2 { background: var(--h2); color: var(--h2t); } mark.c3 { background: var(--h3); color: var(--h3t); }
mark.c4 { background: var(--h4); color: var(--h4t); } mark.c5 { background: var(--h5); color: var(--h5t); }
mark.c6 { background: var(--h6); color: var(--h6t); } mark.c7 { background: var(--h7); color: var(--h7t); }
mark.c8 { background: var(--h8); color: var(--h8t); } mark.c9 { background: var(--h9); color: var(--h9t); }
mark.c10 { background: var(--h10); color: var(--h10t); } mark.c11 { background: var(--h11); color: var(--h11t); }

.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
@media (max-width: 900px) { .compare { grid-template-columns: 1fr; } }
.compare .card { padding: 18px 20px; }
.compare h4 { margin: 0 0 4px; font-size: 16px; }
.compare .desc { color: var(--ink-3); font-size: 13px; margin: 0 0 12px; }
.film { display: grid; grid-template-columns: repeat(9, 1fr); gap: 3px; margin-bottom: 14px; }
.ministats { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 10px; }

/* ---------- demo ---------- */
.demo-section { background:
  radial-gradient(900px 300px at 80% 0, color-mix(in srgb, var(--accent-2) 10%, transparent), transparent 70%), var(--bg); }
.demo { display: grid; grid-template-columns: 360px 1fr; overflow: hidden; }
@media (max-width: 960px) { .demo { grid-template-columns: 1fr; } }
.demo-side { padding: 4px 22px 22px; border-right: 1px solid var(--line); background: var(--bg-alt); }
@media (max-width: 960px) { .demo-side { border-right: 0; border-bottom: 1px solid var(--line); } }
.demo-main { padding: 22px; min-width: 0; }
.lbl { display: block; font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); margin: 18px 0 8px; }
.hidden { display: none !important; }
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.g-item { position: relative; border: 2px solid transparent; border-radius: 10px; overflow: hidden; cursor: pointer; padding: 0; background: none; aspect-ratio: 16/11; }
.g-item img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.g-item:hover img { transform: scale(1.06); }
.g-item.active { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.g-item span { position: absolute; left: 0; right: 0; bottom: 0; font-size: 10.5px; font-weight: 600; color: #fff; padding: 10px 6px 4px; background: linear-gradient(transparent, rgba(0, 0, 0, .7)); text-align: left; }
.select {
  width: 100%; font: inherit; font-size: 14.5px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink);
}
.demo-frames-view { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; min-height: 60px; }
.demo-frames-view.f16 { grid-template-columns: repeat(8, 1fr); }
.demo-frames-view.f24, .demo-frames-view.f32 { grid-template-columns: repeat(12, 1fr); }
@media (max-width: 640px) { .demo-frames-view, .demo-frames-view.f16, .demo-frames-view.f24, .demo-frames-view.f32 { grid-template-columns: repeat(6, 1fr); } }
.prompt-line { margin: 16px 0 10px; font-size: 14px; color: var(--ink-2); }
.role { font: 700 11px var(--mono); letter-spacing: .06em; text-transform: uppercase; padding: 3px 7px; border-radius: 6px; background: var(--bg-alt); color: var(--ink-3); margin-right: 6px; }
.output {
  min-height: 190px; max-height: 420px; overflow-y: auto; border-radius: 12px; border: 1px solid var(--line); padding: 16px 18px;
  font-size: 15px; line-height: 1.75; background: var(--bg);
}
.output .empty { color: var(--ink-3); font-style: italic; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }
@media (max-width: 640px) { .metrics { grid-template-columns: repeat(2, 1fr); } }
.metric { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--surface); }
.m-lbl { font-size: 11.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); }
.m-val { font: 700 24px var(--mono); margin-top: 2px; }
.m-val.bad { color: var(--accent); }
.m-val.good { color: #2e9e5b; }
.m-sub { font-size: 12px; color: var(--ink-3); }

/* ---------- bibtex / footer ---------- */
.bib { position: relative; padding: 20px 22px; }
.bib pre { margin: 0; font: 13.5px/1.6 var(--mono); overflow-x: auto; color: var(--ink); white-space: pre; }
.copy { position: absolute; top: 12px; right: 12px; border: 1px solid var(--line); background: var(--bg-alt); color: var(--ink-2); font: inherit; font-size: 13px; font-weight: 600; border-radius: 8px; padding: 5px 12px; cursor: pointer; }
.footer { text-align: center; padding: 36px 16px 48px; color: var(--ink-3); font-size: 14px; border-top: 1px solid var(--line); }
.footer p { margin: 4px 0; }
.fine { font-size: 12.5px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .fr, .bar-fill { animation: none; transition: none; }
}

/* ---------- frame grids and zoom ---------- */
button.fr { border: 0; padding: 0; cursor: zoom-in; font: inherit; }
button.fr:hover img { transform: scale(1.05); }
.fr img { transition: transform .25s; }
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 6px; margin: 8px 0 14px; }
.fgrid.dense { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
@media (max-width: 640px) { .fgrid, .fgrid.dense { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); } }
.fgrid .fr .idx { font-size: 11.5px; }
.strip-demo { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); }
.frames-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); font-weight: 600; margin-top: 4px; }
.frames-head .hint, .hint { color: var(--ink-3); font-weight: 500; }
.demo-frames-view .fr { cursor: zoom-in; }

.films { padding: 18px 20px; margin-bottom: 16px; }
.film-row { display: grid; grid-template-columns: 170px 1fr; gap: 16px; align-items: start; }
.film-row + .film-row { border-top: 1px dashed var(--line); padding-top: 12px; }
.film-lbl { padding-top: 10px; }
.film-lbl b { display: block; font-size: 16px; }
.film-lbl span { color: var(--ink-3); font-size: 13px; }
@media (max-width: 760px) { .film-row { grid-template-columns: 1fr; gap: 0; } }
.films .fgrid { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); }
.tx-texts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.tx-texts > * { min-width: 0; }
@media (max-width: 900px) { .tx-texts { grid-template-columns: 1fr; } }
.tx-text { padding: 18px 20px; }
.tx-text h4 { margin: 0 0 8px; font-size: 16px; }
.compare { display: block; }

/* ---------- repeated phrases ---------- */
.phrases-lbl { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin: 14px 0 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: baseline; gap: 6px; max-width: 100%; border: 1px solid transparent; border-radius: 8px;
  padding: 4px 9px; font: inherit; font-size: 13px; cursor: pointer; text-align: left; transition: box-shadow .15s, transform .15s;
}
.chip b { font-family: var(--mono); font-size: 12px; }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 520px; }
.chip i { font-style: normal; font-size: 11px; opacity: .7; white-space: nowrap; }
.chip:hover, .chip.on { box-shadow: 0 0 0 2px currentColor; }
.chip.c0 { background: var(--h0); color: var(--h0t); } .chip.c1 { background: var(--h1); color: var(--h1t); }
.chip.c2 { background: var(--h2); color: var(--h2t); } .chip.c3 { background: var(--h3); color: var(--h3t); }
.chip.c4 { background: var(--h4); color: var(--h4t); } .chip.c5 { background: var(--h5); color: var(--h5t); }
.chip.c6 { background: var(--h6); color: var(--h6t); } .chip.c7 { background: var(--h7); color: var(--h7t); }
.chip.c8 { background: var(--h8); color: var(--h8t); } .chip.c9 { background: var(--h9); color: var(--h9t); }
.chip.c10 { background: var(--h10); color: var(--h10t); } .chip.c11 { background: var(--h11); color: var(--h11t); }
mark.rep { transition: background .15s, color .15s, box-shadow .15s; }
.focusing mark.rep:not(.on) { background: transparent; color: inherit; }
.focusing mark.rep.on { box-shadow: 0 0 0 2px currentColor; }
#demo-phrases .chips { max-height: 150px; overflow-y: auto; }

/* ---------- zoom viewer ---------- */
.lb { position: fixed; inset: 0; z-index: 200; background: rgba(10, 11, 14, .96); display: grid; grid-template-rows: auto 1fr auto; align-items: center; justify-items: center; padding: 12px 16px 14px; }
.lb-top { width: 100%; display: flex; align-items: center; gap: 14px; color: #fff; font-size: 14px; }
.lb-title { font-weight: 700; }
.lb-count { color: #b8bcc6; font-family: var(--mono); font-size: 13px; }
.lb-x { margin-left: auto; background: rgba(255, 255, 255, .12); color: #fff; border: 0; border-radius: 10px; width: 38px; height: 38px; font-size: 16px; cursor: pointer; }
.lb figure { margin: 0; max-width: min(1100px, 92vw); max-height: 72vh; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.lb figure img { max-width: 100%; max-height: 66vh; border-radius: 10px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); object-fit: contain; }
.lb figcaption { color: #d7dae0; font-size: 14px; }
.lb-nav { position: fixed; top: 50%; transform: translateY(-50%); width: 48px; height: 64px; border: 0; border-radius: 12px; background: rgba(255, 255, 255, .12); color: #fff; font-size: 34px; cursor: pointer; }
.lb-nav:hover, .lb-x:hover { background: rgba(255, 255, 255, .24); }
.lb-prev { left: 14px; } .lb-next { right: 14px; }
.lb-strip { display: flex; gap: 6px; overflow-x: auto; max-width: 100%; padding: 4px 2px; }
.lb-strip button { flex: 0 0 auto; width: 78px; border: 2px solid transparent; border-radius: 7px; padding: 0; background: none; cursor: pointer; opacity: .55; }
.lb-strip button.on { border-color: var(--accent-2); opacity: 1; }
.lb-strip img { width: 100%; border-radius: 5px; display: block; }

.demo-frames-view, .demo-frames-view.f16, .demo-frames-view.f24, .demo-frames-view.f32 { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }

.spr { display: block; width: 100%; height: 100%; background-repeat: no-repeat; }
.fr .spr { transition: transform .25s; }
button.fr:hover .spr { transform: scale(1.05); }
.g-item .spr { position: absolute; top: 0; left: 50%; height: 100%; width: auto; transform: translateX(-50%); }
.lb-img { display: flex; justify-content: center; }
.lb-img .spr { border-radius: 10px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); max-width: 92vw; }
.lb-img img { max-width: 100%; max-height: 66vh; border-radius: 10px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); object-fit: contain; }
.lb-strip .spr { border-radius: 5px; height: auto; }

/* ---------- output explorer ---------- */
.gallery { grid-template-columns: repeat(4, 1fr); }
.g-item.paper span { background: linear-gradient(transparent, color-mix(in srgb, var(--accent) 85%, black)); }
.xp-films { display: grid; gap: 12px; }
.xp-films .film-row { grid-template-columns: 130px 1fr; }
.xp-films .fgrid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); margin: 0; }
.xp-films .fgrid.dense { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }
@media (max-width: 760px) { .xp-films .film-row { grid-template-columns: 1fr; } }
.xp-outs { display: grid; gap: 14px; }
.xp-outs.two { grid-template-columns: 1fr 1fr; }
.xp-outs > * { min-width: 0; }
@media (max-width: 1100px) { .xp-outs.two { grid-template-columns: 1fr; } }
.xp-outs .tx-text { box-shadow: none; }
.xp-outs .text-out { max-height: 420px; }
.tx-text .empty { color: var(--ink-3); font-style: italic; margin: 0; }
.ex-grid.last { margin-bottom: 0; }

.demo { grid-template-columns: 1fr; }
.demo-side { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(320px, 1.4fr); gap: 8px 28px; align-items: start;
  border-right: 0; border-bottom: 1px solid var(--line); padding: 8px 24px 18px; }
.demo-side .lbl { margin-top: 12px; }
.ctl-row { display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: flex-end; }
.ctl-model { flex: 1 1 260px; min-width: 0; }
.ctl-col { min-width: 0; }
.demo-side .gallery { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
.demo-main { padding: 22px 24px; }
.xp-films .film-row { grid-template-columns: 150px 1fr; }
.xp-films .fgrid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.xp-films .fgrid.dense { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); }
@media (max-width: 1100px) { .xp-outs.two { grid-template-columns: 1fr 1fr; } }
@media (max-width: 860px) { .demo-side { grid-template-columns: 1fr; } .xp-outs.two { grid-template-columns: 1fr; } }
.xp-outs .text-out { max-height: 520px; }
.demo-side .gallery { grid-template-columns: repeat(6, 1fr); gap: 6px; }
@media (max-width: 860px) { .demo-side .gallery { grid-template-columns: repeat(4, 1fr); } }

.section-intro { color: var(--ink); max-width: 1200px; }
.result-head > div:first-child { max-width: 1000px; }
.result-head p, .sub-intro { color: var(--ink); }
#overview p { max-width: 1200px; }

/* ---------- hero logo and figure canvas ---------- */
.hero-inner { max-width: 1320px; }
.hero h1 { font-size: clamp(32px, 4.6vw, 60px); text-wrap: balance; }
.hero-logo { width: clamp(84px, 9vw, 120px); height: auto; display: block; margin: 0 auto 18px; }
.brand-logo { width: 28px; height: 28px; }
.brand-mark { display: none; }
.venue { margin: 18px 0 0; }
.teaser { max-width: 1440px; margin: clamp(32px, 5vw, 56px) auto 0; padding: clamp(16px, 2.4vw, 32px); border-radius: 22px;
  background: var(--canvas); border: 1px solid var(--line); }
.teaser img { background: transparent; border-radius: 0; margin: 0 auto; }
.teaser figcaption { color: var(--ink); font-size: clamp(15px, 1.4vw, 18px); margin-top: 14px; }
:root { --canvas: #efece6; }
:root[data-theme="dark"] { --canvas: #e9e5dd; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --canvas: #e9e5dd; } }
:root[data-theme="dark"] .teaser figcaption { color: #16181d; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .teaser figcaption { color: #16181d; } }

.section-intro, #overview p { max-width: none; }

.stat-lbl { color: var(--ink); font-size: clamp(15px, 1.3vw, 17px); font-weight: 500; }

/* ---------- overview section panels ---------- */
.testbed { margin-bottom: 18px; }
.testbed-head { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; align-items: flex-end; }
.testbed-head > div:first-child { flex: 1 1 520px; min-width: 0; }
.testbed-head p { color: var(--ink); }
.sources { display: flex; flex-wrap: wrap; gap: 8px; }
.sources span { font-size: 13.5px; font-weight: 600; padding: 6px 12px; border-radius: 999px; background: color-mix(in srgb, var(--teal) 12%, transparent); color: var(--teal); }
.testbed-figs { display: grid; grid-template-columns: 1.15fr 1fr; gap: 16px; margin-top: 18px; }
.testbed-figs > * { min-width: 0; }
@media (max-width: 860px) { .testbed-figs { grid-template-columns: 1fr; } }
.canvas-fig { margin: 0; background: var(--canvas); border-radius: 16px; padding: 18px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.canvas-fig img { max-height: 520px; width: auto; max-width: 100%; }
.canvas-fig figcaption { color: #16181d; font-weight: 600; font-size: 15px; margin-top: 8px; }
.stressor-card { margin-bottom: 18px; }
.stressor-card p { color: var(--ink); }
.stressor-card .strip-demo { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; }
.protocols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.protocols > * { min-width: 0; }
@media (max-width: 900px) { .protocols { grid-template-columns: 1fr; } }
.protocol { color: var(--ink); display: block; transition: transform .15s, box-shadow .15s; }
.protocol:hover { text-decoration: none; transform: translateY(-2px); }
.protocol h3 { font-size: 19px; margin: 4px 0 12px; }
.protocol p { margin: 12px 0 0; font-size: 15px; }
.flow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.flow span { font-size: 13px; font-weight: 600; padding: 5px 10px; border-radius: 8px; background: var(--bg-alt); border: 1px solid var(--line); }
.flow span.s { background: color-mix(in srgb, var(--violet) 12%, transparent); color: var(--violet); border-color: transparent; }
.flow span.m { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.flow i { font-style: normal; color: var(--ink-3); font-weight: 700; }
.grid3 p { color: var(--ink); }
.teaser { max-width: calc(1440px - 2 * clamp(16px, 4vw, 32px)); }

/* ---------- typography ---------- */
:root { --ink-2: #16181d; --ink-3: #2b2e35; }
:root[data-theme="dark"] { --ink-2: #eceef2; --ink-3: #dde0e6; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --ink-2: #eceef2; --ink-3: #dde0e6; } }
body { font-size: 17.5px; }
.authors { font-size: clamp(19px, 1.8vw, 23px); gap: 8px 26px; margin-top: 30px; }
.affils { font-size: clamp(16px, 1.4vw, 18px); color: var(--ink); gap: 6px 22px; }
.venue { font-size: 14px; }
.btn { font-size: 16px; padding: 12px 22px; }
.lead { font-size: clamp(19px, 1.7vw, 22px); }
#overview p:not(.lead) { font-size: 17.5px; }
.stat-lbl { font-size: clamp(16px, 1.3vw, 18px); }
.pill { font-size: 12.5px; }
.grid3 h3, .testbed h3, .stressor-card h3 { font-size: 21px; }
.grid3 p, .testbed-head p, .stressor-card p { font-size: 16.5px; }
.formula { font-size: 16px; }
.note { font-size: 15px; color: var(--ink); }
.sources span { font-size: 14.5px; }
.canvas-fig figcaption { font-size: 16px; }
.flow span { font-size: 14px; }
.protocol h3 { font-size: 21px; }
.protocol p { font-size: 16px; }
.step { font-size: 13px; }
.result-head h3 { font-size: 26px; }
.result-head p { font-size: 17px; }
.seg button { font-size: 14.5px; }
.bar-name { font-size: 15.5px; }
.bar-name small { font-size: 13px; color: var(--ink); }
.bar-val { font-size: 14px; }
.family-sep { font-size: 13px; color: var(--ink); }
.heat .h-col { font-size: 14px; color: var(--ink); }
.heat .h-row { font-size: 15px; }
.heat .h-cell { font-size: 14px; }
.legend, .legend-inline { font-size: 14.5px; color: var(--ink); }
.model-tabs button { font-size: 14.5px; color: var(--ink); }
.tag { font-size: 13.5px; }
.frames-head { font-size: 14.5px; color: var(--ink); }
.text-out { font-size: 16px; }
.more { font-size: 15px; }
.phrases-lbl { font-size: 13px; color: var(--ink); }
.chip { font-size: 14px; }
.chip i { opacity: .85; }
.lbl { font-size: 13px; color: var(--ink); }
.select { font-size: 16px; }
.film-lbl b { font-size: 17px; }
.film-lbl span { font-size: 14.5px; color: var(--ink); }
.prompt-line { font-size: 15.5px; color: var(--ink); }
.role { font-size: 12px; color: var(--ink); }
.tx-text h4 { font-size: 18px; }
.g-item span { font-size: 12px; }
.bib pre { font-size: 15px; }
.copy { font-size: 14px; }
.footer { font-size: 15.5px; color: var(--ink); }
.fine { font-size: 14px; }
.topbar nav a { font-size: 15.5px; color: var(--ink); }
.fr .idx { font-size: 12px; }
.lb-count { font-size: 14px; }
.lb figcaption { font-size: 15.5px; }

.canvas-fig img { max-height: 340px; }
.testbed-figs { grid-template-columns: repeat(2, minmax(0, 480px)); justify-content: center; }
@media (max-width: 860px) { .testbed-figs { grid-template-columns: minmax(0, 480px); } }
.sources a { font-size: 14.5px; font-weight: 600; padding: 6px 12px; border-radius: 999px; background: color-mix(in srgb, var(--teal) 12%, transparent); color: var(--teal); }
.sources a:hover { text-decoration: none; background: color-mix(in srgb, var(--teal) 22%, transparent); }
.protocols-card p { color: var(--ink); font-size: 16.5px; }
.protocols-card h3 { font-size: 21px; margin: 10px 0 8px; }
.canvas-fig.wide { margin-top: 16px; padding: clamp(10px, 1.6vw, 20px); }
.canvas-fig.wide img { max-height: none; width: 100%; }
.testbed-figs { grid-template-columns: minmax(0, 440px) minmax(0, 480px); }
.canvas-fig.hist img { max-height: 300px; }
.canvas-fig.pie img { max-height: 420px; }

.protocol-rows { display: grid; gap: 14px; margin-top: 16px; }
.protocol-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr); gap: 14px; align-items: stretch; }
@media (max-width: 1000px) { .protocol-row { grid-template-columns: 1fr; } }
.protocol-row .canvas-fig { padding: clamp(10px, 1.4vw, 18px); }
.protocol-row .canvas-fig img { max-height: none; width: 100%; height: auto; }
.teaser-title { max-width: calc(1440px - 2 * clamp(16px, 4vw, 32px)); margin: clamp(48px, 6vw, 80px) auto 0; text-align: left; }
.teaser-title + .teaser { margin-top: 18px; }
@media (max-width: 640px) { .topbar nav a:not([href="#explorer"]) { display: none; } .topbar nav a[href="#explorer"] { display: inline-block; } }
.authors a { color: var(--ink); border-bottom: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); }
.authors a:hover { text-decoration: none; color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- wordmark ---------- */
.wordmark { color: var(--ink); font-weight: 800; letter-spacing: -.02em; }
.wordmark span { color: #d9482b; }
.brand { gap: 10px; }
.brand-logo { width: 34px; height: 34px; }
.brand .wordmark { font-size: 22px; line-height: 1; }
.authors a { border-bottom: 0; }
.authors a:hover { text-decoration: none; color: var(--accent); }
.hero { padding-bottom: clamp(20px, 3vw, 36px); }
#overview { padding-top: clamp(28px, 4vw, 48px); }
.result-head { display: block; }
.result-head > div:first-child { max-width: none; }
.result-head .controls { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: 10px; margin-top: 16px; }
