/* ═══════════════════════════════════════════════════════════════════════════
   velisa.app — landing page stylesheet
   Loaded AFTER style.css, which stays the single source of truth for tokens,
   .wordmark, .nav-links, .btn and .site-footer.

   THE FIREWALL (see site/DESIGN.md §4.1). privacy.html and support.html are
   LIVE and load style.css. This file must not be able to touch them:

     · no bare element selectors           (h1 {…} would restyle both live pages)
     · no selector that exists in style.css
     · no !important
     · every selector is rooted at a `.v-` class, so it cannot match anything
       on a page that does not carry one — and neither live page does.

   Class selectors are (0,1,0); style.css's element selectors are (0,0,1), so
   .v-body beats `p` cleanly with no escalation. If this file ever needs
   !important, the markup is wrong — fix the markup.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* ── Aliases onto tokens style.css already owns. Source of truth stays there,
        so the three pages can never drift apart. ────────────────────────────── */
  --hairline: var(--card-border);   /* Palette.ember cardBorderAlpha 0.07 */
  --dim: var(--text-dim);           /* #8b8478 — 5.01:1 on --bg, AA at ≥16px */
  --faint: var(--text-faint);       /* #5f5a51 — 2.71:1. DECORATIVE ONLY.     */
  --tabbar: var(--tab);

  /* ── Palette.ember tokens style.css does not define. Verbatim from
        Velisa/Design/Palette.swift; alphas are that file's *Alpha params. ──── */
  --track: rgba(255, 255, 255, 0.08);

  /* Series colours. These appear ONLY inside screenshots and as the four
     8px swatches in the palette figure's caption. Never page chrome. */
  --deep: #8a9a5b;
  --core: #7fa9da;
  --rem: #a08fd8;
  --awake: #e05a5a;
  --resp: #4fb8b0;
  --protein: #d98e5f;
  --carbs: #7fa9da;
  --fat: #a08fd8;
  --fibre: #8a9a5b;

  /* ── SITE-ONLY derived tokens. NOT app tokens. Never back-port. ─────────── */
  --site-ink-on-accent: #1a1408;               /* 9.10:1 on --accent          */
  --site-hairline-strong: rgba(255, 255, 255, 0.12);
  --meta: #a29a8c;                             /* 6.66:1 on --bg. See below.  */
  /* --meta exists because --text-faint is 2.71:1, which fails AA and even the
     3:1 large-text bar. On a 3× phone at 30cm the app survives it; at 12px on
     a laptop it does not. Documented divergence — DESIGN.md §6.3, §14 item 1. */

  /* ── Layout ─────────────────────────────────────────────────────────────── */
  --gutter: clamp(20px, 4vw, 40px);
  --w-prose: 680px;
  --w-shell: 940px;
  --w-wide: 1120px;

  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;
  --s8: 64px;
  --s9: 96px;
  --s10: 128px;
  --s11: 180px;

  /* Matched to Theme.M so the page reads as the same product. */
  --r-plate: 24px;      /* = Theme.M.cardRadius */
  --r-panel: 20px;
  --r-control: 12px;
  --r-pill: 999px;

  /* ── Motion ─────────────────────────────────────────────────────────────── */
  --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-lift: cubic-bezier(0.34, 1.35, 0.64, 1);  /* used EXACTLY once */

  --d-fast: 160ms;
  --d-mid: 320ms;
  --d-wipe: 520ms;
  --d-slow: 620ms;
  --stagger: 70ms;
}

/* ═══════════════════════════════════════════════════════════════════════════
   1 · PAGE SHELL
   ═══════════════════════════════════════════════════════════════════════════ */

.v-home {
  overflow-x: hidden;               /* belt and braces; nothing should overflow */
}

/* Focus, everywhere. Never removed, never a colour change alone. */
.v-home a:focus-visible,
.v-home button:focus-visible,
.v-home summary:focus-visible,
.v-home [tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}

.v-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  white-space: nowrap;
  clip-path: inset(50%);
  border: 0;
}

.v-skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--accent);
  color: var(--site-ink-on-accent);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 15px;
  padding: 12px 18px;
  border-radius: 0 0 var(--r-control) 0;
  text-decoration: none;
}

.v-skip:focus { left: 0; }

/* Utilities live at the very END of this file (§18) so they always win against
   the component rules above without needing !important. */

.v-section {
  padding-block: clamp(80px, 42.86px + 9.52vw, 180px);
  scroll-margin-top: 88px;
  position: relative;
}

.v-section--tight {
  padding-block: clamp(56px, 34.7px + 5.46vw, 113px);
}

.v-rule {
  border-top: 1px solid var(--hairline);
}

.v-prose,
.v-shell,
.v-wide {
  margin-inline: auto;
  padding-inline: var(--gutter);
  width: 100%;
}

