/* Dark theme (preview). Applies only when <html data-theme="dark">. No toggle yet. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: oklch(17% 0.01 260);
  --surface: oklch(21% 0.012 260);
  --ink: oklch(95% 0.004 260);
  --ink-2: oklch(80% 0.015 262);
  --muted: oklch(70% 0.018 263);
  --line: oklch(100% 0 0 / .1);
  --blue: oklch(66% 0.18 258);
  --blue-deep: oklch(60% 0.19 259);

  /* 3D objects, the sticker build and the 2D hardware: a misty pale blue-grey, softer shading tinted
     blue instead of near-black, so the objects look hazy against the dark page */
  --g: oklch(74% 0.016 245);
  --ao: 34% 0.035 250;
}

/* white surfaces → raised dark cards */
:root[data-theme="dark"] :is(.pausebtn, .seg, .plan, .payg, .btn--ghost, .phone__doc) { background: var(--surface); }
:root[data-theme="dark"] .nav::before { background: oklch(17% 0.01 260 / .78); }
@media (max-width: 900px) {
  :root[data-theme="dark"] .nav.is-stuck::before { background: oklch(17% 0.01 260 / .96); }
}
/* .stk__qr stays white: a QR code needs a light background to scan */

/* fills that use --ink (now light) need dark text on them */
:root[data-theme="dark"] :is(.btn, .skip, .seg button[aria-pressed="true"], .chips input:checked + span) { color: var(--bg); }
:root[data-theme="dark"] .btn--ghost:not(:hover) { color: var(--ink); }
/* the picked plan keeps its white-on-dark text: lift it with a lighter card instead of an ink fill */
:root[data-theme="dark"] .plan--pick { background: oklch(27% 0.02 260); border-color: oklch(100% 0 0 / .18); }

/* vignettes: much softer on dark. A wider fade with a long tail, so the hero dissolves into the page
   instead of being cut out. The hero's mask must hit transparent INSIDE the .scene box (a mask hides
   everything past its box, so any alpha left at the edge shows as a hard line, e.g. under the tall rack):
   it ends at 0–92% across and 12–86% down. Vertically it must be gone above the bottom of the tallest object
   (the AV rack ends ~92% down the scene; with more fade left there its flat bottom edge showed as a line).
   The tail eases out so the end has no edge. */
:root[data-theme="dark"] .scene {
  --focus: radial-gradient(ellipse 46% 37% at 46% 49%, oklch(0% 0 0) 20%, oklch(0% 0 0 / .8) 45%, oklch(0% 0 0 / .42) 70%, oklch(0% 0 0 / .14) 86%, oklch(0% 0 0 / .03) 95%, transparent 100%);
}
:root[data-theme="dark"] .btn--small { color: var(--bg) !important; }   /* styles.css forces white with !important */

/* ---------- trade heroes: vignettes with grace ----------
   On white a light window fades into a white page by itself; on dark the same fade reads as a lit disc. So dark
   mode fades over a much longer run on a smoothstep curve (flat at both ends, so neither the start nor the end of
   the fade shows). Blown-up heroes: clear only to 26% (the sticker's edge; its corners get ~3%), then the curve runs the whole rest
   of the radius: starting further out left a flat bright middle and a visible ring where the fade began. */
:root[data-theme="dark"] .thero__art--big::after {
  background: radial-gradient(closest-side,
    transparent 26%,
    color-mix(in oklab, var(--bg) 3%, transparent) 35%,
    color-mix(in oklab, var(--bg) 12%, transparent) 44%,
    color-mix(in oklab, var(--bg) 26%, transparent) 53%,
    color-mix(in oklab, var(--bg) 43%, transparent) 62%,
    color-mix(in oklab, var(--bg) 60%, transparent) 71%,
    color-mix(in oklab, var(--bg) 76%, transparent) 80%,
    color-mix(in oklab, var(--bg) 88%, transparent) 88%,
    color-mix(in oklab, var(--bg) 96%, transparent) 95%,
    var(--bg) 100%);
}
/* Rack heroes (AV, IT): the same curve around the sticker, plus the frame's top and left edges fade in instead
   of standing as a hard grey edge on the dark page (the three masks intersect). */
:root[data-theme="dark"] .surface--rack {
  --vignette: radial-gradient(ellipse 58% 63.8% at 22.6% 16%,
    oklch(0% 0 0) 18%, oklch(0% 0 0 / .96) 30%, oklch(0% 0 0 / .84) 42%, oklch(0% 0 0 / .64) 54%,
    oklch(0% 0 0 / .4) 66%, oklch(0% 0 0 / .2) 78%, oklch(0% 0 0 / .06) 90%, transparent 100%);
  -webkit-mask-image: var(--vignette), linear-gradient(transparent, oklch(0% 0 0 / .25) 5%, oklch(0% 0 0 / .75) 11%, oklch(0% 0 0) 16%), linear-gradient(to right, transparent, oklch(0% 0 0 / .25) 4%, oklch(0% 0 0 / .75) 9%, oklch(0% 0 0) 13%);
          mask-image: var(--vignette), linear-gradient(transparent, oklch(0% 0 0 / .25) 5%, oklch(0% 0 0 / .75) 11%, oklch(0% 0 0) 16%), linear-gradient(to right, transparent, oklch(0% 0 0 / .25) 4%, oklch(0% 0 0 / .75) 9%, oklch(0% 0 0) 13%);
  -webkit-mask-composite: source-in, source-in;
          mask-composite: intersect;
  box-shadow: none;   /* the inset AO frame outlined the box */
}

/* ---------- app demos: the dashboard wireframe in dark ---------- */
:root[data-theme="dark"] :is(.demo, .dm-bar, .dm-pane, .dm-ticket, .demo--sheet .dm-work,
  .st-card, .st-doc, .st-insp, .st-btn--files, .dm-modes span:first-child, .dm-modes--b span:last-child) { background: var(--surface); }
:root[data-theme="dark"] .dm-ticket::after { background: var(--surface); }   /* pseudo-elements can't go in :is() */
:root[data-theme="dark"] .dm-wash { background: var(--bg); }
:root[data-theme="dark"] :is(.dm-top, .dm-modes, .st-rail) { background: oklch(19% 0.011 260); }
:root[data-theme="dark"] :is(.dm-work, .sh-h, .sh-box, .st-page, .st-file) { background: oklch(17.5% 0.01 260); }
:root[data-theme="dark"] .st-rail i.on { box-shadow: 0 0 0 .55cqw var(--surface), 0 0 0 calc(.55cqw + 1px) var(--line); }

/* Trade hero windows only: dim hardware in the dark, so the sticker is the bright thing and the window has little
   contrast with the page to give away its edge. The home hero and everything else keep the misty --g above.
   --ao goes darker with it so the shading still shapes the dimmer grey. Stickers use brand colours, not --g. */
:root[data-theme="dark"] .thero__art {
  --g: oklch(47% 0.014 248);
  --ao: 10% 0.02 255;
}
