/* =========================================================================
   Hoopilot site — design system.

   Language: Google-product (Material 3 flavoured) for the marketing surface.
   Structured, generous, restrained colour, one accent. Dual theme with a real
   toggle; light is the default because Google product pages are light-first.

   The DEVICE DEMO deliberately breaks out of this and uses the app's OWN dark
   palette (coal / court / leather / swish), because it is a real preview of
   the product, not a marketing illustration. Those tokens are copied verbatim
   from src/constants/tokens.ts.
   ========================================================================= */

:root {
  color-scheme: light;

  /* Neutrals: cool grey with a whisper of blue, Google-ish, never pure white */
  --bg: #ffffff;
  --bg-sunken: #f6f8fc;
  --surface: #ffffff;
  --surface-raised: #f1f4f9;
  --line: #dadce0;
  --line-soft: #e8eaed;

  --text: #1f1f1f;
  --text-dim: #444746;
  --text-faint: #5f6368;

  /* ONE accent, locked for the whole page: basketball leather.
     It is the product's own accent, so the site and the app agree. */
  --accent: #d84315;
  --accent-strong: #b3360f;
  --accent-tint: rgba(216, 67, 21, 0.10);
  --accent-edge: rgba(216, 67, 21, 0.32);
  --on-accent: #ffffff;

  /* Semantic status. Separate from the accent, per the app's own scheme. */
  --make: #0b8a63;
  --make-tint: rgba(11, 138, 99, 0.12);
  --miss: #c5372c;
  --miss-tint: rgba(197, 55, 44, 0.12);
  --unsure: #9a6b00;
  --unsure-tint: rgba(154, 107, 0, 0.12);
  --info: #1a63c9;
  --info-tint: rgba(26, 99, 201, 0.12);

  --shadow-1: 0 1px 2px rgba(60, 64, 67, 0.10), 0 1px 3px 1px rgba(60, 64, 67, 0.06);
  --shadow-2: 0 1px 3px rgba(60, 64, 67, 0.12), 0 4px 8px 3px rgba(60, 64, 67, 0.08);

  /* ONE radius system: soft. Interactive pills are full. */
  --r-sm: 8px;
  --r-md: 16px;
  --r-lg: 28px;
  --r-pill: 999px;

  --ease: cubic-bezier(0.2, 0, 0, 1);      /* M3 emphasized */
  --ease-out: cubic-bezier(0.05, 0.7, 0.1, 1);
  --dur-fast: 140ms;
  --dur: 260ms;
  --dur-slow: 520ms;

  --maxw: 1180px;
  --gutter: clamp(20px, 5vw, 48px);

  /* App palette, verbatim from the product. Used ONLY inside the demo. */
  --app-coal: #121010;
  --app-court: #1c1917;
  --app-raised: #262220;
  --app-line: #37312e;
  --app-leather: #f05a24;
  --app-swish: #2fd6a3;
  --app-brick: #e8574f;
  --app-yellow: #e8b84f;
  --app-blue: #4f8de8;
  --app-chalk: #f5f1ec;
  --app-chalk-dim: #b3aca5;
  --app-chalk-faint: #918a83;
}

:root[data-theme='dark'] {
  color-scheme: dark;

  --bg: #131314;
  --bg-sunken: #0e0e0f;
  --surface: #1b1b1c;
  --surface-raised: #232325;
  --line: #3c4043;
  --line-soft: #2c2c2e;

  --text: #e3e3e3;
  --text-dim: #c7c7c7;
  --text-faint: #9aa0a6;

  --accent: #ff8a5c;
  --accent-strong: #ff6a30;
  --accent-tint: rgba(255, 138, 92, 0.14);
  --accent-edge: rgba(255, 138, 92, 0.38);
  --on-accent: #3d1200;

  --make: #4fd6a8;
  --make-tint: rgba(79, 214, 168, 0.14);
  --miss: #ff8a80;
  --miss-tint: rgba(255, 138, 128, 0.14);
  --unsure: #ffd066;
  --unsure-tint: rgba(255, 208, 102, 0.14);
  --info: #8ab4f8;
  --info-tint: rgba(138, 180, 248, 0.14);

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.5), 0 1px 3px 1px rgba(0, 0, 0, 0.3);
  --shadow-2: 0 1px 3px rgba(0, 0, 0, 0.6), 0 6px 12px 4px rgba(0, 0, 0, 0.36);
}

/* Follow the OS until the visitor chooses. The toggle then stamps data-theme,
   which wins in both directions. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #131314; --bg-sunken: #0e0e0f; --surface: #1b1b1c; --surface-raised: #232325;
    --line: #3c4043; --line-soft: #2c2c2e;
    --text: #e3e3e3; --text-dim: #c7c7c7; --text-faint: #9aa0a6;
    --accent: #ff8a5c; --accent-strong: #ff6a30;
    --accent-tint: rgba(255, 138, 92, 0.14); --accent-edge: rgba(255, 138, 92, 0.38);
    --on-accent: #3d1200;
    --make: #4fd6a8; --make-tint: rgba(79, 214, 168, 0.14);
    --miss: #ff8a80; --miss-tint: rgba(255, 138, 128, 0.14);
    --unsure: #ffd066; --unsure-tint: rgba(255, 208, 102, 0.14);
    --info: #8ab4f8; --info-tint: rgba(138, 180, 248, 0.14);
    --shadow-1: 0 1px 2px rgba(0,0,0,.5), 0 1px 3px 1px rgba(0,0,0,.3);
    --shadow-2: 0 1px 3px rgba(0,0,0,.6), 0 6px 12px 4px rgba(0,0,0,.36);
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  /* System stack tuned to read like Google Sans / Roboto without shipping a
     webfont: no <link>, no FOUT, no layout shift. */
  font-family: 'Google Sans Text', 'Google Sans', Roboto, -apple-system,
    BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial,
    'PingFang TC', 'Noto Sans TC', 'Microsoft JhengHei', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

img { max-width: 100%; display: block; }

::selection { background: var(--accent-tint); color: var(--text); }

:where(a, button, input, [tabindex]):focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

/* ---------------------------------------------------------------- layout */

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }

section { padding-block: clamp(64px, 10vw, 128px); }
.section-sunken { background: var(--bg-sunken); }

