/* Wdeck — site stylesheet
   Technical datasheet layout (hairline grids, narrow display type, mono labels) in the brand colours,
   with rounded corners. Brand: #040406 background, #9c5cff violet, #3b82f6 blue, logo gradient #7c3aed → #007aff. */

:root {
  --bg: #040406;
  --bg-2: #08080c;
  --surface: #0c0c12;
  --surface-2: #121219;
  --surface-3: #1a1a23;
  --text: #f5f5f7;
  --text-2: #c4c4d0;
  --muted: #8a8a9e;
  --faint: #5c5c6d;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);

  --primary: #9c5cff;
  --primary-hover: #b285ff;
  --primary-soft: rgba(156, 92, 255, 0.12);
  --primary-line: rgba(156, 92, 255, 0.4);
  --blue: #3b82f6;
  --grad: linear-gradient(135deg, #7c3aed 0%, #007aff 100%);
  --grad-text: linear-gradient(120deg, #ffffff 10%, #c084fc 50%, #60a5fa 88%);
  --ok: #22c55e;
  --danger: #ef4444;

  --r-xs: 6px;
  --r-sm: 10px;
  --r: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --pill: 999px;

  --sans: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  --header-h: 68px;
  --gutter: clamp(16px, 4vw, 48px);
  --max: 1320px;
  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);

  /* aliases kept for inline styles in the pages */
  --red: var(--primary);
  --on-ink: var(--text);
  --line-ink: var(--line);
  --paper-3: var(--surface-3);
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; color-scheme: dark; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, video, canvas, svg { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }
::selection { background: var(--primary); color: #fff; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; border-radius: var(--r-xs); }

.wrap { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Type ---------- */

.mono { font-family: var(--mono); }
.grad {
  background: var(--grad-text);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 12px; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.eyebrow b { display: inline-flex; align-items: center; gap: 10px; color: var(--primary-hover); }
.eyebrow b::after { content: ""; width: 18px; height: 1px; background: var(--line-strong); }

.display {
  font-size: clamp(44px, 7vw, 104px);
  line-height: 0.94;
  letter-spacing: -0.035em;
  font-weight: 700;
  font-variation-settings: "wdth" 86;
  margin: 0;
}
.h2 {
  font-size: clamp(32px, 4.4vw, 60px);
  line-height: 0.98;
  letter-spacing: -0.03em;
  font-weight: 700;
  font-variation-settings: "wdth" 88;
  margin: 0;
}
.h3 {
  font-size: clamp(20px, 1.6vw, 24px);
  line-height: 1.15;
  letter-spacing: -0.015em;
  font-weight: 650;
  margin: 0;
}
.lede { font-size: clamp(17px, 1.3vw, 20px); line-height: 1.5; color: var(--text-2); max-width: 46ch; margin: 0; }
.muted { color: var(--muted); }
.red { color: var(--primary-hover); }

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

code, kbd {
  font-family: var(--mono); font-size: 0.86em;
  background: var(--surface-3); padding: 0.15em 0.45em; border-radius: var(--r-xs);
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 48px; padding: 0 18px 0 20px;
  border-radius: 12px; border: 1px solid var(--line-strong);
  background: transparent; color: var(--text);
  font-size: 15px; font-weight: 600; text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background-color 200ms var(--ease), border-color 200ms var(--ease), box-shadow 200ms var(--ease), color 200ms;
}
.btn:hover { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.28); }
.btn .arrow { font-family: var(--mono); font-weight: 400; transition: transform 220ms var(--ease); }
.btn:hover .arrow { transform: translateX(3px); }
.btn--ink, .btn--red {
  border-color: transparent; color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.18) inset, 0 10px 26px -14px rgba(124, 58, 237, 0.8);
}
.btn--ink:hover, .btn--red:hover { border-color: transparent; box-shadow: 0 1px 0 rgba(255, 255, 255, 0.22) inset, 0 12px 30px -12px rgba(124, 58, 237, 0.95); }
.btn--sm { min-height: 40px; padding: 0 14px 0 16px; font-size: 14px; gap: 12px; border-radius: var(--r-sm); }
.btn[disabled] { opacity: 0.45; pointer-events: none; }

.link {
  color: var(--primary-hover); text-decoration: underline; text-decoration-thickness: 1px;
  text-underline-offset: 3px; text-decoration-color: var(--primary-line); transition: text-decoration-color 160ms;
}
.link:hover { text-decoration-color: var(--primary-hover); }

/* ---------- Header ---------- */

.site-header {
  position: sticky; top: 0; z-index: 50; height: var(--header-h);
  background: rgba(4, 4, 6, 0.74);
  -webkit-backdrop-filter: saturate(1.4) blur(16px);
  backdrop-filter: saturate(1.4) blur(16px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { height: 100%; display: flex; align-items: center; gap: 28px; }

.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark {
  width: 32px; height: 32px; flex: none; border-radius: 8px;
  background: url("../img/Wdeck logo.png?v=3") center / contain no-repeat;
  color: transparent; font-size: 0;
}
/* Wordmark: condensed, wide-tracked, with the same gradient dot as the footer signature. */
.brand-name {
  display: inline-flex; align-items: baseline; gap: 3px;
  font-size: 19px; font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase;
  font-variation-settings: "wdth" 72; color: var(--text); padding-right: 2px;
}
.brand-name::after {
  content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--grad);
  transform: translateY(-1px);
}
.brand:hover .brand-name { color: #fff; }

.site-nav { display: flex; gap: 2px; margin-left: auto; }
.site-nav a {
  padding: 10px 12px; border-radius: var(--r-sm); text-decoration: none;
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
  transition: color 180ms, background-color 180ms;
}
.site-nav a:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.site-nav a[aria-current="page"] { color: var(--text); background: rgba(255, 255, 255, 0.05); }

.nav-toggle {
  display: none; margin-left: auto; width: 44px; height: 44px; border-radius: 12px;
  border: 1px solid var(--line-strong); background: transparent; cursor: pointer; position: relative;
}
.nav-toggle span, .nav-toggle span::before, .nav-toggle span::after {
  position: absolute; left: 13px; width: 16px; height: 1.5px; border-radius: 2px; background: var(--text); content: "";
  transition: transform 200ms var(--ease), top 200ms var(--ease), background-color 200ms;
}
.nav-toggle span { top: 21px; }
.nav-toggle span::before { left: 0; top: -5px; }
.nav-toggle span::after { left: 0; top: 5px; }
.nav-open .nav-toggle span { background: transparent; }
.nav-open .nav-toggle span::before { top: 0; transform: rotate(45deg); }
.nav-open .nav-toggle span::after { top: 0; transform: rotate(-45deg); }

.site-nav .nav-cta { display: none; }

@media (max-width: 900px) {
  .nav-toggle { display: block; }
  .site-header .header-cta { display: none; }
  .site-nav {
    position: fixed; top: calc(var(--header-h) + 8px); left: 12px; right: 12px; margin: 0;
    flex-direction: column; gap: 0; padding: 8px; border-radius: var(--r-lg);
    background: var(--surface-2); border: 1px solid var(--line-strong);
    box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.8);
    transform: translateY(-6px); opacity: 0; visibility: hidden;
    transition: opacity 180ms, transform 220ms var(--ease), visibility 0s 220ms;
  }
  .nav-open .site-nav { opacity: 1; transform: none; visibility: visible; transition: opacity 180ms, transform 220ms var(--ease); }
  .site-nav a { padding: 15px 14px; font-size: 14px; border-radius: var(--r); }
  .site-nav a[aria-current="page"] { background: rgba(156, 92, 255, 0.12); color: #fff; }
  .site-nav a.nav-cta { display: flex; justify-content: center; margin-top: 8px; padding: 14px; font-family: var(--sans); font-size: 15px; letter-spacing: 0; text-transform: none; color: #fff; }
  /* dimmed page behind the open menu; tapping it closes the menu */
  .nav-scrim {
    position: fixed; inset: 0; z-index: 49; background: rgba(0, 0, 0, 0.55);
    opacity: 0; visibility: hidden; transition: opacity 200ms, visibility 0s 200ms;
  }
  .nav-open .nav-scrim { opacity: 1; visibility: visible; transition: opacity 200ms; }
  .nav-open { overflow: hidden; }
}

/* ---------- Sections ---------- */

.section { padding-block: clamp(48px, 6vw, 88px); }
.section--tight { padding-block: clamp(28px, 3.5vw, 48px); }

.section--ink,
.section--paper2 {
  margin-inline: clamp(8px, 1.4vw, 20px);
  border-radius: var(--r-xl);
  border: 1px solid var(--line);
}
.section--ink {
  background:
    radial-gradient(70% 60% at 100% 0%, rgba(124, 58, 237, 0.09), transparent 60%),
    radial-gradient(60% 50% at 0% 100%, rgba(0, 122, 255, 0.06), transparent 60%),
    var(--surface);
}
.section--paper2 { background: var(--bg-2); }

.sec-head {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px 48px; align-items: end;
  padding-top: 20px; border-top: 1px solid var(--line-strong);
  margin-bottom: clamp(28px, 3.5vw, 48px);
}
.sec-head .eyebrow { grid-column: 1 / -1; }
.sec-head .lede { justify-self: end; }
@media (max-width: 800px) {
  .sec-head { grid-template-columns: minmax(0, 1fr); }
  .sec-head .lede { justify-self: start; }
}

.page-hero { padding-block: clamp(56px, 8vw, 112px) clamp(36px, 4.5vw, 64px); position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
.page-hero::before {
  content: ""; position: absolute; inset: -30% -10% auto auto; width: 70vw; height: 70vw; max-width: 900px; max-height: 900px;
  background: radial-gradient(closest-side, rgba(124, 58, 237, 0.14), transparent 70%); pointer-events: none;
}
.page-hero .wrap { position: relative; }
.page-hero .display { margin-block: 20px 26px; max-width: 14ch; }
.page-hero-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 48px; align-items: end; }
.page-hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
@media (max-width: 900px) { .page-hero-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Hairline grid ---------- */

/* Cells share 1px dividers inside one rounded outline. */
.cells {
  display: grid; gap: 0; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden;
}
.cells > * { box-shadow: 1px 0 0 var(--line), 0 1px 0 var(--line); }
.cells--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cells--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cells--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1000px) { .cells--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cells--3 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) { .cells--2, .cells--4 { grid-template-columns: minmax(0, 1fr); } }

.cell { padding: clamp(22px, 2.4vw, 32px); display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.cell p { color: var(--muted); margin: 0; }
.num {
  font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--primary-hover);
}

.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(32px, 5vw, 80px); align-items: center; }
.split--wide-left { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
.split--wide-right { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); }
@media (max-width: 900px) { .split, .split--wide-left, .split--wide-right { grid-template-columns: minmax(0, 1fr); } }

.specs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line); }
.spec { padding: 22px 20px 20px; border-right: 1px solid var(--line); }
.spec:first-child { padding-left: 0; }
.spec:last-child { border-right: 0; }
.spec-val { display: block; font-size: clamp(26px, 2.6vw, 36px); font-weight: 650; letter-spacing: -0.03em; line-height: 1.1; font-variation-settings: "wdth" 88; }
.spec-label { display: block; margin-top: 6px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
@media (max-width: 900px) {
  .specs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .spec, .spec:first-child { border-bottom: 1px solid var(--line); padding: 18px 14px; }
  .spec:nth-child(2n) { border-right: 0; }
}

.frame { position: relative; margin: 0; }
.frame-media { position: relative; border-radius: var(--r); overflow: hidden; }
.frame-media img, .frame-media video { width: 100%; height: auto; }
.frame figcaption {
  display: flex; justify-content: space-between; gap: 16px; margin-top: 12px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}

.ticks { list-style: none; padding: 0; margin: 20px 0 0; border-top: 1px solid var(--line); }
.ticks li { display: grid; grid-template-columns: 24px 1fr; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.ticks li::before { content: "+"; font-family: var(--mono); color: var(--primary-hover); }

/* ---------- Exploded hero ---------- */

.story { position: relative; }
.story-stage {
  position: sticky; top: var(--header-h); z-index: 0; overflow: hidden; pointer-events: none;
  height: calc(100vh - var(--header-h)); height: calc(100svh - var(--header-h));
}
.story-glow {
  --gx: 70%;
  position: absolute; inset: 0;
  background:
    radial-gradient(34% 50% at var(--gx) 52%, rgba(124, 58, 237, 0.16), transparent 72%),
    radial-gradient(26% 38% at calc(var(--gx) + 5%) 64%, rgba(0, 122, 255, 0.09), transparent 72%);
}
.story-glow::after {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 64px 64px;
  background-position: center;
  -webkit-mask-image: radial-gradient(ellipse 34% 50% at var(--gx) 52%, #000 5%, transparent 72%);
  mask-image: radial-gradient(ellipse 34% 50% at var(--gx) 52%, #000 5%, transparent 72%);
}
.story-canvas { position: absolute; inset: 0; }
.story-canvas canvas { width: 100% !important; height: 100% !important; }

/* Text and model are both pinned; each chapter swaps in place after half a screen of scrolling. */
.story { height: calc(100vh - var(--header-h) + 3 * 50vh); height: calc(100svh - var(--header-h) + 3 * 50svh); }
.story-chapters { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.chapter {
  position: absolute; inset: 0 var(--gutter);
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 48px; align-items: center;
}
.chapter-body { max-width: 540px; pointer-events: auto; will-change: opacity, transform; }
.chapter[data-side="right"] .chapter-body { grid-column: 2; justify-self: end; }
.chapter .display { margin: 20px 0 24px; }
.chapter .h2 { margin: 18px 0 16px; }
.chapter-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 30px; }
.story-hint {
  display: inline-flex; align-items: center; gap: 12px; margin-top: 56px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.story-hint::before {
  content: ""; width: 18px; height: 28px; border-radius: var(--pill); border: 1.5px solid var(--line-strong);
  background: radial-gradient(circle at 50% 30%, var(--primary-hover) 2px, transparent 2.5px);
  animation: hint 1.8s var(--ease) infinite;
}
@keyframes hint { 50% { background-position: 0 6px; } }
@media (prefers-reduced-motion: reduce) { .story-hint::before { animation: none; } }

.parts-list { list-style: none; margin: 22px 0 0; padding: 0; border-top: 1px solid var(--line-strong); }
.parts-list li { display: grid; grid-template-columns: 36px 1fr; gap: 10px; align-items: baseline; padding: 11px 0; border-bottom: 1px solid var(--line); }
.parts-list b { color: var(--primary-hover); font-size: 12px; }
.parts-list span { font-size: 14px; color: var(--muted); }
.parts-list strong { font-size: 15px; font-weight: 650; color: var(--text); margin-right: 8px; }

.callouts { position: absolute; inset: 0; pointer-events: none; }
.callouts svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.callouts polyline { fill: none; stroke: rgba(255, 255, 255, 0.32); stroke-width: 1; stroke-linejoin: round; }
.callouts circle { fill: var(--primary-hover); stroke: rgba(4, 4, 6, 0.9); stroke-width: 2; }
.callouts polyline, .callouts circle { transition: opacity 320ms var(--ease); }
.callout {
  position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: 8px; white-space: nowrap;
  padding: 4px 10px 4px 4px; border-radius: var(--r-sm);
  background: rgba(4, 4, 6, 0.82); border: 1px solid var(--line-strong);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text);
  transition: opacity 240ms;
}
.callout b {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 4px; border-radius: 7px;
  background: var(--grad); color: #fff; font-size: 11px;
}
.callouts [data-hidden="1"] { opacity: 0; }

@media (max-width: 900px) {
  .story-glow { --gx: 50%; }
  .chapter { grid-template-columns: minmax(0, 1fr); align-items: end; padding-block: 24px 28px; }
  .chapter .chapter-body,
  .chapter[data-side="right"] .chapter-body {
    grid-column: 1; justify-self: stretch; max-width: none; padding: 22px;
    border-radius: var(--r-lg); background: rgba(8, 8, 12, 0.82); border: 1px solid var(--line);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  }
  .chapter .display { font-size: clamp(38px, 11vw, 58px); margin: 14px 0; }
  .chapter .lede { font-size: 15px; }
  .story-hint { margin-top: 24px; }
  .callout { padding: 3px; }
  .callout span { display: none; }
}

/* ---------- 3D viewer ---------- */

.viewer {
  position: relative; overflow: hidden; aspect-ratio: 4 / 3; max-width: 100%;
  border-radius: var(--r-lg); border: 1px solid var(--line);
  background:
    radial-gradient(60% 55% at 50% 45%, rgba(124, 58, 237, 0.12), transparent 70%),
    var(--surface);
}
.viewer::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1.3px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 20%, transparent 78%);
  mask-image: radial-gradient(circle at 50% 50%, #000 20%, transparent 78%);
}
.viewer canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; cursor: grab; touch-action: pan-y; }
.viewer canvas:active { cursor: grabbing; }
.viewer-hud {
  position: absolute; left: 16px; right: 16px; top: 14px; display: flex; justify-content: space-between; gap: 12px; pointer-events: none;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}
.viewer-hud > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-bar {
  position: absolute; left: 10px; right: 10px; bottom: 10px; display: flex; align-items: center; gap: 14px; padding: 8px 14px;
  border-radius: 12px; background: rgba(4, 4, 6, 0.62); border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2);
}
.viewer-loading { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.viewer-loading::before {
  content: ""; width: 24px; height: 24px; border-radius: 50%; margin-bottom: 44px; position: absolute;
  border: 2px solid var(--line-strong); border-top-color: var(--primary-hover); animation: spin 900ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.viewer.is-ready .viewer-loading { display: none; }

.range { -webkit-appearance: none; appearance: none; flex: 1; height: 22px; background: transparent; cursor: pointer; }
.range::-webkit-slider-runnable-track { height: 3px; border-radius: var(--pill); background: var(--line-strong); }
.range::-moz-range-track { height: 3px; border-radius: var(--pill); background: var(--line-strong); }
.range::-moz-range-progress { height: 3px; border-radius: var(--pill); background: var(--primary); }
.range::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6.5px; border-radius: 50%;
  background: #fff; border: 0; box-shadow: 0 0 0 4px rgba(156, 92, 255, 0.35); transition: box-shadow 160ms;
}
.range::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 0 0 4px rgba(156, 92, 255, 0.35); }
.range:hover::-webkit-slider-thumb { box-shadow: 0 0 0 6px rgba(156, 92, 255, 0.4); }

.chip-btn {
  border: 1px solid var(--line-strong); background: transparent; padding: 6px 10px; border-radius: var(--r-sm); cursor: pointer;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2);
  transition: background-color 160ms, color 160ms, border-color 160ms;
}
.chip-btn:hover, .chip-btn[aria-pressed="true"] { background: var(--primary-soft); border-color: var(--primary-line); color: #fff; }

/* ---------- BOM ---------- */

.bom-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: clamp(28px, 4vw, 64px); align-items: start; }
.bom-layout .viewer { position: sticky; top: calc(var(--header-h) + 24px); aspect-ratio: 1 / 1; }
@media (max-width: 960px) { .bom-layout { grid-template-columns: minmax(0, 1fr); } .bom-layout .viewer { position: relative; top: 0; aspect-ratio: 4 / 3; order: -1; } }

.bom { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line-strong); }
.bom-row {
  position: relative; display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 4px 16px;
  padding: 20px 14px; border-bottom: 1px solid var(--line); border-radius: 0;
  transition: background-color 220ms, border-radius 220ms;
}
.bom-row::after {
  content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: var(--pill);
  background: var(--grad); transform: scaleY(0); transition: transform 260ms var(--ease);
}
.bom-row:hover, .bom-row.is-hot { background: var(--surface); border-radius: var(--r); }
.bom-row:hover::after, .bom-row.is-hot::after { transform: scaleY(1); }
.bom-no { color: var(--primary-hover); font-size: 13px; padding-top: 3px; }
.bom-name { font-size: 19px; font-weight: 650; letter-spacing: -0.015em; }
.bom-spec { grid-column: 2; color: var(--muted); font-size: 15px; }
.bom-qty { grid-row: 1; grid-column: 3; justify-self: end; padding-top: 4px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.bom-link {
  grid-column: 3; grid-row: 2; align-self: end; justify-self: end;
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.05em; text-transform: uppercase; text-decoration: none; color: var(--primary-hover);
  transition: color 160ms;
}
.bom-link:hover { color: #fff; }
.bom-note {
  grid-column: 2 / -1; margin-top: 10px; font-size: 14px; color: var(--text-2);
  background: var(--primary-soft); border-radius: var(--r-sm); padding: 10px 14px;
}

/* pin table */
.table-scroll { overflow-x: auto; }
.pins { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 13px; }
.pins th {
  text-align: left; font-weight: 500; font-size: 11px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted);
  padding: 12px 12px 12px 0; border-bottom: 1px solid var(--line-strong);
}
.pins td { padding: 11px 12px 11px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.pins td.muted { font-family: var(--sans); font-size: 14px; }
.pins tbody tr:hover td { color: #fff; }
.wire { display: inline-block; width: 26px; height: 4px; border-radius: var(--pill); vertical-align: middle; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15); }
.pins .arrow { color: var(--faint); }

/* ---------- Steps ---------- */

.steps { border-top: 1px solid var(--line-strong); }
.step-row {
  display: grid; grid-template-columns: 96px minmax(0, 1fr) minmax(0, 1.1fr); gap: 16px 40px; align-items: start;
  padding: 36px 0; border-bottom: 1px solid var(--line);
}
.step-row .num { font-size: 13px; padding-top: 4px; }
.step-row .h3 { margin-bottom: 12px; }
.step-row p { color: var(--muted); }
.step-row .ticks { margin-top: 16px; }
.step-row .ticks li { padding: 9px 0; color: var(--text-2); font-size: 15px; }
@media (max-width: 900px) { .step-row { grid-template-columns: minmax(0, 1fr); } }

/* ---------- FAQ ---------- */

.faq { border-top: 1px solid var(--line-strong); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  list-style: none; cursor: pointer; display: grid; grid-template-columns: 1fr 24px; gap: 16px; align-items: center;
  padding: 22px 0; font-size: clamp(17px, 1.4vw, 20px); font-weight: 600; letter-spacing: -0.01em; transition: color 160ms;
}
.faq summary:hover { color: #fff; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; font-family: var(--mono); font-size: 20px; font-weight: 400; color: var(--primary-hover); text-align: right;
  transition: transform 240ms var(--ease);
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details > div { padding: 0 0 24px; color: var(--muted); max-width: 70ch; }

/* ---------- Link cards / downloads ---------- */

.dl { display: flex; flex-direction: column; gap: 12px; text-decoration: none; min-height: 220px; transition: background-color 220ms; }
.dl:hover { background: var(--surface); }
.dl-type { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 11px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.dl p { color: var(--muted); margin: 0; font-size: 15px; }
.dl-go {
  margin-top: auto; display: flex; justify-content: space-between; align-items: center; padding-top: 14px; border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2);
  transition: color 200ms;
}
.dl-go span:last-child { transition: transform 220ms var(--ease); }
.dl:hover .dl-go { color: var(--primary-hover); }
.dl:hover .dl-go span:last-child { transform: translateX(4px); }

/* ---------- Gallery ---------- */

.gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.gallery-item { margin: 0; cursor: zoom-in; background: none; border: 0; padding: 0; text-align: left; border-radius: var(--r); }
.gallery-item .frame-media { aspect-ratio: 4 / 3; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 600ms var(--ease); }
.gallery-item:hover img { transform: scale(1.03); }
.gallery-item > span { display: block; margin-top: 10px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.gallery-empty { grid-column: 1 / -1; margin: 0; padding: 40px; border: 1px dashed var(--line-strong); border-radius: var(--r-lg); color: var(--muted); font-family: var(--mono); font-size: 13px; }
@media (max-width: 800px) { .gallery { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .gallery { grid-template-columns: minmax(0, 1fr); } }

.lightbox {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px;
  background: rgba(4, 4, 6, 0.92); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  opacity: 0; visibility: hidden; transition: opacity 200ms, visibility 0s 200ms;
}
.lightbox.is-open { opacity: 1; visibility: visible; transition: opacity 200ms; }
.lightbox img { max-height: 86vh; width: auto; border-radius: var(--r); }
.lightbox button { position: absolute; top: 16px; right: 16px; }

/* ---------- Forms ---------- */

.field { display: grid; gap: 8px; margin-bottom: 18px; }
.field label { font-family: var(--mono); font-size: 11px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.field input, .field textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--text);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; padding: 13px 16px;
  transition: border-color 180ms, box-shadow 180ms, background-color 180ms;
}
.field textarea { resize: vertical; min-height: 150px; }
.field input:hover, .field textarea:hover { border-color: rgba(255, 255, 255, 0.24); }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); background: var(--surface-2); }
.form-status { min-height: 22px; font-family: var(--mono); font-size: 13px; margin-top: 14px; color: var(--muted); }
.form-status.ok { color: var(--ok); }
.form-status.err { color: var(--danger); }

/* ---------- Footer ---------- */

.site-footer {
  margin-top: clamp(32px, 4vw, 56px); padding-block: 64px 28px; overflow: hidden;
  background: var(--bg-2); border-top: 1px solid var(--line);
}
.footer-top { display: grid; grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)); gap: 32px; padding-bottom: 56px; }
.footer-top h4 { margin: 0 0 14px; font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.footer-top ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.footer-top a { text-decoration: none; color: var(--text-2); transition: color 160ms; }
.footer-top a:hover { color: #fff; }
.footer-top p { color: var(--muted); max-width: 38ch; }
.footer-word {
  font-size: clamp(80px, 21vw, 330px); line-height: 0.8; font-weight: 800; letter-spacing: -0.06em;
  font-variation-settings: "wdth" 78; margin: 0 0 32px -0.04em; user-select: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.015));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent;
}
.footer-word span { background: var(--grad); -webkit-background-clip: text; background-clip: text; }
.footer-bottom {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-top: 20px; border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted);
}
@media (max-width: 800px) { .footer-top { grid-template-columns: 1fr 1fr; } .footer-top > :first-child { grid-column: 1 / -1; } }

/* ---------- Toast ---------- */

.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 120; display: grid; gap: 8px; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px;
  background: var(--surface-3); border: 1px solid var(--line-strong); color: var(--text);
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.03em;
  box-shadow: 0 16px 40px -16px rgba(0, 0, 0, 0.9); animation: toast-in 260ms var(--ease);
}
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.18); }
.toast.err::before { background: var(--danger); box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.18); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Reveal ---------- */