.v-prose { max-width: calc(var(--w-prose) + var(--gutter) * 2); }
.v-shell { max-width: calc(var(--w-shell) + var(--gutter) * 2); }
.v-wide  { max-width: calc(var(--w-wide)  + var(--gutter) * 2); }

/* ═══════════════════════════════════════════════════════════════════════════
   2 · TYPOGRAPHY
   Weights permitted, the whole set: serif 400. sans 400 / 600. mono 500 / 700.
   Nothing else — see DESIGN.md §5.0 for why serif 300 does not ship.
   ═══════════════════════════════════════════════════════════════════════════ */

.v-display {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(40px, calc(26.63px + 3.43vw), 76px);
  line-height: 1.04;
  letter-spacing: -0.025em;
  color: var(--text);
  text-wrap: balance;
  margin: 0;
}

/* style.css carries `h2:first-of-type { margin-top: 8px }` at (0,1,1), which
   BEATS a plain .v-h2 at (0,1,0) — and every h2 on this page is the first of
   its type inside its own container, so all of them would have inherited it.
   The .v-section ancestor takes this rule to (0,2,0) and settles it without
   !important. Found by reading style.css, not by looking at the page. */
.v-h2,
.v-section .v-h2 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(30px, calc(24.06px + 1.52vw), 46px);
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: var(--text);
  text-wrap: balance;
  margin: 0;
  padding: 0;
}

.v-h3 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(22px, calc(19.77px + 0.57vw), 28px);
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--text);
  text-wrap: balance;
  margin: 0;
}

.v-h4 {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 16px;
  line-height: 1.4;
  color: var(--text);
  margin: 0;
}

.v-insight {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(24px, calc(20.29px + 0.95vw), 34px);
  line-height: 1.32;
  letter-spacing: -0.012em;
  color: var(--text);
  max-width: 34ch;
  text-wrap: balance;
  margin: 0;
}

.v-lead {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: clamp(18px, calc(16.89px + 0.29vw), 21px);
  line-height: 1.55;
  color: var(--text);
  max-width: 46ch;
  margin: 0;
}

.v-body {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: clamp(16px, calc(15.63px + 0.1vw), 17px);
  line-height: 1.65;
  color: var(--dim);
  text-wrap: pretty;
  margin: 0;
}

.v-body strong,
.v-lead strong {
  font-weight: 600;
  color: var(--text);
}

.v-body a,
.v-lead a,
.v-note a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: opacity var(--d-fast) var(--ease-out);
}

.v-body a:hover,
.v-lead a:hover,
.v-note a:hover { opacity: 0.78; }

.v-num {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(48px, calc(33.14px + 3.81vw), 88px);
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  display: block;
  margin: 0;
}

.v-num--mid {
  font-size: clamp(28px, calc(23.54px + 1.14vw), 40px);
  line-height: 1.05;
  letter-spacing: -0.01em;
}

.v-num--accent { color: var(--accent); }

.v-eyebrow {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 11px;
  line-height: 1.4;
  letter-spacing: 0.13em;   /* Theme.M.eyebrowTracking 1.4pt / 11pt = 0.127em */
  text-transform: uppercase;
  color: var(--accent);
  margin: 0;
}

.v-eyebrow--quiet { color: var(--meta); }

.v-meta {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: 0.02em;
  color: var(--meta);
  margin: 0;
}

.v-meta code,
.v-note code,
.v-body code,
.v-window-text code {
  font-family: var(--font-mono);
  color: var(--text);
  /* Repo paths and Swift symbols are single unbreakable tokens. At 320px
     `ReferencePopulation.unverifiedBodyFatOffsetPoints` is 353px wide and was
     pushing the document to 390px. Measured, not guessed. */
  overflow-wrap: anywhere;
}

.v-note {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 13px;
  line-height: 1.5;
  color: var(--dim);
  margin: var(--s3) 0 0;
  padding-inline-start: var(--s4);
  border-inline-start: 1px solid var(--hairline);
}

.v-note b {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  display: block;
  margin-bottom: 2px;
}

/* Superscript provenance marker, e.g. 447¹ */
.v-mark {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.52em;
  line-height: 1;
  vertical-align: super;
  color: var(--accent);
  margin-inline-start: 0.15em;
  letter-spacing: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   3 · THE CLAIM GRID — provenance in the margin (Tufte lock, DESIGN.md §4.3)
   Below 1180px notes render INLINE and always visible. Never a <details>,
   never a tooltip. Hiding provenance behind a tap contradicts the brand.
   ═══════════════════════════════════════════════════════════════════════════ */

.v-claim { display: block; }

.v-claim > .v-note { max-width: 46ch; }

@media (min-width: 1180px) {
  .v-claim {
    display: grid;
    grid-template-columns: minmax(0, var(--w-prose)) 220px;
    column-gap: 40px;
    align-items: start;
  }
  .v-claim > .v-claim-body { grid-column: 1; }
  .v-claim > .v-note {
    grid-column: 2;
    grid-row: 1;
    align-self: start;
    margin-block-start: 0.35em;
    max-width: none;
  }
  .v-claim > .v-note ~ .v-note { grid-row: 1; margin-block-start: 0; }
}

/* Two notes in the margin column stack rather than overlap. */
@media (min-width: 1180px) {
  .v-claim-notes {
    grid-column: 2;
    grid-row: 1;
    margin-block-start: 0.35em;
    display: flex;
    flex-direction: column;
    gap: var(--s4);
  }
  .v-claim-notes > .v-note { margin-top: 0; }
}

.v-claim-notes {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
}

/* ═══════════════════════════════════════════════════════════════════════════
   4 · NAV
   ═══════════════════════════════════════════════════════════════════════════ */

.v-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--hairline);
}