.eyebrow {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 14px;
}

h1, h2, h3 { margin: 0; font-weight: 500; letter-spacing: -0.02em; line-height: 1.12; }
h1 { font-size: clamp(38px, 6vw, 62px); }
h2 { font-size: clamp(29px, 4vw, 44px); line-height: 1.15; }
h3 { font-size: clamp(19px, 2vw, 22px); line-height: 1.3; letter-spacing: -0.01em; }

p { margin: 0; }
.lede { font-size: clamp(17px, 1.7vw, 20px); color: var(--text-dim); max-width: 62ch; line-height: 1.55; }
.body-dim { color: var(--text-dim); max-width: 66ch; }
.small { font-size: 14px; color: var(--text-faint); }

.stack { display: grid; gap: 20px; }
.stack-lg { display: grid; gap: 40px; }

/* ---------------------------------------------------------------- nav */

.nav {
  position: sticky; top: 0; z-index: 50;
  height: 68px;
  display: flex; align-items: center;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.nav.is-stuck { border-bottom-color: var(--line-soft); }
.nav .wrap { display: flex; align-items: center; gap: 16px; width: 100%; }

.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 500; font-size: 17px; letter-spacing: -0.01em; }
.brand-mark { width: 26px; height: 26px; flex: none; }

.nav-links { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.nav-link {
  display: inline-flex; align-items: center; height: 40px; padding: 0 14px;
  border-radius: var(--r-pill); text-decoration: none;
  color: var(--text-dim); font-size: 14.5px; font-weight: 500;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.nav-link:hover { background: var(--surface-raised); color: var(--text); }
@media (max-width: 720px) { .nav-link.optional { display: none; } }

/* ---------------------------------------------------------------- buttons */

.btn {
  --btn-bg: var(--accent);
  --btn-fg: var(--on-accent);
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  height: 48px; padding: 0 26px;
  border: 0; border-radius: var(--r-pill);
  background: var(--btn-bg); color: var(--btn-fg);
  font: inherit; font-size: 15px; font-weight: 500; white-space: nowrap;
  text-decoration: none; cursor: pointer;
  box-shadow: var(--shadow-1);
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease),
    background-color var(--dur-fast) var(--ease);
}
.btn:hover { box-shadow: var(--shadow-2); background: var(--accent-strong); }
.btn:active { transform: scale(0.98); box-shadow: var(--shadow-1); }

.btn-tonal { --btn-bg: var(--surface-raised); --btn-fg: var(--text); box-shadow: none; }
.btn-tonal:hover { background: var(--line-soft); box-shadow: none; }

.btn-text {
  --btn-bg: transparent; --btn-fg: var(--accent);
  box-shadow: none; padding: 0 18px;
}
.btn-text:hover { background: var(--accent-tint); box-shadow: none; }

/* Icon-only control, e.g. the theme switch. */
.icon-btn {
  width: 42px; height: 42px; flex: none;
  display: inline-grid; place-items: center;
  border: 1px solid var(--line); border-radius: var(--r-pill);
  background: transparent; color: var(--text-dim); cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.icon-btn:hover { background: var(--surface-raised); color: var(--text); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn svg { width: 20px; height: 20px; }
/* One glyph per theme; the other is hidden, so the control reads as a state. */
.icon-btn .i-dark { display: none; }
:root[data-theme='dark'] .icon-btn .i-dark { display: block; }
:root[data-theme='dark'] .icon-btn .i-light { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .icon-btn .i-dark { display: block; }
  :root:not([data-theme='light']) .icon-btn .i-light { display: none; }
}

/* ---------------------------------------------------------------- hero */

.hero { padding-top: clamp(40px, 7vw, 84px); padding-bottom: clamp(48px, 7vw, 96px); }
.hero-grid {
  display: grid; gap: clamp(36px, 5vw, 64px);
  grid-template-columns: 1fr;
  align-items: center;
}
@media (min-width: 940px) {
  /* Asymmetric split: the message leads, the live device answers it. */
  .hero-grid { grid-template-columns: 1.05fr 0.95fr; }
}
.hero h1 { max-width: 15ch; }
.hero .lede { margin-top: 20px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }

/* ---------------------------------------------------------------- device */

.device {
  position: relative;
  width: min(340px, 100%);
  margin-inline: auto;
  aspect-ratio: 9 / 19.5;
  border-radius: 44px;
  padding: 11px;
  background: linear-gradient(160deg, #3a3634, #171513 46%, #2b2725);
  box-shadow: 0 32px 70px rgba(0, 0, 0, 0.34), 0 3px 10px rgba(0, 0, 0, 0.28);
}
.device-screen {
  position: relative; height: 100%; width: 100%;
  border-radius: 34px; overflow: hidden;
  background: var(--app-coal);
  color: var(--app-chalk);
  display: flex; flex-direction: column;
}
.device-notch {
  position: absolute; top: 9px; left: 50%; transform: translateX(-50%);
  width: 86px; height: 22px; border-radius: var(--r-pill);
  background: #000; z-index: 6;
}

/* ---------------------------------------------------------------- cards */

.grid { display: grid; gap: 20px; }
.card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  padding: 26px;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
    border-color var(--dur) var(--ease);
}
.card-hover:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); border-color: var(--line); }
.card h3 { margin-bottom: 10px; }
.card p { color: var(--text-dim); font-size: 15px; }

.card-accent { border-color: var(--accent-edge); background: var(--accent-tint); }

/* Figure with a real frame from the system */
.shot {
  border-radius: var(--r-md); overflow: hidden;
  border: 1px solid var(--line-soft); background: var(--surface-raised);
}
.shot img { width: 100%; height: auto; }
.shot figcaption { padding: 14px 18px; font-size: 13.5px; color: var(--text-faint); border-top: 1px solid var(--line-soft); }

/* ---------------------------------------------------------------- metrics */

.metrics { display: grid; gap: 2px; background: var(--line-soft); border: 1px solid var(--line-soft); border-radius: var(--r-md); overflow: hidden; }
@media (min-width: 640px) { .metrics { grid-template-columns: repeat(3, 1fr); } }
.metric { background: var(--surface); padding: 26px; }
.metric .n {
  font-size: clamp(30px, 4vw, 40px); font-weight: 500; letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums; line-height: 1.05;
}
.metric .k { margin-top: 6px; font-size: 14px; color: var(--text-faint); }

/* ---------------------------------------------------------------- footer */

.footer { border-top: 1px solid var(--line-soft); padding-block: 48px; color: var(--text-faint); font-size: 14px; }
.footer .wrap { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; }
.footer a { color: var(--text-dim); text-decoration: none; }
.footer a:hover { color: var(--text); text-decoration: underline; }

/* ---------------------------------------------------------------- motion */

/* Scroll reveal. Motion is opt-in per element and collapses entirely under
   reduced motion, which is the accessibility contract for everything here. */
.js .reveal { opacity: 0; transform: translateY(18px); }
.reveal.in {
  opacity: 1; transform: none;
  transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
  transition-delay: var(--d, 0ms);
}
@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; }
  .reveal.in { transition: none; }
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; }
}
/* =========================================================================
   Hoopilot site — components. Tokens and base live in app.css; this file
   only composes them. Split in two so the token layer stays readable.
   ========================================================================= */

