/* A6 WORKS showroom
   Layout: one full-bleed 3D stage; type is pinned to it like lettering on a hangar wall.
   Two worlds, one system: slate hangar for collectors, drafting paper for the factory floor.
   Colour comes from the liveries; the interface itself stays slate, bone and one drafting blue. */
:root {
  color-scheme: dark;
  --slate-950: #0b0e11;
  --slate-900: #11151a;
  --slate-800: #181e24;
  --slate-700: #222a32;
  --slate-600: #2f3943;
  --line: rgba(233, 238, 240, 0.13);
  --line-2: rgba(233, 238, 240, 0.28);
  --bone: #eef1ef;
  --bone-2: #b6c0c8;
  --bone-3: #84909a;
  --paper: #e8ebe8;
  --paper-2: #dce0dc;
  --ink: #14181c;
  --ink-2: #48525b;
  --ink-3: #737d86;
  --rule: #c0c7c3;
  --blue: #1746d9;
  --blueprint: #0d2767;
  --accent: #eef1ef;
  --f-sans: "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
    "HarmonyOS Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --f-cond: "Saira Extra Condensed", "Arial Narrow", "Roboto Condensed", "PingFang SC", "Microsoft YaHei UI", sans-serif;
  --f-mono: "IBM Plex Mono", "Cascadia Mono", "SF Mono", Consolas, "PingFang SC", "Microsoft YaHei UI", monospace;
  --header-h: 60px;
  --gutter-l: max(20px, env(safe-area-inset-left, 0px));
  --gutter-r: max(20px, env(safe-area-inset-right, 0px));
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;                 /* no pull-to-refresh or rubber band while dragging the wall */
  background: var(--slate-900);
  color: var(--bone);
  font: 15px/1.6 var(--f-sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
}
a, button, label, input { touch-action: manipulation; }   /* no double-tap zoom delay on controls */
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#app { position: relative; height: 100%; overflow: hidden; }
#stage { position: absolute; inset: 0; }
#gl { display: block; width: 100%; height: 100%; touch-action: none; outline: none; }
.view { position: absolute; inset: 0; }

/* ------------------------------------------------------------------ header */
#top {
  position: absolute; z-index: 20; inset: 0 0 auto 0;
  height: calc(var(--header-h) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) var(--gutter-r) 0 var(--gutter-l);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(11, 14, 17, 0.72), rgba(11, 14, 17, 0));
  transition: color 0.3s, background 0.3s;
}
#top > * { pointer-events: auto; }
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--bone); }
.brand-mark { width: 20px; height: 20px; flex: none; }
.brand-name { font: 800 23px/1 var(--f-cond); letter-spacing: 0.085em; padding-top: 1px; white-space: nowrap; }
#top nav { display: flex; gap: clamp(14px, 2.4vw, 30px); }
#top nav a {
  position: relative; padding: 8px 0; font-size: 13.5px; letter-spacing: 0.06em; text-decoration: none;
  color: var(--bone-2); white-space: nowrap; transition: color 0.2s;
}
#top nav a:hover { color: var(--bone); }
#top nav a[aria-current] { color: var(--bone); }
#top nav a[aria-current]::after { content: ""; position: absolute; left: 0; right: 0; bottom: 2px; height: 1.5px; background: currentColor; }
[data-view="lab"] #top { background: linear-gradient(to bottom, rgba(232, 235, 232, 0.96) 55%, rgba(232, 235, 232, 0)); }
[data-view="lab"] #top .brand { color: var(--ink); }
[data-view="lab"] #top nav a { color: var(--ink-2); }
[data-view="lab"] #top nav a:hover, [data-view="lab"] #top nav a[aria-current] { color: var(--ink); }