/* Hidden start states only apply once site.js has added .motion, so content never stays hidden without JS. */
/* No blur here: a blurred layer is repainted on every scrolled frame and costs more than it adds. */
.motion .reveal {
  opacity: 0; transform: translateY(18px);
  transition: opacity 800ms var(--ease), transform 900ms var(--ease);
}
.motion .reveal.is-in { opacity: 1; transform: none; }

/* Headings uncover from below. A fully clipped element never reports as visible, so the parent is watched instead. */
.motion .reveal-heading {
  transform: translateY(0.3em); clip-path: inset(0 -5% 100% -5%);
  transition: transform 900ms var(--ease), clip-path 900ms var(--ease);
}
.motion .is-in > .reveal-heading { transform: none; clip-path: inset(-20% -5% -25% -5%); }

/* Lists and grids: the container stays put, its children arrive one after another */
.motion .reveal.stagger { opacity: 1; transform: none; }
.motion .stagger > * {
  opacity: 0; transform: translateY(16px);
  transition: opacity 700ms var(--ease), transform 800ms var(--ease), background-color 200ms, border-radius 220ms;
  transition-delay: calc(var(--i, 0) * 70ms);
}
.motion .stagger.is-in > * { opacity: 1; transform: none; }
.motion .stagger.done > * { transition: opacity 200ms, transform 240ms var(--ease), background-color 220ms, border-radius 220ms; }