/* ---------------------------------------------------------------- a11y */

.skip {
  position: absolute; left: -9999px; top: 8px; z-index: 100;
  background: var(--accent); color: var(--on-accent);
  padding: 10px 18px; border-radius: var(--r-pill); font-weight: 500;
}
.skip:focus { left: 12px; }

/* Cross-document view transitions: navigating to system.html and back
   cross-fades instead of blinking. Chrome-only today; everywhere else simply
   navigates, which is the correct fallback. */
@view-transition { navigation: auto; }

code {
  font-family: ui-monospace, 'SF Mono', SFMono-Regular, 'Cascadia Mono', Menlo, Consolas, monospace;
  font-size: 0.88em;
  background: var(--surface-raised);
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  padding: 1px 5px;
  color: var(--text);
  word-break: break-word;
}

.tag { display: inline-block; padding: 1px 9px; border-radius: var(--r-pill); font-size: 0.9em; font-weight: 500; }
.tag-unsure { background: var(--unsure-tint); color: var(--unsure); }

/* --------------------------------------------------------- grid columns */

.cols-2 { grid-template-columns: 1fr; }
.cols-3 { grid-template-columns: 1fr; }
@media (min-width: 700px) { .cols-2 { grid-template-columns: 1fr 1fr; } }
@media (min-width: 860px) { .cols-3 { grid-template-columns: repeat(3, 1fr); } }

.card-ic { width: 52px; height: 42px; margin-bottom: 16px; color: var(--accent); }
.card-ic svg { width: 100%; height: 100%; display: block; overflow: visible; }

.strip { margin: 16px 0 0; border-radius: var(--r-sm); overflow: hidden; border: 1px solid var(--line-soft); }
.strip img { width: 100%; }
.strip figcaption { padding: 9px 12px; font-size: 12.5px; color: var(--text-faint); background: var(--surface-raised); }

/* -------------------------------------------------------------- pipeline */

.pipe { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
@media (min-width: 900px) { .pipe { grid-template-columns: repeat(5, 1fr); gap: 12px; } }

.pipe-step {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  padding: 22px 20px;
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
}
.pipe-step.lit { transform: translateY(-4px); border-color: var(--accent-edge); box-shadow: var(--shadow-2); }
.pipe-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
/* The numbers are the flow order of a frame through the pipeline, not
   decoration: stage 03 cannot run before 02. */
.pipe-n { font-size: 13px; font-weight: 500; letter-spacing: 0.08em; color: var(--accent); font-variant-numeric: tabular-nums; }
.pipe-step p { font-size: 14.5px; color: var(--text-dim); }
.pipe-mod { margin-top: 12px; font-size: 12px; color: var(--text-faint); }
.pipe-mod code { background: transparent; border: 0; padding: 0; color: var(--text-faint); font-size: 12px; }

@media (min-width: 900px) {
  .pipe-step::after {
    content: ''; position: absolute; top: 50%; right: -13px; width: 14px; height: 2px;
    background: var(--line); transform: translateY(-50%);
    transition: background-color var(--dur) var(--ease);
  }
  .pipe-step:last-child::after { display: none; }
  .pipe-step.lit::after { background: var(--accent); }
}

/* ----------------------------------------------------------- truth table */

.truth {
  display: grid; gap: 0;
  border: 1px solid var(--line-soft); border-radius: var(--r-lg); overflow: hidden;
  background: var(--surface);
}
@media (min-width: 900px) { .truth { grid-template-columns: 1.15fr 1fr; } }

.truth-controls { padding: clamp(22px, 3vw, 34px); display: grid; gap: 22px; align-content: start; }
.tri { border: 0; margin: 0; padding: 0; }
.tri legend { padding: 0; font-size: 14px; font-weight: 500; color: var(--text); display: block; margin-bottom: 9px; }
.tri legend span { display: block; font-weight: 400; font-size: 13px; color: var(--text-faint); margin-top: 2px; }

.seg { display: inline-flex; flex-wrap: wrap; background: var(--surface-raised); border-radius: var(--r-pill); padding: 3px; gap: 2px; }
.seg button {
  border: 0; background: transparent; color: var(--text-dim);
  font: inherit; font-size: 13.5px; font-weight: 500;
  padding: 7px 15px; border-radius: var(--r-pill); cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }

.truth-out {
  padding: clamp(22px, 3vw, 34px);
  background: var(--bg-sunken);
  border-left: 1px solid var(--line-soft);
  display: flex; flex-direction: column; gap: 16px;
}
@media (max-width: 899px) { .truth-out { border-left: 0; border-top: 1px solid var(--line-soft); } }

.truth-badge { display: inline-block; padding: 10px 26px; border-radius: var(--r-pill); font-size: clamp(22px, 3vw, 28px); font-weight: 500; letter-spacing: -0.01em; }
[data-outcome='make'] .truth-badge { background: var(--make-tint); color: var(--make); }
[data-outcome='miss'] .truth-badge { background: var(--miss-tint); color: var(--miss); }
[data-outcome='unsure'] .truth-badge { background: var(--unsure-tint); color: var(--unsure); }
.truth-verdict.pop .truth-badge { animation: pop var(--dur-slow) var(--ease); }
@keyframes pop { from { transform: scale(0.92); opacity: 0.4; } to { transform: scale(1); opacity: 1; } }

.truth-why { font-size: 15px; color: var(--text-dim); line-height: 1.6; }
.truth-code {
  margin: 0; padding: 14px 16px; overflow-x: auto;
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-sm);
  font-family: ui-monospace, 'SF Mono', SFMono-Regular, 'Cascadia Mono', Menlo, Consolas, monospace;
  font-size: 12.5px; line-height: 1.7; color: var(--text); white-space: pre;
}