@supports not (backdrop-filter: blur(2px)) {
  .v-nav { background: var(--bg); }
}

.v-nav-in {
  margin-inline: auto;
  padding-inline: var(--gutter);
  max-width: calc(var(--w-wide) + var(--gutter) * 2);
  height: 64px;
  display: flex;
  align-items: center;
  gap: var(--s4);
}

.v-nav-in .wordmark { margin-inline-end: auto; }

.v-chip {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--meta);
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  padding: 5px 11px;
  white-space: nowrap;
  margin: 0;
}

.v-chip-live { display: none; }
.v-home[data-release="live"] .v-chip-pre { display: none; }
.v-home[data-release="live"] .v-chip-live {
  display: inline;
  color: var(--accent);
  border-color: var(--accent);
}

/* The SAME body[data-release] flip also swaps the launch-status prose beside
   both CTAs (hero meta line, and the eyebrow/heading/body/meta in §10), so
   flipping VELISA_RELEASE.live never leaves "Velisa isn't shipping yet."
   sitting next to a real App Store badge. .v-copy-* is for block elements
   (p); .v-inline-* is for text spans inside a heading that must stay one
   stable id for aria-labelledby. */
.v-copy-live { display: none; }
.v-home[data-release="live"] .v-copy-pre  { display: none; }
.v-home[data-release="live"] .v-copy-live { display: block; }

.v-inline-live { display: none; }
.v-home[data-release="live"] .v-inline-pre  { display: none; }
.v-home[data-release="live"] .v-inline-live { display: inline; }

@media (max-width: 719px) {
  .v-chip { display: none; }
}

/* At 320px the four nav links measured 283px, which pushed the document to
   375px wide. Below 480px the in-page "Mathematics" jump link steps out —
   it is still in the footer, and the nav then matches privacy.html and
   support.html exactly, which is the right answer anyway. */
@media (max-width: 479px) {
  .v-nav-in .nav-links { gap: 14px; }
  .v-nav-in .nav-links a[href^="#"] { display: none; }
}

/* 2px scroll-progress rule along the nav's bottom edge.
   Pure decoration, so if it cannot be scroll-LINKED it does not render at all —
   no JS scroll listener is worth this. */
.v-progress { display: none; }

@supports (animation-timeline: scroll()) {
  .v-progress {
    display: block;
    position: absolute;
    inset-inline: 0;
    bottom: -1px;
    height: 2px;
    background: var(--accent);
    transform-origin: left center;
    transform: scaleX(0);
    animation: v-progress linear both;
    animation-timeline: scroll(root block);
  }
}

@keyframes v-progress {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   5 · PLATES  (DESIGN.md §9.2 — flat, no device frame, no box-shadow ever)
   ═══════════════════════════════════════════════════════════════════════════ */

.v-figure { margin: 0; }

.v-mat {
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: calc(var(--r-plate) + 12px);
  padding: 12px;
  display: inline-block;
  max-width: 100%;
}

.v-plate {
  border-radius: var(--r-plate);
  overflow: hidden;
  border: 1px solid var(--hairline);
  background: var(--card);
  display: block;
  transition: border-color var(--d-fast) var(--ease-out);
}

.v-plate:hover { border-color: var(--site-hairline-strong); }

.v-plate img {
  display: block;
  width: 100%;
  height: auto;
}

.v-cap {
  margin-top: var(--s3);
  max-width: 46ch;
}

/* ═══════════════════════════════════════════════════════════════════════════
   6 · HERO — The Inputs Switch
   ═══════════════════════════════════════════════════════════════════════════ */

.v-hero { padding-block: clamp(48px, 24px + 6.15vw, 112px) clamp(64px, 40px + 6.15vw, 128px); }

.v-hero-head { display: flex; flex-direction: column; gap: var(--s4); }
.v-hero-head .v-lead { margin-top: var(--s2); }

.v-hero-grid {
  margin-top: clamp(40px, 24px + 4.1vw, 80px);
  display: grid;
  gap: clamp(32px, 16px + 4.1vw, 72px);
  align-items: start;
}

@media (min-width: 900px) {
  .v-hero-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 380px); }
}

/* Both frames occupy the same grid cell and crossfade.
   Under prefers-reduced-motion they split into two cells — see §12. */
