@font-face {
  font-family: Figtree;
  src: url('./media/fonts/figtree/Figtree[wght].ttf') format('truetype');
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #f5f7fa;
  --ink: #12161d;
  --text: #2e3540;
  --muted: #5b6573;
  --line: #dde2e8;
  --accent: #145bd2;
  --focus: #0b4fc0;
  --type-display: clamp(64px, 6.3vw, 88px);
  --type-section: 38px;
  --type-body: 18px;
  --type-support: 15px;
  --space-local: 12px;
  --space-group: 24px;
  --space-section: 72px;
  font-family: Figtree, Arial, Helvetica, sans-serif;
  font-synthesis: none;
  color: var(--text);
  background: var(--paper);
  scroll-padding-top: 28px;
}

* { box-sizing: border-box; }
body, h1, h2, h3, h4, p, figure { margin: 0; }
body { min-width: 320px; background: var(--paper); }
h1, h2, h3, h4 { color: var(--ink); }
.site-header, .reel {
  color-scheme: dark;
  --ink: #f1f3f7;
  --text: #f1f3f7;
  --muted: #a2a8b3;
  --accent: #a7c7ff;
  --focus: #a7c7ff;
  color: var(--text);
}
  background:
    radial-gradient(ellipse at 12% 8%, #17202e 0, transparent 52%),
    radial-gradient(ellipse at 88% 72%, #101c28 0, transparent 54%),
    linear-gradient(145deg, #0e1015 0%, #0b0d10 52%, #101318 100%);
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button, a { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 4px; }
button:focus-visible, a:focus-visible, input:focus-visible, video:focus-visible { outline: 2px solid var(--focus); outline-offset: 5px; }
::selection { color: #fff; background: #31517f; }
[hidden] { display: none !important; }
.page-width { width: min(1120px, calc(100% - 96px)); margin-inline: auto; }
h2 { font-size: var(--type-section); line-height: 1.16; font-weight: 600; letter-spacing: -.035em; }
h3 { font-size: 23px; line-height: 1.3; font-weight: 500; letter-spacing: -.02em; }
h4 { font-size: 19px; line-height: 1.35; font-weight: 500; letter-spacing: -.015em; }
.mono { font-size: 12px; font-weight: 500; line-height: 1.5; letter-spacing: .07em; text-transform: uppercase; font-variant-numeric: tabular-nums; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: 12px; left: 20px; z-index: 10; padding: 10px 16px; color: #fff; background: var(--accent); transform: translateY(-180%); }
.skip-link:focus { transform: translateY(0); }

.site-header { position: absolute; z-index: 5; inset: 0 0 auto; background: linear-gradient(#06080bc0, transparent); }
.site-header-row { display: flex; align-items: center; justify-content: space-between; min-height: 74px; gap: 32px; }
.site-header nav { display: flex; flex-shrink: 0; gap: 30px; }
.report-title { color: #c9ced6; font-size: var(--type-support); line-height: 1.35; letter-spacing: -.005em; }
.report-title strong { color: #fff; font-weight: 600; }
.report-title:hover { color: #fff; }
.site-header nav a { color: #d4d8df; font-size: var(--type-support); }

.reel { position: relative; height: 100svh; min-height: 600px; max-height: 1200px; overflow: hidden; isolation: isolate; background: #06080b; }
.reel-media { position: absolute; inset: 0; overflow: hidden; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.has-reel .reel-media { cursor: ew-resize; }
/* Without JS the grid poster is shown with only its right (output) half in view. */
.reel-poster { position: absolute; top: 0; left: -100%; width: 200%; height: 100%; object-fit: cover; object-position: right center; }
.reel-media canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity 0s linear .9s; }
.reel-media[data-front="0"] canvas:nth-of-type(1), .reel-media[data-front="1"] canvas:nth-of-type(2) { z-index: 1; opacity: 1; transition: opacity .9s ease; }
.reel-split { --split: 50%; position: absolute; z-index: 2; inset: 0; pointer-events: none; }
.reel-split::before { content: ""; position: absolute; top: 0; bottom: 0; left: var(--split); width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 2px #fff, 0 0 22px #a7c7ffb0; }
.reel-handle { position: absolute; top: 46%; left: var(--split); width: 46px; height: 46px; margin: -23px 0 0 -23px; border: 1.5px solid #fff; border-radius: 50%; background: #06080b70; backdrop-filter: blur(8px); pointer-events: auto; cursor: ew-resize; }
.reel-handle::before, .reel-handle::after { content: ""; position: absolute; top: 50%; width: 7px; height: 7px; margin-top: -4px; border: solid #fff; border-width: 0 0 1.5px 1.5px; }
.reel-handle::before { left: 11px; transform: rotate(45deg); }
.reel-handle::after { right: 11px; transform: rotate(-135deg); }
.reel-handle:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
.reel-label { position: absolute; top: 112px; padding: 4px 0; color: #fff; font-size: 11px; white-space: nowrap; text-shadow: 0 1px 8px #000c; }
.reel-label-proxy { right: calc(100% - var(--split)); margin-right: 16px; }
.reel-label-output { left: var(--split); margin-left: 16px; }
.reel::after { content: ""; position: absolute; z-index: 1; inset: auto 0 0; height: 58%; background: linear-gradient(transparent, #06080bd9 70%, #06080b); pointer-events: none; }
.reel-footer { position: absolute; z-index: 3; inset: auto 0 0; display: flex; align-items: end; justify-content: space-between; gap: 32px 64px; padding-bottom: 56px; pointer-events: none; }
.reel-footer :is(button, a, [role="group"]) { pointer-events: auto; }
.reel h1 { font-size: clamp(56px, 6.6vw, 108px); font-weight: 600; line-height: .95; letter-spacing: -.05em; white-space: nowrap; }
.project-subtitle { max-width: 44ch; margin-top: 22px; color: #c9ced6; font-size: 18px; line-height: 1.5; letter-spacing: -.01em; }
.project-subtitle strong { color: #fff; font-weight: 600; }
.reel-meta { display: grid; justify-items: end; gap: 10px; text-align: right; }
.reel-caption { color: #fff; font-size: 13px; }
.reel-controls { display: flex; align-items: center; gap: 20px; }
.reel-ticks { display: flex; gap: 6px; }
.reel-tick { position: relative; width: 30px; height: 24px; padding: 0; border: 0; background: none; }
.reel-tick::before, .reel-tick::after { content: ""; position: absolute; left: 0; top: 50%; height: 2px; }
.reel-tick::before { right: 0; background: #ffffff40; }
.reel-tick:hover::before { background: #ffffff90; }
.reel-tick[aria-current]::before { background: #ffffff70; }
.reel-tick[aria-current]::after { width: calc(var(--progress, 0) * 100%); background: #fff; }
.reel-tick:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.reel-controls .text-button { color: #fff; font-size: 13px; }
.reel-error { max-width: 32ch; color: #fff; font-size: var(--type-support); line-height: 1.5; }
.output-badge { color: var(--muted); font-size: 11px; white-space: nowrap; }

.text-button { flex-shrink: 0; border: 0; padding: 4px 0; background: transparent; color: var(--accent); font-size: var(--type-support); }
.text-button:hover { text-decoration: underline; text-underline-offset: 4px; }

.overview { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 64px; padding-block: var(--space-section); }
.overview > p { max-width: 60ch; font-size: var(--type-body); line-height: 1.65; }

.chapters { padding-bottom: var(--space-section); }
.chapter { padding-top: 28px; border-top: 1px solid var(--line); }
.chapter + .chapter { margin-top: 96px; }
.chapter-text { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 14px 64px; }
.chapter-text > :last-child { padding-top: 32px; }
.chapter-index { display: flex; align-items: center; gap: 12px; color: var(--accent); }
.chapter-index::after { content: ""; width: 32px; height: 2px; background: currentColor; }
.chapter h2 { margin-top: 14px; }
.chapter-claim { max-width: 60ch; font-size: var(--type-body); line-height: 1.6; }
.chapter-variables { display: flex; flex-wrap: wrap; gap: 6px 28px; margin-top: 18px; color: var(--muted); }
.chapter-player { margin-top: 40px; }
.chapter-controls { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 32px; margin-bottom: 16px; }
.chapter-tabs { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: baseline; }
.chapter-poster { display: block; width: 100%; height: auto; border-radius: 6px; }
.tile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tile { position: relative; min-width: 0; }
.tile canvas { display: block; width: 100%; aspect-ratio: var(--tile-aspect, 7 / 4); border-radius: 4px; background: #0b0d10; }
.tile-label { position: absolute; left: 8px; bottom: 8px; padding: 3px 7px; border-radius: 2px; background: #06080bc0; color: #fff; font-size: 10px; pointer-events: none; }
.chapter-stage { --gap: 16px; position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.frame { position: relative; min-width: 0; transition: translate .9s cubic-bezier(.22, 1, .36, 1); }
.frame > canvas { display: block; width: 100%; aspect-ratio: var(--tile-aspect, 7 / 4); border-radius: 6px; background: #0b0d10; }
.frame > .tile-label { left: 12px; bottom: 12px; transition: opacity .4s ease .5s; }
.frame-inset { position: absolute; top: 12px; left: 12px; width: 28%; overflow: hidden; border: 1px solid #ffffffd0; border-radius: 4px; background: #0b0d10; box-shadow: 0 8px 24px #0009; transform-origin: top left; transition: scale .6s cubic-bezier(.22, 1, .36, 1) .25s, opacity .4s ease .25s; }
.chapter-stage[data-blend] .frame-inset { display: none; }
.blend-control { display: inline-flex; align-items: center; gap: 10px; margin-right: 12px; font-size: 12px; }
.blend-control input { width: 140px; accent-color: currentColor; }
.frame-inset canvas { display: block; width: 100%; aspect-ratio: var(--inset-aspect, 7 / 4); }
.frame-inset-label { position: absolute; left: 4px; bottom: 4px; padding: 1px 5px; border-radius: 2px; background: #06080bc0; color: #fff; font-size: 9px; letter-spacing: .08em; white-space: nowrap; }
.stage-note { position: absolute; z-index: 1; top: 50%; left: 50%; translate: -50% -50%; padding: 5px 12px; border-radius: 2px; background: #06080bc0; color: #fff; font-size: 11px; opacity: 0; transition: opacity .3s ease; pointer-events: none; }
.chapter-stage[data-phase="merged"] .frame:nth-child(1) { translate: calc(50% + var(--gap) / 2) 0; }
.chapter-stage[data-phase="merged"] .frame:nth-child(2) { translate: calc(-50% - var(--gap) / 2) 0; }
.chapter-stage[data-phase="merged"] .frame-inset { scale: 0; opacity: 0; transition-delay: 0s; }
.chapter-stage[data-phase="merged"] .frame > .tile-label { opacity: 0; transition-delay: 0s; }
.chapter-stage[data-phase="merged"] .stage-note { opacity: 1; }
.chapter-stage[data-snap] :is(.frame, .frame-inset, .tile-label, .stage-note) { transition: none; }
.tab-thumb { display: block; width: 96px; aspect-ratio: 7 / 4; border-radius: 3px; background-color: #0b0d10; background-repeat: no-repeat; outline: 2px solid transparent; outline-offset: 2px; }
.chapter-tab:has(.tab-thumb) { display: grid; grid-template-columns: 96px minmax(0, 1fr); align-items: center; gap: 14px; padding: 4px 0; font-size: 15px; text-align: left; text-decoration: none; }
.chapter-tab[aria-pressed="true"] .tab-thumb { outline-color: var(--accent); }
.chapter-player figcaption { max-width: 80ch; margin-top: 14px; color: var(--muted); font-size: var(--type-support); line-height: 1.55; }
.chapter-player figcaption > .mono { margin-right: 8px; color: var(--ink); }
.chapter-player figcaption .text-button { margin-left: 8px; font-size: inherit; }
.chapter-error { display: block; margin-top: 4px; color: var(--ink); }
.chapter-stage[data-frames="1"] { grid-template-columns: minmax(0, 1fr); max-width: 1000px; }
canvas[data-snow] { image-rendering: pixelated; }
.live-frame { max-width: 1000px; }
.live-video, .live-poster { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; border-radius: 6px; background: #0b0d10; }
.infra { padding-top: 28px; padding-bottom: var(--space-section); border-top: 1px solid var(--line); }
.infra:focus { outline: none; }
.infra-figure, .infra-gantt-figure { margin-top: 40px; }
.infra-diagram { padding: clamp(12px, 3vw, 40px); border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.infra-diagram img { display: block; width: 100%; max-width: 1080px; height: auto; margin-inline: auto; }
.infra figcaption { max-width: 80ch; margin-top: 14px; color: var(--muted); font-size: var(--type-support); line-height: 1.55; }
.infra-gantt-figure { --proxy: #2a9d8f; --dit: #e08a3c; --decode: #3f7fd0; --out: #12161d; }
.infra-gantt-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 10px 32px; margin-bottom: 20px; }
.infra-gantt-head h3 { font-size: 24px; line-height: 1.25; font-weight: 600; letter-spacing: -.02em; }
.gantt-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); font-size: 11px; letter-spacing: .06em; }
.gantt-legend span { display: inline-flex; align-items: center; gap: 7px; }
.gantt-legend span::before { content: ""; width: 14px; height: 8px; border-radius: 2px; background: var(--legend); }
.gantt-legend [data-lane="proxy"] { --legend: var(--proxy); }
.gantt-legend [data-lane="dit"] { --legend: var(--dit); }
.gantt-legend [data-lane="decode"] { --legend: var(--decode); }
.gantt-legend [data-lane="out"]::before { width: 2px; height: 12px; background: var(--out); }
.gantt { padding: 20px 24px 14px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.gantt-run + .gantt-run { margin-top: 22px; padding-top: 18px; border-top: 1px dashed var(--line); }
.gantt-run-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin-bottom: 10px; }
.gantt-run-head strong { font-size: 17px; font-weight: 600; color: var(--ink); }
.gantt-run-head span { color: var(--muted); font-size: 11px; letter-spacing: .04em; }
.gantt-lane, .gantt-axis { display: grid; grid-template-columns: 120px minmax(0, 1fr); align-items: center; column-gap: 16px; }
.gantt-lane-name { color: var(--muted); font-size: 13px; text-align: right; }
.gantt-track { position: relative; height: 30px; background: linear-gradient(90deg, #12161d10 1px, transparent 1px) var(--zero) 0 / var(--tick) 100% repeat-x; }
.gantt-track::before { content: ""; position: absolute; inset: 0 auto 0 var(--zero); width: 1px; background: #12161d38; }
.gantt-bar { position: absolute; top: 5px; bottom: 5px; min-width: 2px; border-radius: 3px; background: var(--bar); transform-origin: left; transform: scaleX(0); transition: transform .9s cubic-bezier(.22, 1, .36, 1); }
.gantt[data-shown] .gantt-bar { transform: none; }
.gantt-run[data-run="optimized"] .gantt-bar { transition-delay: .35s; }
.gantt-bar[data-lane="proxy"] { --bar: var(--proxy); }
.gantt-bar[data-lane="dit"] { --bar: var(--dit); }
.gantt-bar[data-lane="decode"] { --bar: var(--decode); }
.gantt-bar[data-lane="out"] { --bar: var(--out); top: 3px; bottom: 3px; border-radius: 1px; }
.gantt .mono, .gantt-run-head .mono { text-transform: none; }
.gantt-bar-label { position: absolute; top: 50%; left: 8px; translate: 0 -50%; color: #fff; font-size: 10px; letter-spacing: .02em; white-space: nowrap; }
.gantt-bar[data-narrow="true"] .gantt-bar-label { left: calc(100% + 6px); color: var(--muted); }
.gantt-axis { margin-top: 8px; }
.gantt-ticks { position: relative; height: 16px; color: var(--muted); font-size: 10px; }
.gantt-ticks span { position: absolute; translate: -50% 0; white-space: nowrap; }
.chapter-tab { padding: 8px 0; border: 0; background: transparent; color: var(--muted); font-size: 16px; line-height: 1.4; text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 8px; text-decoration-thickness: 2px; }
.chapter-tab:hover { color: var(--ink); text-decoration-color: var(--muted); }
.chapter-tab[aria-pressed="true"] { color: var(--accent); text-decoration-color: var(--accent); }

.method { padding-bottom: var(--space-section); }
.method-flow { display: grid; grid-template-columns: auto minmax(32px, 1fr) auto minmax(32px, 1fr) auto; align-items: center; color: var(--ink); }
.method-inputs { display: grid; gap: 10px; padding-block: 4px; padding-right: 20px; border-right: 1px solid var(--muted); }
.method-rule { height: 1px; background: var(--muted); }
.method-output { padding-left: 20px; }
.method-model { padding: 14px 22px; border: 1px solid var(--ink); border-radius: 4px; }
.method figcaption { max-width: 60ch; margin-top: var(--space-group); color: var(--muted); font-size: var(--type-support); line-height: 1.55; }
.site-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 0 28px; font-size: var(--type-support); line-height: 1.6; }
.site-footer > a { font-size: var(--type-support); }

@media (max-width: 1050px) {
  .page-width { width: calc(100% - 64px); }
  .overview { gap: 36px; }
}

@media (max-width: 900px) {
  .reel-footer { flex-direction: column; align-items: start; }
  .reel-meta { justify-items: start; text-align: left; }
  .overview { grid-template-columns: minmax(0, 1fr); gap: 18px; padding-block: 44px 48px; }
  .overview h2 { max-width: 24ch; }
  .chapter-text { grid-template-columns: minmax(0, 1fr); }
  .chapter-text > :last-child { padding-top: 0; }
}

@media (max-width: 700px) {
  .gantt { padding: 16px 12px 10px; overflow-x: auto; }
  .gantt-run, .gantt-axis { min-width: 640px; }
  .gantt-lane, .gantt-axis { grid-template-columns: 92px minmax(0, 1fr); column-gap: 10px; }
  .page-width { width: calc(100% - 36px); }
  .site-header-row { min-height: 66px; gap: 18px; }
  .site-header nav { gap: 12px; }
  .site-header nav a { font-size: 12px; }
  .report-title { font-size: 12px; }
  .reel { height: auto; min-height: 0; max-height: none; padding-top: 66px; }
  .reel-media { position: relative; inset: auto; aspect-ratio: 7 / 4; }
  .reel::after { display: none; }
  .reel-label { top: 10px; }
  .reel-footer { position: relative; padding-block: 24px 36px; }
  .reel h1 { font-size: clamp(34px, 9vw, 60px); }
  .chapter-stage { grid-template-columns: minmax(0, 1fr); }
  .frame-inset { top: 8px; left: 8px; width: 40%; }
  .frame-inset-label { font-size: 8px; letter-spacing: .04em; }
  h2, .overview h2 { font-size: 29px; }
  .chapter-tabs { column-gap: 20px; }
  .chapter + .chapter { margin-top: 64px; }
  .method-flow { grid-template-columns: minmax(0, 1fr); justify-items: start; }
  .method-inputs { padding-right: 0; border-right: 0; }
  .method-output { padding-left: 0; }
  .method-rule { width: 1px; height: 24px; margin-left: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .gantt-bar { transition: none; }
  .reel-media canvas { transition: none; }
}