/* ------------------------------------------------------------------ shared controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  min-height: 40px; padding: 0 18px; border: 1px solid var(--bone); border-radius: 2px;
  background: var(--bone); color: var(--slate-900); font-weight: 600; font-size: 14px; letter-spacing: 0.04em;
  text-decoration: none; white-space: nowrap; transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.btn:hover { background: #fff; border-color: #fff; }
.btn.ghost { background: transparent; color: var(--bone); border-color: var(--line-2); }
.btn.ghost:hover { border-color: var(--bone); background: rgba(238, 241, 239, 0.06); }
.textlink { color: var(--bone-2); text-decoration: none; border-bottom: 1px solid var(--line-2); padding-bottom: 2px; white-space: nowrap; transition: color 0.2s, border-color 0.2s; }
.textlink::after { content: " →"; }
.textlink:hover { color: var(--bone); border-color: var(--bone); }
.eyebrow { font: 500 12px/1.4 var(--f-mono); letter-spacing: 0.16em; color: var(--bone-3); }

/* ------------------------------------------------------------------ wall */
#view-wall { pointer-events: none; overflow: hidden; --u: 300px; }
#view-wall a { pointer-events: auto; }
#wall-copy {
  position: absolute; left: 0; top: 0; width: calc(var(--u) * 1.12);
  display: grid; gap: calc(var(--u) * 0.05); will-change: transform;
  transition: opacity 0.35s;
}
#wall-copy .eyebrow { font-size: clamp(10px, calc(var(--u) * 0.031), 14px); }
#wall-copy h1 {
  font-size: clamp(27px, calc(var(--u) * 0.132), 68px); line-height: 1.14; font-weight: 700; letter-spacing: -0.012em;
}
#wall-copy .lede { font-size: clamp(12.5px, calc(var(--u) * 0.046), 19px); line-height: 1.7; color: var(--bone-2); max-width: 25em; }
#wall-copy .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px; padding-top: calc(var(--u) * 0.012); }
#wall-copy .btn { min-height: clamp(36px, calc(var(--u) * 0.115), 46px); font-size: clamp(12.5px, calc(var(--u) * 0.042), 15px); }
#wall-copy .textlink { font-size: clamp(12.5px, calc(var(--u) * 0.042), 15px); }

#bays { position: absolute; inset: 0; transition: opacity 0.35s; }
.bay {
  position: absolute; left: 0; top: 0; display: inline-flex; align-items: center; gap: 0.6em;
  padding: 0.42em 0.7em; border: 1px solid transparent; border-radius: 2px;
  font-size: clamp(10px, calc(var(--u) * 0.034), 13.5px); line-height: 1.3; white-space: nowrap; text-decoration: none;
  color: var(--bone-2); will-change: transform; transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.bay-no { font-family: var(--f-mono); font-size: 0.86em; color: var(--bone-3); }
.bay-name { font-weight: 600; letter-spacing: 0.05em; }
.bay-chips { display: inline-flex; gap: 2px; }
.bay-chips i { display: block; width: 0.62em; height: 0.62em; }
.bay.is-hot, .bay:focus-visible { color: var(--bone); border-color: var(--line-2); background: rgba(11, 14, 17, 0.66); }
.bay.is-hot .bay-no { color: var(--bone-2); }
#wall-hint {
  position: absolute; right: var(--gutter-r); bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  padding: 6px 9px; border-radius: 2px; background: rgba(11, 14, 17, 0.72);
  font: 400 11px/1 var(--f-mono); letter-spacing: 0.12em; color: var(--bone-2);
}
#view-wall.is-leaving #wall-copy, #view-wall.is-leaving #bays, #view-wall.is-leaving #wall-hint { opacity: 0; }
/* small or short screens (set by wall.js from the size of a bay on screen) */
#view-wall.is-tight .bay-chips { display: none; }
#view-wall.is-tighter .bay-no { display: none; }
#view-wall.is-tighter .bay { padding: 0.35em 0.5em; }
#view-wall.is-compact #wall-copy { gap: calc(var(--u) * 0.04); }
#view-wall.is-compact #wall-copy .lede { display: none; }
#view-wall.is-compact #wall-copy h1 { font-size: clamp(20px, calc(var(--u) * 0.132), 68px); }
#view-wall.is-compact #wall-copy .actions { gap: 8px 16px; }
#view-wall.is-compact #wall-copy .btn { min-height: 34px; padding: 0 14px; }
#view-wall.is-mini #wall-copy .eyebrow { display: none; }
#view-wall.is-mini #wall-copy .btn, #view-wall.is-mini #wall-copy .textlink { font-size: 12px; }