.v-hero-fig {
  display: grid;
  justify-items: center;
  gap: var(--s5);
}

.v-frame {
  grid-area: 1 / 1;
  margin: 0;
  transition: opacity var(--d-wipe) var(--ease-in-out);
  max-width: 100%;
}

.v-frame .v-mat { display: block; width: min(304px, 82vw); }

.v-frame .v-cap { display: none; }

.v-hero-fig[data-state="empty"] .v-frame[data-frame="full"]  { opacity: 0; }
.v-hero-fig[data-state="empty"] .v-frame[data-frame="empty"] { opacity: 1; }
.v-hero-fig[data-state="full"]  .v-frame[data-frame="empty"] { opacity: 0; }
.v-hero-fig[data-state="full"]  .v-frame[data-frame="full"]  { opacity: 1; }

/* The frame underneath must not swallow clicks or keyboard focus. */
.v-hero-fig[data-state="empty"] .v-frame[data-frame="full"],
.v-hero-fig[data-state="full"] .v-frame[data-frame="empty"] {
  pointer-events: none;
}

.v-switch {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s3);
  flex-wrap: wrap;
}

.v-switch-btn {
  appearance: none;
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  padding: 10px 14px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: var(--s3);
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: border-color var(--d-fast) var(--ease-out);
}

.v-switch-btn:hover { border-color: var(--site-hairline-strong); }

.v-switch-label {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  color: var(--meta);
  transition: color var(--d-fast) var(--ease-out);
  white-space: nowrap;
}

.v-switch-btn[aria-checked="false"] .v-switch-label[data-when="off"],
.v-switch-btn[aria-checked="true"]  .v-switch-label[data-when="on"] {
  color: var(--text);
}

.v-switch-track {
  width: 40px;
  height: 22px;
  border-radius: var(--r-pill);
  background: var(--track);
  position: relative;
  flex: none;
}

.v-switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text);
  /* --ease-lift is used EXACTLY once on this page. Here. */
  transition: transform var(--d-fast) var(--ease-lift);
}

.v-switch-btn[aria-checked="true"] .v-switch-thumb { transform: translateX(18px); }

.v-hero-cta {
  margin-top: var(--s6);
  display: flex;
  flex-direction: column;
  gap: var(--s4);
  align-items: flex-start;
}

/* Under reduced motion the hero head takes the full width, so this line needs
   its own measure or it runs to 1280px. */
.v-hero-cta .v-meta { max-width: 62ch; }

.v-cta-row {
  display: flex;
  gap: var(--s3);
  flex-wrap: wrap;
  align-items: center;
}

.v-cta-lg {
  padding: 14px 24px;
  font-size: 16px;
  min-height: 48px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   7 · THE REFUSAL
   ═══════════════════════════════════════════════════════════════════════════ */

.v-quote {
  margin: 0;
  padding-inline-start: var(--s5);
  border-inline-start: 2px solid var(--accent);
}

.v-quote .v-meta { margin-top: var(--s4); }

/* ═══════════════════════════════════════════════════════════════════════════
   8 · COLUMN SETS — hairline dividers, never cards (DESIGN.md §8 rule 21)
   ═══════════════════════════════════════════════════════════════════════════ */

.v-cols {
  display: grid;
  gap: var(--s6);
  margin-top: var(--s7);
}

@media (min-width: 860px) {
  .v-cols--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s6); }
  .v-cols--3 > * { padding-inline-start: var(--s5); border-inline-start: 1px solid var(--hairline); }
  .v-cols--3 > :first-child { padding-inline-start: 0; border-inline-start: none; }
}

@media (max-width: 859px) {
  .v-cols > * { padding-block-start: var(--s5); border-block-start: 1px solid var(--hairline); }
  .v-cols > :first-child { padding-block-start: 0; border-block-start: none; }
}

.v-col-head {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--meta);
  margin: 0 0 var(--s4);
}

.v-col-lead { color: var(--text); }

/* ═══════════════════════════════════════════════════════════════════════════
   9 · THE FOUR TABS — the single Apple borrow, used once
   ═══════════════════════════════════════════════════════════════════════════ */

.v-tabs { display: grid; gap: var(--s7); margin-top: var(--s7); }

.v-tabs-fig { display: grid; justify-items: center; }

.v-tab-plate {
  grid-area: 1 / 1;
  width: min(304px, 78vw);
  transition: opacity var(--d-mid) var(--ease-out);
}

.v-tab-copy { max-width: 50ch; }
.v-tab-copy .v-h3 { margin-bottom: var(--s4); }
.v-tab-copy .v-body + .v-body { margin-top: var(--s5); }
.v-tab-copy .v-body + .v-meta { margin-top: var(--s5); }

/* Below 1024px the section is four stacked figure + copy pairs. No sticky. */
@media (max-width: 1023px) {
  .v-tabs-fig { display: none; }
  .v-tab-block { display: grid; gap: var(--s5); }
  .v-tab-inline { display: grid; justify-items: start; }
  .v-tab-inline .v-plate { width: min(304px, 78vw); }
}