/* Images settle from a slight zoom */
.motion .frame.reveal .frame-media img,
.motion .frame.reveal .frame-media video { transform: scale(1.06); transition: transform 1400ms var(--ease); }
.motion .frame.reveal.is-in .frame-media img,
.motion .frame.reveal.is-in .frame-media video { transform: none; }

/* ---------- Misc ---------- */

.tag {
  display: inline-block; padding: 3px 8px; border-radius: var(--r-xs); border: 1px solid var(--line-strong);
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}
.note { padding: 14px 16px; border-radius: var(--r); font-size: 15px; color: var(--text-2); background: var(--primary-soft); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.swatch {
  display: inline-flex; align-items: center; gap: 9px; padding: 5px 12px 5px 5px; border-radius: 12px;
  border: 1px solid var(--line-strong); background: transparent; cursor: pointer;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-2);
  transition: border-color 180ms, background-color 180ms, color 180ms;
}
.swatch i { width: 22px; height: 22px; border-radius: 8px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18); }
.swatch:hover { border-color: rgba(255, 255, 255, 0.3); color: #fff; }
.swatch[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); color: #fff; }

.stack-sm > * + * { margin-top: 12px; }
.mt-lg { margin-top: clamp(36px, 4.5vw, 64px); }

/* ---------- Motion ---------- */

/* Page-to-page crossfade; the header stays in place */
@view-transition { navigation: auto; }
.site-header { view-transition-name: site-header; transition: background-color 300ms, box-shadow 300ms; }
::view-transition-old(root) { animation: vt-out 220ms var(--ease) both; }
::view-transition-new(root) { animation: vt-in 420ms var(--ease) both; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-8px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(12px); } }