/* ------------------------------------------------------------------ studio */
#view-studio { pointer-events: none; --panel-w: 396px; }
#view-studio > * { pointer-events: auto; }
.st-head {
  position: absolute; left: var(--gutter-l); top: calc(var(--header-h) + env(safe-area-inset-top, 0px) + 18px);
  width: min(380px, 38vw); display: grid; justify-items: start; gap: 6px; pointer-events: none !important;
}
.st-head .back { pointer-events: auto; font: 500 12px/1 var(--f-mono); letter-spacing: 0.12em; color: var(--bone-2); text-decoration: none; padding: 8px 0; transition: color 0.2s; }
.st-head .back::before { content: "← "; }
.st-head .back:hover { color: var(--bone); }
.st-code { margin-top: 18px; font: 500 12px/1.4 var(--f-mono); letter-spacing: 0.16em; color: var(--accent); }
.st-head h1 { font-size: clamp(34px, 4.6vw, 60px); line-height: 1.1; font-weight: 700; letter-spacing: -0.01em; text-wrap: balance; }
.st-tag { font-size: 14.5px; line-height: 1.7; color: var(--bone-2); max-width: 19em; }
/* bottom-left of the stage: messages, then the pose bar */
#view-studio > .st-low {
  position: absolute; left: var(--gutter-l); bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  display: grid; justify-items: start; gap: 12px; max-width: calc(100% - var(--panel-w) - 60px); pointer-events: none;
}
.st-low > * { pointer-events: auto; }
.st-dock { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; min-width: 0; max-width: 100%; }
.dock-toggles { display: flex; gap: 6px; }
.dock-label { font: 500 11px/1 var(--f-mono); letter-spacing: 0.16em; color: var(--bone-3); margin-right: 2px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  position: relative; min-height: 32px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 2px; background: transparent;
  color: var(--bone-2); font-size: 13px; letter-spacing: 0.03em; white-space: nowrap; transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.chip:hover { color: var(--bone); border-color: var(--bone-3); }
.chip[aria-pressed="true"] { background: var(--bone); border-color: var(--bone); color: var(--slate-900); font-weight: 600; }
.chip.has-mark::after { content: ""; display: inline-block; width: 5px; height: 5px; margin-left: 7px; border-radius: 50%; background: var(--accent); vertical-align: 2px; }
.chip[aria-pressed="true"].has-mark::after { background: var(--slate-900); }
.chip.toggle::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 7px; border: 1px solid currentColor; border-radius: 50%; vertical-align: 0; }
.chip.toggle[aria-pressed="true"] { background: transparent; color: var(--bone); border-color: var(--bone-3); font-weight: 400; }
.chip.toggle[aria-pressed="true"]::before { background: var(--accent); border-color: var(--accent); }

.panel {
  position: absolute; right: var(--gutter-r); top: calc(var(--header-h) + env(safe-area-inset-top, 0px) + 6px);
  bottom: calc(16px + env(safe-area-inset-bottom, 0px)); width: var(--panel-w);
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  background: rgba(17, 21, 26, 0.84); border: 1px solid var(--line); border-radius: 3px;
  -webkit-backdrop-filter: blur(18px) saturate(1.2); backdrop-filter: blur(18px) saturate(1.2);
}
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--line); }
.tabs button {
  position: relative; height: 50px; border: 0; background: none; color: var(--bone-3); font-size: 14px; letter-spacing: 0.1em;
  transition: color 0.2s;
}
.tabs button:hover { color: var(--bone-2); }
.tabs button[aria-selected="true"] { color: var(--bone); font-weight: 600; }
.tabs button[aria-selected="true"]::after { content: ""; position: absolute; left: 18px; right: 18px; bottom: -1px; height: 2px; background: var(--accent); }
.panes { overflow-y: auto; padding: 18px 20px 24px; scrollbar-width: thin; scrollbar-color: var(--slate-600) transparent; }
.pane { display: grid; gap: 10px; min-width: 0; }
.pane h3 { display: flex; justify-content: space-between; align-items: baseline; margin-top: 12px; font: 500 11px/1.4 var(--f-mono); letter-spacing: 0.16em; color: var(--bone-3); }
.pane h3 .value { letter-spacing: 0.06em; color: var(--bone-2); }
.pane-lede { font-size: 13.5px; line-height: 1.65; color: var(--bone-2); }
.note { font-size: 12.5px; line-height: 1.6; color: var(--bone-3); }

.livery-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 4px; }
.livery {
  display: grid; gap: 2px; padding: 0 0 10px; border: 1px solid var(--line); border-radius: 2px; background: rgba(255, 255, 255, 0.025);
  text-align: left; overflow: hidden; transition: border-color 0.2s, background 0.2s;
}
.livery:hover { border-color: var(--bone-3); background: rgba(255, 255, 255, 0.05); }
.livery-swatch { display: flex; height: 44px; margin-bottom: 7px; }
.livery-swatch i { display: block; }
.livery-name { padding: 0 11px; font-size: 14px; font-weight: 600; letter-spacing: 0.04em; }
.livery-en { padding: 0 11px; font: 400 10px/1.4 var(--f-mono); letter-spacing: 0.12em; color: var(--bone-3); }
.livery.is-base { border-color: var(--bone-3); border-style: dashed; }
.livery[aria-pressed="true"] { border-color: var(--accent); border-style: solid; box-shadow: inset 0 0 0 1px var(--accent); }