/* ------------------------------------------------------------- cta band */

.cta-band { padding-block: clamp(48px, 7vw, 88px); }
.cta-card {
  display: grid; gap: 26px; align-items: center;
  padding: clamp(28px, 4vw, 52px);
  border-radius: var(--r-lg);
  background: var(--surface-raised);
  border: 1px solid var(--line-soft);
}
@media (min-width: 820px) { .cta-card { grid-template-columns: 1fr auto; gap: 48px; } }

/* ======================================================== DEVICE SCREEN ==
   Inside the phone the site theme does not apply: this is the product's own
   surface, so it keeps the app palette in both site themes. */

.ds-top { display: flex; align-items: center; gap: 8px; padding: 42px 14px 8px; flex: none; }
.ds-chip {
  font-size: 10.5px; font-weight: 500;
  padding: 4px 9px; border-radius: var(--r-pill);
  background: var(--app-raised); color: var(--app-chalk-dim);
  border: 1px solid var(--app-line); white-space: nowrap;
}
.ds-chip-live { margin-left: auto; color: var(--app-swish); border-color: rgba(47, 214, 163, 0.35); }

.ds-stage { position: relative; flex: 1 1 auto; min-height: 0; }
.ds-stage canvas { width: 100%; height: 100%; display: block; }

.ds-verdict {
  position: absolute; left: 10px; right: 10px; bottom: 10px;
  padding: 11px 13px; border-radius: 14px;
  background: rgba(18, 16, 16, 0.9);
  border: 1px solid var(--app-line);
  backdrop-filter: blur(8px);
  opacity: 0; transform: translateY(14px) scale(0.98);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
  pointer-events: none;
}
.ds-verdict.show { opacity: 1; transform: none; }
.ds-verdict.make { border-color: rgba(47, 214, 163, 0.5); }
.ds-verdict.miss { border-color: rgba(232, 87, 79, 0.5); }
.ds-verdict.unsure { border-color: rgba(232, 184, 79, 0.5); }

.v-top { display: flex; align-items: center; gap: 8px; }
.v-badge { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; color: var(--app-chalk); }
.ds-verdict.make .v-badge { color: var(--app-swish); }
.ds-verdict.miss .v-badge { color: var(--app-brick); }
.ds-verdict.unsure .v-badge { color: var(--app-yellow); }
.v-flag { font-size: 10px; padding: 2px 7px; border-radius: var(--r-pill); background: rgba(232, 184, 79, 0.16); color: var(--app-yellow); }
.v-scn { font-size: 11.5px; color: var(--app-chalk-dim); margin-top: 2px; }
.v-code {
  margin-top: 6px; font-size: 10.5px; color: var(--app-chalk-faint);
  font-family: ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, Consolas, monospace;
  overflow-x: auto; white-space: nowrap;
}

.ds-signals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 10px 12px 0; flex: none; }
.sig {
  display: flex; flex-direction: column; gap: 1px;
  padding: 7px 9px; border-radius: 11px;
  background: var(--app-court); border: 1px solid var(--app-line);
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.sig-k { font-size: 9.5px; letter-spacing: 0.08em; color: var(--app-chalk-faint); font-weight: 600; }
.sig-v { font-size: 13px; font-weight: 600; color: var(--app-chalk); }
.sig[data-tone='yes'] { border-color: rgba(47, 214, 163, 0.55); background: rgba(47, 214, 163, 0.09); }
.sig[data-tone='yes'] .sig-v { color: var(--app-swish); }
.sig[data-tone='no'] { border-color: rgba(232, 87, 79, 0.5); background: rgba(232, 87, 79, 0.09); }
.sig[data-tone='no'] .sig-v { color: var(--app-brick); }
.sig[data-tone='null'] .sig-v { color: var(--app-chalk-faint); }
.sig[data-tone='pending'] .sig-v { color: var(--app-chalk-dim); }

.ds-stats { display: grid; grid-template-columns: repeat(4, 1fr); padding: 10px 12px 2px; flex: none; }
.ds-stat { text-align: center; }
.ds-stat b { display: block; font-size: 17px; font-weight: 600; color: var(--app-chalk); font-variant-numeric: tabular-nums; }
.ds-stat span { font-size: 9.5px; color: var(--app-chalk-faint); }

.ds-actions { display: flex; gap: 8px; padding: 10px 12px 16px; flex: none; }
.ds-btn {
  flex: 1; height: 38px; border: 0; border-radius: var(--r-pill);
  background: var(--app-leather); color: #1a0d06;
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: transform var(--dur-fast) var(--ease), filter var(--dur-fast) var(--ease);
}
.ds-btn:active { transform: scale(0.97); }
.ds-btn:hover { filter: brightness(1.08); }
.ds-btn-ghost { flex: 0 0 76px; background: transparent; color: var(--app-chalk-dim); border: 1px solid var(--app-line); }
.ds-btn-ghost.on { color: var(--app-swish); border-color: rgba(47, 214, 163, 0.5); }
/* =========================================================================
   Gate + architecture page. Appended to app.css at build time; kept as its
   own authoring file so the token layer stays readable.
   ========================================================================= */

/* ---------------------------------------------------------------- gate */

.gate {
  min-height: calc(100dvh - 68px);
  display: grid;
  place-items: center;
  padding: clamp(28px, 6vw, 72px) var(--gutter);
  transition: opacity var(--dur-slow) var(--ease), transform var(--dur-slow) var(--ease);
}
.gate.unlocked { opacity: 0; transform: translateY(-14px) scale(0.985); pointer-events: none; }

.gate-card {
  width: 100%;
  max-width: 480px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  padding: clamp(30px, 5vw, 46px);
  box-shadow: var(--shadow-2);
}
.gate-card h1 { font-size: clamp(24px, 3.4vw, 32px); margin-bottom: 12px; }
.gate-sub { color: var(--text-dim); font-size: 15px; max-width: 38ch; margin-inline: auto; }

.gate-lock {
  width: 66px; height: 66px;
  margin: 0 auto 22px;
  display: grid; place-items: center;
  border-radius: var(--r-pill);
  background: var(--accent-tint);
  color: var(--accent);
}
.gate-lock svg { width: 40px; height: 40px; }
.lock-shackle { transform-origin: 24px 21px; transition: transform var(--dur-slow) var(--ease); }
.gate.unlocked .lock-shackle { transform: translateY(-5px) rotate(-14deg); }
.gate.working .lock-pin { animation: pin 900ms var(--ease) infinite; }
@keyframes pin { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

.gate-form { margin-top: 28px; display: grid; gap: 18px; justify-items: center; }

.code { display: flex; gap: 10px; }
.code-cell {
  width: 54px; height: 64px;
  text-align: center;
  font: inherit;
  font-size: 26px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  background: var(--bg-sunken);
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  transition: border-color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease),
    transform var(--dur-fast) var(--ease);
}
.code-cell:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  transform: translateY(-2px);
}
@media (max-width: 380px) { .code-cell { width: 46px; height: 56px; font-size: 22px; } }