.site-header.is-scrolled { background: rgba(4, 4, 6, 0.88); box-shadow: 0 12px 32px -20px rgba(0, 0, 0, 0.9); }

/* Navigation: a short gradient underline slides to the hovered link and back to the current page */
@media (min-width: 901px) {
  .site-nav { position: relative; }
  .site-nav a { position: relative; z-index: 1; }
}
.nav-pill {
  position: absolute; bottom: 2px; left: 0; width: 0; height: 2px; border-radius: var(--pill); pointer-events: none;
  background: var(--grad);
  transition: transform 380ms var(--ease), width 380ms var(--ease), opacity 200ms;
}
.site-nav.has-pill a:hover,
.site-nav.has-pill a[aria-current="page"] { background: transparent; }

/* Soft light that follows the cursor across cards */
.spot { position: relative; isolation: isolate; }
.spot::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 50%), rgba(156, 92, 255, 0.1), transparent 62%);
  opacity: 0; transition: opacity 300ms;
}
.spot:hover::before { opacity: 1; }

/* Gradient buttons flow on hover */
.btn--ink, .btn--red,
.btn--ink:hover, .btn--red:hover {
  background: linear-gradient(135deg, #7c3aed 0%, #007aff 50%, #7c3aed 100%) 0% 50% / 200% 100%;
  transition: background-position 600ms var(--ease), box-shadow 200ms var(--ease);
}
.btn--ink:hover, .btn--red:hover { background-position: 100% 50%; }
.btn:active { transform: translateY(1px); }

.spec-val { font-variant-numeric: tabular-nums; }

/* Hero: intro and model fade-in */
.motion .story .chapter:first-child .chapter-body > * { animation: intro 900ms var(--ease) both; }
.motion .story .chapter:first-child .chapter-body > :nth-child(2) { animation-delay: 80ms; }
.motion .story .chapter:first-child .chapter-body > :nth-child(3) { animation-delay: 160ms; }
.motion .story .chapter:first-child .chapter-body > :nth-child(4) { animation-delay: 240ms; }
.motion .story .chapter:first-child .chapter-body > :nth-child(5) { animation-delay: 420ms; }
@keyframes intro { from { opacity: 0; transform: translateY(18px); } }

.story-canvas { opacity: 0; transform: scale(0.97); transition: opacity 1000ms var(--ease), transform 1200ms var(--ease); }
.story.is-ready .story-canvas { opacity: 1; transform: none; }
.viewer canvas { opacity: 0; transition: opacity 800ms var(--ease); }
.viewer.is-ready canvas { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .motion .reveal, .motion .stagger > *, .motion .frame.reveal .frame-media img, .motion .frame.reveal .frame-media video {
    opacity: 1 !important; transform: none !important; filter: none !important; clip-path: none !important; transition: none !important;
  }
  .motion .story .chapter:first-child .chapter-body > *, .story-glow { animation: none; }
  .story-canvas, .viewer canvas { opacity: 1; transform: none; transition: none; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

/* Small index numbers use the sans face with even-width figures (the mono dotted zero reads like an 8). */
.eyebrow b, .num, .callout b, .bom-no, .parts-list b {
  font-family: var(--sans); font-variant-numeric: tabular-nums; font-weight: 700;
}

/* ---------- Feature blocks (subpages) ---------- */

.features { border-top: 1px solid var(--line-strong); }
.feature {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: clamp(28px, 4vw, 72px);
  align-items: center; padding-block: clamp(32px, 4.5vw, 64px); border-bottom: 1px solid var(--line);
}
.feature--flip .feature-media { order: -1; }
.feature-text .num { display: block; margin-bottom: 14px; }
.feature-text .h3 { margin-bottom: 12px; font-size: clamp(22px, 2vw, 28px); }
.feature-text > p { color: var(--muted); max-width: 52ch; }
.feature-media .viewer { aspect-ratio: 4 / 3; }
@media (max-width: 900px) {
  .feature { grid-template-columns: minmax(0, 1fr); }
  .feature--flip .feature-media { order: 0; }
}

/* key/value specification list */
.kv { list-style: none; margin: 20px 0 0; padding: 0; border-top: 1px solid var(--line); }
.kv li { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.kv b { font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
@media (max-width: 560px) { .kv li { grid-template-columns: minmax(0, 1fr); gap: 2px; } }

/* Action chips (app page) */
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 0; padding: 0; list-style: none; }
.cell .tag-list + p { margin-top: 12px; }

/* ---------- Chapter snapping (home) ---------- */

/* Invisible markers, one per chapter; scroll-margin puts the snap position under the header. */
.story-snap { position: absolute; inset: 0; pointer-events: none; }
.story-snap i { position: absolute; left: 0; right: 0; height: 1px; scroll-snap-align: start; scroll-margin-top: var(--header-h); }
.story-snap i:nth-child(1) { top: 0; }
.story-snap i:nth-child(2) { top: 50vh; top: 50svh; }
.story-snap i:nth-child(3) { top: 100vh; top: 100svh; }
.story-snap i:nth-child(4) { top: 150vh; top: 150svh; }

/* Turned on by the hero script only while the story is on screen. */
/* Touch keeps native snapping; with a mouse wheel the hero script steps chapter by chapter instead. */
@media (pointer: coarse) {
  html.snap { scroll-snap-type: y proximity; }
}
@media (prefers-reduced-motion: reduce) { html.snap { scroll-snap-type: none; } }

/* Bill of materials: heading and list share the left column; the model sits beside them. */
.sec-head--stack { grid-template-columns: minmax(0, 1fr); border-top: 0; padding-top: 0; margin-bottom: 28px; }
.sec-head--stack .lede { justify-self: start; }
.bom-layout .viewer { aspect-ratio: 4 / 5; max-height: calc(100vh - var(--header-h) - 48px); }
@media (max-width: 960px) { .bom-layout .viewer { aspect-ratio: 4 / 3; max-height: none; } }

/* 3D viewers sit straight on the page: no panel, border or dot grid behind the model. */
.viewer { background: transparent; border: 0; border-radius: 0; overflow: visible; }
.viewer::before { content: none; }

/* ---------- Hardware: BOM stage + part grid ---------- */

.bom-stage { margin: 0 0 clamp(20px, 2.5vw, 32px); }
.bom-stage .viewer { aspect-ratio: 16 / 7; max-height: 560px; width: 100%; }
.bom-caption {
  display: flex; justify-content: space-between; gap: 16px; padding-top: 14px; border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.bom-caption [data-hud] { color: var(--text); }

.parts { list-style: none; margin: 0; padding: 0; }
.part {
  position: relative; display: flex; flex-direction: column; gap: 10px; min-width: 0;
  padding: clamp(22px, 2.2vw, 30px); outline: none; transition: background-color 220ms;
}
.part::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--grad);
  transform: scaleX(0); transform-origin: left; transition: transform 320ms var(--ease);
}
.part:hover, .part:focus-visible, .part.is-hot { background: var(--surface); }
.part:hover::before, .part:focus-visible::before, .part.is-hot::before { transform: scaleX(1); }
.part-top { display: flex; justify-content: space-between; align-items: baseline; }
.part-qty {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
  padding: 3px 9px; border: 1px solid var(--line); border-radius: var(--pill);
}
.part-name { margin: 6px 0 0; font-size: 19px; font-weight: 650; letter-spacing: -0.015em; }
.part-spec { margin: 0; color: var(--muted); font-size: 15px; }
.part-note { margin: 0; font-size: 13px; color: var(--muted); }
.part-note::before { content: "Note — "; color: var(--primary-hover); }
.part-link {
  margin-top: auto; padding-top: 8px; font-family: var(--mono); font-size: 12px; letter-spacing: 0.05em;
  text-transform: uppercase; text-decoration: none; color: var(--primary-hover); transition: color 160ms;
}
a.part-link:hover { color: #fff; }
.part-link--none { opacity: 0.5; color: var(--muted); }
@media (max-width: 1000px) { .parts.cells--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .parts.cells--3 { grid-template-columns: minmax(0, 1fr); }
  .bom-stage .viewer { aspect-ratio: 4 / 3; }
}

/* ---------- Hardware: module pair ---------- */

.modules { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(32px, 5vw, 80px); }
.module .viewer { aspect-ratio: 16 / 10; width: 100%; }
.module-text { padding-top: 20px; border-top: 1px solid var(--line-strong); }
.module-text .num { display: block; margin-bottom: 12px; }
.module-text .h3 { margin: 0 0 10px; font-size: clamp(22px, 2vw, 28px); }
.module-text > p { margin: 0; color: var(--muted); max-width: 52ch; }
@media (max-width: 860px) { .modules { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Hardware: interactive wiring diagram ---------- */

.wiring { margin: 0 0 clamp(28px, 3.5vw, 48px); }
.wiring-svg { display: block; width: 100%; height: auto; overflow: hidden; }
.wiring-scroll { overflow-x: auto; scrollbar-width: thin; }
@media (max-width: 700px) { .wiring-scroll .wiring-svg { width: 720px; max-width: none; } }
.wiring-svg image, .wiring-dim { pointer-events: none; }
.wiring-dim { fill: var(--bg); opacity: 0; transition: opacity 260ms var(--ease); }
.wiring.is-active .wiring-dim { opacity: 0.74; }

.wire { outline: none; cursor: pointer; }
.wire-line path, .wire-hit path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.wire-line path { stroke: var(--c); stroke-width: 6; }
.wire-line, .wire-dots { opacity: 0; transition: opacity 220ms var(--ease); }
.wire-dots circle { fill: var(--c); stroke: #fff; stroke-width: 2; }
.wire-hit path { stroke: transparent; stroke-width: 14; pointer-events: stroke; }
.wire.is-on .wire-line, .wire.is-on .wire-dots { opacity: 1; }
.wire.is-on .wire-line { filter: drop-shadow(0 0 6px var(--c)); }

.wiring-caption {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  padding-top: 14px; border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}
.wiring-read { display: inline-flex; align-items: center; gap: 10px; min-height: 20px; }
.wiring-read b { font-weight: 600; color: var(--text); }
.wiring-read i {
  display: none; width: 26px; height: 4px; border-radius: var(--pill); background: var(--c, transparent);
}
.wiring.is-active .wiring-read i { display: inline-block; }
.wiring-read [data-wiring-arrow] { color: var(--muted); }

.wiring-foot { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: clamp(28px, 4vw, 64px); align-items: start; }
.wiring-aside { position: sticky; top: calc(var(--header-h) + 24px); }
.wiring-aside p { margin: 0 0 22px; max-width: 40ch; }
.wiring-actions { display: flex; gap: 12px; flex-wrap: wrap; }
@media (max-width: 900px) { .wiring-foot { grid-template-columns: minmax(0, 1fr); } .wiring-aside { position: static; } }

.wire-swatch { display: inline-block; width: 26px; height: 4px; border-radius: var(--pill); vertical-align: middle; }
.pins tbody tr { cursor: pointer; transition: opacity 200ms; }
.pins tbody tr.is-on td { color: #fff; }
.pins.is-active tbody tr:not(.is-on) { opacity: 0.4; }
.wire-tag { fill: var(--c); }
.wire-dots text { font-family: var(--mono); font-size: 20px; font-weight: 600; fill: var(--ink, #fff); }

/* Wiring: diagram and pin table side by side */
.wiring-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: clamp(28px, 3.5vw, 56px); align-items: center; }
.wiring-side { position: sticky; top: calc(var(--header-h) + 24px); }
.wiring-layout .wiring { margin: 0 0 24px; }
.wiring-layout .wiring-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.pins--compact td { padding: 10px 10px 10px 0; }
.pins--compact td:first-child { width: 38px; }
.pins--compact td.muted { font-size: 13px; }
.pins--compact .wire-swatch { width: 22px; }
@media (max-width: 1100px) {
  .wiring-layout { grid-template-columns: minmax(0, 1fr); }
  .wiring-side { position: static; }
}

/* ---------- Small animated icons (printer, soldering) ---------- */
.anim-icon { display: block; height: 84px; width: auto; flex: none; }
.cell-top, .gstep-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; }
.icon-lead { display: flex; align-items: center; gap: 16px; margin: 0 0 20px; color: var(--muted); font-size: 15px; }
.icon-lead .anim-icon { height: 72px; }
@media (max-width: 640px) { .anim-icon { height: 64px; } .icon-lead .anim-icon { height: 56px; } }
span.anim-icon > svg { display: block; width: 100%; height: 100%; }

/* BOM: part cards on the left, the exploded model on the right */
.bom-split { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: clamp(28px, 4vw, 64px); align-items: start; }
.bom-split .bom-stage { position: sticky; top: calc(var(--header-h) + 24px); margin: 0; order: 2; }
.bom-split .bom-stage .viewer { aspect-ratio: 1 / 1; max-height: calc(100vh - var(--header-h) - 110px); }
.bom-split .parts { order: 1; }
@media (max-width: 960px) {
  .bom-split { grid-template-columns: minmax(0, 1fr); }
  .bom-split .bom-stage { position: relative; top: 0; order: 0; }
  .bom-split .bom-stage .viewer { aspect-ratio: 4 / 3; max-height: none; }
}
@media (min-width: 641px) and (max-width: 1000px) { .bom-split .parts.cells--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.viewer--sync { aspect-ratio: 5 / 4; }
.viewer--sync canvas { cursor: default; touch-action: auto; }

/* BOM as a list: animated icon, text, quantity + link */
.bom-split .bom { order: 1; }
.bom .bom-row { grid-template-columns: 76px minmax(0, 1fr) auto; gap: 0 20px; align-items: center; padding: 16px 14px; }
.bom-icon { width: 76px; height: 76px; display: block; }
span.bom-icon > svg { width: 100%; height: 100%; display: block; }
.bom-body { min-width: 0; }
.bom .bom-name { display: flex; align-items: baseline; gap: 12px; margin: 0 0 4px; font-size: 18px; }
.bom .bom-no { padding: 0; font-size: 12px; }
.bom .bom-spec { margin: 0; grid-column: auto; font-size: 14.5px; }
.bom .bom-note { margin: 8px 0 0; grid-column: auto; font-size: 13px; padding: 7px 11px; }
.bom-side { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; align-self: stretch; justify-content: center; }
.bom .bom-qty, .bom .bom-link { grid-row: auto; grid-column: auto; padding: 0; align-self: auto; justify-self: auto; }
.bom .bom-qty { padding: 3px 9px; border: 1px solid var(--line); border-radius: var(--pill); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.bom-link--none { color: var(--faint); white-space: nowrap; }
@media (max-width: 560px) {
  .bom .bom-row { grid-template-columns: 56px minmax(0, 1fr); gap: 4px 14px; }
  .bom-icon { width: 56px; height: 56px; }
  .bom-side { grid-column: 2; flex-direction: row; justify-content: flex-start; align-items: center; }
}

/* Home "Print it, wire it, flash it": three cards, icon badge top-left, large picture, text below */
.step-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(16px, 2vw, 24px); }
.step-card { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.step-card-media {
  position: relative; aspect-ratio: 16 / 10; border-radius: var(--r-lg); overflow: hidden;
  display: grid; place-items: center; background: #07070a;
}
.step-card-media > img:first-child { width: 100%; height: 100%; object-fit: contain; display: block; transition: transform 600ms var(--ease); }
.step-card:hover .step-card-media > img:first-child { transform: scale(1.03); }
/* The animated icon sits in a dark badge that overlaps the picture's lower edge, cut out from it. */
.step-card-head { display: flex; align-items: flex-end; gap: 14px; margin: -44px 0 4px 16px; position: relative; z-index: 1; }
.step-card-badge {
  display: grid; place-items: center; width: 88px; height: 88px; flex: none; border-radius: 22px;
  background: linear-gradient(160deg, #1a1a24, #0e0e14);
  box-shadow: 0 0 0 6px var(--bg), 0 12px 28px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.section--paper2 .step-card-badge { box-shadow: 0 0 0 6px var(--bg-2), 0 12px 28px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.06); }
.step-card-icon { height: 66px; width: auto; max-width: 72px; display: block; }
span.step-card-icon { display: inline-block; }
span.step-card-icon > svg { width: 100%; height: 100%; display: block; }
.step-card-head .num { padding-bottom: 8px; }
.step-card .h3 { margin: 0; }
.step-card p { margin: 0; color: var(--muted); }
@media (max-width: 1000px) { .step-cards { grid-template-columns: minmax(0, 1fr); } .step-card-media { aspect-ratio: 16 / 9; } }

/* Step cards: preview pop-up on the icon badge */
button.step-card-badge { border: 0; padding: 0; cursor: pointer; font: inherit; color: inherit; transition: transform 220ms var(--ease); }
button.step-card-badge:hover, button.step-card-badge:focus-visible, .step-card-head.is-open button.step-card-badge { transform: translateY(-3px); }
button.step-card-badge:focus-visible { outline: 2px solid var(--primary); outline-offset: 8px; }
.step-card-head { position: relative; }
.step-pop {
  position: absolute; left: -4px; bottom: calc(100% + 14px); z-index: 5; width: min(320px, calc(100vw - 48px));
  padding: 16px; border-radius: var(--r-lg);
  background: rgba(14, 14, 20, 0.92); border: 1px solid var(--line-strong);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(156, 92, 255, 0.08);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  opacity: 0; visibility: hidden; transform: translateY(8px) scale(0.98); transform-origin: 40px 100%;
  transition: opacity 200ms var(--ease), transform 260ms var(--ease), visibility 0s linear 260ms;
  pointer-events: none;
}
.step-pop::after {
  content: ""; position: absolute; left: 38px; top: 100%; width: 14px; height: 14px; margin-top: -7px;
  background: inherit; border-right: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong);
  transform: rotate(45deg); backdrop-filter: none;
}
@media (hover: hover) {
  .step-card-head:hover .step-pop { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; pointer-events: auto; }
}
.step-card-head:focus-within .step-pop, .step-card-head.is-open .step-pop { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; pointer-events: auto; }
.step-pop-title { margin: 0 0 12px; font-weight: 650; font-size: 15px; color: var(--text); }
.step-pop-items { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.step-pop-items li {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px 8px;
  border-radius: var(--r); background: rgba(255, 255, 255, 0.03);
}
.step-pop-items img, .step-pop-items span.anim-tint { width: 56px; height: 56px; display: block; }
.step-pop-items li > span:last-child { font-size: 11.5px; color: var(--muted); text-align: center; line-height: 1.3; }
.step-pop-items li > span:first-child:not(:last-child) { width: 56px; height: 56px; display: block; }
.step-pop-items li > span:first-child > svg { width: 100%; height: 100%; display: block; }
.step-pop-facts { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; }
.step-pop-facts span {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--text-2);
  padding: 3px 8px; border: 1px solid var(--line); border-radius: var(--pill);
}
.step-pop-link { display: inline-block; margin-top: 12px; font-family: var(--mono); font-size: 12px; letter-spacing: .05em; text-transform: uppercase; color: var(--primary-hover); text-decoration: none; }
.step-pop-link:hover { color: #fff; }
@media (prefers-reduced-motion: reduce) { .step-pop { transition: none; } }
/* Invisible bridge so the pointer can travel from the badge into the pop-up. */
.step-pop::before { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 20px; }
section[id] { scroll-margin-top: calc(var(--header-h) + 8px); }

/* Main menu preview panel */
.site-header { overflow: visible; }
.nav-panel {
  position: fixed; top: calc(var(--header-h) - 4px); left: 0; z-index: 60; width: 300px;
  padding: 8px;
  border-radius: var(--r-lg); background: rgba(12, 12, 18, 0.94); border: 1px solid var(--line-strong);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(156, 92, 255, 0.08);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity 180ms var(--ease), transform 240ms var(--ease), visibility 0s linear 240ms, left 240ms var(--ease);
}
.nav-panel.is-open { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
/* arrow towards the hovered link, plus a bridge so the pointer can cross the gap */
.nav-panel::before {
  content: ""; position: absolute; top: -7px; left: var(--arrow, 50%); width: 12px; height: 12px; margin-left: -6px;
  background: rgba(12, 12, 18, 0.94); border-left: 1px solid var(--line-strong); border-top: 1px solid var(--line-strong);
  transform: rotate(45deg);
}
.nav-panel::after { content: ""; position: absolute; left: 0; right: 0; top: -18px; height: 18px; }
.nav-panel-items { display: grid; gap: 2px; align-content: start; }
.nav-panel-item {
  display: grid; grid-template-columns: 44px minmax(0, 1fr); align-items: center; gap: 12px;
  padding: 7px 10px 7px 6px; border-radius: var(--r); text-decoration: none; color: var(--text);
  transition: background-color 160ms;
}
.nav-panel-item:hover, .nav-panel-item:focus-visible { background: rgba(255, 255, 255, 0.05); }
.nav-panel-item > img, .nav-panel-item > span:first-child:not(:last-child) { width: 44px; height: 44px; object-fit: contain; display: block; }
.nav-panel-item > span:first-child:not(:last-child) > svg { width: 100%; height: 100%; display: block; }
.nav-panel-item b { display: block; font-size: 14px; font-weight: 600; }
.nav-panel-item small { display: block; font-size: 12px; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .nav-panel { transition: none; } }

/* ---------- Phones: bottom tab bar ---------- */
.tabbar { display: none; }
@media (max-width: 900px) {
  :root { --tabbar-h: calc(64px + env(safe-area-inset-bottom, 0px)); }
  /* The tab bar replaces the drop-down menu; the header keeps the logo and Download. */
  .nav-toggle, .site-nav, .nav-scrim { display: none !important; }
  .site-header .header-cta { display: inline-flex; margin-left: auto; }
  .site-header .wrap { gap: 12px; }
  body { padding-bottom: var(--tabbar-h); }
  .tabbar {
    position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); z-index: 55;
    display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; padding: 6px;
    border-radius: 22px; background: rgba(14, 14, 20, 0.86);
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
    -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4);
  }
  .tabbar a {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-height: 48px; border-radius: 16px; text-decoration: none; color: var(--muted);
    font-size: 10.5px; font-weight: 600; letter-spacing: 0.01em;
    -webkit-tap-highlight-color: transparent; transition: color 160ms, background-color 160ms, transform 120ms;
  }
  .tabbar a:active { transform: scale(0.94); }
  .tabbar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .tabbar a[aria-current="page"] { color: #fff; background: rgba(156, 92, 255, 0.16); }
  .tabbar a[aria-current="page"] svg { stroke: #c9a7ff; }
  .tabbar a:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
  /* Anything pinned to the bottom of the screen sits above the tab bar. */
  .story .chapter { padding-bottom: calc(var(--tabbar-h) + 22px); }
  .guide-controls { bottom: calc(var(--tabbar-h) + 18px); }
  .toasts { bottom: calc(var(--tabbar-h) + 18px) !important; }
}