.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(30px, 1fr)); gap: 7px; }
.swatch { position: relative; aspect-ratio: 1; padding: 0; border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 2px; background: var(--c); }
.swatch[aria-pressed="true"], .swatch.custom.is-on { outline: 2px solid var(--bone); outline-offset: 2px; }
.swatch.custom { display: block; overflow: hidden; cursor: pointer; background: conic-gradient(#d8261c, #f7c61b, #86e22a, #19e0f5, #1d4fc4, #ff2bd6, #d8261c); }
.swatch.custom::after { content: ""; position: absolute; inset: 28%; background: var(--c, transparent); border-radius: 50%; }
.swatch.custom input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }

.sheet { display: grid; gap: 10px; padding: 12px 12px 8px; border-radius: 2px; background: #a8b8c2; color: #15181b; }
.sheet-pack { display: grid; gap: 4px; min-width: 0; }
.sheet-title { padding-bottom: 3px; border-bottom: 1px dashed rgba(21, 24, 27, 0.4); font: 500 10px/1.4 var(--f-mono); letter-spacing: 0.18em; color: #2e3c46; }
.sheet-row { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.sticker { position: relative; height: 58px; padding: 6px 8px 13px; border: 1px dashed transparent; border-radius: 2px; background: none; }
.sticker canvas { display: block; height: 38px; width: auto; }
.sticker-no { position: absolute; left: 4px; bottom: 1px; font: 400 9px/1 var(--f-mono); color: #2e3c46; }
.sticker:hover { border-color: rgba(21, 24, 27, 0.55); }
.sticker[aria-pressed="true"] { border: 1px solid #15181b; background: rgba(255, 255, 255, 0.5); }
.sticker:focus-visible, .band:focus-visible { outline-color: #15181b; }
.bands { display: flex; flex-wrap: wrap; gap: 6px; }
.band { display: grid; place-items: center; width: 46px; height: 32px; padding: 0; border: 1px solid var(--line-2); border-radius: 2px; background: #3a444d; color: var(--bone-2); font-size: 12.5px; }
.band i { display: block; width: 100%; height: 12px; }
.band.none { width: auto; padding: 0 12px; background: transparent; }
.band[aria-pressed="true"] { outline: 2px solid var(--bone); outline-offset: 2px; }
.band:focus-visible { outline-color: var(--accent); }
.linkbtn { justify-self: start; padding: 4px 0; border: 0; background: none; color: var(--accent); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--bone-2); cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }

.panel-foot { display: grid; gap: 10px; padding: 14px 20px 16px; border-top: 1px solid var(--line); }
.summary { font-size: 13px; color: var(--bone-2); }
.foot-actions { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.btn:disabled { opacity: 0.4; cursor: default; }
.toast {
  max-width: min(440px, 100%);
  display: flex; align-items: baseline; gap: 14px; padding: 10px 14px; border: 1px solid var(--line-2); border-radius: 2px;
  background: var(--slate-800); font-size: 13px; color: var(--bone);
}
.toast .linkbtn { flex: none; }

/* Narrow windows that are not a phone on its side: the panel becomes a sheet across the bottom.
   (Phones in portrait, tablets in portrait, small desktop windows.) */
@media (max-width: 899px) and (orientation: portrait), (max-width: 899px) and (min-height: 521px) {
  #view-studio { --panel-w: 0px; --sheet-h: 48%; }
  .st-head { top: calc(var(--header-h) + env(safe-area-inset-top, 0px) + 2px); width: 62vw; gap: 2px; }
  .st-code { margin-top: 4px; font-size: 10.5px; }
  .st-head h1 { font-size: 28px; }
  .st-tag { display: none; }
  .panel { left: 0; right: 0; top: auto; bottom: 0; width: auto; height: var(--sheet-h); border-width: 1px 0 0; border-radius: 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .panes { padding: 14px max(16px, env(safe-area-inset-right, 0px)) 18px max(16px, env(safe-area-inset-left, 0px)); }
  .tabs button { height: 44px; }
  #view-studio > .st-low { left: 0; right: 0; bottom: calc(var(--sheet-h) + 8px); max-width: none; gap: 8px; justify-items: stretch; }
  .st-dock { flex-wrap: nowrap; overflow-x: auto; padding: 0 var(--gutter-r) 0 var(--gutter-l); scrollbar-width: none; }
  .st-dock .chips { flex-wrap: nowrap; }
  .st-dock .chip, .dock-toggles { flex: none; }
  .dock-label { display: none; }
  .toast { margin: 0 12px; max-width: none; }
  .panel-foot { padding: 10px max(16px, env(safe-area-inset-right, 0px)) 12px max(16px, env(safe-area-inset-left, 0px)); grid-template-columns: 1fr auto; align-items: center; }
  .livery-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* tablets in portrait: a lower sheet, more columns, the tagline is back */
@media (min-width: 600px) and (max-width: 899px) and (orientation: portrait) {
  #view-studio { --sheet-h: 42%; }
  .st-head { top: calc(var(--header-h) + env(safe-area-inset-top, 0px) + 10px); gap: 4px; }
  .st-code { font-size: 12px; }
  .st-head h1 { font-size: 40px; }
  .st-tag { display: block; }
  .livery-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .panes { padding-inline: max(24px, env(safe-area-inset-left, 0px)) max(24px, env(safe-area-inset-right, 0px)); }
  .panel-foot { padding-inline: max(24px, env(safe-area-inset-left, 0px)) max(24px, env(safe-area-inset-right, 0px)); }
}
@media (max-width: 479px) {
  .livery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #top nav { gap: 14px; }
  #top nav a { font-size: 12.5px; letter-spacing: 0.02em; }
  .brand-name { font-size: 20px; }
}
@media (max-width: 359px) {
  .brand-name { display: none; }
}
/* A phone held sideways: very little height. The panel stays a column on the right, everything else tightens. */
@media (orientation: landscape) and (max-height: 520px) {
  :root { --header-h: 46px; }
  .brand-name { font-size: 20px; }
  #top nav a { padding: 6px 0; }
  #view-studio { --panel-w: min(340px, 44vw); }
  .st-head { top: calc(var(--header-h) + env(safe-area-inset-top, 0px)); width: 40vw; gap: 0; }
  .st-head .back { padding: 6px 0; }
  .st-code { margin-top: 2px; font-size: 10.5px; }
  .st-head h1 { font-size: 26px; }
  .st-tag { display: none; }
  .panel { top: calc(var(--header-h) + env(safe-area-inset-top, 0px)); bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }
  .tabs button { height: 40px; }
  .panes { padding: 12px 14px 16px; }
  .panel-foot { grid-template-columns: 1fr auto; align-items: center; padding: 8px 14px 10px; }
  .livery-swatch { height: 34px; }
  #view-studio > .st-low { bottom: calc(8px + env(safe-area-inset-bottom, 0px)); gap: 6px; max-width: calc(100% - var(--panel-w) - var(--gutter-l) - var(--gutter-r) - 12px); }
  .st-dock { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .st-dock .chips { flex-wrap: nowrap; }
  .st-dock .chip, .dock-toggles { flex: none; }
  .dock-label { display: none; }
}

/* ------------------------------------------------------------------ industry: drafting paper */
#view-lab { background: var(--paper); color: var(--ink); color-scheme: light; --accent: var(--blue); }
.lab-scroll { height: 100%; overflow: hidden auto; --lab-h: 100vh; }
#view-lab .eyebrow { color: var(--blue); }
#view-lab .textlink { color: var(--ink-2); border-color: var(--rule); }
#view-lab .textlink:hover { color: var(--ink); border-color: var(--ink); }

.pipe { display: grid; grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr); }
.pipe-steps { grid-column: 1; grid-row: 1; padding: 0 3vw 0 max(var(--gutter-l), 5vw); }
.pipe-stage {
  grid-column: 2; grid-row: 1; position: sticky; top: 0; align-self: start; height: var(--lab-h);
  padding: calc(var(--header-h) + env(safe-area-inset-top, 0px) + 4px) var(--gutter-r) 18px 0;
}
#lab-stage { position: relative; height: 100%; overflow: hidden; border-radius: 3px; }
#lab-stage > #gl { position: absolute; inset: 0; }

.step { display: grid; align-content: center; gap: 18px; min-height: var(--lab-h); max-width: 35rem; padding-block: calc(var(--header-h) + 28px) 44px; }
.step h1 { font-size: clamp(38px, 5.1vw, 78px); line-height: 1.1; font-weight: 700; letter-spacing: -0.015em; }
.step h2 { font-size: clamp(32px, 3.9vw, 58px); line-height: 1.14; font-weight: 700; letter-spacing: -0.01em; }
.step > p { max-width: 31em; font-size: 16px; line-height: 1.85; color: var(--ink-2); }
.step > .lede { font-size: 17px; }
.step > .step-no { font: 500 13px/1.4 var(--f-mono); letter-spacing: 0.16em; color: var(--blue); }
.step > .scroll-cue { margin-top: 14px; font: 400 12px/1.4 var(--f-mono); letter-spacing: 0.12em; color: var(--ink-3); }
.scroll-cue::before { content: "↓  "; }
.facts { display: grid; grid-template-columns: repeat(4, auto); justify-content: start; gap: 18px clamp(22px, 2.6vw, 40px); margin-top: 8px; padding-top: 24px; border-top: 1px solid var(--rule); }
.facts dt { font: 700 clamp(36px, 3.7vw, 54px)/1 var(--f-cond); letter-spacing: 0.01em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.facts dt small { margin-left: 4px; font: 500 13px/1 var(--f-mono); letter-spacing: 0.04em; color: var(--ink-3); }
.facts dd { margin-top: 7px; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.specs { display: grid; margin-top: 6px; border-top: 1px solid var(--rule); }
.specs li { display: grid; grid-template-columns: minmax(7.6em, auto) minmax(0, 1fr); gap: 18px; align-items: baseline; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.specs b { font: 700 25px/1.15 var(--f-cond); letter-spacing: 0.02em; white-space: nowrap; }
.specs span { font-size: 14px; line-height: 1.6; color: var(--ink-2); }

.hud {
  position: absolute; inset: 0; z-index: 1; pointer-events: none; display: grid;
  grid-template: "status meta" auto "space space" minmax(0, 1fr) "pips pips" auto "plot plot" auto / minmax(0, 1fr) auto;
  gap: 10px; padding: 14px 16px 14px;
  color: var(--ink); font: 500 11.5px/1.4 var(--f-mono); letter-spacing: 0.08em; transition: color 0.3s;
}
.hud-status { grid-area: status; display: flex; align-items: center; gap: 8px; }
.hud-status i { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
.hud-meta { grid-area: meta; text-align: right; font-variant-numeric: tabular-nums; }
.hud-pips { grid-area: pips; display: none; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; max-width: 540px; }
.pip { position: relative; aspect-ratio: 3 / 2; border: 1px solid rgba(20, 24, 28, 0.6); border-radius: 2px; }
.pip span { position: absolute; left: 5px; top: 5px; padding: 1px 5px; background: rgba(232, 235, 232, 0.86); font-size: 10px; letter-spacing: 0.06em; }
.hud-plot { grid-area: plot; display: grid; gap: 5px; padding: 7px 9px 8px; border-radius: 2px; background: rgba(232, 235, 232, 0.8); opacity: 0; transition: opacity 0.3s, background 0.3s; }
#hud-canvas { display: block; width: 100%; height: 88px; }
#lab-stage[data-mode="1"] .hud-status i { background: #d8261c; animation: hud-blink 1.1s steps(2, jump-none) infinite; }
#lab-stage[data-mode="1"] .hud-pips { display: grid; }
#lab-stage[data-mode="1"] .hud-plot, #lab-stage[data-mode="2"] .hud-plot, #lab-stage[data-mode="3"] .hud-plot { opacity: 1; }
#lab-stage[data-mode="2"] .hud { color: #d6e6ff; }
#lab-stage[data-mode="2"] .hud-plot { background: rgba(9, 28, 78, 0.72); }
#lab-stage[data-mode="2"] .hud-status i { background: #9fc2ff; }
#lab-stage[data-mode="3"] .hud-status i { background: var(--blue); }
@keyframes hud-blink { from { opacity: 1; } to { opacity: 0.15; } }
.lab-flash { position: absolute; inset: 0; z-index: 2; pointer-events: none; opacity: 0; background: #dfe9ff; }
.lab-flash.go { animation: lab-flash 0.56s ease-out; }
@keyframes lab-flash { 0% { opacity: 0; } 34% { opacity: 0.92; } 100% { opacity: 0; } }

.strip { padding-block: clamp(64px, 9vw, 124px); }
.strip-in { max-width: 1280px; margin: 0 auto; padding-left: max(var(--gutter-l), 5vw); padding-right: max(var(--gutter-r), 5vw); }
.strip-head { display: grid; gap: 14px; max-width: 46rem; margin-bottom: clamp(30px, 4vw, 52px); }
.strip-head h2 { font-size: clamp(28px, 3.4vw, 48px); line-height: 1.2; font-weight: 700; letter-spacing: -0.01em; text-wrap: balance; }
.strip-head > p:not(.eyebrow) { font-size: 16px; line-height: 1.8; color: var(--ink-2); }
.scenes { border-top: 1px solid var(--rule); }
.scene-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px 28px; }
.scene { display: grid; align-content: start; gap: 8px; min-width: 0; }
.scene-art { aspect-ratio: 320 / 172; max-width: 100%; margin-bottom: 8px; border: 1px solid var(--rule); background: var(--paper-2); }
.scene-art svg { display: block; width: 100%; height: 100%; }
.scene-art svg * { fill: none; stroke: var(--blue); stroke-width: 1.3; }
.scene-art svg .fill { fill: var(--blue); }
.scene-art svg .paper { fill: var(--paper-2); }
.scene-art svg .dash { stroke-width: 1; stroke-dasharray: 4 4; }
.scene-art svg .bold { stroke-width: 2.6; stroke-linejoin: round; stroke-linecap: round; }
.scene-art svg .thin { stroke-width: 0.8; opacity: 0.55; }
.scene-art svg .gap { stroke: var(--paper-2); stroke-width: 3.5; }
.scene-art svg text { fill: var(--blue); stroke: none; font: 500 9px var(--f-mono); letter-spacing: 0.05em; }
.scene h3 { font-size: 19px; font-weight: 700; letter-spacing: 0.01em; }
.scene > p { font-size: 14.5px; line-height: 1.7; color: var(--ink-2); }
.scene > .scene-tag { justify-self: start; margin-top: 4px; padding: 2px 8px; border: 1px solid var(--blue); font: 500 11px/1.5 var(--f-mono); letter-spacing: 0.08em; color: var(--blue); }

.models { background: var(--paper-2); }
.table-wrap { overflow-x: auto; }
.models table { width: 100%; min-width: 760px; border-collapse: collapse; font-size: 14.5px; line-height: 1.6; }
.models thead th { padding: 0 18px 10px 0; border-bottom: 1px solid var(--ink); text-align: left; font: 500 11px/1.4 var(--f-mono); letter-spacing: 0.14em; color: var(--ink-3); }
.models tbody th, .models td { padding: 15px 18px 15px 0; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
.models tbody th { font-size: 16.5px; font-weight: 700; white-space: nowrap; }
.models td { color: var(--ink-2); }
.models small { display: block; margin-top: 2px; font: 400 11px/1.4 var(--f-mono); letter-spacing: 0.04em; color: var(--ink-3); }
.fineprint { margin-top: 14px; font-size: 12.5px; color: var(--ink-3); }

.kit {
  background-color: var(--blueprint); color: #eef2ff;
  background-image: linear-gradient(rgba(255, 255, 255, 0.055) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.055) 1px, transparent 1px);
  background-size: 32px 32px;
}
#view-lab .kit .eyebrow { color: #9fc2ff; }
.kit-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 28px; counter-reset: kit; border-top: 1px solid rgba(255, 255, 255, 0.4); }
.kit-list li { display: grid; align-content: start; gap: 6px; padding: 22px 0 28px; border-bottom: 1px solid rgba(255, 255, 255, 0.18); counter-increment: kit; }
.kit-list li::before { content: counter(kit, decimal-leading-zero); font: 500 11px/1.4 var(--f-mono); letter-spacing: 0.14em; color: #9fc2ff; }
.kit-list h3 { font-size: 21px; font-weight: 700; }
.kit-list p { font-size: 14.5px; line-height: 1.7; color: #c8d5f6; }
.lab-foot { padding-block: 34px calc(44px + env(safe-area-inset-bottom, 0px)); font-size: 13px; color: var(--ink-3); }
.lab-foot .strip-in { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 12px 28px; }

/* Narrow windows that are not a phone on its side: the 3D stage sits on top and stays there, the text scrolls under it. */
@media (max-width: 899px) and (orientation: portrait), (max-width: 899px) and (min-height: 521px) {
  .pipe { display: flex; flex-direction: column; }
  .pipe-stage { order: -1; z-index: 2; align-self: stretch; height: calc(var(--lab-h) * 0.47); padding: calc(var(--header-h) + env(safe-area-inset-top, 0px)) 0 0; background: var(--paper); }
  #lab-stage { border-radius: 0; }
  .pipe-steps { padding: 0 var(--gutter-r) 0 var(--gutter-l); }
  .step { align-content: start; min-height: calc(var(--lab-h) * 0.6); padding-block: 26px 40px; }
  .facts { grid-template-columns: repeat(2, auto); }
  .hud { gap: 6px; padding: 8px 10px; font-size: 10px; }
  .pip span { font-size: 9px; left: 3px; top: 3px; padding: 0 4px; }
  .hud-pips { max-width: 78%; gap: 6px; }
  .hud-caption { display: none; }
  #hud-canvas { height: 38px; }
}
/* tablets in portrait: room for the full read-outs and four figures in a row */
@media (min-width: 600px) and (max-width: 899px) and (orientation: portrait) {
  .pipe-steps { padding: 0 max(32px, env(safe-area-inset-right, 0px)) 0 max(32px, env(safe-area-inset-left, 0px)); }
  .step { max-width: 40rem; padding-block: 34px 48px; }
  .facts { grid-template-columns: repeat(4, auto); }
  .hud { gap: 8px; padding: 12px 14px; font-size: 11px; }
  .pip span { font-size: 10px; left: 5px; top: 5px; padding: 1px 5px; }
  .hud-pips { max-width: 70%; gap: 8px; }
  .hud-caption { display: block; }
  #hud-canvas { height: 64px; }
}
@media (max-width: 899px) {
  .scene-grid, .kit-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 599px) {
  .scene-grid, .kit-list { grid-template-columns: minmax(0, 1fr); }
  .specs li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}
/* A phone held sideways: text and stage stay side by side, with tighter type and read-outs. */
@media (orientation: landscape) and (max-height: 520px) {
  .pipe { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); }
  .pipe-steps { padding: 0 2.5vw 0 var(--gutter-l); }
  .pipe-stage { padding: calc(var(--header-h) + env(safe-area-inset-top, 0px) + 2px) var(--gutter-r) 8px 0; }
  .step { gap: 10px; padding-block: calc(var(--header-h) + 12px) 22px; }
  .step h1 { font-size: clamp(26px, 4.4vw, 40px); }
  .step h2 { font-size: clamp(24px, 4vw, 36px); }
  .step > p { font-size: 14px; line-height: 1.7; }
  .step > .lede { font-size: 14.5px; }
  .step > .scroll-cue { margin-top: 4px; }
  .facts { gap: 10px 20px; margin-top: 2px; padding-top: 12px; }
  .facts dt { font-size: 28px; }
  .facts dd { margin-top: 3px; font-size: 12px; }
  .specs li { padding: 7px 0; gap: 12px; }
  .specs b { font-size: 20px; }
  .specs span { font-size: 13px; }
  .hud { gap: 6px; padding: 8px 10px; font-size: 10px; }
  .pip span { font-size: 9px; left: 3px; top: 3px; padding: 0 4px; }
  .hud-pips { max-width: 74%; gap: 6px; }
  .hud-caption { display: none; }
  #hud-canvas { height: 34px; }
  .strip { padding-block: 40px; }
}

/* ------------------------------------------------------------------ touch screens: targets a finger can hit */
@media (pointer: coarse) {
  .chip { min-height: 40px; padding: 0 14px; font-size: 14px; }
  .tabs button { font-size: 15px; }
  .swatches { grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 8px; }
  .band { width: 54px; height: 40px; }
  .band.none { padding: 0 16px; }
  .sticker { height: 66px; padding: 8px 10px 15px; }
  .sticker canvas { height: 42px; }
  .check { min-height: 40px; font-size: 14.5px; }
  .check input { width: 20px; height: 20px; }
  .linkbtn { padding: 10px 0; }
  .btn { min-height: 44px; }
  .textlink { padding-block: 9px 3px; }
  #top nav a { padding: 12px 0; }
  .st-head .back { padding: 12px 0; }
  .bay { padding: 0.6em 0.8em; }
}
@media (pointer: coarse) and (orientation: landscape) and (max-height: 520px) {
  .chip { min-height: 36px; }
  .btn { min-height: 38px; }
  #top nav a { padding: 8px 0; }
  .st-head .back { padding: 8px 0; }
}

/* ------------------------------------------------------------------ curtain and loader */
#curtain { position: absolute; z-index: 40; inset: 0; background: var(--slate-900); opacity: 0; pointer-events: none; transition: opacity 0.26s ease; }
#curtain.is-on { opacity: 1; pointer-events: auto; transition-duration: 0.22s; }
#loader {
  position: absolute; z-index: 50; inset: 0; display: grid; place-items: end start;
  padding: 0 var(--gutter-r) max(9vh, 40px) max(var(--gutter-l), 5vw);
  background: var(--slate-900); transition: opacity 0.6s ease;
}
#loader.is-done { opacity: 0; pointer-events: none; }
.loader-box { display: grid; gap: 12px; width: min(320px, 100%); }
.loader-brand { font: 800 44px/1 var(--f-cond); letter-spacing: 0.08em; }
.loader-msg { font-size: 14px; color: var(--bone-2); }
.loader-bar { height: 2px; background: var(--line); overflow: hidden; }
.loader-bar i { display: block; height: 100%; background: var(--bone); transform: scaleX(0); transform-origin: 0 50%; transition: transform 0.25s ease-out; }
.loader-pct { font: 400 12px/1 var(--f-mono); letter-spacing: 0.1em; color: var(--bone-3); font-variant-numeric: tabular-nums; }
#loader.is-error .loader-bar, #loader.is-error .loader-pct { display: none; }
#loader.is-error .loader-msg { color: var(--bone); line-height: 1.7; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
