@font-face { font-family: 'Instrument Sans'; src: url('assets/fonts/instrument-sans.woff2') format('woff2'); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Instrument Serif'; src: url('assets/fonts/instrument-serif.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Instrument Serif'; src: url('assets/fonts/instrument-serif-italic.woff2') format('woff2'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url('assets/fonts/jetbrains-mono.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }

/* palette follows scenario.com/experiments: warm paper, forest ink, terracotta */
:root {
  --experiment-footer-bg: var(--paper);
  --experiment-footer-ink: var(--muted);
  --experiment-footer-border: var(--line);
  --bg: #f6f5ef;
  --paper: #fbfaf6;
  --card: #fdfcf8;
  --tint: #eeeadf;
  --line: #d6ddcf;
  --line-2: #c3ccbb;
  --ink: #263f35;
  --ink-2: #1c2f27;
  --muted: #6a7269;
  --accent: #be603e;
  --accent-2: #a9532f;
  --on-dark: #f6f5ef;
  --radius: 12px;
  --btn-radius: 4px;
  --pad: clamp(16px, 3.4vw, 56px);
  --gap: clamp(20px, 2.6vw, 40px);
  --maxw: 1640px;
  --serif: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  --sans: 'Instrument Sans', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --ease: cubic-bezier(0.3, 0, 0, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; min-height: 100dvh; }
button { font: inherit; color: inherit; }
a { color: inherit; }
svg { stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
em { font-style: italic; color: var(--accent); }
kbd { font-family: var(--mono); font-size: .82em; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; background: var(--paper); color: var(--ink); }
.eyebrow { font-family: var(--mono); font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.app { display: grid; grid-template-rows: auto 1fr auto; min-height: 100vh; min-height: 100dvh; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 44px; padding: 0 18px; border-radius: var(--btn-radius); font-size: 14.5px; font-weight: 500; text-decoration: none; cursor: pointer; white-space: nowrap; border: 1px solid transparent; transition: background .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease); }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-accent { background: var(--accent); color: var(--on-dark); font-weight: 600; }
.btn-accent:hover { background: var(--accent-2); }
.btn-ink { background: var(--ink); color: var(--on-dark); }
.btn-ink:hover { background: var(--ink-2); }
.btn-line { background: var(--paper); border-color: var(--ink); color: var(--ink); }
.btn-line:hover { background: var(--ink); color: var(--on-dark); }
.btn.wide { width: 100%; justify-content: space-between; }
.text-link { color: var(--ink); text-underline-offset: 4px; font-size: 14.5px; }

/* top bar */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px max(var(--pad), calc((100% - var(--maxw)) / 2 + var(--pad))); border-bottom: 1px solid var(--line); background: var(--paper); position: relative; z-index: 5; }
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-mark { width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid var(--ink); position: relative; flex: none; }
.brand-mark::after { content: ""; position: absolute; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); top: -5px; left: 50%; margin-left: -4.5px; animation: orbit 6s linear infinite; transform-origin: 4.5px 21.5px; }
@keyframes orbit { to { transform: rotate(360deg); } }
.brand h1 { white-space: nowrap; font-family: var(--serif); font-weight: 400; font-size: 27px; line-height: 1; letter-spacing: -0.01em; margin: 3px 0 0; }
.top-actions { display: flex; gap: 10px; align-items: center; }

/* layout: one grid. Desktop columns = left rail, stage, camera charts; the stage width
   drives both the stage height and the height of the chart column. */