.gate-msg { font-size: 14px; min-height: 20px; color: var(--text-faint); }
.gate-msg[data-tone='err'] { color: var(--miss); }
.gate-msg[data-tone='ok'] { color: var(--make); }
.gate-msg[data-tone='warn'] { color: var(--unsure); }

.gate-foot {
  margin-top: 24px; padding-top: 20px;
  border-top: 1px solid var(--line-soft);
  font-size: 12.5px; color: var(--text-faint); line-height: 1.6;
}

.gate.shake { animation: shake 420ms var(--ease); }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  18% { transform: translateX(-9px); }
  38% { transform: translateX(8px); }
  58% { transform: translateX(-5px); }
  78% { transform: translateX(3px); }
}

/* --------------------------------------------------------------- vault */

.vault { --maxw: 1340px; padding-bottom: 40px; }
.vault section { padding-block: clamp(44px, 6vw, 76px); }
.vault section + section { border-top: 1px solid var(--line-soft); }

.v-hero { padding-top: clamp(36px, 5vw, 60px) !important; }
.v-hero h1 { max-width: 20ch; margin-bottom: 20px; }
.v-chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.v-chip {
  font-size: 13px; padding: 7px 14px; border-radius: var(--r-pill);
  background: var(--surface-raised); color: var(--text-dim);
  border: 1px solid var(--line-soft);
}
.v-chip code { background: transparent; border: 0; padding: 0; }

/* ------------------------------------------------------------- diagram */

.diag-head { display: grid; gap: 20px; margin-bottom: 30px; }
@media (min-width: 860px) { .diag-head { grid-template-columns: 1fr auto; align-items: end; } }
.diag-actions { display: flex; gap: 8px; align-items: center; }

.diag-wrap { overflow-x: auto; padding-bottom: 4px; }
.diag {
  position: relative;
  min-width: 900px;
  padding-bottom: 46px;      /* room for the long-edge bus lane */
}
@media (max-width: 899px) { .diag { min-width: 0; padding-bottom: 0; } }