@media (min-width: 1024px) {
  .v-tabs {
    grid-template-columns: 44% minmax(0, 1fr);
    column-gap: clamp(32px, 16px + 2.5vw, 64px);
    align-items: start;
    margin-top: var(--s8);
  }
  .v-tabs-fig {
    position: sticky;
    top: 96px;
    grid-column: 1;
    grid-row: 1;
  }
  .v-tab-list { grid-column: 2; grid-row: 1; }
  .v-tab-inline { display: none; }
  .v-tab-block {
    min-height: 62vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  /* The active plate is chosen by `data-active`, which ships in the markup as
     "today". JS only ever updates it, so with JS off one correct plate shows
     rather than four stacked on top of each other. */
  .v-tab-plate { opacity: 0; pointer-events: none; }
  .v-tabs-fig[data-active="today"] .v-tab-plate[data-tab="today"],
  .v-tabs-fig[data-active="train"] .v-tab-plate[data-tab="train"],
  .v-tabs-fig[data-active="eat"]   .v-tab-plate[data-tab="eat"],
  .v-tabs-fig[data-active="body"]  .v-tab-plate[data-tab="body"] {
    opacity: 1;
    pointer-events: auto;
  }

  /* Scroll-LINKED copy focus where the browser supports it. Pure CSS, so it
     works with JS disabled. */
  @supports (animation-timeline: view()) {
    .v-tab-copy {
      animation: v-focus linear both;
      animation-timeline: view();
      animation-range: cover 20% cover 80%;
    }
  }
  /* Fallback: IntersectionObserver toggles .is-active (see site.js). Gated on
     .v-armed so a JS-less page keeps every block at full opacity. */
  @supports not (animation-timeline: view()) {
    .v-tabs.v-armed .v-tab-copy {
      opacity: 0.34;
      transition: opacity var(--d-mid) var(--ease-out);
    }
    .v-tabs.v-armed .v-tab-block.is-active .v-tab-copy { opacity: 1; }
  }
}

@keyframes v-focus {
  0%   { opacity: 0.32; }
  38%  { opacity: 1; }
  62%  { opacity: 1; }
  100% { opacity: 0.32; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   10 · THE MATHEMATICS
   ═══════════════════════════════════════════════════════════════════════════ */

.v-math-head { display: grid; gap: var(--s4); }

/* Four tiles, two up. Three-across-plus-one-orphan is what a flex row gives
   you here, because "cited references in Velisa/Scoring" is 270px on its own
   and the shell is 940px. A 2×2 grid is deliberate rather than leftover. */
.v-stat-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s6) var(--s7);
  margin-top: var(--s7);
  padding-block: var(--s6);
  border-block: 1px solid var(--hairline);
}

@media (max-width: 479px) {
  .v-stat-row { grid-template-columns: minmax(0, 1fr); gap: var(--s5); }
}

.v-stat { display: grid; gap: var(--s2); }

.v-stat-label {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--meta);
  margin: 0;
}

.v-formula {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: clamp(13px, calc(12.26px + 0.19vw), 15px);
  line-height: 1.7;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--r-control);
  padding: var(--s5);
  margin: var(--s5) 0;
  overflow-x: auto;
  white-space: pre;
  -webkit-overflow-scrolling: touch;
  tab-size: 2;
}

.v-formula-cap {
  margin-top: calc(var(--s5) * -1 + var(--s3));
  margin-bottom: var(--s5);
}

.v-engine {
  padding-block-start: var(--s7);
  margin-block-start: var(--s7);
  border-block-start: 1px solid var(--hairline);
}

.v-engine-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s3) var(--s5);
  margin-bottom: var(--s5);
}

.v-engine .v-body + .v-body { margin-top: var(--s5); }

.v-window {
  display: grid;
  gap: var(--s2);
  margin-top: var(--s5);
  padding: var(--s4) var(--s5);
  border: 1px solid var(--hairline);
  border-radius: var(--r-control);
  background: var(--card);
}

.v-window-label {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 10px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0;
}

.v-window-text {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  margin: 0;
}

.v-cites {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.03em;
  color: var(--meta);
  margin: var(--s3) 0 0;
}

/* Refusal list — the four conditions, the five non-computations */
.v-list { margin: var(--s5) 0 0; padding: 0; list-style: none; display: grid; gap: var(--s4); }

.v-list > li {
  position: relative;
  margin: 0;
  padding-inline-start: var(--s5);
  font-family: var(--font-sans);
  font-size: clamp(15px, calc(14.63px + 0.1vw), 16px);
  line-height: 1.6;
  color: var(--dim);
}

.v-list > li::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 0.62em;
  width: 6px;
  height: 1px;
  background: var(--accent);
}

.v-list > li b {
  font-weight: 600;
  color: var(--text);
}

