/*
 * vialmetry.app — Direction A "Calibrated".
 *
 * Colours are the app's own palettes (src/ui/theme.ts): three schemes, each in
 * light and dark, chosen on <html data-scheme data-mode> by theme.js. Without
 * JavaScript the page is Spruce and follows the system light/dark setting.
 */

@font-face { font-family: "Instrument Serif"; src: url("/assets/fonts/instrument-serif-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("/assets/fonts/instrument-sans-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("/assets/fonts/instrument-sans-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("/assets/fonts/instrument-sans-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("/assets/fonts/instrument-sans-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/assets/fonts/jetbrains-mono-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/assets/fonts/jetbrains-mono-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

/* ---------- colour ---------- */

:root, html[data-scheme="spruce"] {
  --ground: #F3F6F4; --surface: #FFFFFF; --raised: #FFFFFF; --alt: #EAF0EE;
  --ink: #0B1D1A; --ink-soft: #3B4F4B; --ink-faint: #566A66;
  --line: #DDE5E2; --line-strong: #B9C7C3;
  --accent: #00766B; --accent-pressed: #005A52; --accent-soft: #E1F3EF; --accent-on: #FFFFFF;
  --hero: #013229; --hero-accent: #4FE0C6;
}
html[data-scheme="amber"] {
  --ground: #F5F3EE; --surface: #FFFEFB; --raised: #FFFFFF; --alt: #ECE8DF;
  --ink: #172027; --ink-soft: #46545D; --ink-faint: #64717A;
  --line: #D7D0C4; --line-strong: #B7AEA0;
  --accent: #8A4B08; --accent-pressed: #6B3804; --accent-soft: #F5E4C8; --accent-on: #FFFFFF;
  --hero: #2B1A08; --hero-accent: #F2B45F;
}
html[data-scheme="indigo"] {
  --ground: #F4F4F8; --surface: #FEFEFF; --raised: #FFFFFF; --alt: #E8E8F0;
  --ink: #1C1D2B; --ink-soft: #4D4F63; --ink-faint: #6B6D81;
  --line: #D3D3E1; --line-strong: #B5B5CA;
  --accent: #4D4AA1; --accent-pressed: #3C397F; --accent-soft: #E4E4F7; --accent-on: #FFFFFF;
  --hero: #1B1A46; --hero-accent: #AFAFFF;
}
:root {
  --resting: #B4541F; --nearly: #806200; --ready: #17675C;
  --stopper: var(--ink); --cap: var(--accent-pressed); --hero-ink: #F4F7F6;
  --shadow: 0 1px 0 rgba(11, 29, 26, 0.04), 0 8px 24px rgba(11, 29, 26, 0.07);
  --shadow-strong: 0 1px 0 rgba(11, 29, 26, 0.05), 0 18px 48px rgba(11, 29, 26, 0.10);
  color-scheme: light;
}

/* Dark: chosen explicitly, or following the system when no choice is stored. */
html[data-mode="dark"], html[data-mode="dark"][data-scheme="spruce"] {
  --ground: #06110E; --surface: #0E1E1A; --raised: #132621; --alt: #183029;
  --ink: #EAF2EF; --ink-soft: #B7C8C3; --ink-faint: #8FA7A1;
  --line: #1F3530; --line-strong: #2F4A44;
  --accent: #4FE0C6; --accent-pressed: #34C7AD; --accent-soft: #16332D; --accent-on: #04221C;
}
html[data-mode="dark"][data-scheme="amber"] {
  --ground: #0D1115; --surface: #151B20; --raised: #1A2228; --alt: #202A31;
  --ink: #F1F5F7; --ink-soft: #BCC7CD; --ink-faint: #91A0A8;
  --line: #303C44; --line-strong: #46545D;
  --accent: #F2B45F; --accent-pressed: #D99A44; --accent-soft: #382918; --accent-on: #2B1803;
}
html[data-mode="dark"][data-scheme="indigo"] {
  --ground: #0E0E18; --surface: #171724; --raised: #1E1E2D; --alt: #262638;
  --ink: #F3F2FA; --ink-soft: #C3C1D3; --ink-faint: #9694AA;
  --line: #353449; --line-strong: #4B4A62;
  --accent: #AFAFFF; --accent-pressed: #9696EA; --accent-soft: #2C2B4B; --accent-on: #1B1A46;
}
html[data-mode="dark"] {
  --resting: #FFA26E; --nearly: #F1C75B; --ready: #6DD5C4;
  --stopper: var(--ink-faint); --cap: var(--accent);
  --hero: var(--raised); --hero-ink: var(--ink);
  --shadow: none; --shadow-strong: none;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  html:not([data-mode]) {
    --ground: #06110E; --surface: #0E1E1A; --raised: #132621; --alt: #183029;
    --ink: #EAF2EF; --ink-soft: #B7C8C3; --ink-faint: #8FA7A1;
    --line: #1F3530; --line-strong: #2F4A44;
    --accent: #4FE0C6; --accent-pressed: #34C7AD; --accent-soft: #16332D; --accent-on: #04221C;
    --resting: #FFA26E; --nearly: #F1C75B; --ready: #6DD5C4;
    --stopper: var(--ink-faint); --cap: var(--accent); --hero: var(--raised); --hero-ink: var(--ink);
    --shadow: none; --shadow-strong: none;
    color-scheme: dark;
  }
}

/* ---------- base ---------- */

*, *::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(--ground);
  color: var(--ink);
  font: 17px/1.6 "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-pressed); }
img { max-width: 100%; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.skip { position: absolute; left: -9999px; top: 8px; }
.skip:focus { left: 16px; z-index: 10; background: var(--raised); padding: 10px 16px; border-radius: 10px; }
.wrap { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 80px; }
.eyebrow { margin: 0; font: 500 13px/1.4 "JetBrains Mono", ui-monospace, monospace; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
.serif { font-family: "Instrument Serif", Georgia, serif; font-weight: 400; }
.mono { font-family: "JetBrains Mono", ui-monospace, monospace; }
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }
h1, h2, h3 { margin: 0; }
.display { font: 400 104px/0.98 "Instrument Serif", Georgia, serif; letter-spacing: -2px; }
.h2 { font: 400 64px/1 "Instrument Serif", Georgia, serif; letter-spacing: -1px; }
.lede { margin: 0; font-size: 21px; line-height: 1.55; color: var(--ink-soft); }

/* ---------- buttons ---------- */

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 26px; border-radius: 999px; font-weight: 600; font-size: 17px; text-decoration: none; border: 1px solid transparent; }
.btn-primary { background: var(--accent); color: var(--accent-on); }
.btn-primary:hover { background: var(--accent-pressed); color: var(--accent-on); }
.btn-quiet { border-color: var(--line-strong); color: var(--ink); }
.btn-quiet:hover { background: var(--alt); color: var(--ink); }

/* ---------- header ---------- */

.site-header { border-bottom: 1px solid var(--line); background: var(--ground); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 84px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); }
.brand-mark { width: 18px; height: 42px; }
.brand-mark g { stroke: var(--accent); }
.brand-mark circle { fill: var(--accent); }
.brand-name { font: 400 30px/1 "Instrument Serif", Georgia, serif; letter-spacing: -0.2px; }
.nav { display: flex; gap: 28px; font-weight: 500; font-size: 16px; }
.nav a { color: var(--ink-soft); text-decoration: none; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); text-decoration: underline; }
.header-actions { display: flex; align-items: center; gap: 12px; }

.picker { display: flex; align-items: center; gap: 2px; padding: 2px 6px; border-radius: 999px; background: var(--alt); }
.picker button { width: 44px; height: 44px; padding: 0; border: 0; background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--ink); border-radius: 999px; }
.swatch { width: 22px; height: 22px; border-radius: 999px; }
.swatch-amber { background: #8A4B08; }
.swatch-spruce { background: #00766B; }
.swatch-indigo { background: #4D4AA1; }
.picker button[aria-pressed="true"] .swatch { box-shadow: 0 0 0 2px var(--alt), 0 0 0 4px var(--ink); }
.picker .mode-icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-moon { display: block; }
.icon-sun { display: none; }
html[data-mode="dark"] .icon-moon { display: none; }
html[data-mode="dark"] .icon-sun { display: block; }
.picker .no-js { display: none; }

.menu { display: none; position: relative; }
.menu summary { list-style: none; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; cursor: pointer; border-radius: 12px; }
.menu summary::-webkit-details-marker { display: none; }
.menu summary svg { width: 22px; height: 22px; fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; }
.menu nav { position: absolute; right: 0; top: 52px; z-index: 5; min-width: 240px; padding: 8px; border-radius: 18px; background: var(--raised); box-shadow: var(--shadow-strong); border: 1px solid var(--line); display: flex; flex-direction: column; }
.menu nav a { display: flex; align-items: center; min-height: 48px; padding: 0 14px; border-radius: 12px; color: var(--ink); text-decoration: none; font-weight: 500; }
.menu nav a:hover { background: var(--alt); }

/* ---------- home: hero ---------- */

.hero { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 64px; align-items: center; padding: 96px 0 112px; }
.hero-copy { display: flex; flex-direction: column; gap: 28px; }
.hero-copy .lede { max-width: 560px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.fine { margin: 0; font-size: 14px; color: var(--ink-faint); }

.calc { background: var(--raised); border-radius: 28px; padding: 40px; display: flex; flex-direction: column; gap: 20px; box-shadow: var(--shadow-strong); border: 1px solid transparent; }
html[data-mode="dark"] .calc { border-color: var(--line); }
.calc-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font: 500 12px/1.4 "JetBrains Mono", monospace; letter-spacing: 0.08em; color: var(--ink-faint); }
.calc-units { font-size: 120px; line-height: 0.9; font-weight: 600; letter-spacing: -4px; font-variant-numeric: tabular-nums; }
.calc-units small { font-size: 32px; letter-spacing: 0; color: var(--ink-soft); font-weight: 500; }
.syringe { width: 100%; height: auto; display: block; touch-action: pan-y; cursor: ew-resize; user-select: none; }
.calc label { font-size: 14px; font-weight: 600; color: var(--ink-soft); }
.calc input[type="range"] { width: 100%; height: 32px; accent-color: var(--accent); margin: 0; }
.readouts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.readout { border-radius: 16px; padding: 16px 18px; background: var(--alt); }
.readout-accent { background: var(--accent-soft); }
.readout > span { display: block; font: 500 11px/1.4 "JetBrains Mono", monospace; letter-spacing: 0.08em; color: var(--ink-soft); }
.readout strong { font-size: 32px; font-weight: 600; font-variant-numeric: tabular-nums; }
.readout strong small { font-size: 15px; font-weight: 500; color: var(--ink-soft); }
.working { margin: 0; font: 500 14px/1.5 "JetBrains Mono", monospace; color: var(--ink-soft); overflow-wrap: anywhere; }

/* Syringe drawing */
.s-needle { stroke: var(--ink-faint); stroke-width: 1.5; stroke-linecap: round; }
.s-hub { fill: var(--alt); stroke: var(--line-strong); stroke-width: 1.2; }
.s-barrel { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1.4; }
.s-fill { fill: var(--accent); fill-opacity: 0.24; }
html[data-mode="dark"] .s-fill { fill-opacity: 0.34; }
.s-tick { stroke: var(--ink-soft); }
.s-label { font: 500 10px "JetBrains Mono", monospace; fill: var(--ink-soft); }
.s-label.is-mark { fill: var(--accent); }
.s-flange, .s-thumb, .s-rod { fill: var(--line-strong); }
.s-stopper { fill: var(--stopper); }
.s-grip { stroke: var(--surface); stroke-width: 1.2; stroke-linecap: round; opacity: 0.7; }
.s-marker { stroke: var(--accent); stroke-width: 3; stroke-linecap: round; }
.s-mark-label { font: 700 13px "JetBrains Mono", monospace; fill: var(--accent); }

/* ---------- sections ---------- */

.band { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section { padding: 112px 0; }
.split { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 32px; align-items: center; }
.split-copy { grid-column: span 5; display: flex; flex-direction: column; gap: 24px; }
.split-copy p { margin: 0; font-size: 19px; line-height: 1.6; color: var(--ink-soft); }
.split-art { grid-column: 7 / span 6; }

.legend { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 24px; font-size: 16px; }
.legend li { display: flex; align-items: center; gap: 10px; }
.legend svg { width: 22px; height: 22px; flex: none; }

.figures { display: flex; justify-content: center; gap: 40px; }
.figures figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.figures figcaption { font: 500 12px/1.4 "JetBrains Mono", monospace; letter-spacing: 0.08em; color: var(--ink-faint); }
.body-map { width: 300px; height: auto; }
.figure-switch { display: none; }
#fig-female, #fig-male { position: absolute; opacity: 0; pointer-events: none; }
.b-body { fill: var(--alt); stroke: var(--line-strong); stroke-width: 1.4; stroke-linejoin: round; }
.b-detail { fill: none; stroke: var(--line-strong); stroke-width: 1; stroke-linecap: round; opacity: 0.55; }
.b-mid { fill: none; stroke: var(--line-strong); stroke-width: 0.9; stroke-dasharray: 3 4; opacity: 0.5; }
.b-navel { fill: var(--line-strong); opacity: 0.8; }
.b-ring-base { fill: var(--raised); stroke: var(--line); stroke-width: 1.9; }
.b-ring { fill: none; stroke-width: 1.9; stroke-linecap: round; }
.b-suggest { fill: none; stroke: var(--accent); stroke-width: 1.25; stroke-dasharray: 3 2.4; }
.st-resting { stroke: var(--resting); } .sf-resting { fill: var(--resting); }
.st-nearly { stroke: var(--nearly); } .sf-nearly { fill: var(--nearly); }
.st-ready { stroke: var(--ready); } .sf-ready { fill: var(--ready); }
.gs-resting { stop-color: var(--resting); } .gs-nearly { stop-color: var(--nearly); } .gs-ready { stop-color: var(--ready); }

.features-head { display: flex; flex-direction: column; gap: 16px; max-width: 760px; margin-bottom: 48px; }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.card { background: var(--raised); border-radius: 24px; padding: 32px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow); border: 1px solid transparent; }
html[data-mode="dark"] .card { border-color: var(--line); }
.card h3 { font-size: 22px; font-weight: 600; }
.card p { margin: 0; font-size: 16px; line-height: 1.6; color: var(--ink-soft); }
.card .tag { margin: 0; font: 500 13px/1.4 "JetBrains Mono", monospace; letter-spacing: 0.06em; color: var(--ink-soft); }
.card .big { margin: 0; font: 700 28px/1.2 "JetBrains Mono", monospace; color: var(--accent); }
.vial-row { display: flex; align-items: flex-end; gap: 16px; }
.vial { width: 44px; height: auto; }
.v-cap { fill: var(--cap); } .v-crimp { fill: var(--line-strong); }
.v-liquid { fill: var(--accent); fill-opacity: 0.3; } .v-level { stroke: var(--accent); stroke-width: 1.6; }
.v-glass { fill: none; stroke: var(--line-strong); stroke-width: 1.4; }
.v-grad { stroke: var(--ink-faint); stroke-width: 0.9; }

.math { margin: 0 auto; border-radius: 32px; padding: 72px; background: var(--hero); color: var(--hero-ink); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 64px; align-items: center; }
.math .eyebrow, .math a { color: var(--hero-accent); }
.math h2 { font: 400 60px/1.02 "Instrument Serif", Georgia, serif; }
.math p { margin: 0; font-size: 18px; line-height: 1.6; opacity: 0.88; }
.math-copy { display: flex; flex-direction: column; gap: 20px; }
.formulas { display: flex; flex-direction: column; gap: 14px; font: 500 20px/1.4 "JetBrains Mono", monospace; }
.formulas div { padding: 20px 24px; border-radius: 16px; background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.14); }

/* ---------- download ---------- */

.qr-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.qr-card { background: var(--raised); border-radius: 24px; padding: 28px; display: flex; flex-direction: column; gap: 16px; align-items: center; text-align: center; box-shadow: var(--shadow); border: 1px solid transparent; }
html[data-mode="dark"] .qr-card { border-color: var(--line); }
.qr-card img.qr { width: 200px; height: 200px; border-radius: 12px; background: #FFFFFF; }
.qr-card strong { font-size: 18px; }
.badge { height: 48px; width: auto; display: block; }
.badge-big { height: 60px; }
.soon { border-radius: 16px; background: var(--accent-soft); padding: 14px 16px; font-size: 15px; line-height: 1.5; color: var(--ink); }
.soon strong { display: block; font-size: 16px; }
.phone-store { display: none; flex-direction: column; gap: 16px; background: var(--raised); border-radius: 24px; padding: 24px 20px; box-shadow: var(--shadow); border: 1px solid transparent; }
html[data-mode="dark"] .phone-store { border-color: var(--line); }
.device-line { display: flex; align-items: center; gap: 8px; }
.device-line svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.phone-store h3 { font: 400 36px/1.05 "Instrument Serif", Georgia, serif; }
.phone-store p { margin: 0; font-size: 15px; line-height: 1.55; color: var(--ink-soft); }
.other-store { display: flex; align-items: center; min-height: 44px; font-weight: 600; font-size: 15px; }
.qr-more { border-top: 1px solid var(--line); padding-top: 4px; }
.qr-more summary { min-height: 48px; display: flex; align-items: center; justify-content: space-between; cursor: pointer; font-weight: 600; font-size: 15px; list-style: none; }
.qr-more summary::-webkit-details-marker { display: none; }
.qr-more summary::after { content: "+"; color: var(--accent); font-size: 20px; }
.qr-more[open] summary::after { content: "\2212"; }
.qr-more .qr-grid { gap: 12px; padding: 8px 0 4px; }
.qr-more img { width: 132px; height: 132px; border-radius: 8px; background: #FFFFFF; }
.qr-more figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-soft); }

/* Which store the visitor sees: theme.js sets data-device from the browser.
   Without it (no JavaScript), phones see both stores and no QR codes. */
.for-ios, .for-android { display: none; }
html[data-device="ios"] .for-ios, html[data-device="android"] .for-android { display: revert; }
html[data-device="ios"] .for-other, html[data-device="android"] .for-other { display: none; }
html[data-device="ios"] .phone-store, html[data-device="android"] .phone-store { display: flex; }
html[data-device="ios"] .desktop-store, html[data-device="android"] .desktop-store { display: none; }

/* ---------- questions teaser ---------- */

.q-list { display: flex; flex-direction: column; }
.q-list a { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 64px; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; font-size: 19px; font-weight: 500; }
.q-list a:last-child { border-bottom: 1px solid var(--line); }
.q-list a span { color: var(--accent); }

/* ---------- footer ---------- */

.site-footer { border-top: 1px solid var(--line); background: var(--surface); padding: 56px 0; font-size: 15px; color: var(--ink-soft); }
.site-footer .wrap { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 32px; }
.foot-about { grid-column: span 5; display: flex; flex-direction: column; gap: 12px; }
.foot-about p { margin: 0; line-height: 1.6; }
.foot-links { grid-column: 7 / span 3; display: flex; flex-direction: column; gap: 10px; }
.foot-links a { color: var(--ink); }
.foot-legal { grid-column: 10 / span 3; display: flex; flex-direction: column; gap: 10px; font-size: 12px; line-height: 1.5; color: var(--ink-faint); }

/* ---------- inner pages ---------- */

.page { max-width: 760px; margin: 0 auto; padding: 64px 0 96px; }
.page h1 { font: 400 56px/1.02 "Instrument Serif", Georgia, serif; letter-spacing: -1px; margin: 0 0 16px; }
.page .brand-line { margin: 0 0 12px; }
.prose h2 { font-size: 24px; font-weight: 600; line-height: 1.3; margin: 48px 0 12px; }
.prose h3 { font-size: 18px; font-weight: 600; margin: 24px 0 8px; }
.prose p, .prose ul, .prose ol { margin: 0 0 16px; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li { margin: 6px 0; }
.prose > .brand { display: none; }
.prose .meta { color: var(--ink-soft); font-size: 15px; margin: 0; }
.prose .lede { font-size: 19px; margin-bottom: 32px; }
.prose header { border-bottom: 1px solid var(--line); padding-bottom: 20px; margin-bottom: 32px; }
.prose header .brand { display: none; }
.prose header h1 { margin-bottom: 8px; }
.prose .summary { background: var(--accent-soft); border-radius: 20px; padding: 20px 24px; margin: 0 0 32px; }
.prose .summary h2 { margin-top: 0; font-size: 18px; }
.prose .summary > :last-child { margin-bottom: 0; }
.prose .note { background: var(--raised); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 12px; padding: 14px 18px; margin: 16px 0 20px; }
.prose .note > :last-child { margin-bottom: 0; }
.prose .formula { background: var(--raised); border: 1px solid var(--line); border-radius: 14px; padding: 16px 20px; margin: 0 0 16px; overflow-x: auto; font: 500 15px/1.7 "JetBrains Mono", monospace; }
.prose table { width: 100%; border-collapse: collapse; margin: 0 0 20px; font-size: 15px; }
.prose th, .prose td { text-align: left; vertical-align: top; padding: 10px 8px; border-bottom: 1px solid var(--line); }
.prose th { color: var(--ink-soft); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; }
.prose .table-wrap { overflow-x: auto; }
.prose code { background: var(--raised); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; font: 500 0.9em "JetBrains Mono", monospace; }
.prose nav.toc { font-size: 15px; margin: 0 0 32px; }
.prose nav.toc ol { columns: 2; column-gap: 32px; }
.prose .steps li::marker { color: var(--accent); font-weight: 700; }

.panel { background: var(--raised); border-radius: 24px; padding: 28px; margin: 0 0 20px; box-shadow: var(--shadow); border: 1px solid transparent; }
html[data-mode="dark"] .panel { border-color: var(--line); }
.panel h2 { font-size: 22px; font-weight: 600; margin: 0 0 10px; }
.panel p { margin: 0 0 10px; color: var(--ink-soft); }
.panel > :last-child { margin-bottom: 0; }
.panel-accent { background: var(--accent-soft); box-shadow: none; }
.big-link { font-weight: 600; font-size: 17px; }

/* FAQ */
.search { display: flex; flex-direction: column; gap: 8px; margin: 24px 0 16px; }
.search label { font: 500 12px/1.4 "JetBrains Mono", monospace; letter-spacing: 0.08em; color: var(--ink-soft); text-transform: uppercase; }
.search input { height: 56px; border-radius: 16px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); padding: 0 18px; font: 17px "Instrument Sans", sans-serif; }
.search-status { margin: 0 0 16px; font-size: 14px; color: var(--ink-soft); min-height: 20px; }
.topics { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 32px; padding: 0; list-style: none; }
.topics a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; border-radius: 999px; background: var(--alt); color: var(--ink); text-decoration: none; font-size: 15px; font-weight: 600; }
.topics a:hover { background: var(--accent-soft); }
.faq-topic { background: var(--raised); border-radius: 24px; padding: 12px 24px; margin: 0 0 20px; box-shadow: var(--shadow); border: 1px solid transparent; scroll-margin-top: 16px; }
html[data-mode="dark"] .faq-topic { border-color: var(--line); }
.faq-topic h2 { margin: 16px 0 4px; font: 500 12px/1.4 "JetBrains Mono", monospace; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.faq-topic details { border-top: 1px solid var(--line); scroll-margin-top: 16px; }
.faq-topic details:first-of-type { border-top: 0; }
.faq-topic summary { min-height: 60px; padding: 10px 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; font-weight: 600; font-size: 17px; list-style: none; }
.faq-topic summary::-webkit-details-marker { display: none; }
.faq-topic summary::after { content: "+"; color: var(--accent); font-size: 22px; flex: none; }
.faq-topic details[open] summary::after { content: "\2212"; }
.faq-topic details p { margin: 0 0 14px; color: var(--ink-soft); line-height: 1.65; }
.faq-topic [hidden] { display: none; }

/* ---------- narrow screens ---------- */

@media (max-width: 1100px) {
  .wrap { padding: 0 40px; }
  .display { font-size: 80px; }
  .hero { grid-template-columns: minmax(0, 1fr); gap: 48px; padding: 64px 0 80px; }
  .split-copy, .split-art { grid-column: 1 / -1; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .math { grid-template-columns: minmax(0, 1fr); padding: 48px; gap: 32px; }
  .foot-about { grid-column: span 12; }
  .foot-links { grid-column: span 6; }
  .foot-legal { grid-column: span 6; }
}

@media (max-width: 760px) {
  body { font-size: 16px; }
  .wrap { padding: 0 16px; }
  .site-header .wrap { min-height: 64px; gap: 8px; }
  .brand-name { font-size: 26px; }
  .brand-mark { display: none; }
  .nav, .header-actions .btn { display: none; }
  .menu { display: block; }
  /* On phones the colour choice lives on the home page only; every other
     page keeps whatever was chosen there. */
  body:not(.home) .picker { display: none; }
  .picker { padding: 0; background: transparent; }
  .picker .swatch { width: 18px; height: 18px; }
  .eyebrow { font-size: 11px; }
  .display { font-size: 52px; letter-spacing: -1px; }
  .h2 { font-size: 40px; }
  .lede { font-size: 17px; }
  .hero { padding: 40px 0 48px; gap: 32px; }
  .hero-actions .btn { width: 100%; }
  .calc { padding: 20px; border-radius: 24px; gap: 12px; }
  .calc-units { font-size: 72px; letter-spacing: -3px; }
  .calc-units small { font-size: 22px; }
  .readout strong { font-size: 24px; }
  .working { font-size: 12px; }
  .section { padding: 56px 0; }
  .split-copy p { font-size: 16px; }
  .legend { font-size: 15px; }
  .figure-switch { display: flex; padding: 4px; border-radius: 999px; background: var(--alt); border: 0; margin: 0; }
  .figure-switch legend { position: absolute; left: -9999px; }
  .figure-switch label { flex: 1; min-height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 999px; font-weight: 600; cursor: pointer; border: 1px solid transparent; }
  #fig-female:checked ~ .figure-switch label[for="fig-female"],
  #fig-male:checked ~ .figure-switch label[for="fig-male"] { background: var(--raised); border-color: var(--accent); }
  #fig-female:focus-visible ~ .figure-switch label[for="fig-female"],
  #fig-male:focus-visible ~ .figure-switch label[for="fig-male"] { outline: 3px solid var(--accent); outline-offset: 2px; }
  #fig-female:checked ~ .figures .fig-male, #fig-male:checked ~ .figures .fig-female { display: none; }
  .figures { padding: 16px; border-radius: 24px; background: var(--surface); }
  .body-map { width: 260px; }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 24px; }
  .math { padding: 32px 24px; border-radius: 24px; }
  .math h2 { font-size: 40px; }
  .formulas { font-size: 15px; }
  .formulas div { padding: 14px 16px; }
  .qr-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .q-list a { font-size: 16px; min-height: 56px; }
  .page { padding: 32px 0 64px; }
  .page h1 { font-size: 40px; }
  .prose nav.toc ol { columns: 1; }
  .site-footer .wrap { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .foot-about, .foot-links, .foot-legal { grid-column: auto; }
}

/* Phones without JavaScript: QR codes cannot be scanned from the phone
   holding them, so show the store buttons only (PromptSpend's rule). */
@media (max-width: 760px), (hover: none) {
  html:not([data-device]) .desktop-store .qr { display: none; }
}