.diag-edges { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; overflow: visible; }
.diag-edge {
  fill: none;
  stroke: var(--line);
  stroke-width: 1.6;
  transition: stroke var(--dur) var(--ease), stroke-width var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.diag-edge.far { stroke-dasharray: 4 5; opacity: 0.75; }
.diag-edge.hl { stroke: var(--accent); stroke-width: 2.4; opacity: 1; }
.diag.focusing .diag-edge:not(.hl) { opacity: 0.32; }
.diag-dot { fill: var(--accent); }

.diag-lanes { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(6, 1fr); gap: 34px; align-items: start; }
@media (max-width: 899px) { .diag-lanes { grid-template-columns: 1fr; gap: 22px; } }

.diag-lane { display: flex; flex-direction: column; gap: 12px; }
.diag-lane-head { display: flex; align-items: center; gap: 7px; padding-bottom: 4px; }
.diag-lane-n {
  width: 20px; height: 20px; flex: none;
  display: grid; place-items: center;
  border-radius: var(--r-pill);
  background: var(--accent-tint); color: var(--accent);
  font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.diag-lane-t { font-size: 13px; font-weight: 500; color: var(--text-dim); letter-spacing: 0.02em; }

.diag-node {
  position: relative;
  display: flex; flex-direction: column; gap: 4px;
  width: 100%; text-align: left;
  padding: 13px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: var(--surface);
  font: inherit; cursor: pointer;
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.diag-node:hover { transform: translateY(-2px); box-shadow: var(--shadow-1); border-color: var(--line); }
.dn-title { font-size: 14px; font-weight: 500; color: var(--text); line-height: 1.35; }
.dn-file { font-size: 11px; color: var(--text-faint); font-family: ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, Consolas, monospace; word-break: break-all; }
.dn-tone {
  position: absolute; top: -7px; right: 10px;
  font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: var(--r-pill);
  background: var(--surface); border: 1px solid var(--line);
  color: var(--text-faint);
}
.tone-guard .dn-tone, .dp-tone.tone-guard { color: var(--info); border-color: var(--info); background: var(--info-tint); }
.tone-rule .dn-tone, .dp-tone.tone-rule { color: var(--miss); border-color: var(--miss); background: var(--miss-tint); }
.tone-core .dn-tone, .dp-tone.tone-core { color: var(--accent); border-color: var(--accent); background: var(--accent-tint); }
.diag-node.tone-core { border-color: var(--accent-edge); }

.diag.focusing .diag-node:not(.rel) { opacity: 0.34; }
.diag-node.sel { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.diag-node.lit { border-color: var(--accent); background: var(--accent-tint); transform: translateY(-2px); }

/* --------------------------------------------------------------- panel */

.diag-panel {
  margin-top: 30px;
  min-height: 178px;
  padding: clamp(20px, 3vw, 28px);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  background: var(--bg-sunken);
}
.diag-panel.pop { animation: pop var(--dur) var(--ease); }
.diag-panel-empty { color: var(--text-faint); font-size: 14px; }
.dp-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.dp-head h3 { font-size: 19px; }
.dp-tone { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: var(--r-pill); border: 1px solid; }
.dp-file { font-size: 12px; }
.dp-body { color: var(--text-dim); max-width: 78ch; line-height: 1.65; }
.dp-io {
  margin-top: 12px; font-size: 12.5px; color: var(--text-faint);
  font-family: ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, Consolas, monospace;
}
.dp-links { display: grid; gap: 8px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line-soft); font-size: 13px; color: var(--text-dim); }
@media (min-width: 700px) { .dp-links { grid-template-columns: 1fr 1fr; gap: 24px; } }
.dp-links b { display: block; font-size: 11px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-faint); font-weight: 600; margin-bottom: 3px; }

/* ----------------------------------------------------------------- fsm */

.fsm { list-style: none; margin: 28px 0 0; padding: 0; display: grid; gap: 12px; }
@media (min-width: 1000px) { .fsm { grid-template-columns: repeat(5, 1fr); } }
.fsm-state {
  position: relative;
  display: flex; flex-direction: column; gap: 8px;
  padding: 20px 18px;
  border: 1px solid var(--line-soft); border-radius: var(--r-md);
  background: var(--surface);
}
.fsm-state b { font-size: 15px; font-weight: 500; }
.fsm-state span { font-size: 13.5px; color: var(--text-dim); line-height: 1.55; }
.fsm-state em { font-size: 12px; font-style: normal; color: var(--accent); margin-top: auto; padding-top: 6px; }
.fsm-final { border-color: var(--accent-edge); background: var(--accent-tint); }
@media (min-width: 1000px) {
  .fsm-state::after {
    content: ''; position: absolute; top: 50%; right: -13px; width: 14px; height: 2px;
    background: var(--line); transform: translateY(-50%);
  }
  .fsm-state:last-child::after { display: none; }
}

/* ------------------------------------------------------------ callouts */

.callout {
  margin-top: 30px;
  padding: clamp(22px, 3vw, 30px);
  border-radius: var(--r-md);
  background: var(--surface-raised);
  border: 1px solid var(--line-soft);
}
.callout h3 { margin-bottom: 10px; }
.callout p { color: var(--text-dim); max-width: 82ch; line-height: 1.65; }
.callout-rule { background: var(--accent-tint); border-color: var(--accent-edge); }

/* -------------------------------------------------------------- tables */

.table-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: var(--r-md); }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 620px; }
.tbl th, .tbl td { text-align: left; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.tbl thead th { font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-faint); font-weight: 600; background: var(--bg-sunken); }
.tbl tbody th { width: 132px; font-weight: 500; color: var(--text); }
.tbl td { color: var(--text-dim); line-height: 1.6; }
.tbl tr:last-child th, .tbl tr:last-child td { border-bottom: 0; }

/* Camera-angle switcher inside the phone. Horizontally scrollable so five
   chips fit a 320px-wide device without wrapping into two rows. */
.ds-angles {
  display: flex; gap: 5px; flex: none;
  padding: 8px 12px 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.ds-angles::-webkit-scrollbar { display: none; }
.ds-angle {
  flex: none;
  padding: 5px 11px;
  border-radius: var(--r-pill);
  border: 1px solid var(--app-line);
  background: var(--app-court);
  color: var(--app-chalk-dim);
  font: inherit; font-size: 11px; font-weight: 500;
  cursor: pointer; white-space: nowrap;
  transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease),
    background-color var(--dur-fast) var(--ease);
}
.ds-angle:hover { color: var(--app-chalk); }
.ds-angle.on {
  color: var(--app-coal); background: var(--app-chalk);
  border-color: var(--app-chalk);
}
.ds-stage canvas { cursor: grab; }
.ds-stage canvas:active { cursor: grabbing; }

/* -------------------------------------------------- net / angles / honesty */

.net-grid { display: grid; gap: clamp(32px, 5vw, 56px); }
@media (min-width: 940px) { .net-grid { grid-template-columns: 1.05fr 0.95fr; align-items: start; } }
.net-grid .lede { margin-bottom: 4px; }

/* The three states of the net signal, shown as three states rather than a
   list, because the point is that there are exactly three. */
.tri-state { display: grid; gap: 10px; }
.ts-row {
  display: flex; gap: 16px; align-items: flex-start;
  padding: 18px 20px;
  border: 1px solid var(--line-soft); border-radius: var(--r-md);
  background: var(--surface);
}
.ts-row b { display: block; font-weight: 500; font-size: 15px; }
.ts-row code { margin-top: 4px; display: inline-block; font-size: 12px; }
.ts-row p { margin-top: 8px; font-size: 14px; color: var(--text-dim); }
.ts-row[data-v='true'] { border-color: color-mix(in srgb, var(--make) 42%, transparent); }
.ts-row[data-v='false'] { border-color: color-mix(in srgb, var(--miss) 38%, transparent); }
.ts-row[data-v='null'] { border-color: var(--line); }

/* A three-strand net glyph: swinging, still, or absent. */
.ts-ic { flex: none; width: 34px; height: 40px; position: relative; }
.ts-ic span {
  position: absolute; top: 4px; width: 2px; height: 30px; border-radius: 2px;
  background: var(--text-faint); transform-origin: top center;
}
.ts-ic span:nth-child(1) { left: 5px; }
.ts-ic span:nth-child(2) { left: 16px; }
.ts-ic span:nth-child(3) { left: 27px; }
.ts-row[data-v='true'] .ts-ic span { background: var(--make); animation: swing 1.4s var(--ease) infinite alternate; }
.ts-row[data-v='true'] .ts-ic span:nth-child(2) { animation-delay: 90ms; }
.ts-row[data-v='true'] .ts-ic span:nth-child(3) { animation-delay: 180ms; }
.ts-row[data-v='false'] .ts-ic span { background: var(--miss); }
@keyframes swing { from { transform: rotate(-9deg); } to { transform: rotate(9deg); } }
.ts-ic-none::after {
  content: ''; position: absolute; inset: 4px 3px;
  border: 2px dashed var(--line); border-radius: 6px;
}
@media (prefers-reduced-motion: reduce) { .ts-ic span { animation: none !important; } }