.layout {
  --left: 280px; --right: 300px;
  --stage-w: min(calc(100vh - 236px), 820px, calc(100vw - 2 * var(--pad) - var(--left) - var(--right) - 2 * var(--gap) - 16px));
  display: grid; grid-template-columns: minmax(var(--left), 1fr) var(--stage-w) minmax(var(--right), 1fr); width: 100%; max-width: var(--maxw); margin: 0 auto; box-sizing: border-box; grid-template-rows: auto auto 1fr;
  column-gap: var(--gap); row-gap: 16px; justify-content: center; align-items: start;
  padding: 28px var(--pad) 40px;
}
.layout > * { min-width: 0; }
.stage-wrap { display: contents; }
.intro { grid-column: 1; grid-row: 1 / span 2; align-self: stretch; display: flex; flex-direction: column; }
/* desktop: the subject rail ends exactly where the stage ends; cards compress on short screens */
@media (min-width: 1241px) and (min-height: 561px) {
  .intro { contain: size; min-height: 0; }
  .intro h2 em { display: block; }
  .intro .subjects { flex: 1 1 auto; min-height: 0; grid-auto-rows: 1fr; }
}
@media (min-width: 1241px) and (min-height: 561px) and (max-height: 840px) {
  .intro .subjects { gap: 6px; }
  .intro .subject { grid-template-columns: 36px 1fr; gap: 10px; padding: 3px 10px 3px 3px; }
  .intro .subject img { width: 36px; height: 36px; }
  .intro .subject span { font-size: 12px; margin-top: 0; }
  .intro .hint-line { margin-bottom: 18px; }
}
.stage-bar { grid-column: 2 / span 2; grid-row: 1; }
.stage { grid-column: 2; grid-row: 2; }
.panel { grid-column: 3; grid-row: 2; height: var(--stage-w); }

.intro h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(40px, 3.4vw, 54px); line-height: .96; letter-spacing: -0.025em; margin: 0 0 14px; }
.hint-line { color: var(--muted); font-size: 14.5px; line-height: 1.5; margin: 0 0 26px; }
.list-label { margin-bottom: 10px; }

