/* The dark room. One full-screen stage per method: the live model on the right, the parameters on the left,
   the six moves as a strip along the bottom. Choosing a step puts its Grasshopper canvas where the headline was
   (state "card"); Enlarge lets the canvas fill the stage and shrinks the model to a corner (state "wide").
   Palette: Red Orange for sliders and the one button, Yellow Punk for the model and everything that links
   the canvas to the panel, Snowy White text on ink. */
:root {
  --red: #F42902; --red-fill: #D92300; --red-text: #B81E00;
  --paper: #FDFDFF; --punk: #D4F94F; --punk-line: #9CC21C;
  --ink: #141416; --ink-2: #1E1F22; --ink-3: #2A2B30; --ink-4: #34363C; --dim: #A3A6AE;
  --canvas: #D4D0C8;
  /* 3D scene, read by the viewers */
  --model: #D4F94F; --model-2: #C2E63C; --cut: #F42902; --edge: #141416; --grid-major: #3A3C42; --grid-minor: #26272B;
  --display: Unbounded, ui-sans-serif, system-ui, sans-serif;
  --sans: Onest, ui-sans-serif, -apple-system, system-ui, sans-serif;
  --m: clamp(16px, 2.4vw, 36px); --rail: 340px; --strip: 104px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body.room { margin: 0; background: var(--ink); color: var(--paper); font-family: var(--sans); font-size: 18px; line-height: 1.5; font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
h1, h2, h3, p, dl, dd, ol { margin: 0; }
img { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--punk); outline-offset: 2px; }
::selection { background: var(--punk); color: var(--ink); }

/* header, over the stage */
.top { position: absolute; z-index: 30; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px var(--m); pointer-events: none; }
.top > * { pointer-events: auto; }
.mark { font: 700 18px/1 var(--display); text-decoration: none; }
.seg { display: flex; gap: 2px; padding: 4px; border-radius: 999px; background: var(--ink-2); }
.seg-btn { border: 0; background: transparent; padding: 10px 22px; border-radius: 999px; font-weight: 500; cursor: pointer; transition: background-color 160ms, color 160ms; }
.seg-btn:hover { color: var(--punk); }
.seg-btn.active { background: var(--punk); color: var(--ink); }
.top-links { display: flex; gap: 22px; font-weight: 500; }
.top-links a { text-decoration: none; }
.top-links a:hover { color: var(--punk); }

.chip { display: inline-grid; place-items: center; min-width: 38px; height: 38px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--ink-3); color: var(--paper); font-size: 16px; font-weight: 500; cursor: pointer; transition: background-color 160ms, transform 160ms var(--ease); }
.chip:hover { background: var(--ink-4); }
.chip:active { transform: scale(0.96); }
.chip.active { background: var(--punk); color: var(--ink); }
.chip.light { background: var(--paper); color: var(--ink); }

/* the stage */
.stage { position: relative; height: 100svh; min-height: 760px; overflow: hidden; background: var(--ink); }
.model-area { position: absolute; top: 0; bottom: var(--strip); right: 0; left: 44%; transition: left 420ms var(--ease); }
.stage-canvas { position: absolute; inset: 0; cursor: grab; }
.stage-canvas:active { cursor: grabbing; }
.stage-canvas canvas { display: block; width: 100%; height: 100%; }
.viewer-tools { position: absolute; top: 92px; right: var(--m); display: flex; flex-wrap: wrap; justify-content: end; gap: 6px; }
.stage-stats { position: absolute; right: var(--m); bottom: 8px; display: flex; gap: 6px; }
.stage-stats div { background: var(--ink-2); border-radius: 12px; padding: 6px 12px; }
.stage-stats dt { color: var(--dim); font-size: 14px; }
.stage-stats dd { font-weight: 600; }
.viewer-status { position: absolute; left: 16px; bottom: 14px; color: var(--dim); font-size: 15px; }
.mini-back { position: absolute; left: 10px; top: 10px; display: none; }
/* a narrow model area (the card is open on a laptop): the hint goes, the readouts get smaller */
.model-area { container-type: inline-size; }
@container (max-width: 460px) {
  .viewer-status { display: none; }
  .stage-stats { left: 12px; right: 12px; justify-content: end; }
  .stage-stats div { padding: 5px 8px; min-width: 0; }
  .stage-stats dt { font-size: 13px; }
  .stage-stats dd { font-size: 15px; }
}