.angle-grid { display: grid; gap: clamp(30px, 4vw, 52px); }
@media (min-width: 940px) { .angle-grid { grid-template-columns: 1.1fr 0.9fr; align-items: start; } }
.angle-fig {
  width: 100%; height: auto; color: var(--text-faint);
  border: 1px solid var(--line-soft); border-radius: var(--r-md);
  background: var(--surface);
}

.honesty {
  padding: clamp(30px, 5vw, 60px);
  border-radius: var(--r-lg);
  background: var(--surface-raised);
  border: 1px solid var(--line-soft);
}
.honesty .stack { gap: 18px; max-width: 78ch; }

/* ============================================================== DECK ==
   Presentation mode. One slide fills the viewport; moving between them is a
   designed transition, not a scroll. Everything below inherits the same
   tokens and the same easing curve as the rest of the site, which is what
   keeps the deck feeling like the same product rather than a separate toy. */

body.is-deck { overflow: hidden; height: 100dvh; }

.deck {
  position: fixed; inset: 0;
  display: grid; grid-template-rows: auto 1fr auto;
  background: var(--bg);
}

.deck-top {
  display: flex; align-items: center; gap: 14px;
  padding: 18px clamp(18px, 4vw, 44px) 6px;
  z-index: 3;
}
.deck-top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.deck-counter { font-size: 13px; color: var(--text-faint); font-variant-numeric: tabular-nums; }

.deck-stage { position: relative; overflow: hidden; }

.slide {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  padding: clamp(16px, 3vh, 34px) clamp(20px, 6vw, 96px);
  opacity: 0; visibility: hidden; pointer-events: none;
  transform: translateX(var(--enter, 5%)) scale(0.985);
  transition: opacity 500ms var(--ease), transform 500ms var(--ease), visibility 0s linear 500ms;
  overflow-y: auto;
}
.slide.active {
  opacity: 1; visibility: visible; pointer-events: auto;
  transform: none;
  transition: opacity 500ms var(--ease), transform 500ms var(--ease), visibility 0s;
}
.slide.leaving {
  visibility: visible; opacity: 0;
  transform: translateX(var(--leave, -5%)) scale(0.985);
  transition: opacity 460ms var(--ease), transform 460ms var(--ease), visibility 0s linear 460ms;
}
.deck[data-dir="fwd"] .slide { --enter: 5%; --leave: -5%; }
.deck[data-dir="back"] .slide { --enter: -5%; --leave: 5%; }
.slide:focus { outline: none; }

.slide-inner { width: 100%; max-width: 1080px; display: grid; gap: clamp(14px, 2vh, 22px); }

/* The stagger. One rhythm applied everywhere is what separates a designed
   transition from a pile of effects. */
.slide.run .slide-inner > * {
  animation: deckRise 560ms var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 70ms + 80ms);
}
.slide.run .s-stat, .slide.run .s-point, .slide.run .s-card {
  animation: deckRise 560ms var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 70ms + 240ms);
}
@keyframes deckRise { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }

.s-eyebrow {
  font-size: clamp(12px, 1.3vw, 14px); font-weight: 500; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--accent); margin: 0;
}
.s-title {
  font-size: clamp(30px, 5.2vw, 66px); font-weight: 500; letter-spacing: -0.028em;
  line-height: 1.08; margin: 0; text-wrap: balance;
}
.s-body {
  font-size: clamp(16px, 1.85vw, 23px); color: var(--text-dim);
  line-height: 1.55; max-width: 64ch; margin: 0;
}
.s-note { font-size: clamp(11px, 1.1vw, 13px); color: var(--text-faint); margin: 0; max-width: 82ch; line-height: 1.5; }

/* Title and closing slides carry the one moment of atmosphere in the deck. */
.slide-title::before, .slide-close::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(70% 60% at 18% 22%, var(--accent-tint), transparent 70%);
}
.slide-title .s-title { font-size: clamp(42px, 8.4vw, 104px); }
.slide-statement .s-title { font-size: clamp(34px, 6.4vw, 80px); max-width: 18ch; }

.s-stats { display: grid; gap: clamp(14px, 2vw, 28px); grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-top: 6px; }
.s-stat b {
  display: block; font-size: clamp(30px, 4.6vw, 58px); font-weight: 500;
  letter-spacing: -0.035em; line-height: 1; font-variant-numeric: tabular-nums;
}
.s-stat span { display: block; margin-top: 10px; font-size: clamp(12px, 1.3vw, 15px); color: var(--text-faint); line-height: 1.45; }

.s-points { display: grid; gap: 2px; background: var(--line-soft); border: 1px solid var(--line-soft); border-radius: var(--r-md); overflow: hidden; margin-top: 6px; }
.s-point { background: var(--surface); padding: clamp(14px, 2vw, 22px) clamp(16px, 2vw, 26px); display: grid; gap: 6px; align-content: start; }
.s-point b { font-size: clamp(15px, 1.6vw, 19px); font-weight: 500; }
.s-point span { font-size: clamp(13px, 1.35vw, 16px); color: var(--text-dim); line-height: 1.55; }
@media (min-width: 860px) { .s-points { grid-template-columns: 1fr 1fr; } }

.s-roadmap { display: grid; gap: 14px; margin-top: 6px; }
@media (min-width: 860px) { .s-roadmap { grid-template-columns: repeat(3, 1fr); } }
.s-card {
  position: relative;
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--r-md); padding: clamp(18px, 2vw, 26px);
  display: grid; gap: 10px; align-content: start;
}
.s-card h3 { font-size: clamp(17px, 1.8vw, 21px); }
.s-card p { font-size: clamp(13px, 1.32vw, 15px); color: var(--text-dim); line-height: 1.55; }
.s-status {
  justify-self: start;
  font-size: 11px; font-weight: 600; letter-spacing: 0.04em;
  padding: 3px 10px; border-radius: var(--r-pill);
  background: var(--accent-tint); color: var(--accent);
}
.s-risk { border-top: 1px solid var(--line-soft); padding-top: 10px; font-size: 12.5px; color: var(--text-faint); }
.s-risk b { display: block; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 3px; }