/* ── The ledger table ───────────────────────────────────────────────────── */

.v-table-wrap { margin-top: var(--s6); }

.v-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.v-table th {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 11px;
  line-height: 1.4;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--meta);
  padding: 0 var(--s5) var(--s3) 0;
  border-bottom: 1px solid var(--site-hairline-strong);
  vertical-align: bottom;
}

.v-table td {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--dim);
  padding: var(--s4) var(--s5) var(--s4) 0;
  border-bottom: 1px solid var(--hairline);
  vertical-align: top;
}

.v-table td:last-child,
.v-table th:last-child { padding-inline-end: 0; }

.v-table .v-td-metric {
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
}

.v-table .v-td-src {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.65;
  letter-spacing: 0.02em;
  color: var(--meta);
}

.v-table tr:last-child td { border-bottom: none; }

/* Under 760px the table reflows to labelled blocks. No horizontal scroll —
   this is the most important content on the page and it has to read on an SE. */
@media (max-width: 759px) {
  .v-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .v-table tr {
    display: block;
    padding-block: var(--s5);
    border-bottom: 1px solid var(--hairline);
  }
  .v-table tr:first-child { padding-block-start: 0; }
  .v-table tr:last-child { border-bottom: none; }
  .v-table td {
    display: block;
    padding: 0;
    border: none;
  }
  .v-table td + td { margin-top: var(--s3); }
  .v-table .v-td-metric { white-space: normal; font-size: 17px; }
  .v-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--meta);
    margin-bottom: 3px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   11 · THE WIDTH OF THE NUMBER — the ± band, drawn to scale
   ═══════════════════════════════════════════════════════════════════════════ */

.v-band-grid { display: grid; gap: clamp(40px, 24px + 4.1vw, 72px); margin-top: var(--s7); }

@media (min-width: 1000px) {
  .v-band-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 420px); align-items: center; }
}

.v-band { margin-top: var(--s7); }

.v-band-marks { position: relative; height: 34px; }

.v-band-point {
  position: absolute;
  bottom: 0;
  left: 50%;                          /* the point estimate, 28 of 0–56 */
  transform: translateX(-50%);
  display: grid;
  justify-items: center;
  gap: 4px;
}

.v-band-point span {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 20px;
  line-height: 1;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

.v-band-point i {
  display: block;
  width: 1px;
  height: 8px;
  background: var(--accent);
}

.v-band-track {
  position: relative;
  height: 14px;
  border-radius: var(--r-pill);
  background: var(--track);
  overflow: hidden;
}

/* Drawn from the centre outward. The resting state is FULL — a JS-less or
   unsupported browser shows the complete band, never an empty track. */
.v-band-fill {
  position: absolute;
  inset: 0;
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--accent) 26%, transparent);
  transform: scaleX(1);
  transform-origin: 50% 50%;
}

@supports (animation-timeline: view()) {
  .v-band-fill {
    animation: v-band-open linear both;
    animation-timeline: view();
    animation-range: entry 20% cover 55%;
  }
}
@supports not (animation-timeline: view()) {
  .v-band.v-armed .v-band-fill {
    transform: scaleX(0);
    transition: transform var(--d-slow) var(--ease-out);
  }
  .v-band.v-armed.is-in .v-band-fill { transform: scaleX(1); }
}

@keyframes v-band-open {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

.v-band-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: var(--accent);
  z-index: 2;
}

/* The same axis, second row: the distance from the point estimate (28) to the
   calendar age on the same card (31). 3 of 56 = 5.357%. Drawn to the same
   scale as the band above it, which is the entire argument of this section. */
.v-band-gap {
  position: relative;
  height: 8px;
  margin-top: 5px;
}

.v-band-gap i {
  position: absolute;
  left: 50%;
  width: 5.357%;
  min-width: 3px;
  height: 8px;
  border-radius: 2px;
  background: var(--text);
}

.v-band-span {
  position: relative;
  margin-top: var(--s4);
  display: flex;
  align-items: center;
  gap: var(--s3);
}

.v-band-span i {
  flex: 1;
  height: 1px;
  background: var(--hairline);
}

.v-band-span span {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.v-band-axis {
  display: flex;
  justify-content: space-between;
  margin-top: var(--s4);
  padding-top: var(--s3);
  border-top: 1px solid var(--hairline);
}

.v-band-axis span {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--meta);
  font-variant-numeric: tabular-nums;
}

/* ═══════════════════════════════════════════════════════════════════════════
   12 · THREE PALETTES — scoped theming, :root is never touched
   ═══════════════════════════════════════════════════════════════════════════ */

.v-palette {
  --fig-accent: var(--accent);
  --fig-card: var(--card);
  --fig-text: var(--text);
  --fig-bg: var(--bg);
  margin: var(--s7) 0 0;
  display: grid;
  justify-items: center;
  gap: var(--s5);
}