/* the panel on the left */
.rail { position: absolute; z-index: 5; left: var(--m); top: 92px; bottom: var(--strip); width: var(--rail); display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 20px; background: var(--ink-2); }
.pane-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 3px; border-radius: 999px; background: var(--ink); }
.pane-tabs button { border: 0; border-radius: 999px; padding: 8px; background: transparent; color: var(--dim); font-size: 16px; font-weight: 500; cursor: pointer; }
.pane-tabs button.active { background: var(--ink-3); color: var(--paper); }
.rail-scroll { flex: 1; min-height: 0; overflow-y: auto; margin-right: -8px; padding-right: 8px; scrollbar-color: var(--ink-4) transparent; }
.volume-group h3 { color: var(--dim); font: 500 15px/1.3 var(--sans); margin: 10px 0 4px; }
.param { padding: 8px 10px 10px; margin: 0 -10px 4px; border-radius: 12px; }
.param label { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 16px; }
.pname { display: inline-flex; align-items: center; gap: 10px; }
.pnum { display: inline-flex; align-items: center; justify-content: center; flex: none; min-width: 26px; height: 26px; padding: 0 7px; border-radius: 999px; background: var(--punk); color: var(--ink); font-weight: 700; font-size: 14px; line-height: 26px; text-align: center; font-variant-numeric: tabular-nums; }
.param output { color: var(--punk); font-weight: 600; }
.param input[type=range] { width: 100%; margin: 8px 0 0; accent-color: var(--red); height: 22px; }
.ticks { display: flex; justify-content: space-between; color: var(--dim); font-size: 14px; }
.param.flash { animation: blink 1s ease-in-out 3; }
@keyframes blink { 0%, 100% { background: transparent; color: var(--paper); } 50% { background: var(--punk); color: var(--ink); } }
.param.flash output, .param.flash .ticks { color: inherit; }
.ops-note { color: var(--dim); font-size: 15px; margin: 4px 0 10px; }
.op { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; background: var(--ink); margin-bottom: 6px; cursor: pointer; font-size: 16px; }
.op:hover { background: var(--ink-3); }
.op input { accent-color: var(--red); width: 18px; height: 18px; margin: 0; }
.button-quiet { border: 0; border-radius: 12px; padding: 11px 14px; background: var(--ink-3); text-align: left; font-size: 16px; cursor: pointer; }
.button-quiet:hover { background: var(--ink-4); }

