:root {
  color-scheme: light;
  --paper: #ffffff;
  --panel: #f3f5f8;
  --ink: #14161b;
  --muted: #5a6170;
  --line: #dee2e8;
  --faint: #eef1f5;
  --body: "Schibsted Grotesk", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--paper); color: var(--ink); font: 17px/1.6 var(--body); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
a { color: inherit; text-underline-offset: .2em; }
button, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
h1, h2, h3, p, figure { margin: 0; }
h1, h2 { font-weight: 700; line-height: 1.08; letter-spacing: -.03em; }
h2 { font-size: clamp(1.8rem, 3vw, 2.5rem); }
h3 { font-size: 1.15rem; line-height: 1.3; font-weight: 600; letter-spacing: -.01em; }
code { font-family: var(--mono); font-size: .88em; }
.wrap { width: min(1240px, calc(100% - 64px)); margin-inline: auto; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; z-index: 10; top: 8px; left: 8px; padding: 8px 16px; background: var(--paper); transform: translateY(-150%); }
.skip:focus { transform: none; }

.topbar { display: flex; justify-content: center; align-items: center; gap: 16px; padding-block: 18px; }
.wordmark { font-weight: 600; text-decoration: none; font-size: .95rem; }
.topbar nav { display: flex; gap: 28px; }
.topbar nav a { font-size: .95rem; color: var(--muted); text-decoration: none; }
.topbar nav a:hover { color: var(--ink); }

.hero { padding-block: clamp(40px, 7vw, 96px) clamp(48px, 7vw, 96px); text-align: center; }
h1 { font-size: clamp(2rem, 4.2vw, 3.6rem); text-wrap: balance; }
.authors { margin-top: 22px; font-size: 1.05rem; font-weight: 600; }
.affiliation { margin-top: 2px; color: var(--muted); }
.hero-links { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; margin-top: 26px; }
.tldr { max-width: 62ch; margin: 28px auto 0; font-size: clamp(1.05rem, 1.5vw, 1.2rem); line-height: 1.5; text-wrap: pretty; }
.tldr strong { margin-right: 6px; }
.link-button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 16px; border-radius: 999px;
  border: 1px solid var(--ink); background: var(--paper);
  font-size: .92rem; font-weight: 500; text-decoration: none; line-height: 1.2;
}
.link-button:hover, .button:hover { background: var(--ink); color: var(--paper); }
.link-button.primary { background: var(--ink); color: var(--paper); }
.link-button.primary:hover { background: #2c313b; }
.link-button.soon { border-color: var(--line); color: var(--muted); cursor: default; }
.link-button.soon:hover { background: var(--paper); color: var(--muted); }

/* Story: steps scroll on the left, the stage stays put on the right. */
.part { border-top: 1px solid var(--line); padding-top: clamp(40px, 6vw, 72px); }
.part h2 { text-align: center; }
.story { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 5vw, 80px); }
.steps { padding-block: 8vh 28vh; }
.step { min-height: 64vh; display: flex; flex-direction: column; justify-content: center; gap: 14px; max-width: 46ch; opacity: .32; transition: opacity .35s ease; }
.step.is-active { opacity: 1; }
.step p { color: #2c313b; text-wrap: pretty; }
.step code { background: var(--faint); padding: 1px 5px; border-radius: 4px; }
.step-num { font-size: .9rem; font-weight: 600; color: var(--muted) !important; }
.step h3 { font-size: clamp(1.4rem, 2.1vw, 1.8rem); text-wrap: balance; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.step .hint { font-size: .92rem; color: var(--muted); }
.step-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 4px; }
.key-value { font-size: .85rem; color: var(--muted); }
.segmented { display: inline-flex; border: 1px solid var(--ink); border-radius: 999px; overflow: hidden; }
.segmented button { border: 0; background: var(--paper); padding: 8px 14px; min-height: 40px; font-size: .92rem; }
.segmented button + button { border-left: 1px solid var(--ink); }
.segmented button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.race summary { cursor: pointer; font-size: .92rem; color: var(--muted); }
.race p { margin-top: 6px; font-family: var(--mono); font-size: .82rem; color: var(--muted); }

.stage-wrap { position: relative; }
.stage { position: sticky; top: max(16px, calc(50vh - 340px)); padding-block: 24px; }
.stage-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; margin-bottom: 12px; }
.prompt-button, .model-pick {
  display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 7px 12px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--paper); text-align: left;
}
.prompt-button { min-width: 0; }
.prompt-button:hover, .model-pick:hover { border-color: var(--ink); }
.prompt-button img { width: 36px; height: 36px; border-radius: 6px; object-fit: cover; flex: none; }
.prompt-text { min-width: 0; flex: 1; }
.prompt-text span, .prompt-text small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prompt-button small, .model-pick small { font-size: .75rem; color: var(--muted); line-height: 1.2; }
.prompt-text span { font-size: .95rem; font-weight: 500; }
.chev, .model-pick::after { width: 8px; height: 8px; border-right: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink); transform: rotate(45deg) translateY(-3px); flex: none; }
.model-pick { position: relative; cursor: pointer; display: grid; grid-template-columns: auto; gap: 0; padding-right: 32px; }
.model-pick::after { content: ""; position: absolute; right: 14px; top: 50%; }
.model-pick select { appearance: none; border: 0; background: transparent; padding: 0; font-size: .95rem; font-weight: 500; cursor: pointer; }
.model-pick select:focus-visible { outline: none; }
.model-pick:focus-within { outline: 2px solid var(--ink); outline-offset: 3px; }