/* Values copied verbatim from Palette.graphite / Palette.indigo. */
.v-palette[data-theme="graphite"] {
  --fig-accent: #e6e8ea;
  --fig-card: #17191c;
  --fig-text: #c8cdd3;
  --fig-bg: #0e0f11;
}
.v-palette[data-theme="indigo"] {
  --fig-accent: #8fa0ff;
  --fig-card: #131829;
  --fig-text: #e8eaf4;
  --fig-bg: #0b0e1a;
}

.v-palette .v-mat {
  background: var(--fig-card);
  border-color: var(--hairline);
  transition: background var(--d-mid) var(--ease-out);
  display: block;
  width: min(304px, 82vw);
}

.v-palette-stack { display: grid; justify-items: center; }

.v-palette-shot {
  grid-area: 1 / 1;
  width: 100%;
  transition: opacity var(--d-mid) var(--ease-out);
}

.v-palette[data-theme="ember"]    .v-palette-shot:not([data-theme="ember"]),
.v-palette[data-theme="graphite"] .v-palette-shot:not([data-theme="graphite"]),
.v-palette[data-theme="indigo"]   .v-palette-shot:not([data-theme="indigo"]) {
  opacity: 0;
  pointer-events: none;
}

.v-pills {
  display: flex;
  gap: var(--s2);
  flex-wrap: wrap;
  justify-content: center;
}

.v-pill {
  appearance: none;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--meta);
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  padding: 0 16px;
  min-height: 44px;
  cursor: pointer;
  transition: color var(--d-fast) var(--ease-out), border-color var(--d-fast) var(--ease-out);
}

.v-pill:hover { border-color: var(--site-hairline-strong); }

.v-pill[aria-checked="true"] {
  color: var(--fig-text);
  border-color: var(--fig-accent);
}

.v-palette figcaption { text-align: center; }

.v-swatches {
  display: inline-flex;
  gap: 6px;
  vertical-align: middle;
  margin-inline-start: var(--s2);
}

.v-swatches i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  display: block;
}

/* ═══════════════════════════════════════════════════════════════════════════
   13 · WHAT IT DOESN'T DO — the block that replaces a logo wall
   ═══════════════════════════════════════════════════════════════════════════ */

.v-refusals { margin: var(--s7) 0 0; display: grid; }

.v-refusals > div {
  display: grid;
  gap: var(--s2) var(--s5);
  padding-block: var(--s5);
  border-block-start: 1px solid var(--hairline);
  align-items: baseline;
}

.v-refusals > div:last-child { border-block-end: 1px solid var(--hairline); }

@media (min-width: 720px) {
  .v-refusals > div { grid-template-columns: 240px minmax(0, 1fr); }
}

.v-refusals dt {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
  margin: 0;
}

.v-refusals dd {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  color: var(--dim);
}

/* ═══════════════════════════════════════════════════════════════════════════
   14 · CTA + FOOTER
   ═══════════════════════════════════════════════════════════════════════════ */

.v-cta { display: grid; gap: var(--s4); justify-items: start; }
.v-cta .v-cta-row { margin-top: var(--s3); }

/* Apple's official badge is a complete, self-contained button graphic —
   Apple's own guidelines forbid adding a border, background or padding
   around it, so this is deliberately NOT a .btn. min-height keeps the tap
   target at the same 44px floor as every other control on the page. */
.v-appstore-badge {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.v-appstore-badge img { display: block; height: 44px; width: auto; }

.v-foot {
  border-top: 1px solid var(--hairline);
  padding-block: var(--s7) var(--s8);
}

.v-foot-note { max-width: 68ch; }

.v-foot-row {
  margin-top: var(--s6);
  padding-top: var(--s5);
  border-top: 1px solid var(--hairline);
  display: flex;
  justify-content: space-between;
  gap: var(--s4);
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--meta);
}

.v-foot-row a { color: var(--meta); text-decoration: none; }
.v-foot-row a:hover { color: var(--accent); }

/* ═══════════════════════════════════════════════════════════════════════════
   15 · MOTION — scroll-TRIGGERED one-shot entrances
   Translate distance is 12px. Not 40, not 80. The page must not heave.
   ═══════════════════════════════════════════════════════════════════════════ */

/* .v-reveal on its own is VISIBLE. It only hides once site.js adds .v-armed,
   and site.js only arms elements that are still below the fold — so there is
   no flash, no CLS, and a page with JS disabled is simply complete. */
.v-reveal.v-armed {
  opacity: 0;
  transform: translateY(12px);
  transition:
    opacity var(--d-slow) var(--ease-out),
    transform var(--d-slow) var(--ease-out);
  transition-delay: calc(var(--i, 0) * var(--stagger));
}