/* the headline */
.hero-text { position: absolute; z-index: 4; left: calc(var(--m) + var(--rail) + 32px); bottom: calc(var(--strip) + 40px); max-width: 520px; }
.hero-text h1 { font: 800 clamp(40px, 4.2vw, 60px)/0.98 var(--display); letter-spacing: -0.04em; text-wrap: balance; }
.hero-text p { margin-top: 16px; font-size: 20px; max-width: 40ch; }
.hero-text .fact { margin-top: 10px; color: var(--punk); font-size: 17px; font-weight: 500; }
.btn { display: inline-block; margin-top: 22px; padding: 14px 26px; border-radius: 999px; background: var(--red-fill); color: #FFFFFF; font-weight: 600; text-decoration: none; transition: background-color 160ms, transform 160ms var(--ease); }
.btn:hover { background: var(--red); }
.btn:active { transform: scale(0.97); }

/* the canvas card (state "card") */
.card { position: absolute; z-index: 6; left: calc(var(--m) + var(--rail) + 16px); bottom: var(--strip); width: min(600px, 40vw); height: min(540px, calc(100% - var(--strip) - 110px)); display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 20px; background: var(--ink-2); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card-head h2 { font: 700 22px/1.15 var(--display); letter-spacing: -0.02em; }
.card-meta { margin-top: 6px; color: var(--punk); font-size: 16px; font-weight: 500; }
.chips { display: flex; flex-wrap: wrap; justify-content: end; gap: 6px; flex: none; max-width: 60%; }
.gh-wrap { position: relative; flex: 1; min-height: 0; border-radius: 14px; overflow: hidden; background: var(--canvas); }
.gh-host { position: absolute; inset: 0; }
.card-foot { display: flex; justify-content: space-between; gap: 12px; color: var(--dim); font-size: 15px; }
.card-foot b { color: var(--paper); font-weight: 500; }
.stage[data-mode="card"] .hero-text, .stage[data-mode="wide"] .hero-text { display: none; }
.stage[data-mode="card"] .model-area { left: calc(var(--m) + var(--rail) + min(600px, 40vw) + 32px); }
.stage[data-mode="card"] .viewer-tools { top: 92px; }

/* the enlarged canvas (state "wide"): the card fills the stage beside the panel, the model shrinks to a corner */
.stage[data-mode="wide"] .card { top: 92px; right: var(--m); width: auto; height: auto; }
.stage[data-mode="wide"] .enlarge { display: none; }
.stage[data-mode="wide"] .model-area { z-index: 8; left: auto; top: auto; right: calc(var(--m) + 28px); bottom: calc(var(--strip) + 68px); width: 280px; height: 250px; border-radius: 16px; background: var(--ink); overflow: hidden; transition: none; }
.stage[data-mode="wide"] .viewer-tools, .stage[data-mode="wide"] .stage-stats, .stage[data-mode="wide"] .viewer-status { display: none; }
.stage[data-mode="wide"] .mini-back { display: inline-grid; z-index: 2; }

/* the graph */
.gh-svg { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.gh-svg:active { cursor: grabbing; }
.gh-box { fill: none; stroke: var(--red); stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.gh-box.ctx { stroke: #6A6C72; stroke-dasharray: 5 4; stroke-width: 1.5; }
.gh-box.param { fill: rgb(212 249 79 / 0.4); stroke: var(--punk-line); stroke-width: 3; cursor: pointer; }
.gh-box.param:hover, .gh-box.param:focus, .gh-box.param.on { fill: rgb(212 249 79 / 0.75); }
.gh-box.param:focus { outline: none; }
.gh-badge { cursor: pointer; }
.gh-badge circle { fill: var(--punk); stroke: var(--ink); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.gh-badge text { fill: var(--ink); font-family: var(--sans); font-weight: 700; text-anchor: middle; dominant-baseline: central; font-variant-numeric: tabular-nums; }

/* the strip of six moves */
.scrub { position: absolute; z-index: 7; left: var(--m); right: var(--m); bottom: 20px; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.step-btn { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 7px 12px 7px 7px; border: 0; border-radius: 14px; background: var(--ink-2); color: var(--dim); text-align: left; cursor: pointer; transition: background-color 160ms, color 160ms; }
.step-btn:hover { background: var(--ink-3); color: var(--paper); }
.step-btn img { width: 44px; height: 52px; object-fit: contain; flex: none; border-radius: 8px; background: var(--ink); }
.step-btn b { font-weight: 500; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step-text { min-width: 0; }
.step-btn.active { background: var(--paper); color: var(--ink); }

/* six moves */
.moves { padding: 150px var(--m) 0; }
.big { font: 800 clamp(36px, 4.2vw, 64px)/1 var(--display); letter-spacing: -0.035em; max-width: 20ch; text-wrap: balance; }
.sub { margin-top: 18px; font-size: 20px; max-width: 56ch; }
.story { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 48px; margin-top: 48px; align-items: start; }
.pin { position: sticky; top: 24px; height: calc(100svh - 48px); max-height: 860px; border-radius: 24px; background: var(--ink-2); }
.pin img { position: absolute; inset: 40px; width: calc(100% - 80px); height: calc(100% - 80px); object-fit: contain; transition: opacity 260ms; }
.pin span { position: absolute; left: 24px; bottom: 20px; color: var(--dim); font-size: 16px; }
.steps { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.move { display: grid; grid-template-columns: minmax(0, 1fr) 210px; gap: 18px; align-items: center; padding: 16px; border-radius: 18px; color: var(--dim); transition: background-color 300ms, color 300ms; }
.move.on { background: var(--paper); color: var(--ink); }
.move-text { border: 0; background: none; padding: 4px; text-align: left; cursor: pointer; color: inherit; }
.move h3 { font: 700 22px/1.15 var(--display); letter-spacing: -0.02em; color: var(--paper); }
.move.on h3 { color: var(--ink); }
.move p { margin-top: 6px; font-size: 16px; }
.move-canvas { display: block; height: 118px; padding: 0; border: 0; border-radius: 12px; overflow: hidden; background: var(--canvas); cursor: zoom-in; }
.move-canvas img { width: 100%; height: 100%; object-fit: contain; padding: 6px; transition: transform 400ms var(--ease); }
.move-canvas:hover img { transform: scale(1.06); }
.move:not(.on) .move-canvas { opacity: 0.7; }

/* the building */
.building { padding: 150px var(--m) 0; }
.photo { position: relative; margin: 48px calc(-1 * var(--m)) 0; height: min(980px, 110svh); }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.facts { position: absolute; left: var(--m); bottom: var(--m); max-width: 540px; padding: 24px 28px; border-radius: 20px; background: var(--ink); }
.facts dl { display: grid; grid-template-columns: 110px 1fr; gap: 8px 18px; font-size: 17px; }
.facts dt { color: var(--dim); }
.facts p { margin-top: 16px; color: var(--dim); font-size: 16px; }
.thumbs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.thumbs img { width: 100%; height: 420px; object-fit: cover; }
.credits { margin-top: 16px; color: var(--dim); font-size: 15px; max-width: 90ch; }
.foot { display: flex; justify-content: space-between; gap: 16px; padding: 110px var(--m) 40px; color: var(--dim); font-size: 16px; }

/* entrances */
.reveal { opacity: 0; transform: translateY(24px); }
.reveal.in { opacity: 1; transform: none; transition: opacity 700ms var(--ease), transform 700ms var(--ease); transition-delay: var(--d, 0ms); }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
  .param.flash { animation: none; background: var(--punk); color: var(--ink); }
  .model-area, .move-canvas img, .chip, .btn, .seg-btn { transition: none; }
}

/* laptops: a narrower panel */
@media (max-width: 1200px) {
  :root { --rail: 300px; }
  .hero-text { max-width: 440px; }
  .card { width: min(520px, 42vw); }
  .stage[data-mode="card"] .model-area { left: calc(var(--m) + var(--rail) + min(520px, 42vw) + 32px); }
  .step-btn img { width: 36px; height: 44px; }
}

/* tablet and phone: everything stacks, the strip scrolls sideways */
@media (max-width: 900px) {
  body.room { font-size: 17px; }
  .top { position: relative; flex-wrap: wrap; padding: 14px 16px; }
  .top-links { display: none; }
  .seg-btn { padding: 8px 16px; }
  .stage { height: auto; min-height: 0; display: flex; flex-direction: column; gap: 14px; padding: 8px 16px 24px; overflow: visible; }
  .hero-text, .model-area, .rail, .card, .scrub { position: relative; left: auto; right: auto; top: auto; bottom: auto; width: auto; }
  .hero-text { order: 0; max-width: none; }
  .hero-text h1 { font-size: 38px; }
  .model-area { order: 1; height: 380px; border-radius: 20px; background: var(--ink-2); overflow: hidden; }
  .viewer-tools { top: 12px; right: 12px; }
  .stage-stats { right: 12px; bottom: 12px; }
  .stage-stats div { padding: 4px 10px; }
  .viewer-status { display: none; }
  .scrub { order: 2; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 4px; }
  .step-btn { flex: none; scroll-snap-align: start; }
  .card { order: 3; height: 72svh; }
  .rail { order: 4; }
  .rail-scroll { overflow: visible; }
  .stage[data-mode] .model-area { left: auto; }
  .stage[data-mode="card"] .hero-text { display: none; }
  .stage[data-mode="wide"] .model-area { position: relative; right: auto; bottom: auto; width: auto; height: 260px; z-index: auto; }
  .stage[data-mode="wide"] .card { height: 84svh; }
  .chips { max-width: none; justify-content: start; }
  .card-head { flex-direction: column; }
  .card-foot { flex-direction: column; gap: 2px; }
  .moves, .building { padding-top: 90px; }
  .story { grid-template-columns: 1fr; gap: 20px; }
  .pin { position: relative; top: auto; height: 340px; }
  .move { grid-template-columns: 1fr; }
  .move-canvas { height: 150px; }
  .photo { height: 560px; }
  .facts { right: var(--m); }
  .facts dl { grid-template-columns: 90px 1fr; }
  .thumbs { grid-template-columns: 1fr; }
  .thumbs img { height: 300px; }
  .foot { flex-direction: column; }
}