.s-custom { display: grid; gap: clamp(20px, 3vw, 40px); }
@media (min-width: 900px) { .s-custom.split { grid-template-columns: 1.05fr 0.95fr; align-items: center; } }
.slide-demo .device { width: min(268px, 52vh); margin-inline: 0; }
.slide-demo .slide-inner { max-width: 1180px; }
.s-lead { display: grid; gap: 14px; align-content: center; }

.deck-nav { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 10px 20px 22px; z-index: 3; }
.deck-arrow {
  width: 44px; height: 44px; flex: none;
  display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: var(--r-pill);
  background: var(--surface); color: var(--text-dim); cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.deck-arrow:hover { background: var(--surface-raised); color: var(--text); }
.deck-arrow:active { transform: scale(0.94); }
.deck-arrow svg { width: 20px; height: 20px; }

.deck-dots { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; justify-content: center; }
.deck-dot {
  width: 9px; height: 9px; padding: 0; border: 0; border-radius: var(--r-pill);
  background: var(--line); cursor: pointer;
  transition: width var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.deck-dot:hover { background: var(--text-faint); }
.deck-dot.on { width: 26px; background: var(--accent); }

.deck-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--line-soft); }
.deck-progress span {
  display: block; height: 100%; background: var(--accent);
  transform-origin: left center; transform: scaleX(0);
  transition: transform 520ms var(--ease);
}

@media (prefers-reduced-motion: reduce) {
  .slide, .slide.active, .slide.leaving { transition: opacity 1ms linear, visibility 0s; transform: none; }
  .slide.run .slide-inner > *, .slide.run .s-stat, .slide.run .s-point, .slide.run .s-card { animation: none; }
  .deck-progress span { transition: none; }
}

/* Reading progress. Sits on the sticky nav's bottom edge so it reads as part
   of the chrome rather than a separate bar competing for attention. */
.read-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px;
  z-index: 60; pointer-events: none; background: transparent;
}
.read-progress span {
  display: block; height: 100%; background: var(--accent);
  transform-origin: left center; transform: scaleX(0);
}

/* Source links inside metric captions and callouts. Underlined by default:
   a citation that does not look like a citation is not doing its job. */
.src { color: var(--text-faint); text-decoration: underline; text-underline-offset: 2px; }
.src:hover { color: var(--accent); }
.metric .k a { display: inline-block; margin-top: 2px; font-size: 12.5px; }
.tbl.cmp { min-width: 780px; }
.tbl.cmp th:first-child { width: 118px; }
.tbl.cmp td:nth-child(2) { width: 190px; }

/* ------------------------------------------------------------- hardware */

.hw-grid { display: grid; gap: 18px; }
@media (min-width: 980px) { .hw-grid { grid-template-columns: repeat(3, 1fr); } }

.hw-card {
  display: flex; flex-direction: column;
  border: 1px solid var(--line-soft); border-radius: var(--r-lg);
  background: var(--surface);
  overflow: hidden;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.hw-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); border-color: var(--line); }

.hw-head { padding: 24px 24px 18px; border-bottom: 1px solid var(--line-soft); }
.hw-head h3 { margin-top: 12px; }
.hw-tag { margin-top: 6px; font-size: 14px; color: var(--text-dim); }
.hw-status {
  display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: 0.05em;
  padding: 4px 11px; border-radius: var(--r-pill);
  background: var(--surface-raised); color: var(--text-faint); border: 1px solid var(--line);
}
.hw-status[data-s="規劃中"] { background: var(--accent-tint); color: var(--accent); border-color: var(--accent-edge); }

.hw-body { padding: 20px 24px; display: grid; gap: 18px; flex: 1; }
.hw-block b {
  display: block; font-size: 11px; font-weight: 600; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--text-faint); margin-bottom: 6px;
}
.hw-block p { font-size: 14px; color: var(--text-dim); line-height: 1.62; }

.hw-risk { padding: 18px 24px 22px; background: var(--bg-sunken); border-top: 1px solid var(--line-soft); }
.hw-risk b {
  display: block; font-size: 11px; font-weight: 600; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--miss); margin-bottom: 6px;
}
.hw-risk p { font-size: 13px; color: var(--text-faint); line-height: 1.6; }

/* ------------------------------------------------- deck: fit the viewport
   A presentation slide that scrolls is a broken slide. Two things fight the
   viewport: the phone mock on the demo slide (its aspect ratio makes a
   width-driven size explode vertically) and the three roadmap cards. Size the
   phone from HEIGHT instead, and tighten the type on short screens. */

.slide-demo .device {
  height: min(56vh, 460px);
  width: auto;
  margin-inline: 0;
  padding: 8px;
  border-radius: 32px;
}
.slide-demo .device-screen { border-radius: 25px; }
.slide-demo .device-notch { width: 62px; height: 16px; top: 7px; }
.slide-demo .ds-top { padding: 30px 10px 6px; }

.s-roadmap .s-card { padding: 16px 18px; gap: 8px; }
.s-roadmap .s-card p { font-size: clamp(12px, 1.15vw, 13.5px); line-height: 1.5; }
.s-roadmap .s-risk { padding-top: 8px; font-size: 11.5px; }

/* Short viewports (laptops, projectors at 16:10, browser chrome eating room). */
@media (max-height: 780px) {
  .slide { padding-block: 12px; }
  .slide-inner { gap: clamp(10px, 1.4vh, 16px); }
  .s-title { font-size: clamp(26px, 3.6vw, 42px); }
  .slide-title .s-title { font-size: clamp(34px, 6vw, 72px); }
  .slide-statement .s-title { font-size: clamp(28px, 4.4vw, 54px); }
  .s-body { font-size: clamp(14px, 1.5vw, 18px); line-height: 1.5; }
  .s-stat b { font-size: clamp(26px, 3.4vw, 42px); }
  .s-point { padding: 11px 16px; gap: 4px; }
  .s-point span { font-size: clamp(12px, 1.2vw, 14px); line-height: 1.5; }
  .deck-nav { padding: 6px 20px 16px; }
  .deck-top { padding-top: 12px; }
}