.v-reveal.v-armed.is-in {
  opacity: 1;
  transform: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   16 · prefers-reduced-motion — a complete page, not a degraded one
   Acceptance test: screenshot both. Neither may look like the other's leftovers.
   ═══════════════════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
  /* Entrances: gone. site.js also declines to arm anything when this matches,
     so these are belt and braces rather than the only guard. */
  .v-reveal,
  .v-reveal.v-armed {
    opacity: 1;
    transform: none;
    transition: none;
  }

  /* Progress rule: gone. */
  .v-progress { display: none; }

  /* The Inputs Switch becomes a static diptych — arguably the better layout,
     which is the point. Both frames, both captions, no control. */
  .v-switch { display: none; }

  .v-hero-fig {
    grid-template-columns: minmax(0, 1fr);
    justify-items: start;
    gap: var(--s6);
  }
  .v-frame {
    grid-area: auto;
    transition: none;
  }
  /* The base state rules are .v-hero-fig[data-state="…"] .v-frame[data-frame="…"]
     at (0,3,0). An override has to MATCH that specificity to win on source
     order — (0,2,0) silently loses, which is exactly what happened here and
     left the diptych showing one frame. */
  .v-hero-fig[data-state="empty"] .v-frame[data-frame],
  .v-hero-fig[data-state="full"] .v-frame[data-frame] {
    opacity: 1;
    pointer-events: auto;
  }
  .v-frame .v-cap { display: block; }
  .v-frame .v-mat { width: min(304px, 82vw); }

  /* The animated hero puts the figure in a 380px column, which cannot hold two
     frames. Reduced motion gets its own layout: full-width head, diptych under
     it. This is the "arguably better, not obviously stripped" test. */
  @media (min-width: 900px) {
    .v-hero-grid { grid-template-columns: minmax(0, 1fr); }
    .v-hero-fig {
      grid-template-columns: repeat(2, minmax(0, max-content));
      justify-content: start;
      align-items: start;
      gap: var(--s7);
    }
    .v-frame .v-mat { width: 304px; }
    .v-frame .v-cap { max-width: 304px; }
  }

  /* Four tabs: static, all copy at full opacity, four inline figures. */
  .v-tabs-fig { display: none; }
  .v-tab-inline { display: grid; justify-items: start; }
  .v-tab-inline .v-plate { width: min(304px, 78vw); }
  .v-tab-block { min-height: 0; display: grid; gap: var(--s5); }
  .v-tab-copy,
  .v-tabs.v-armed .v-tab-copy { opacity: 1; animation: none; transition: none; }

  @media (min-width: 1024px) {
    .v-tabs { grid-template-columns: minmax(0, 1fr); }
    .v-tab-list { grid-column: 1; }
    .v-tab-block { grid-template-columns: min(304px, 34%) minmax(0, 1fr); gap: var(--s6); align-items: start; }
  }

  /* ± band: drawn at full extent immediately, labels visible. */
  .v-band-fill,
  .v-band.v-armed .v-band-fill { transform: scaleX(1); animation: none; transition: none; }

  /* Palette figure: pills still work, the crossfade becomes an instant swap. */
  .v-palette-shot,
  .v-tab-plate,
  .v-palette .v-mat { transition: none; }

  /* Kept: user-initiated colour and border transitions ≤160ms, no transform.
     Focus rings are never suppressed. */
  .v-switch-thumb { transition: none; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   17 · NARROW-END REPAIRS (320px is a real device with a real user)
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 419px) {
  .v-nav-in { gap: var(--s3); }
  .v-formula { padding: var(--s4); font-size: 12px; }
  .v-stat-row { gap: var(--s5) var(--s6); }
  .v-band-span span { font-size: 11px; }
  .v-hero-cta .v-cta-row { width: 100%; }
  .v-hero-cta .btn { width: 100%; justify-content: center; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   18 · UTILITIES — last in the file on purpose, so they beat the component
   rules above on source order rather than on !important.

   These exist because the page ships ZERO inline style attributes: the
   `_headers` CSP (DESIGN.md §12.4) sets `style-src 'self'`, which blocks
   style="…" attributes exactly as it blocks a <style> block. A page whose
   pitch is "no external requests" should be provably enforceable, and that
   means the markup has to survive its own policy.
   ═══════════════════════════════════════════════════════════════════════════ */

.v-d1 { --i: 1; }
.v-d2 { --i: 2; }
.v-d3 { --i: 3; }
.v-d4 { --i: 4; }

.v-mt3 { margin-top: var(--s3); }
.v-mt4 { margin-top: var(--s4); }
.v-mt5 { margin-top: var(--s5); }
.v-mt6 { margin-top: var(--s6); }
.v-mt7 { margin-top: var(--s7); }
.v-mb6 { margin-block: var(--s6); }

.v-w52 { max-width: 52ch; }
.v-w64 { max-width: 64ch; }
.v-w68 { max-width: 68ch; }
.v-w72 { max-width: 72ch; }

.v-bright { color: var(--text); }

.v-sw-deep { background: var(--deep); }
.v-sw-core { background: var(--core); }
.v-sw-rem  { background: var(--rem); }
.v-sw-resp { background: var(--resp); }