.subjects { display: grid; gap: 8px; }
.subject { display: grid; grid-template-columns: 48px 1fr; gap: 12px; align-items: center; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 6px 12px 6px 6px; cursor: pointer; transition: border-color .2s, background .2s, box-shadow .2s; min-width: 0; }
.subject img { width: 48px; height: 48px; border-radius: 7px; object-fit: cover; display: block; background: var(--tint); }
.subject strong { display: block; font-size: 15px; font-weight: 600; }
.subject span { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.subject[aria-selected="true"] { border-color: var(--ink); background: var(--paper); box-shadow: inset 3px 0 0 var(--accent); }
.subject:hover { border-color: var(--line-2); }
.subject[aria-selected="true"]:hover { border-color: var(--ink); }
.subject[disabled] { opacity: .45; cursor: not-allowed; }

.make-card { margin-top: 24px; background: var(--tint); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: grid; gap: 10px; }
.make-title { font-family: var(--serif); font-size: 25px; line-height: 1.05; margin: 0 0 6px; letter-spacing: -0.01em; }

/* controls row, directly above the stage */
.stage-bar { display: grid; grid-template-columns: subgrid; align-items: center; row-gap: 10px; }
.bar-left { grid-column: 1; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
/* the transport row spans exactly the camera-chart column, buttons stretched to fill it */
.stage-bar .transport { grid-column: 2; display: flex; width: 100%; }
.stage-bar .transport > * { flex: 1 1 0; min-width: 0; justify-content: center; }
.stage-bar .transport > .auto-btn, .stage-bar .transport > .reset { flex-grow: 1.8; }
.bar-right { display: inline-flex; gap: 10px; align-items: center; }
.modes { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 3px; }
.modes button { white-space: nowrap; border: 0; background: transparent; padding: 0 14px; min-height: 36px; border-radius: 5px; cursor: pointer; font-size: 13.5px; color: var(--muted); }
.modes button:hover { color: var(--ink); }
.modes button[aria-checked="true"] { background: var(--ink); color: var(--on-dark); font-weight: 600; }
.transport { display: inline-flex; gap: 6px; align-items: center; }
.compare-toggle, .reset, .auto-btn { display: inline-flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 0 14px; min-height: 42px; cursor: pointer; font-size: 13.5px; color: var(--ink); white-space: nowrap; }
.compare-toggle:hover, .reset:hover, .auto-btn:hover { border-color: var(--ink); }
.compare-toggle svg, .reset svg, .auto-btn svg { width: 15px; height: 15px; flex: none; }
.compare-toggle kbd { font-size: 11px; color: var(--muted); }
.compare-toggle[aria-pressed="true"] { background: var(--accent); color: var(--on-dark); border-color: var(--accent); font-weight: 600; }
.compare-toggle[aria-pressed="true"] kbd { color: var(--ink); }
.compare-toggle:disabled { opacity: .4; cursor: not-allowed; }
.reset.is-origin { color: var(--muted); }
.icon { width: 42px; height: 42px; display: inline-grid; place-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; color: var(--ink); }
.icon svg { width: 16px; height: 16px; }
.icon:hover { border-color: var(--ink); }
#spin .i-pause { display: none; }
#spin[aria-pressed="true"] .i-pause { display: block; }
#spin[aria-pressed="true"] .i-play { display: none; }

/* stage */
.stage { width: 100%; position: relative; aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; background: #e7e3d8; border: 1px solid var(--line); cursor: grab; touch-action: pan-y; user-select: none; -webkit-user-select: none; box-shadow: 0 24px 60px -34px rgba(38, 63, 53, .5); }
.stage.dragging { cursor: grabbing; }
.backdrop { position: absolute; inset: 0; background: radial-gradient(120% 90% at 50% 38%, #fbf8f2 0%, #ece6db 58%, #ddd5c7 100%); opacity: 0; transition: opacity .35s; }
.stage[data-mode="studio"] .backdrop, .stage[data-mode="clay"] .backdrop { opacity: 1; }
.stage[data-mode="clay"] .backdrop { background: radial-gradient(120% 90% at 50% 38%, #eeeeec 0%, #dcdcd8 60%, #c8c8c2 100%); }
.frames { position: absolute; inset: 0; }
.frames img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; pointer-events: none; -webkit-user-drag: none; }
.cmp-layer { position: absolute; inset: 0; z-index: 3; clip-path: inset(0 calc(100% - var(--split, 50%)) 0 0); background: radial-gradient(120% 90% at 50% 38%, #eeeeec 0%, #dcdcd8 60%, #c8c8c2 100%); }
.cmp-layer[hidden] { display: none; }
.cmp-handle { position: absolute; top: 0; bottom: 0; left: var(--split, 50%); width: 44px; margin-left: -22px; z-index: 5; cursor: ew-resize; touch-action: none; display: grid; place-items: center; }
.cmp-handle[hidden] { display: none; }
.cmp-handle::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px; background: var(--paper); box-shadow: 0 0 0 1px rgba(38, 63, 53, .3); }
.cmp-handle span { position: relative; width: 36px; height: 36px; border-radius: 50%; background: var(--ink); box-shadow: 0 3px 12px rgba(0, 0, 0, .3); }
.cmp-handle span::before, .cmp-handle span::after { content: ""; position: absolute; top: 50%; width: 0; height: 0; margin-top: -5px; border: 5px solid transparent; }
.cmp-handle span::before { left: 5px; border-right-color: var(--on-dark); }
.cmp-handle span::after { right: 5px; border-left-color: var(--on-dark); }
.cmp-handle:focus-visible { outline: none; }
.cmp-handle:focus-visible span { outline: 2px solid var(--accent); outline-offset: 3px; }
.cmp-tag, .badge, .loader, .drag-hint { background: rgba(251, 250, 246, .9); color: var(--ink); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: 0 1px 0 rgba(38, 63, 53, .08), 0 6px 18px -10px rgba(38, 63, 53, .5); }
.cmp-tag { position: absolute; top: 14px; z-index: 4; padding: 6px 10px; border-radius: 4px; font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; display: none; pointer-events: none; }
.cmp-tag-l { left: 14px; }
.cmp-tag-r { right: 14px; }
.stage.comparing .cmp-tag { display: block; }
.stage.comparing .badge { top: auto; bottom: 14px; }
.loader { position: absolute; inset: auto 0 18px; margin: auto; width: max-content; display: flex; gap: 10px; align-items: center; padding: 8px 14px; border-radius: 999px; font-size: 13px; z-index: 4; transition: opacity .3s; }
.loader span { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: orbit 0.8s linear infinite; }
.loader.done { opacity: 0; pointer-events: none; }
.drag-hint { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; gap: 10px; align-items: center; padding: 8px 14px; border-radius: 999px; font-size: 13px; z-index: 4; transition: opacity .5s; pointer-events: none; white-space: nowrap; }
.drag-hint svg { width: 40px; height: 14px; }
.drag-hint.gone { opacity: 0; }
.badge { position: absolute; top: 14px; left: 14px; padding: 6px 10px; border-radius: 4px; font-family: var(--mono); font-size: 11.5px; letter-spacing: .04em; font-variant-numeric: tabular-nums; z-index: 4; }

/* camera charts: two equal cards, together as tall as the stage */
.panel { display: flex; flex-direction: column; gap: 16px; }
.chart-card { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 14px; }
.chart-label { display: flex; justify-content: space-between; gap: 8px; }
.chart-label span + span { color: #9aa296; }
.chart-body { flex: 1 1 auto; min-height: 0; container-type: size; display: grid; place-items: center; padding: 6px 0; }
.chart-box { position: relative; width: min(100cqw, 100cqh); aspect-ratio: 1; }
.chart-box svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.chart-caption { margin: 0; display: grid; gap: 2px; text-align: center; }
.chart-caption strong { font-family: var(--serif); font-weight: 400; font-size: 22px; line-height: 1.1; }
.chart-caption small { color: var(--muted); font-size: 12.5px; }

.dial .ring { stroke: var(--line-2); stroke-width: 1.4; }
.dial .ring-in { stroke: var(--line); stroke-dasharray: 2 4; }
.dial .dot { fill: #c9cfc1; stroke: none; cursor: pointer; transition: fill .2s; }
.dial .dot:hover { fill: var(--ink); }
.dial .dot.on { fill: var(--accent); }
.dial[data-tier="low"] .dot:not(.quarter), .dial[data-tier="high"] .dot:not(.quarter), .dial[data-tier="top"] .dot { fill: #e3e6dc; }
.dial .top-ring { fill: none; stroke: transparent; stroke-width: 2; stroke-dasharray: 3 3; }
.dial[data-tier="top"] .top-ring { stroke: var(--accent); }
.dial .dot.origin { stroke: var(--ink); stroke-width: 1.6; }
.dial .cone { fill: rgba(190, 96, 62, .14); stroke: none; }
.dial .cone-line { stroke: var(--accent); stroke-width: 1.4; }
.dial text, .elev text { fill: var(--muted); stroke: none; font-size: 11px; font-family: var(--mono); letter-spacing: .06em; }
.dial .origin-label { fill: var(--ink); }
.elev .ground { stroke: var(--line-2); stroke-width: 1.4; }
.elev .ground-fill { fill: rgba(38, 63, 53, .05); stroke: none; }
.elev .arc { stroke: var(--line-2); stroke-width: 1.4; stroke-dasharray: 3 4; }
.elev .ray { stroke: var(--accent); stroke-width: 1.4; }

/* height chart camera points: these are the camera height controls */
.tiers { position: absolute; inset: 0; }
.cam-btn { position: absolute; transform: translate(-13px, -50%); display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 3px 9px 3px 4px; border: 1px solid transparent; border-radius: 999px; background: transparent; cursor: pointer; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.cam-dot { width: 18px; height: 18px; border-radius: 50%; background: #c9cfc1; border: 3px solid var(--card); box-shadow: 0 0 0 1px var(--line-2); flex: none; transition: background .2s; }
.cam-name { font-weight: 600; color: inherit; }
.cam-deg { font-family: var(--mono); font-size: 11px; }
.cam-btn:hover { color: var(--ink); background: var(--tint); }
.cam-btn:hover .cam-dot { background: var(--ink); }
.cam-btn[aria-checked="true"] { color: var(--ink); background: var(--paper); border-color: var(--line); box-shadow: 0 4px 14px -8px rgba(38, 63, 53, .6); }
.cam-btn.label-left { flex-direction: row-reverse; padding: 3px 4px 3px 9px; transform: translate(calc(-100% + 13px), -50%); }
.cam-btn[aria-checked="true"] .cam-dot { background: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

.foot[data-experiment-controls] { display: flex; justify-content: space-between; align-items: center; gap: 12px 24px; flex-wrap: wrap; padding: 18px max(var(--pad), calc((100% - var(--maxw)) / 2 + var(--pad))); border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; background: var(--paper); }
.credits { margin: 0; }
.foot-links { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; }
.foot-links a { color: var(--ink); text-underline-offset: 3px; }
.foot .pdf-link { color: var(--accent); font-weight: 600; }

/* making-of modal */
body.modal-open { overflow: hidden; }
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(28, 47, 39, .55); display: grid; place-items: center; padding: clamp(12px, 4vh, 48px) 16px; animation: fade .2s ease-out; }
.modal[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(.985); } }
.modal-inner { width: min(960px, 100%); max-height: 100%; overflow-y: auto; overscroll-behavior: contain; background: var(--bg); border: 1px solid var(--line); border-radius: 16px; padding: 30px clamp(18px, 4.4vw, 56px) 40px; position: relative; box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .55); animation: rise .25s ease-out; }
.modal .close { position: sticky; top: 0; float: right; z-index: 2; margin: -10px -14px 0 0; background: var(--paper); }
.modal h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(34px, 4.6vw, 54px); line-height: 1; letter-spacing: -0.025em; margin: 8px 0 16px; }
.lead { font-size: 17px; line-height: 1.6; color: var(--muted); margin: 0 0 20px; max-width: 64ch; }
.modal-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.steps { list-style: none; padding: 0; margin: 26px 0 0; counter-reset: s; }
.steps li { counter-increment: s; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: clamp(18px, 3vw, 36px); align-items: center; padding: 30px 0; border-top: 1px solid var(--line); }
.steps li:nth-child(even) .step-media { order: 2; }
.steps .step-num { font-family: var(--mono); font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); margin: 0 0 8px; }
.steps h3 { font-family: var(--serif); font-weight: 400; margin: 0 0 10px; font-size: clamp(26px, 2.6vw, 32px); line-height: 1.05; letter-spacing: -0.01em; }
.steps p { margin: 0; color: var(--muted); line-height: 1.6; font-size: 15px; }
.steps .step-tool { margin-top: 12px; font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink); }
.step-media img { width: 100%; border-radius: 10px; display: block; border: 1px solid var(--line); background: var(--tint); }
.downloads { border-top: 1px solid var(--line); padding-top: 30px; margin-top: 4px; scroll-margin-top: 20px; }
.downloads h3 { font-family: var(--serif); font-weight: 400; font-size: clamp(28px, 3vw, 38px); line-height: 1.02; margin: 8px 0 10px; letter-spacing: -0.02em; }
.downloads > p:not(.eyebrow) { color: var(--muted); margin: 0 0 18px; line-height: 1.55; }
.dl-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.dl { display: grid; gap: 6px; align-content: start; padding: 16px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; text-decoration: none; transition: border-color .2s, transform .2s var(--ease); }
.dl:hover { border-color: var(--ink); transform: translateY(-2px); }
.dl-kind { justify-self: start; font-family: var(--mono); font-size: 10px; letter-spacing: .14em; padding: 3px 7px; border-radius: 3px; background: var(--ink); color: var(--on-dark); }
.dl strong { font-size: 15.5px; }
.dl-skill { margin-bottom: 10px; background: var(--ink); border-color: var(--ink); color: var(--on-dark); }
.dl-skill .dl-kind { background: var(--accent, #b3654a); color: #fff; }
.dl-skill:hover { border-color: var(--accent, #b3654a); }
.dl.dl-skill span:last-child { color: rgba(246, 245, 239, .82); }
.dl.dl-skill strong { color: var(--on-dark); }
.dl span:last-child { font-size: 13px; color: var(--muted); line-height: 1.45; }
.making-links { display: flex; gap: 20px; align-items: center; margin-top: 30px; padding-top: 24px; border-top: 1px solid var(--line); flex-wrap: wrap; }


/* size-aware pieces: chart labels follow the chart width */
@container (max-width: 200px) {
  .dial text, .elev text { font-size: 19px; letter-spacing: 0; }
  .dial .deg { display: none; }
}
@container (max-width: 220px) {
  .cam-deg { display: none; }
  .cam-btn { font-size: 11.5px; padding-right: 6px; gap: 4px; }
  .cam-dot { width: 16px; height: 16px; }
}

/* responsive */
@media (max-width: 1240px) {
  .layout {
    --right: 260px;
    --stage-w: min(calc(100vh - 236px), 820px, calc(100vw - 2 * var(--pad) - var(--right) - var(--gap) - 16px));
    grid-template-columns: var(--stage-w) var(--right); grid-template-rows: auto auto auto;
  }
  .intro { grid-column: 1 / -1; grid-row: 1; display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; margin-bottom: 8px; }
  .intro h2, .hint-line, .list-label, .subjects { grid-column: 1; }
  .make-card { grid-column: 2; grid-row: 1 / span 4; margin-top: 0; }
  .stage-bar { grid-column: 1 / -1; grid-row: 2; }
  .stage { grid-column: 1; grid-row: 3; }
  .panel { grid-column: 2; grid-row: 3; }
  .subjects { grid-auto-flow: column; grid-auto-columns: 86px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x proximity; scrollbar-width: thin; }
  .subject { grid-template-columns: 1fr; justify-items: center; text-align: center; padding: 6px; scroll-snap-align: start; }
  .subject img { width: 72px; height: 72px; }
  .subject strong { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 74px; }
  .subject span { display: none; }
  .subject[aria-selected="true"] { box-shadow: inset 0 -3px 0 var(--accent); }
}
@media (max-width: 860px) {
  .dl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .steps li { grid-template-columns: 1fr; gap: 16px; padding: 24px 0; }
  .steps li:nth-child(even) .step-media { order: 0; }
}
@media (max-width: 760px) {
  .top { padding: 10px 16px; gap: 10px; }
  .brand { gap: 10px; }
  .brand .eyebrow { display: none; }
  .brand h1 { font-size: 23px; margin: 0; }
  .brand-mark { width: 28px; height: 28px; }
  .brand-mark::after { transform-origin: 4.5px 18.5px; }
  .top-actions { gap: 6px; }
  .top .btn { padding: 0 12px; font-size: 13.5px; min-height: 40px; }
  .pdf-top span { display: none; }
  .pdf-top { width: 40px; padding: 0; }
  .layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; padding: 14px 16px 24px; row-gap: 12px; }
  .intro, .stage-bar, .stage, .panel { grid-column: 1; grid-row: auto; }
  .intro { display: block; margin-bottom: 4px; }
  .intro h2 { font-size: 32px; margin-bottom: 6px; }
  .hint-line { font-size: 13.5px; margin-bottom: 12px; }
  .list-label, .make-card { display: none; }
  .subjects { grid-auto-columns: 74px; gap: 6px; }
  .subject img { width: 60px; height: 60px; }
  .subject strong { font-size: 11.5px; max-width: 62px; }
  .stage-bar { gap: 8px; }
  .bar-left { justify-content: center; }
  .stage-bar .transport { grid-column: 1; }
  .modes button { padding: 0 10px; font-size: 12.5px; }
  .compare-toggle kbd, .reset span { display: none; }
  .compare-toggle, .reset { padding: 0 12px; font-size: 12.5px; }
  .panel { height: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .chart-card { padding: 10px 10px 12px; }
  .chart-body { container-type: inline-size; display: block; }
  .chart-box { width: 100%; }
  .chart-label span + span, .chart-caption small { display: none; }
  .chart-caption strong { font-size: 17px; }
}
@media (max-width: 420px) {
  #making-open span { display: none; }
  #making-open { width: 40px; padding: 0; }
  .create-yours.btn { padding: 0 12px; }
  .top .create-yours svg { display: none; }
  .compare-toggle { gap: 6px; }
}
@media (max-width: 360px) {
  .brand h1 { font-size: 20px; }
  .pdf-top { display: none; }
  .modes button { padding: 0 8px; font-size: 12px; }
  .transport { gap: 4px; }
  .icon, .reset { width: 38px; height: 38px; min-height: 38px; }
  .reset { padding: 0; justify-content: center; }
}
@media (max-height: 560px) and (min-width: 700px) {
  .layout { --stage-w: min(72vh, 50vw); grid-template-columns: var(--stage-w) minmax(0, 1fr); grid-template-rows: auto auto auto; }
  .stage-bar { grid-column: 1 / -1; grid-row: 1; justify-content: flex-start; }
  .stage { grid-column: 1; grid-row: 2 / span 2; }
  .intro { grid-column: 2; grid-row: 2; display: block; }
  .hint-line, .make-card, .list-label { display: none; }
  .panel { grid-column: 2; grid-row: 3; height: auto; display: grid; grid-template-columns: 1fr 1fr; }
  .chart-body { container-type: inline-size; display: block; }
  .chart-box { width: 100%; }
  .chart-caption small { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .brand-mark::after, .loader span, .modal, .modal-inner { animation: none; }
  * { transition-duration: 0s !important; }
}
@media (max-width: 360px) {
  .top-actions { gap: 4px; }
  .top .btn { min-height: 36px; }
  .pdf-top, #making-open { width: 36px; }
  .create-yours.btn { padding: 0 9px; font-size: 13px; }
  .brand h1 { font-size: 18px; }
  .brand { gap: 8px; }
}

/* full screen: header, subject rail and footer step aside; controls, stage and charts fill the screen */
.fs-exit { display: none; }
html.is-fullscreen, html.is-fullscreen body { background: var(--paper); }
html.is-fullscreen .top, html.is-fullscreen .intro, html.is-fullscreen .foot[data-experiment-controls] { display: none; }
html.is-fullscreen .layout {
  --right: clamp(260px, 24vw, 380px);
  --stage-w: min(calc(100vh - 110px), calc(100vw - var(--right) - var(--gap) - 64px));
  max-width: none; min-height: 100vh; padding: 24px 32px; align-content: center;
  grid-template-columns: var(--stage-w) var(--right); grid-template-rows: auto auto; justify-content: center;
}
html.is-fullscreen .stage-bar { grid-column: 1 / -1; grid-row: 1; }
html.is-fullscreen .stage { grid-column: 1; grid-row: 2; }
html.is-fullscreen .panel { grid-column: 2; grid-row: 2; height: var(--stage-w); display: flex; }
#fullscreen[aria-pressed="true"] { background: var(--ink); color: var(--on-dark); }

/* auto mode button: pressed = the guided loop is running */
.auto-btn[aria-pressed="true"] { background: var(--accent); color: var(--on-dark); border-color: var(--accent); font-weight: 600; }
@media (max-width: 760px) { .auto-btn span { display: none; } .auto-btn { padding: 0; width: 42px; justify-content: center; } }
@media (max-width: 360px) { .auto-btn { width: 38px; height: 38px; min-height: 38px; } }
.auto-caption { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 6; max-width: calc(100% - 32px); padding: 8px 14px; border-radius: 999px; background: rgba(38, 63, 53, .88); color: var(--on-dark); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.auto-caption[hidden] { display: none; }
.stage:has(.auto-caption:not([hidden])) .drag-hint { opacity: 0; }
.auto-btn .i-sparkle { width: 17px; height: 17px; fill: currentColor; stroke: currentColor; stroke-width: .8; }
.back-link { display: inline-flex; align-items: center; gap: 4px; font-family: var(--mono); font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); text-decoration: none; margin-left: -3px; }
.back-link svg { width: 12px; height: 12px; stroke-width: 2; flex: none; }
.back-link:hover { color: var(--accent); }
.back-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
@media (max-width: 760px) {
  .brand > div { display: contents; }
  .back-link { order: -1; }
  .back-link span { display: none; }
  .back-link { width: 28px; height: 28px; justify-content: center; margin: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--card); color: var(--ink); }
  .back-link svg { width: 14px; height: 14px; }
}

.load-error { flex-basis: 100%; color: var(--accent); }
.load-error[hidden] { display: none; }