.board { position: relative; aspect-ratio: 5 / 4; background: var(--panel); border-radius: 16px; overflow: hidden; }
[data-regions], [data-lines], [data-dots], [data-overlay], [data-tiles] { position: absolute; inset: 0; width: 100%; height: 100%; }
[data-regions] { transition: opacity .5s ease; }
[data-lines], [data-dots] { pointer-events: none; overflow: visible; }
[data-overlay] { pointer-events: none; }
[data-overlay] .interactive { pointer-events: auto; }
.tile { position: absolute; margin: 0; aspect-ratio: 1; transition: left .7s cubic-bezier(.2,.7,.2,1), top .7s cubic-bezier(.2,.7,.2,1), width .7s cubic-bezier(.2,.7,.2,1), opacity .5s ease; }
.tile img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 8%; background: var(--line); box-shadow: 0 0 0 2px var(--paper); }
.tile figcaption { position: absolute; left: 50%; top: calc(100% + 4px); transform: translateX(-50%); font: 600 .72rem/1 var(--mono); padding: 3px 5px; border-radius: 4px; color: #fff; white-space: nowrap; transition: opacity .3s ease; }
.tile figcaption:empty { opacity: 0; }
.tile.winner img { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--ink); }
@media (prefers-reduced-motion: reduce) { .tile, [data-regions], .step { transition: none; } }

.ov { position: absolute; font-size: .82rem; line-height: 1.25; }
.ov-row { display: flex; align-items: center; gap: 8px; transform: translateY(-50%); }
.chip { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
.ov-code { font: 600 .85rem var(--mono); }
.ov-muted { color: var(--muted); }
.ov-bar { transform: translateY(-50%); height: 10px; border-radius: 5px; background: #fff; overflow: hidden; }
.ov-bar span { display: block; height: 100%; border-radius: inherit; }
.ov-score { transform: translateY(-50%); font: 600 .82rem var(--mono); }
.ov-label { transform: translateX(-50%); text-align: center; white-space: nowrap; font-size: .85rem; }
.ov-label strong { font-weight: 600; }

.stage-caption { min-height: 3.2em; margin-top: 12px; font-size: .95rem; color: var(--muted); }
.stage-caption strong { color: var(--ink); font-weight: 600; }
.ov-thresh { height: 26px; margin-left: -1px; transform: translateY(-50%); border-left: 2px solid var(--ink); }
.ov-thresh span { position: absolute; top: 30px; left: 0; transform: translateX(-50%); white-space: nowrap; font-size: .78rem; color: var(--muted); }
.stage-note { margin-bottom: 12px; font-size: .9rem; color: var(--muted); }
.ov-verdict { display: grid; gap: 4px; max-width: 46%; }
.ov-verdict strong { font-size: clamp(1.1rem, 2vw, 1.5rem); font-weight: 700; line-height: 1.15; }
.ov-verdict span { color: var(--muted); font-size: .85rem; }

.demo-note { padding-block: 8px 24px; font-size: .85rem; color: var(--muted); max-width: 1240px; }

.section { border-top: 1px solid var(--line); padding-block: clamp(48px, 7vw, 96px); }

.properties { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px; margin-top: 36px; }
.properties p { margin-top: 8px; color: #2c313b; font-size: .98rem; }

.citation-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
pre { margin: 0; background: var(--panel); border-radius: 12px; padding: 20px; overflow-x: auto; font-size: .86rem; }
pre code { font-size: inherit; }
footer { padding-block: 28px; border-top: 1px solid var(--line); color: var(--muted); font-size: .88rem; }
.fallback img { width: 100%; height: auto; }

#prompt-dialog { width: min(760px, calc(100% - 24px)); max-height: min(780px, 88dvh); color: var(--ink); background: var(--paper); border: 0; border-radius: 16px; padding: 20px; }
#prompt-dialog::backdrop { background: rgba(20, 22, 27, .55); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.prompt-grid { margin-top: 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.prompt-option { display: grid; gap: 6px; align-content: start; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); text-align: left; font-size: .85rem; line-height: 1.3; }
.prompt-option:hover { border-color: #9aa3b2; background: var(--panel); }
.prompt-option[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.prompt-option img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }

@media (max-width: 980px) {
  .wrap { width: calc(100% - 32px); }
  .story { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .stage-wrap { grid-row: 1; position: sticky; top: 0; z-index: 3; background: var(--paper); }
  .stage { position: static; padding-block: 10px 4px; }
  .stage-caption { min-height: 2.6em; font-size: .85rem; margin-top: 6px; }
  .steps { padding-block: 4vh 20vh; }
  .ov { font-size: .7rem; }
  .step { min-height: 62vh; justify-content: flex-start; padding-top: 6vh; }
  .ov-code { font-size: .72rem; }
}
@media (max-width: 560px) {
  .stage-bar { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 6px; margin-bottom: 8px; }
  .prompt-button, .model-pick { min-height: 44px; padding-block: 4px; }
  .prompt-button small, .model-pick small { display: none; }
  .model-pick select { width: 100%; text-overflow: ellipsis; font-size: .85rem; }
  .prompt-text span { font-size: .85rem; }
  .prompt-button img { width: 30px; height: 30px; }
  .tile figcaption { font-size: .6rem; padding: 2px 3px; }
}
