/* ==========================================================================
   AFTER — one stylesheet, served from public/ verbatim.

   Why not Astro scoped styles: on this machine Astro 5.18.2's Vite style
   plugin emits no assets at all (no CSS, no client JS) in dev or build,
   while still stamping scope attributes. Files in public/ skip that
   pipeline. See TOOLING.md. Revisit if the toolchain is fixed.

   Palette rule (2026-08-28 decision): no green anywhere.
   Colour has jobs, not moods:
     ink       structure and body text
     cobalt    interactive — links, buttons, focus
     burgundy  emergency, and nothing else
     brass     position, and nothing else: the you-are-here dot on the rail and
               the section letter that opens each heading (Franck, 2026-09-11). It measures
               3.4:1 on paper, so it marks position and never carries text.
   ========================================================================== */

:root {
  --paper:        #FAF9F6;
  --panel:        #F0EFE9;
  --panel-hover:  #E8E7E0;
  --ink:          #14243D;
  --ink-deep:     #0E1A2D;
  --body:         #3E4652;
  --muted:        #5D6068;
  --faint:        #6B6C66; /* was #8A8B85 — 3.3:1, failed AA */
  --rule:         #E6E4DD;
  --rule-strong:  #D6D4CC;

  --cobalt:       #1B4FA8;
  --cobalt-deep:  #133A7C;

  --burgundy:     #741620;
  --burgundy-ink: #FBEFEF;
  --burgundy-soft:#E8B4B8; /* on burgundy: eyebrow text */
  --burgundy-deep:#5C111A; /* hover only */
  --burgundy-tint:#FBF1F1; /* warning panel ground */
  --burgundy-line:#E0BFC1; /* warning panel border */
  --burgundy-text:#741620; /* burgundy TEXT on the tint panel */

  --brass:        #B0862F; /* non-text use only */

  /* Severity ramp — gold to wine, for a rating the patient sets.
     A five-stop scale has four *fillable* segments (the first stop is "None"
     and never fills), so the ramp spans the full range in four; --sev-5 is
     spare, for a longer scale.
     UNRESOLVED: this ramp reuses both reserved colours. --sev-1 sits in
     --brass territory (#B0862F), which DESIGN.md gives one job, and --sev-4
     is a near neighbour of --burgundy (#741620), which is supposed to mean
     emergency and nothing else. Fills only, so the never-behind-text half of
     the brass rule still holds. See the note in DESIGN.md. */
  --sev-1:        #C7A15E; /* gold */
  --sev-2:        #C08243; /* amber */
  --sev-3:        #B4623A; /* orange */
  --sev-4:        #B03A22; /* orange-red — deliberately NOT wine, so it cannot
                              be mistaken for --burgundy #741620 on a page
                              where both appear. Hotter and lighter: hue 10°
                              vs 352°, lightness 41% vs 27%. */
  --sev-5:        #8F2D18; /* deeper, only for scales with 5 filled steps */

  --serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --sans:  'Public Sans', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;

  /* Body never drops below 16px: read one-handed, often by someone tired. */
  --t-eyebrow: 11.5px;
  --t-small:   13px;
  --t-meta:    14.5px;
  --t-body:    16.5px;
  --t-lede:    17px;
  --t-fine:    12.5px;  /* legal / meta only */
  --t-h4:      19px;
  --t-h3:      21px;
  --t-h2-sm:   25px;
  --t-h2:      27px;
  --t-h1:      38px;

  --gutter: 30px;

  /* Height of the condensed site bar. The rail pins below it; both were
     pinned to 0, which put the rail's letters and its brass position dot
     behind the bar on every guide. */
  --bar-h: 88px; /* fallback; measured emergency strip + menu header */
}

/* Reader-controlled text size, set on <html> by the footer control. */
html[data-textsize='larger'] {
  --bar-h: 96px;
  --t-eyebrow: 13px;
  --t-small: 14.5px;
  --t-meta:  16px;
  --t-body:  19px;
  --t-lede:  19px;
  --t-fine:  13.5px;
  --t-h4:    21px;
  --t-h3:    23px;
  /* the bar grows with the type scale */
  --t-h2-sm: 27px;
  --t-h2:    29px;
  --t-h1:    40px;
}

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

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--t-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--cobalt); text-decoration: none; }
a:hover { color: var(--cobalt-deep); }

/* WCAG 2.2 AA — focus must be visible and never clipped. */
:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 3px; }

img { max-width: 100%; height: auto; }

.shell { max-width: 460px; margin: 0 auto; background: var(--paper); }

.eyebrow {
  margin: 0;
  font-size: var(--t-eyebrow); font-weight: 600; letter-spacing: 0.22em;
  color: var(--faint); text-transform: uppercase;
}

.btn {
  min-height: 48px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 0 26px;
  background: var(--ink); color: var(--paper);
  font-size: var(--t-eyebrow); font-weight: 600; letter-spacing: 0.13em; text-transform: uppercase;
}
.btn:hover { background: var(--ink-deep); color: var(--paper); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
.skip:focus {
  position: fixed; top: 8px; left: 8px; z-index: 100;
  width: auto; height: auto; clip-path: none;
  padding: 12px 18px; background: var(--ink); color: var(--paper);
}

/* ============================================================== dark mode ===
   Only when the reader's phone asks for it — never a brand choice (decided
   2026-09-01). Someone reads this hours after discharge, in a dark room, and a
   full-brightness page is a real cost.

   Only the tokens change. Every component below inherits, which is the whole
   reason colour lives in tokens. Ratios below were computed against the dark
   ground, not assumed from the light theme — brass and burgundy in particular
   cannot simply be inverted. */

@media (prefers-color-scheme: dark) {
  /* :not([data-theme="light"]) lets an explicit light choice below win over
     the system's own dark preference. */
  :root:not([data-theme='light']) {
    color-scheme: dark;

    --paper:        #0F1520;  /* deep navy-black, same family as --ink */
    --panel:        #18202D;
    --panel-hover:  #212B3A;
    --ink:          #E8EAEE;  /* 15.9:1 on paper */
    --ink-deep:     #F4F5F7;
    --body:         #C8CDD6;  /* 11.6:1 */
    --muted:        #A2A9B5;  /*  7.8:1 */
    --faint:        #8D95A2;  /*  5.9:1 */
    --rule:         #26303E;
    --rule-strong:  #384454;

    --cobalt:       #8FB4EE;  /*  8.7:1 — links must lighten on dark */
    --cobalt-deep:  #B4CDF5;

    --burgundy:     #8E2130;  /* strip and E block keep their weight */
    --burgundy-ink: #FDF0F0;  /*  8.6:1 on burgundy */
    --burgundy-soft:#EFBCC0;
    --burgundy-deep:#A6293A;
    --burgundy-tint:#241419;  /* warning panel ground */
    --burgundy-line:#5C2A32;
    --burgundy-text:#F3A2A9;  /*  7.4:1 on the tint — the light value would vanish */

    --brass:        #C9A567;  /* marker only, still never text */

    /* Same gold-to-wine path, lifted for a dark ground. The light values
       would sit at 1.5:1 against #0F1520 and the low end would vanish. */
    --sev-1:        #C8A063; /* gold */
    --sev-2:        #CE8F55; /* amber */
    --sev-3:        #D2743F; /* orange */
    --sev-4:        #DC5A38; /* orange-red, clear of dark's --burgundy #8E2130 */
    --sev-5:        #C44A2C;
  }

  /* The takeaways rule reads as a hairline on light and as a bar on dark. */
  :root:not([data-theme='light']) .guide .takeaways { border-top-color: var(--cobalt); }

  /* A white-hot search field is the brightest thing on a night page. */
  :root:not([data-theme='light']) .search,
  :root:not([data-theme='light']) .compact .field { background: var(--panel); }
  :root:not([data-theme='light']) .search input { color: var(--ink); }

  /* The condensing bar's shadow was tuned for light ground. */
  @keyframes condense {
    to { border-bottom-color: var(--rule); box-shadow: 0 1px 12px rgba(0, 0, 0, .5); }
  }
}

/* ------------------------------------------------------- manual dark theme
   Same tokens as the media query above, applied when the reader has picked
   Dark explicitly (footer toggle) regardless of what their system prefers.
   Duplicated rather than shared: this file has no preprocessor (TOOLING.md),
   so there is no way to factor the token list out without one — keep both
   blocks in sync if either changes.

   Wrapped in `@media screen` on purpose: `:root[data-theme="dark"]` is more
   specific than the print reset's bare `:root` below, and would otherwise
   win the cascade and print dark. `@media screen` keeps it out of print
   entirely, so specificity never gets the chance to matter. */
@media screen {
  :root[data-theme='dark'] {
    color-scheme: dark;

    --paper:        #0F1520;
    --panel:        #18202D;
    --panel-hover:  #212B3A;
    --ink:          #E8EAEE;
    --ink-deep:     #F4F5F7;
    --body:         #C8CDD6;
    --muted:        #A2A9B5;
    --faint:        #8D95A2;
    --rule:         #26303E;
    --rule-strong:  #384454;

    --cobalt:       #8FB4EE;
    --cobalt-deep:  #B4CDF5;

    --burgundy:     #8E2130;
    --burgundy-ink: #FDF0F0;
    --burgundy-soft:#EFBCC0;
    --burgundy-deep:#A6293A;
    --burgundy-tint:#241419;
    --burgundy-line:#5C2A32;
    --burgundy-text:#F3A2A9;

    --brass:        #C9A567;

    --sev-1:        #C8A063; /* gold */
    --sev-2:        #CE8F55; /* amber */
    --sev-3:        #D2743F; /* orange */
    --sev-4:        #DC5A38; /* orange-red, clear of dark's --burgundy #8E2130 */
    --sev-5:        #C44A2C;
  }

  :root[data-theme='dark'] .guide .takeaways { border-top-color: var(--cobalt); }
  :root[data-theme='dark'] .search,
  :root[data-theme='dark'] .compact .field { background: var(--panel); }
  :root[data-theme='dark'] .search input { color: var(--ink); }
}

/* ---------------------------------------------------------------- site bar */

.site-chrome { position: sticky; top: 0; z-index: 30; background: var(--paper); }
.site-chrome .bar { border-bottom-color: var(--rule); }
@media print { .site-chrome { position: static; } }
.estrip {
  position: relative;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 44px; padding: 10px 16px;
  background: var(--burgundy); color: var(--burgundy-ink);
  font-size: var(--t-fine); font-weight: 600; letter-spacing: 0.02em;
}
.estrip a { color: var(--burgundy-ink); text-decoration: underline; text-underline-offset: 3px; }

.bar {
  position: relative; z-index: 20;
  background: var(--paper); border-bottom: 1px solid transparent;
}
.barpad { padding: 22px 24px 0; }
.brand {
  display: block; text-align: center;
  font-family: var(--serif); font-size: var(--t-h3); line-height: 1.5;
  letter-spacing: 0.34em; padding-left: 0.34em; color: var(--ink);
}
/* Wordmark: AFT plain, ER in burgundy (DECISIONS.md 2026-09-03). ER *is* the
   emergency the colour already means, so this is not a new job for burgundy.
   --burgundy-text is theme-aware (#741620 on paper, #F3A2A9 on night), so one
   rule covers both modes. Colour only — no italic. */
.brand-er, .sheet-brand .brand-er { color: var(--burgundy-text); }
.brand-author { margin: 8px 0 0; text-align: center; font-size: var(--t-fine); color: var(--muted); }
.bar[data-compact='true'] .brand-author { display: none; }
.nav {
  display: flex; align-items: center; justify-content: center;
  gap: 13px; flex-wrap: wrap; padding: 10px 10px 14px; overflow: hidden;
}
.nav a {
  min-height: 44px; display: flex; align-items: center;
  font-size: var(--t-eyebrow); font-weight: 600; letter-spacing: 0.055em;
  text-transform: uppercase; color: var(--ink); white-space: nowrap;
}
.nav a:hover { color: var(--cobalt); }

/* Appears as the bar condenses, so search and 911 stay in reach. */
.compact { display: flex; align-items: center; gap: 8px; padding: 0 16px; max-height: 0; opacity: 0; overflow: hidden; }
.compact .field {
  flex: 1; display: flex; align-items: center; gap: 10px;
  min-height: 42px; padding: 0 14px;
  background: var(--panel); color: var(--muted); font-size: var(--t-meta);
}
.compact .sos {
  display: flex; align-items: center; min-height: 42px; padding: 0 14px;
  background: var(--burgundy); color: var(--burgundy-ink);
  font-size: var(--t-eyebrow); font-weight: 600; letter-spacing: 0.08em;
}

/* A guide is entered from a card, not browsed — start it condensed. */
.bar[data-compact='true'] .nav { display: none; }
.bar[data-compact='true'] .compact { max-height: 60px; opacity: 1; padding-bottom: 12px; }
.bar[data-compact='true'] .barpad { padding-top: 14px; }
.bar[data-compact='true'] .brand { font-size: var(--t-meta); letter-spacing: 0.28em; }
.bar[data-compact='true'] { border-bottom-color: var(--rule); }

/* ------------------------------------------------------------------- rail */

.rail { width: 100%; display: flex; justify-content: space-between; gap: 4px; position: relative; }
.rail::before {
  content: ''; position: absolute; left: 9%; right: 9%; top: 34px;
  height: 1px; background: var(--rule-strong); transform-origin: left center;
}
.rail .step {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 9px;
  position: relative; min-height: 44px; color: var(--ink);
}
.rail a.step:hover .ltr { color: var(--cobalt); }
.guide .rail .step { min-width: 0; }
.guide .rail small { max-width: 100%; overflow-wrap: anywhere; }
.rail .ltr { font-family: var(--serif); font-size: var(--t-h3); line-height: 1; }
.rail .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--rule-strong); box-shadow: 0 0 0 4px var(--paper); }
.rail small { font-size: var(--t-eyebrow); letter-spacing: 0.06em; color: var(--muted); text-align: center; line-height: 1.3; }

.rail a.step[aria-current='true'] .dot { background: var(--brass); }
/* R leads off the page to the recovery tool: the only step that is a link
   everywhere, including the homepage. Cobalt letter says "this goes somewhere". */
.rail .step-r .ltr { color: var(--cobalt); }
.rail .step-r:hover .ltr { color: var(--cobalt-deep); }
.rail a.step[aria-current='true'] .ltr,
.rail a.step[aria-current='true'] small { color: var(--ink); }

/* -------------------------------------------------------------- home page */

.hero { padding: 30px var(--gutter) 0; display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; }
.hero h1 {
  margin: 0; font-family: var(--serif); font-weight: 400;
  font-size: var(--t-h1); line-height: 1.16; letter-spacing: -0.005em;
  text-wrap: balance; max-width: 320px;
}
.hero .lede { margin: 0; font-size: var(--t-lede); line-height: 1.6; color: var(--muted); max-width: 280px; }

.search {
  margin: 26px var(--gutter) 0;
  display: flex; align-items: center; gap: 14px;
  min-height: 60px; padding: 0 20px; background: var(--panel); color: var(--faint);
}
.search input {
  flex: 1; min-height: 58px; border: 0; background: transparent;
  font-family: var(--sans); font-size: 16px; color: var(--ink);
}
.search input::placeholder { color: var(--faint); }
.search input:focus { outline: none; }
.search:focus-within { outline: 2px solid var(--cobalt); outline-offset: 3px; }

.spine { padding: 44px var(--gutter) 0; display: flex; flex-direction: column; align-items: center; gap: 16px; }

.guides { padding: 46px var(--gutter) 0; display: flex; flex-direction: column; align-items: center; gap: 20px; }
.cards { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.card {
  padding: 18px 20px; background: var(--panel); color: inherit;
  display: flex; flex-direction: column; gap: 5px;
  transition: background 0.18s ease, transform 0.18s ease;
}
.card:hover { background: var(--panel-hover); transform: translateX(2px); color: inherit; }
.card b { font-family: var(--serif); font-weight: 400; font-size: var(--t-h3); line-height: 1.2; }
.card span { font-size: var(--t-meta); line-height: 1.45; color: var(--muted); }

/* Two burgundy treatments doing different jobs must not look identical.
   The top strip is the phone number — loud, persistent, always reachable.
   This band is the warning SIGNS: information a reader may not recognise as
   an emergency. Same colour family, deliberately quieter, and no call button:
   this is an educational tool, not an alarm. The 911 pathway still lives in
   the strip, the condensed bar, and the footer disclaimer. */
.band {
  margin: 52px var(--gutter) 0; padding: 30px 24px;
  background: var(--burgundy-tint); border: 1px solid var(--burgundy-line);
  color: var(--ink);
  display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center;
}
.band .eyebrow { color: var(--burgundy-text); }
.band h2 {
  margin: 0; font-family: var(--serif); font-weight: 400;
  font-size: var(--t-h2); line-height: 1.22; color: var(--burgundy-text);
}
.band p { margin: 0; font-size: var(--t-body); line-height: 1.6; max-width: 300px; }
.band .band-btn { margin-top: 4px; background: var(--burgundy); color: var(--burgundy-ink); }
.band .band-btn:hover { background: var(--burgundy-deep); color: var(--burgundy-ink); }

.tools {
  margin: 46px var(--gutter) 0; padding: 28px 24px; background: var(--panel);
  display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center;
}
.tools h2 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: var(--t-h2-sm); line-height: 1.25; }
.tools p { margin: 0; font-size: var(--t-meta); line-height: 1.6; color: var(--muted); max-width: 290px; }

.about { padding: 48px var(--gutter) 0; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.about h2 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: var(--t-h2); line-height: 1.25; }
.about p { margin: 0; font-size: var(--t-body); line-height: 1.65; color: var(--body); max-width: 310px; }

/* --------------------------------------------------- floating sheet link ---
   The follow-up sheet is the thing a reader comes back for, and it was three
   taps down. Deliberately NOT beside search or beside the emergency route:
   those are different jobs and pairing them made each read as the other.
   Hidden on the sheets themselves. */
.tools-fab {
  position: fixed; right: 16px; bottom: 16px; z-index: 25;
  display: inline-flex; align-items: center; gap: 9px;
  min-height: 48px; padding: 0 18px;
  background: var(--ink); color: var(--paper);
  font-size: var(--t-meta); font-weight: 600; letter-spacing: 0.02em;
  box-shadow: 0 6px 20px -6px rgba(20, 36, 61, .45);
}
.tools-fab:hover { background: var(--ink-deep); color: var(--paper); }
.tools-fab svg { flex-shrink: 0; }

/* Never let it sit on top of the last line of the page. */
.shell { padding-bottom: 84px; }

/* Mobile pass (Franck, 2026-09-11): fold to the icon while the reader
   scrolls down, so the button never sits on the line being read. The label
   is hidden by width, not display, so the fold animates and the link keeps
   its accessible name. Base.astro sets data-fab. */
html[data-fab='collapse'] .tools-fab {
  transition: padding 0.2s ease, gap 0.2s ease;
}
html[data-fab='collapse'] .tools-fab span {
  display: inline-block; max-width: 200px; overflow: hidden; white-space: nowrap;
  transition: max-width 0.2s ease, opacity 0.15s ease;
}
html[data-fab='collapse'] .tools-fab.is-min { padding: 0 15px; gap: 0; }
html[data-fab='collapse'] .tools-fab.is-min span { max-width: 0; opacity: 0; }

@media print { .tools-fab { display: none !important; } }

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

.sig { padding: 44px var(--gutter) 0; text-align: center; display: flex; flex-direction: column; gap: 5px; }
.sig .name { font-family: var(--serif); font-style: italic; font-size: var(--t-h4); }
.sig .role { font-size: var(--t-small); color: var(--muted); }

.disclaimer { margin: 0; padding: 26px var(--gutter) 24px; text-align: center; font-size: var(--t-fine); line-height: 1.65; color: var(--faint); }

.foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px var(--gutter); border-top: 1px solid var(--rule); }
.foot .lbl { font-size: var(--t-eyebrow); font-weight: 600; letter-spacing: 0.16em; color: var(--faint); text-transform: uppercase; }
.sizes { display: flex; flex-wrap: wrap; gap: 8px; }
/* Reading editor on screen; original table remains the print/backup source. */
@media screen { .tracker-page .sugar-print-table { display: none; } }
.tracker-page .sugar-entry { border-bottom: 1px solid var(--rule); }
.tracker-page .sugar-entry > summary {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  min-height: 44px; padding: 16px 0; cursor: pointer; font-size: var(--t-body);
}
.tracker-page .sugar-entry > summary span { overflow-wrap: anywhere; }
.tracker-page .sugar-edit { color: var(--cobalt); font-size: var(--t-meta); flex-shrink: 0; }
.tracker-page .sugar-body { display: grid; gap: 12px; padding-bottom: 20px; }
.tracker-page .sugar-body .tap-label { margin: 8px 0 0; }
.tracker-page .sugar-number {
  width: 100%; min-height: 52px; padding: 12px; border: 1px solid var(--rule-strong);
  border-radius: 12px; background: var(--paper); color: var(--ink); font: inherit;
  font-size: var(--t-h3);
}
.tracker-page .sugar-body .field-input { box-sizing: border-box; min-width: 0; max-width: 100%; }
.tracker-page .sugar-time > summary, .tracker-page .sugar-note > summary {
  min-height: 44px; padding: 12px 0; cursor: pointer; color: var(--cobalt); overflow-wrap: anywhere;
}
.tracker-page .sugar-time .tap-chip { margin-top: 12px; }
.sizes button {
  min-height: 44px; padding: 0 16px;
  font-family: var(--sans); font-size: var(--t-eyebrow); font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  background: transparent; color: var(--ink);
  border: 1px solid transparent; cursor: pointer;
}
.sizes button[aria-pressed='true'] { background: var(--ink); color: var(--paper); }
.sizes button:hover:not([aria-pressed='true']) { border-color: var(--rule-strong); }

/* ------------------------------------------------------------- guide page
   The guide body is authored Markdown. These rules are the contract between
   the writing house style and the page — a guide never needs to know they
   exist. Section wrappers come from the rehype plugin. */

.guide { padding: 0 0 8px; }

.guide .guide-head { padding: 26px var(--gutter) 0; }
.guide .guide-head h1 {
  margin: 0; font-family: var(--serif); font-weight: 400;
  font-size: var(--t-h1); line-height: 1.12; letter-spacing: -0.008em;
}
.guide .guide-head .deck {
  margin: 10px 0 0; padding: 0;
  font-family: var(--serif); font-style: italic;
  font-size: var(--t-h4); line-height: 1.35; color: var(--body);
}

.guide .reviewed { margin: 10px 0 0; padding: 0 var(--gutter); font-size: var(--t-fine); color: var(--faint); }
.guide .guide-note { margin: 12px 0 0; padding: 0; font-size: var(--t-fine); line-height: 1.5; color: var(--faint); }
.guide .guide-note a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }

/* Sticks to the top so the five sections are reachable from anywhere in a long
   guide. top:0 rather than a guessed offset — an earlier guess left a
   transparent strip that body text scrolled through. */
.guide .spine-wrap {
  position: sticky; top: var(--bar-h); z-index: 12;
  padding: 12px var(--gutter);
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  box-shadow: 0 6px 14px -12px rgba(20, 36, 61, 0.5);
}
.guide .step { scroll-margin-top: calc(var(--bar-h) + 104px); }

/* Key Takeaways reads as the summary it is, rather than as more prose. */
.guide .takeaways {
  display: block; margin: 22px var(--gutter) 6px; padding: 20px 22px;
  background: var(--panel); border-top: 2px solid var(--ink);
}
.guide .takeaways-head {
  margin: 0 0 12px; padding: 0;
  font-size: var(--t-eyebrow); font-weight: 600; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--muted);
}
.guide .takeaways ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 12px; }
.guide .takeaways li { font-size: var(--t-body); line-height: 1.55; }
.guide .takeaways li::marker { color: var(--cobalt); font-weight: 600; }

/* Each section shows its opening; the rest waits behind a control. Emergency
   is never collapsed — a red flag behind a click is a red flag nobody reads. */
.guide .unfold { margin: 0; }
.guide .unfold > summary {
  cursor: pointer; list-style: none;
  margin: 6px var(--gutter) 0; padding: 12px 0;
  min-height: 44px; display: flex; align-items: center; gap: 8px;
  font-size: var(--t-meta); font-weight: 600; letter-spacing: 0.02em;
  color: var(--cobalt); border-top: 1px solid var(--rule);
}
.guide .unfold > summary::-webkit-details-marker { display: none; }
.guide .unfold > summary::before { content: '+'; color: var(--muted); font-size: 16px; }
.guide .unfold[open] > summary::before { content: '-'; }
.guide .unfold[open] > summary { color: var(--muted); }

/* On paper everything is open: printing a page with content hidden inside it
   produces a document with holes in it. */
@media print {
  .guide .unfold > summary { display: none !important; }
  .guide .unfold { display: block !important; }
  .guide .spine-wrap { position: static; box-shadow: none; }
}
.guide .reviewed { padding-top: 8px; }

.guide p, .guide ul, .guide ol { padding-left: var(--gutter); padding-right: var(--gutter); }
.guide p { margin: 0 0 14px; font-size: var(--t-body); line-height: 1.7; }
.guide ul, .guide ol { margin: 0 0 14px; }
.guide li { margin-bottom: 10px; font-size: var(--t-body); line-height: 1.6; }
.guide strong { font-weight: 600; }

/* Hypoglycemia reference: readable teaching steps, with all exceptions visible.
   Native list markers preserve the sequence in speech, print and without JS. */
.guide[data-guide='hypoglycemia'] .takeaways {
  border: 0; border-radius: 16px; padding: 20px;
}
.guide[data-guide='hypoglycemia'] .takeaways ul {
  margin: 0; padding: 0 0 0 20px;
}
.guide[data-guide='hypoglycemia'] .takeaways li:last-child { margin-bottom: 0; }
.guide[data-guide='hypoglycemia'] .step-head { text-wrap: balance; }
.guide[data-guide='hypoglycemia'] #step-f h3 {
  font-size: var(--t-h3); letter-spacing: 0; margin-top: 24px;
}
.guide[data-guide='hypoglycemia'] #step-f > ol {
  margin: 20px var(--gutter) 24px; padding: 0 0 0 32px;
}
.guide[data-guide='hypoglycemia'] #step-f > ol > li {
  padding: 16px 0 16px 8px; margin: 0; border-bottom: 1px solid var(--rule);
}
.guide[data-guide='hypoglycemia'] #step-f > ol > li:first-child {
  border-top: 1px solid var(--rule);
}
.guide[data-guide='hypoglycemia'] #step-f > ol > li::marker {
  color: var(--cobalt); font-size: var(--t-h3); font-weight: 600;
}
.guide[data-guide='hypoglycemia'] #step-t > ul > li { margin-bottom: 20px; }
.guide hr { display: none; }

.guide .step { padding: 30px 0 0; }
.guide .step-head {
  margin: 0 0 14px; padding: 0 var(--gutter);
  display: block;
  font-family: var(--serif); font-weight: 400; font-size: var(--t-h2);
  line-height: 1.2; letter-spacing: -0.005em;
}
/* Franck, 2026-09-11: the section's letter is the heading's own first letter,
   set larger and in the italic, rather than a badge repeating it beside the
   heading. Every heading starts with its rail letter (the two that did not were
   renamed). The badge stays in the markup for the rail's scroll-spy and is
   hidden here. */
.guide .step-head .step-letter { display: none; }
.guide .step-head::first-letter { font-size: 1.32em; font-style: italic; color: var(--brass); }
.guide .step[data-step='E'] .step-head::first-letter { color: var(--brass); }
.guide .step-letter {
  flex-shrink: 0; width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--rule-strong); color: var(--muted);
  font-size: 16px; line-height: 1;
}
.guide .step h3 {
  margin: 18px 0 8px; padding: 0 var(--gutter);
  font-family: var(--sans); font-size: var(--t-meta); font-weight: 600; letter-spacing: 0.02em;
}

/* A three-column table is unreadable at 390px, so it scrolls in its own
   container rather than squeezing the page. */
/* The wrapper scrolls, not the table: display:block on a <table> removes it
   from the accessibility tree, taking the header relationships with it. */
.guide .table-scroll {
  overflow-x: auto; width: calc(100% - var(--gutter) * 2);
  margin: 0 var(--gutter) 18px;
  /* a visible hint that there is more to the right */
  background:
    linear-gradient(to right, var(--paper) 30%, transparent),
    linear-gradient(to left, var(--paper) 30%, transparent) right,
    radial-gradient(farthest-side at 0 50%, rgba(20,36,61,.14), transparent),
    radial-gradient(farthest-side at 100% 50%, rgba(20,36,61,.14), transparent) right;
  background-repeat: no-repeat; background-size: 32px 100%, 32px 100%, 14px 100%, 14px 100%;
  background-attachment: local, local, scroll, scroll;
}
.guide table { width: 100%; border-collapse: collapse; font-size: var(--t-meta); }
.guide th, .guide td { padding: 10px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--rule); min-width: 130px; }
.guide th { font-weight: 600; color: var(--muted); }

.guide blockquote { margin: 0 var(--gutter) 18px; padding: 14px 16px; background: var(--panel); font-size: var(--t-meta); line-height: 1.6; }
.guide blockquote p { padding: 0; margin: 0; font-size: inherit; }

/* Emergency is the one section that changes colour, and it is derived from
   the [E] marker in the source — so it cannot be forgotten or misapplied. */
.guide .step[data-step='E'] { margin-top: 34px; padding: 30px 0 26px; background: var(--burgundy); color: var(--burgundy-ink); }
.guide .step[data-step='E'] .step-head { color: var(--burgundy-ink); }
.guide .step[data-step='E'] .step-letter { background: var(--burgundy-ink); color: var(--burgundy); border-color: var(--burgundy-ink); }
.guide .step[data-step='E'] li::marker { color: var(--burgundy-soft); }
.guide .step[data-step='E'] a { color: var(--burgundy-ink); text-decoration: underline; }

/* ------------------------------------------------------------------ motion
   Every animation is opt-in. Without scroll timelines, or with reduced
   motion, the page is fully visible and readable — nothing starts hidden. */

@media (prefers-reduced-motion: no-preference) {
  .hero .eyebrow { animation: rise 0.5s 0.05s both ease-out; }
  .hero h1       { animation: rise 0.6s 0.12s both ease-out; }
  .hero .lede    { animation: rise 0.6s 0.22s both ease-out; }
  .search        { animation: rise 0.6s 0.30s both ease-out; }

  @supports (animation-timeline: view()) {
    .reveal {
      opacity: 0; transform: translateY(14px);
      animation-name: rise; animation-duration: auto; animation-fill-mode: forwards;
      animation-timing-function: linear;
      animation-timeline: view(); animation-range: entry 8% cover 24%;
    }
    .rail::before {
      transform: scaleX(0);
      animation-name: draw; animation-duration: auto; animation-fill-mode: forwards;
      animation-timing-function: linear;
      animation-timeline: view(); animation-range: entry 20% cover 50%;
    }
  }

  @supports (animation-timeline: scroll()) {
    .bar[data-compact='false'],
    .bar[data-compact='false'] .barpad,
    .bar[data-compact='false'] .brand,
    .bar[data-compact='false'] .nav,
    .bar[data-compact='false'] .compact {
      animation-duration: auto; animation-timing-function: linear;
      animation-fill-mode: both; animation-timeline: scroll(root);
    }
    .bar[data-compact='false']          { animation-name: condense;    animation-range: 100px 260px; }
    .bar[data-compact='false'] .barpad  { animation-name: padshrink;   animation-range: 100px 260px; }
    .bar[data-compact='false'] .brand   { animation-name: brandshrink; animation-range: 100px 260px; }
    .bar[data-compact='false'] .nav     { animation-name: navhide;     animation-range: 100px 220px; }
    .bar[data-compact='false'] .compact { animation-name: compactshow; animation-range: 180px 260px; }
  }
}

@keyframes rise         { to { opacity: 1; transform: none; } }
@keyframes draw         { to { transform: scaleX(1); } }
@keyframes condense     { to { border-bottom-color: var(--rule); box-shadow: 0 1px 12px rgba(20,36,61,.06); } }
@keyframes padshrink    { to { padding-top: 14px; } }
@keyframes brandshrink  { to { font-size: var(--t-meta); letter-spacing: 0.28em; } }
@keyframes navhide      { to { max-height: 0; opacity: 0; padding-top: 0; padding-bottom: 0; } }
@keyframes compactshow  { to { max-height: 60px; opacity: 1; padding-bottom: 12px; } }

/* Sentence case: a 32-character uppercase run reads as body text, not a label. */
.spine .steps-label {
  margin: 0; font-size: var(--t-meta); line-height: 1.5;
  color: var(--muted); text-align: center;
}

/* -------------------------------------------------- where-to-go comparison */

.page-head {
  padding: 30px var(--gutter) 0;
  display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center;
}
.page-head h1 {
  margin: 0; font-family: var(--serif); font-weight: 400;
  font-size: var(--t-h1); line-height: 1.14; letter-spacing: -0.008em;
  text-wrap: balance;
}
.page-head .lede {
  margin: 0; font-size: var(--t-lede); line-height: 1.6; color: var(--muted); max-width: 320px;
}


/* Says what the channel is not, before offering it. Patients must not read
   this as a route to medical advice — that is what their own doctor is for. */
.feedback {
  margin: 0; padding: 0 var(--gutter) 26px;
  text-align: center; font-size: var(--t-small); line-height: 1.65; color: var(--muted);
}

/* Quieter than the ER button on purpose: the person who needs the comparison
   is not the person who needs the emergency department right now. */
.band .band-link {
  margin-top: 2px; font-size: var(--t-meta); line-height: 1.45;
  color: var(--burgundy-text); text-decoration: underline; text-underline-offset: 3px;
  max-width: 280px;
}
.band .band-link:hover { color: var(--burgundy-deep); }

/* ------------------------------------------------------------ guide index */

.guides-list { padding: 8px var(--gutter) 0; }
.guides-list .cards { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.result-count {
  margin: 14px 0 0; padding: 0 var(--gutter);
  font-size: var(--t-meta); color: var(--muted); text-align: center; min-height: 1.2em;
}
.no-match {
  margin: 16px 0 0; padding: 20px 22px; background: var(--panel);
  font-size: var(--t-meta); line-height: 1.6; color: var(--muted);
}

/* The hidden attribute must beat display:flex on cards and anything else the
   search filter toggles. Without this the filter reports a count but hides
   nothing — the failure looks like a broken search. */
[hidden] { display: none !important; }

/* ------------------------------------------------------- recovery tools */

.tools-list { padding: 12px var(--gutter) 0; display: flex; flex-direction: column; gap: 8px; }
.tools-list .card em { font-size: var(--t-small); color: var(--faint); font-style: italic; }

/* ---- printable sheets ------------------------------------------------- */

.sheet { padding: 26px var(--gutter) 0; }
.sheet-brand {
  font-family: var(--serif); font-size: var(--t-meta); letter-spacing: 0.3em;
  color: var(--muted); padding-bottom: 14px;
}
.sheet-head h1 {
  margin: 0; font-family: var(--serif); font-weight: 400;
  font-size: var(--t-h1); line-height: 1.14; letter-spacing: -0.008em;
}
.sheet-intro { margin: 10px 0 0; font-size: var(--t-body); line-height: 1.55; color: var(--muted); }
.sheet-date {
  margin: 16px 0 0; display: flex; align-items: baseline; gap: 10px;
  font-size: var(--t-meta); color: var(--muted);
}
.rule-inline { flex: 1; border-bottom: 1px solid var(--ink); height: 0; }

.sheet .block { padding-top: 26px; break-inside: avoid; }
.sheet .block h2 {
  margin: 0; font-family: var(--serif); font-weight: 400;
  font-size: var(--t-h3); line-height: 1.25;
}
.sheet .hint { margin: 6px 0 12px; font-size: var(--t-meta); line-height: 1.5; color: var(--muted); }

/* Lines to write on, not inputs — there is nowhere to submit anything. */
.write-line { border-bottom: 1px solid var(--rule-strong); height: 34px; }

.sheet table.grid { width: 100%; border-collapse: collapse; }
.sheet table.grid th,
.sheet table.grid td {
  border: 1px solid var(--rule-strong); padding: 9px 8px;
  font-size: var(--t-small); text-align: left; vertical-align: top; height: 32px;
}
.sheet table.grid thead th { font-weight: 600; color: var(--muted); background: var(--panel); }
.sheet table.grid tbody th { font-weight: 500; color: var(--muted); white-space: nowrap; }

.sheet-foot {
  margin-top: 26px; padding-top: 14px; border-top: 1px solid var(--rule);
  font-size: var(--t-eyebrow); line-height: 1.55; color: var(--muted);
}

.sheet-actions {
  padding: 26px var(--gutter) 0;
  display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center;
}
.sheet-note { margin: 0; font-size: var(--t-small); color: var(--muted); }

/* ---- print ------------------------------------------------------------
   Site chrome, navigation and the print button never reach paper. Black on
   white: these get printed on whatever is in the house, often nearly out of
   ink, and a tonal panel wastes what is left. */
/* Paper is always light. Without this, a reader whose phone is in dark mode
   prints the dark palette's pale greys onto a white page — the print rules
   force the ground white but leave every token dark. Reset the palette for
   print before anything else in this section runs. */
@media print {
  :root {
    color-scheme: light;
    --paper: #FFFFFF; --panel: #FFFFFF; --panel-hover: #FFFFFF;
    --ink: #000000; --ink-deep: #000000; --body: #222222;
    --muted: #333333; --faint: #444444;
    --rule: #999999; --rule-strong: #666666;
    --cobalt: #000000; --cobalt-deep: #000000;
    --burgundy: #6B1119; --burgundy-ink: #FFFFFF; --burgundy-soft: #E8B4B8;
    --burgundy-deep: #6B1119; --burgundy-tint: #FFFFFF; --burgundy-line: #666666;
    --burgundy-text: #6B1119; --brass: #6B5320;
  }
}

@page { size: letter; margin: 0.55in; }

@media print {
  html, body, .shell { background: #fff !important; color: #000 !important; }
  .estrip, .bar, .foot, .sig, .disclaimer, .feedback, .sheet-actions { display: none !important; }

  .sheet { padding: 0; }
  .sheet-brand { color: #000; padding-bottom: 10px; }
  .sheet-head h1 { font-size: var(--t-h2); }
  .sheet-intro, .sheet .hint, .sheet-date { color: #333; font-size: 11pt; }
  .sheet .block { padding-top: 20px; }
  .sheet .block h2 { font-size: 15pt; }

  .write-line { border-bottom: 1px solid #666; height: 30px; }
  .sheet table.grid th, .sheet table.grid td { border-color: #666; color: #000; font-size: 10pt; }
  .sheet table.grid thead th { background: transparent !important; }
  .sheet table.grid tbody tr { break-inside: avoid; }

  .sheet-foot { color: #000; font-size: 8.5pt; border-top-color: #666; }
  a[href]::after { content: ''; }
}

.tools-sub {
  margin: 0; font-size: var(--t-meta); line-height: 1.5;
  color: var(--muted); text-align: center; max-width: 300px;
}
.sheet-back {
  margin: 0; padding: 20px var(--gutter) 0;
  text-align: center; font-size: var(--t-small); color: var(--muted);
}

/* The hand-off, at the end of the guide where Reconnect leaves off. */
.take-sheet {
  margin: 30px var(--gutter) 0; padding: 22px;
  background: var(--panel);
  display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center;
}
.take-sheet b { font-family: var(--serif); font-weight: 400; font-size: var(--t-h3); }
.take-sheet p { margin: 0; font-size: var(--t-meta); line-height: 1.5; color: var(--muted); max-width: 280px; }

@media print { .sheet-back, .take-sheet { display: none !important; } }

/* ------------------------------------------------------ paper-only sheets */

.sheet-privacy {
  margin: 20px var(--gutter) 0; padding: 13px 15px;
  background: var(--panel); display: flex; gap: 11px; align-items: flex-start;
  font-size: var(--t-small); line-height: 1.55; color: var(--muted);
}
.sheet-privacy svg { flex-shrink: 0; margin-top: 2px; color: var(--ink); }

.tool-lead { border-top: 3px solid var(--cobalt); margin-top: 24px; }
.episode-list { display: flex; flex-direction: column; gap: 16px; }
.episode-entry {
  border: 1px solid var(--rule-strong); padding: 16px;
  background: color-mix(in srgb, var(--panel) 58%, transparent); break-inside: avoid;
}
.episode-entry h3, .sheet .block > h3 {
  margin: 0 0 12px; font-family: var(--serif); font-weight: 400;
  font-size: var(--t-h4); line-height: 1.25;
}
.episode-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.episode-grid p { margin: 0; min-width: 0; }
.episode-grid b { display: block; min-height: 2.7em; font-size: var(--t-small); line-height: 1.35; }
.episode-grid .wide { grid-column: 1 / -1; }
.episode-grid .wide b { min-height: auto; }
.episode-grid .write-line { display: block; }
.write-area { display: flex; flex-direction: column; gap: 0; }
.write-area span { display: block; height: 34px; border-bottom: 1px solid var(--rule-strong); }
.paper-box { height: 128px; border: 1px solid var(--rule-strong); }
.paper-grid td { height: 42px !important; }
.glucose-grid { table-layout: fixed; }
.glucose-grid th:nth-child(1) { width: 25%; }
.glucose-grid th:nth-child(2) { width: 25%; }
.glucose-grid th:nth-child(3) { width: 18%; }
.glucose-grid th:nth-child(4) { width: 32%; }
.topic-grid { table-layout: fixed; }
.topic-grid th { width: calc(100% / var(--tool-columns)); overflow-wrap: anywhere; }
.sheet-caution {
  margin: 9px 0 0; font-size: var(--t-small); line-height: 1.5; color: var(--muted);
}
.paper-checks { display: flex; flex-direction: column; }
.paper-checks p {
  margin: 0; padding: 9px 0; border-bottom: 1px solid var(--rule);
  display: flex; gap: 10px; align-items: flex-start; font-size: var(--t-meta); line-height: 1.5;
  break-inside: avoid;
}
.paper-checks p span { flex: 0 0 auto; font-size: 1.1em; line-height: 1.35; }
.emergency-from-guide > *:not(.step),
.emergency-from-guide .step:not([data-step='E']) { display: none !important; }
.emergency-from-guide .step[data-step='E'] { margin: 0; }
.emergency-from-guide .step[data-step='E'] .step-head { display: none; }
.emergency-from-guide .step[data-step='E'] p,
.emergency-from-guide .step[data-step='E'] ul,
.emergency-from-guide .step[data-step='E'] ol,
.emergency-from-guide .step[data-step='E'] blockquote {
  margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0;
}
/* Any quote inside the burgundy section must read on burgundy: the default
   pale panel put pale text on a pale box (2026-09-11). */
.guide .step[data-step='E'] blockquote { background: rgba(255,255,255,.10); color: var(--burgundy-ink); }

@media print {
  .sheet-privacy { display: none !important; }
  .episode-entry { background: transparent; border-color: #666; }
  .paper-checks p, .write-area span { border-bottom-color: #666; color: #000; }
  .paper-box { border-color: #666; }
  .sheet-caution { color: #333; font-size: 9pt; }
}

/* ------------------------------------------------------- QR landing page */

.start-head {
  padding: 34px var(--gutter) 0;
  display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center;
}
.start-head h1 {
  margin: 0; font-family: var(--serif); font-weight: 400;
  font-size: var(--t-h1); line-height: 1.14; letter-spacing: -0.008em; text-wrap: balance;
}
.start-head .lede { margin: 0; font-size: var(--t-lede); line-height: 1.55; color: var(--muted); max-width: 300px; }

.start-doors { padding: 26px var(--gutter) 0; display: flex; flex-direction: column; gap: 10px; }
.door {
  display: flex; gap: 16px; align-items: flex-start;
  padding: 22px 20px; background: var(--panel); color: inherit;
  transition: background 0.18s ease, transform 0.18s ease;
}
.door:hover { background: var(--panel-hover); transform: translateX(2px); color: inherit; }
.door-n {
  flex-shrink: 0; width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--rule-strong); color: var(--muted);
  font-family: var(--serif); font-size: 16px; line-height: 1;
}
.door-body { display: flex; flex-direction: column; gap: 6px; }
.door-body b { font-family: var(--serif); font-weight: 400; font-size: var(--t-h3); line-height: 1.2; }
.door-body span { font-size: var(--t-meta); line-height: 1.5; color: var(--muted); }
.door-body em { font-size: var(--t-small); color: var(--faint); font-style: italic; }

/* ------------------------------------------------------------ pain chart */

.tracker-table { max-width: 260px; }
.tracker-table tbody th { width: 46%; }

.chart-wrap { margin: 20px 0 0; padding: 0; }
.chart-wrap svg { width: 100%; height: auto; display: block; }
.chart-title {
  margin: 10px 0 0; font-family: var(--serif); font-weight: 400;
  font-size: var(--t-lede); line-height: 1.25;
}
.chart-desc { margin: 6px 0 0; font-size: var(--t-small); line-height: 1.55; color: var(--muted); }
.chart-notes {
  margin: 10px 0 0; padding-left: 18px;
  display: flex; flex-direction: column; gap: 6px;
}
.chart-notes li { font-size: var(--t-small); line-height: 1.5; color: var(--muted); }
.chart-notes li::marker { color: var(--rule-strong); }

@media print {
  .chart-wrap svg { max-width: 4.5in; }
  .chart-notes li, .chart-desc { color: #333; font-size: 9pt; }
}

/* The condition sheets lead; the general pair is the fallback beneath them. */
.tools-list { padding-top: 34px; }
.tools-list .eyebrow, .tools-list .tools-sub { align-self: center; text-align: center; }
.tools-list { align-items: center; }
.tools-list .card { width: 100%; }

.suggested { padding-bottom: 18px; }

/* The published course, inside the Timeline section of a guide. */
.course-chart { margin: 18px var(--gutter) 4px; padding: 0; }
.course-chart svg { width: 100%; height: auto; display: block; }
.course-chart figcaption {
  margin-top: 8px; font-size: var(--t-small); line-height: 1.55; color: var(--muted);
}
@media print {
  .course-chart { break-inside: avoid; }
  .course-chart svg { max-width: 4.2in; }
  .course-chart figcaption { color: #333; font-size: 9pt; }
}

/* Reading pages: about, and anything else that is prose rather than a tool. */
.prose { padding: 30px var(--gutter) 0; }
.prose h2 {
  margin: 34px 0 12px; font-family: var(--serif); font-weight: 400;
  font-size: var(--t-h2); line-height: 1.25;
}
.prose h2:first-child { margin-top: 0; }
.prose p { margin: 0 0 14px; font-size: var(--t-body); line-height: 1.7; }
.prose strong { font-weight: 600; }

/* ===================================================== guide layout lab ===
   Three treatments of the same guide. Shared fixes first, then what differs. */

.lab-flag {
  margin: 0; padding: 10px var(--gutter);
  background: var(--panel); border-bottom: 1px solid var(--rule);
  font-size: var(--t-small); color: var(--muted); text-align: center;
}

/* Shared: the summary block reads as a summary. */
.guide-v .takeaways {
  display: block; margin: 22px var(--gutter) 6px; padding: 20px 22px;
  background: var(--panel); border-top: 2px solid var(--ink);
}
.guide-v .takeaways-head {
  margin: 0 0 12px; padding: 0;
  font-size: var(--t-eyebrow); font-weight: 600; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--muted);
}
.guide-v .takeaways ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 12px; }
.guide-v .takeaways li { font-size: var(--t-body); line-height: 1.55; }
.guide-v .takeaways li::marker { color: var(--cobalt); font-weight: 600; }

/* Shared: the rail sticks, so the five sections are reachable from anywhere.
   Offset comes from the compact bar's own height, measured once in CSS rather
   than guessed — the earlier attempt guessed and left a transparent gap. */
.guide-v .spine-wrap {
  position: sticky; top: 0; z-index: 12;
  margin: 0; padding: 12px var(--gutter);
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  box-shadow: 0 6px 14px -12px rgba(20, 36, 61, 0.5);
}
.guide-v .step { scroll-margin-top: 96px; }

/* ---- A: navigate. Nothing hidden; the rail does the work. --------------- */

/* ---- B: unfold. Most of each section behind a control. ------------------ */
.guide-v-b .unfold { margin: 0; }
.guide-v-b .unfold > summary {
  cursor: pointer; list-style: none;
  margin: 6px var(--gutter) 0; padding: 12px 0;
  min-height: 44px; display: flex; align-items: center; gap: 8px;
  font-size: var(--t-meta); font-weight: 600; letter-spacing: 0.02em;
  color: var(--cobalt); border-top: 1px solid var(--rule);
}
.guide-v-b .unfold > summary::-webkit-details-marker { display: none; }
.guide-v-b .unfold > summary::before { content: '+'; color: var(--muted); font-size: 16px; }
.guide-v-b .unfold[open] > summary::before { content: '–'; }
.guide-v-b .unfold[open] > summary { color: var(--muted); }

/* ---- C: pace. Same words, given rhythm. -------------------------------- */
.guide-v-c .step { padding-top: 40px; }
.guide-v-c .step-head {
  padding-bottom: 4px; border-bottom: 1px solid var(--rule);
  margin-bottom: 18px; margin-left: var(--gutter); margin-right: var(--gutter);
  padding-left: 0; padding-right: 0;
}
.guide-v-c .step p.lead {
  font-size: var(--t-h4); line-height: 1.55; color: var(--ink);
}
.guide-v-c .step h3 {
  margin-top: 26px;
  font-size: var(--t-eyebrow); font-weight: 600; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--muted);
}
.guide-v-c .step p { margin-bottom: 16px; }
.guide-v-c .step[data-step='E'] .step-head { border-bottom-color: rgba(251, 239, 239, 0.35); }

/* The guide's own follow-up text on the sheet. Set tighter than body copy:
   this is reference the patient reads once before the visit, sharing a page
   with space they have to write in. */
.followup-block .from-guide-followup .step[data-step='R'] { padding: 0; margin: 0; }
.followup-block .from-guide-followup .step-head { display: none; }
.followup-block .from-guide-followup p,
.followup-block .from-guide-followup ul,
.followup-block .from-guide-followup ol { padding-left: 0; padding-right: 0; }
.followup-block .from-guide-followup p { font-size: var(--t-meta); line-height: 1.55; margin-bottom: 10px; }
.followup-block .from-guide-followup li { font-size: var(--t-meta); line-height: 1.5; }
.followup-block .from-guide-followup hr { display: none; }
@media print {
  .followup-block .from-guide-followup p,
  .followup-block .from-guide-followup li { font-size: 9.5pt; line-height: 1.45; }
}


/* ============================================================================
   Recovery tracker  (/tools/)
   ----------------------------------------------------------------------------
   Lives here, not in the page, because Astro's asset pipeline emits no
   component CSS on this machine — a <style> block in the .astro file is simply
   never served in dev (see TOOLING.md and PRODUCT.md). It survives a production
   build only because inlineStylesheets is 'always', which hides the breakage
   until someone opens the dev preview.

   Every rule is namespaced under .tracker-page. The tracker reuses generic
   names (.card, .btn, .card-title) that already mean something site-wide, and
   without the prefix these would redefine them on guides and the homepage.
   ========================================================================== */

  .tracker-page .page-head { padding: 0 0 8px; }

  .tracker-page .tracker-shell {
    /* Wider than the 460px reading measure because this page holds tables,
       but deliberately close to it — 860 read as a different site. */
    max-width: 640px;
    margin: 0 auto;
  }

  .tracker-page .card {
    background: var(--panel);
    padding: 20px;
    border-radius: 4px;
    margin-bottom: 20px;
  }
  .tracker-page .card-title {
    margin: 0 0 8px;
    font-family: var(--serif);
    font-weight: 400;
    font-size: var(--t-h3);
    color: var(--ink);
  }
  .tracker-page .card-subtitle {
    margin: 0 0 16px;
    font-size: var(--t-meta);
    color: var(--muted);
    line-height: 1.5;
  }









  .tracker-page .btn {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 16px;
    background: var(--ink);
    color: var(--paper);
    font-size: var(--t-small);
    font-weight: 600;
    letter-spacing: 0.05em;
    border: 1px solid var(--ink);
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
  }
  .tracker-page .btn:hover { background: var(--ink-deep); color: var(--paper); }
  .tracker-page .btn-outline {
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--rule-strong);
  }
  .tracker-page .btn-outline:hover { background: var(--panel); }
  .tracker-page .btn-delete {
    background: var(--ink);
    color: var(--paper);
    border-color: var(--ink);
  }
  .tracker-page .btn-delete:hover { background: var(--ink-deep); }
  .tracker-page .btn-sm {
    min-height: 44px;
    padding: 0 12px;
    font-size: var(--t-fine);
  }

  .tracker-page .source-ledger {
    background: var(--panel-hover);
    border: 1px solid var(--rule-strong);
    border-radius: 4px;
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: var(--t-small);
    color: var(--body);
  }
  .tracker-page .source-ledger summary {
    font-weight: 600;
    color: var(--cobalt-deep);
    cursor: pointer;
    outline: none;
    letter-spacing: 0.03em;
  }
  .tracker-page .source-ledger ul {
    margin: 10px 0 0;
    padding-left: 20px;
  }
  .tracker-page .source-ledger li {
    margin-bottom: 6px;
    line-height: 1.5;
  }
  .tracker-page .source-ledger code {
    background: rgba(127,127,127,0.16);
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 0.9em;
  }

  .tracker-page .card-danger {
    background: var(--burgundy-tint);
    border: 1px solid var(--burgundy-line);
    color: var(--ink);
  }
  .tracker-page .card-danger .card-title {
    color: var(--burgundy-text);
  }
  .tracker-page .card-danger ul {
    margin: 8px 0 0;
    padding-left: 20px;
  }
  .tracker-page .card-danger li {
    margin-bottom: 6px;
    font-size: var(--t-meta);
    line-height: 1.5;
  }

  .tracker-page .card-meds {
    background: var(--panel);
    border: 1px solid var(--rule-strong);
  }
  .tracker-page .card-meds .med-header {
    font-weight: 600;
    color: var(--ink);
    font-size: var(--t-meta);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .tracker-page .card-bridge {
    background: var(--panel);
    border: 1px solid var(--rule-strong);
    padding: 14px 18px;
    margin-bottom: 20px;
    border-radius: 4px;
    font-size: var(--t-meta);
    color: var(--ink);
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .tracker-page .card-mimics {
    background: var(--panel-hover);
    border: 1px solid var(--rule-strong);
    padding: 16px 20px;
    margin-bottom: 20px;
    border-radius: 4px;
  }

  .tracker-page .form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 14px;
  }
  .tracker-page .field-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  .tracker-page .field-label {
    font-size: var(--t-small);
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }
  .tracker-page .field-input {
    font-family: var(--sans);
    font-size: 16px;
    color: var(--ink);
    background: var(--paper);
    border: 1px solid var(--rule-strong);
    padding: 10px 12px;
    border-radius: 4px;
    width: 100%;
  }
  .tracker-page .field-input:focus {
    outline: 2px solid var(--cobalt);
    outline-offset: 1px;
  }

  .tracker-page .log-table-wrap {
    overflow-x: auto;
    margin: 14px 0;
    border: 1px solid var(--rule-strong);
    border-radius: 4px;
    background: var(--paper);
  }
  .tracker-page .log-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--t-meta);
    text-align: left;
    min-width: 680px;
  }
  .tracker-page .log-table th,
.tracker-page .log-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--rule);
    vertical-align: middle;
  }
  .tracker-page .log-table th {
    background: var(--panel);
    font-weight: 600;
    color: var(--muted);
    font-size: var(--t-small);
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }
  .tracker-page .log-table input[type="text"],
  .tracker-page .log-table input[type="number"] {
    width: 100%;
    font-family: var(--sans);
    font-size: 16px;
    color: var(--ink);
    background: transparent;
    border: 1px solid transparent;
    padding: 6px 8px;
    border-radius: 3px;
  }
  .tracker-page .log-table input:focus {
    background: var(--paper);
    border-color: var(--cobalt);
    outline: none;
  }
  .tracker-page .table-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
  }

  .tracker-page .dashboard-panel {
    background: var(--paper);
    border: 1px solid var(--rule-strong);
    border-radius: 4px;
    padding: 16px;
    margin-bottom: 20px;
  }
  .tracker-page .dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .tracker-page .dashboard-title {
    font-size: var(--t-small);
    font-weight: 600;
    color: var(--ink);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .tracker-page .dashboard-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
  }
  .tracker-page .metric-badge {
    background: var(--panel);
    padding: 10px 12px;
    border-radius: 4px;
  }
  .tracker-page .metric-label {
    font-size: var(--t-fine);
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 2px;
  }
  .tracker-page .metric-val {
    font-size: var(--t-h4);
    font-weight: 600;
    color: var(--ink);
    /* Logged values are read down a column and compared day to day, so the
       digits have to line up. Browser default is proportional. */
    font-variant-numeric: tabular-nums;
  }
  .tracker-page .log-table input[type="number"] { font-variant-numeric: tabular-nums; }
  .tracker-page .chart-svg-container .ch-val,
  .tracker-page .chart-svg-container .ch-base-label { font-variant-numeric: tabular-nums; }

  .tracker-page .chart-svg-container {
    width: 100%;
    height: 176px;
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: 4px;
    position: relative;
  }

  /* Chart colours come from tokens through CSS, never as hex baked into the
     SVG string. Hard-coded values shipped the light-mode ink into dark mode,
     where the patient's own logged numbers rendered at 1.2:1 — invisible.
     Driving them from CSS also means a theme switch needs no re-render.

     These rules are global on purpose. The chart is injected with innerHTML at runtime,
     so its elements never receive Astro's scope attribute and a scoped
     selector silently fails to match — the fills fall back to SVG default
     black. The container is static and scoped, which keeps the reach narrow. */
  .tracker-page .chart-svg-container .ch-axis { stroke: var(--rule); }
  .tracker-page .chart-svg-container .ch-base { stroke: var(--muted); }
  .tracker-page .chart-svg-container .ch-base-label { fill: var(--muted); }
  .tracker-page .chart-svg-container .ch-line { stroke: var(--cobalt); }
  .tracker-page .chart-svg-container .ch-dot { fill: var(--cobalt); }
  .tracker-page .chart-svg-container .ch-val { fill: var(--ink); }
  .tracker-page .chart-svg-container .ch-idx { fill: var(--muted); }
  .tracker-page .chart-svg-container .chart-svg { width: 100%; height: 100%; display: block; }

  .tracker-page .chart-svg-container .chart-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 0 16px;
    text-align: center;
    font-size: var(--t-small);
    color: var(--muted);
  }
  .tracker-page .chart-legend {
    display: flex;
    gap: 16px;
    font-size: var(--t-fine);
    color: var(--muted);
    justify-content: flex-end;
    margin-top: 6px;
  }
  .tracker-page .legend-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
  }
  .tracker-page .legend-color {
    width: 10px;
    height: 10px;
    border-radius: 2px;
  }

  .tracker-page .modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(20, 36, 61, 0.45);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 16px;
  }
  .tracker-page .modal-backdrop.open { display: flex; }
  .tracker-page .modal-box {
    background: var(--paper);
    max-width: 440px;
    width: 100%;
    border-radius: 6px;
    box-shadow: 0 12px 28px rgba(0,0,0,0.18);
    padding: 24px;
    border: 1px solid var(--rule-strong);
  }
  .tracker-page .modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
  }

  .tracker-page .physician-banner {
    display: none;
    background: var(--panel-hover);
    border: 2px solid var(--ink);
    padding: 12px 14px;
    margin-bottom: 16px;
    border-radius: 4px;
  }
  .tracker-page .physician-banner-title {
    font-size: 11pt;
    font-weight: bold;
    color: var(--ink);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
  }
  .tracker-page .physician-banner-text {
    font-size: 9pt;
    line-height: 1.4;
    color: var(--body);
    margin: 0;
  }

  @media print {
    .tracker-page .nav-tabs-wrap,
.tracker-page .action-bar,
.tracker-page .source-ledger,
.tracker-page .table-actions,
.tracker-page .no-print {
      display: none !important;
    }
    .tracker-page .card {
      background: transparent !important;
      border: 1px solid #777 !important;
      padding: 12px !important;
      margin-bottom: 12px !important;
      break-inside: avoid;
    }
    .tracker-page .card-danger {
      border: 2px solid #000 !important;
      background: #fff !important;
    }
    .tracker-page .card-meds {
      border-left: 4px solid #000 !important;
    }
    .tracker-page .card-bridge {
      border-left: 4px solid #000 !important;
      border: 1px solid #777 !important;
    }
    .tracker-page .card-mimics {
      border-left: 4px solid #000 !important;
      border: 1px solid #777 !important;
    }
    .tracker-page .log-table th {
      background: #eee !important;
      color: #000 !important;
      border: 1px solid #777 !important;
    }
    .tracker-page .log-table td {
      border: 1px solid #999 !important;
    }
    .tracker-page .physician-banner {
      display: block !important;
    }

    body.print-blank .tracker-page .dashboard-panel { display: none !important; }
    body.print-blank .tracker-page .field-input,
    body.print-blank .tracker-page .log-table input {
      color: transparent !important;
      border-bottom: 1px solid #888 !important;
      background: transparent !important;
    }

    body.print-summary .tracker-page .dashboard-panel {
      display: block !important;
      border: 1px solid #888 !important;
      padding: 8px !important;
    }
    body.print-summary .tracker-page .chart-svg-container {
      height: 100px !important;
    }
    body.print-summary .tracker-page .field-input,
    body.print-summary .tracker-page .log-table input {
      border: none !important;
      border-bottom: 1px dotted #555 !important;
      padding: 2px !important;
      font-size: 10pt !important;
    }

    /* Paper is narrower than the phone's scroll. The screen table keeps a
       680px floor and fixed column widths so it can scroll sideways; on paper
       there is no sideways, so every column has to share the page or the
       right-hand ones (the 15-minute recheck, the meal) fall off the sheet. */
    .tracker-page .log-table-wrap { overflow: visible !important; border: none !important; margin: 8px 0 !important; }
    .tracker-page .log-table { min-width: 0 !important; width: 100% !important; table-layout: fixed; font-size: 9pt !important; }
    .tracker-page .log-table th { width: auto !important; padding: 4px 5px !important; font-size: 7.5pt !important; letter-spacing: 0 !important; white-space: normal; }
    .tracker-page .log-table td { padding: 3px 4px !important; }
    .tracker-page .log-table input { font-size: 9pt !important; padding: 1px 2px !important; }
    .tracker-page .log-table tr { break-inside: avoid; }
    /* Summary: rows with nothing in them are set by prepForPrint(). */
    body.print-summary .tracker-page .log-table tr.is-empty { display: none !important; }
    /* A card can split across pages; only the red-flag card and a table row
       must not. Whole-card avoidance was putting one card on each sheet. */
    .tracker-page .card { break-inside: avoid; }
    /* Only the long teaching cards may split; a log or red-flag card is
       short enough to keep whole, and a split leaves an empty box behind. */
    .tracker-page .card-meds { break-inside: auto; }
    .tracker-page .card-title, .tracker-page .card-subtitle, .tracker-page .med-header { break-after: avoid; }
    .tracker-page .print-date { margin-top: 4px !important; }
    /* Summary: the typed value is printed as text so it wraps; an <input>
       clips at its box and the doctor gets "shaky, sw". prepForPrint() copies
       each value onto its cell. The blank sheet keeps the inputs — it wants
       empty write-on lines, not text. */
    body.print-summary .tracker-page .log-table td[data-print] input { display: none !important; }
    body.print-summary .tracker-page .log-table td[data-print]::before {
      content: attr(data-print); display: block; font-size: 9pt; line-height: 1.3;
      white-space: normal; overflow-wrap: anywhere; min-height: 1.3em;
      border-bottom: 1px dotted #555; padding: 1px 2px;
    }
    /* The screen's room for the floating button was printing as a blank
       trailing page. */
    .shell { padding-bottom: 0 !important; }
  }
  @media screen { .tracker-page .print-date { display: none; } }


  .tracker-page .device-note { font-size: var(--t-small); color: var(--muted); margin-top: 10px; }
  .tracker-page .device-note strong { color: var(--body); font-weight: 600; }
  @media print { .tracker-page .device-note { display: none !important; } }

/* --- Recovery tracker: chooser, finish block, phone-friendly logs ---------- */

  .tracker-page .picker {
    margin: 0 0 22px;
  }
  .tracker-page .picker-label {
    display: block;
    font-size: var(--t-small);
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
  }
  .tracker-page .picker-select {
    width: 100%;
    min-height: 48px;
    font-family: var(--sans);
    font-size: 16px;
    color: var(--ink);
    background: var(--paper);
    border: 1px solid var(--rule-strong);
    border-radius: 4px;
    padding: 10px 12px;
  }
  .tracker-page .picker-select:focus-visible {
    outline: 2px solid var(--cobalt);
    outline-offset: 2px;
  }

  .tracker-page .finish {
    max-width: 640px;
    margin: 34px auto 0;
    padding-top: 22px;
    border-top: 1px solid var(--rule);
  }
  .tracker-page .finish h2 {
    font-family: var(--serif);
    font-weight: 400;
    font-size: var(--t-h3);
    margin: 0 0 4px;
  }
  .tracker-page .finish-note {
    margin: 0 0 14px;
    font-size: var(--t-meta);
    color: var(--muted);
    line-height: 1.5;
  }
  .tracker-page .finish-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }
  .tracker-page .finish-more {
    margin-top: 20px;
    font-size: var(--t-meta);
  }
  .tracker-page .finish-more summary {
    cursor: pointer;
    color: var(--cobalt);
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  .tracker-page .finish-clear {
    color: var(--cobalt);
  }

  /* ==========================================================================
     Tap entry — a day rail plus one card of tappable answers, replacing the
     row-per-day grid of text boxes for modules that declare a TAP_SCHEMA.

     Same data underneath: every answer still writes the
     after_trk_<module>_r<n>_<col> key the table wrote, so the chart, the
     printed sheet, the blank copy and the backup file all keep working
     against an input surface they never see.

     Colour obeys the system: cobalt is the only interactive colour, burgundy
     stays emergency-only (it appears here for exactly two answers, the KB's
     escalation pair), and brass keeps its single job on the guide rail. No
     state is carried by colour alone — every one also changes glyph or text.
     ========================================================================== */

  .tracker-page .tap-rail {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 2px 2px 12px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }
  .tracker-page .tap-rail::-webkit-scrollbar { height: 0; }

  .tracker-page .tap-day {
    flex: 0 0 auto;
    width: 62px;
    min-height: 76px;
    padding: 8px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: var(--paper);
    border: 1px solid var(--rule-strong);
    border-radius: 4px;
    color: var(--muted);
    cursor: pointer;
    scroll-snap-align: start;
    font-family: inherit;
  }
  .tracker-page .tap-day .tap-dnum {
    font-size: var(--t-h4);
    font-weight: 600;
    color: var(--ink);
    line-height: 1;
  }
  .tracker-page .tap-day .tap-dlab {
    font-size: var(--t-eyebrow);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--faint);
  }
  .tracker-page .tap-day .tap-mark { font-size: var(--t-small); line-height: 1; }

  .tracker-page .tap-day.is-done { border-color: var(--cobalt); }
  .tracker-page .tap-day.is-done .tap-mark { color: var(--cobalt); }

  /* The escalation pair only. Burgundy plus a filled marker plus the word in
     the day's own aria-label — three signals, not one colour. */
  .tracker-page .tap-day.is-marked { border-color: var(--burgundy); border-width: 2px; }
  .tracker-page .tap-day.is-marked .tap-mark { color: var(--burgundy); }

  .tracker-page .tap-day.is-on {
    background: var(--cobalt);
    border-color: var(--cobalt);
  }
  .tracker-page .tap-day.is-on .tap-dnum,
  .tracker-page .tap-day.is-on .tap-dlab,
  .tracker-page .tap-day.is-on .tap-mark { color: var(--paper); }

  .tracker-page .tap-day:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 3px; }

  .tracker-page .tap-railnote {
    margin: 0 2px 18px;
    font-size: var(--t-small);
    color: var(--faint);
  }

  .tracker-page .tap-q { margin-top: 22px; }
  .tracker-page .tap-q:first-child { margin-top: 4px; }
  .tracker-page .tap-q > .tap-label {
    margin: 0 0 10px;
    font-family: var(--serif);
    font-weight: 400;
    font-size: var(--t-h4);
    color: var(--ink);
    line-height: 1.3;
  }

  /* Severity meter. Filled-segment count carries the value — no colour ramp,
     because a ramp would have to borrow brass or burgundy, and both are spoken
     for. The chosen word is printed below and bolded, so the reading never
     depends on seeing the fill. */
  .tracker-page .tap-meter { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; }
  .tracker-page .tap-seg {
    min-height: 44px;
    padding: 0;
    background: var(--panel);
    border: 1px solid var(--rule-strong);
    border-radius: 4px;
    cursor: pointer;
  }
  /* Each filled segment takes its own depth, so the run of boxes reads as a
     ramp rather than a solid block — how far it is filled and how dark it
     gets both say the same thing. */
  .tracker-page .tap-seg.tap-s1.is-filled { background: var(--sev-1); border-color: var(--sev-1); }
  .tracker-page .tap-seg.tap-s2.is-filled { background: var(--sev-2); border-color: var(--sev-2); }
  .tracker-page .tap-seg.tap-s3.is-filled { background: var(--sev-3); border-color: var(--sev-3); }
  .tracker-page .tap-seg.tap-s4.is-filled { background: var(--sev-4); border-color: var(--sev-4); }
  .tracker-page .tap-seg.tap-s5.is-filled { background: var(--sev-5); border-color: var(--sev-5); }
  /* The chosen stop, marked two ways so it survives both cases. On a filled
     segment a paper-coloured ring reads against the colour. On an unfilled
     one — "None", which is a real answer and plots as 0 — there is no fill to
     ring, so it takes an ink ring and a shifted ground instead. Without this,
     tapping "None" changed nothing visible and looked like a dead control. */
  .tracker-page .tap-seg.is-edge { box-shadow: inset 0 0 0 2px var(--paper); }
  .tracker-page .tap-seg.is-edge:not(.is-filled) {
    /* "None" is off the heat ramp entirely — it is the absence of severity,
       not the bottom of it — so it is marked by a cobalt border rather than a
       fill. Filling it would read as "some amount of pain" on a scale where
       every other filled box means exactly that. The inset shadow doubles the
       border weight without the 1px reflow a border-width change would cause. */
    border-color: var(--cobalt);
    box-shadow: inset 0 0 0 1px var(--cobalt);
  }

  /* Immediate physical feedback on the tap itself, for every segment. */
  @media (prefers-reduced-motion: no-preference) {
    .tracker-page .tap-seg { transition: transform 0.09s ease; }
    .tracker-page .tap-seg:active { transform: scale(0.94); }
    .tracker-page .tap-chip { transition: transform 0.09s ease; }
    .tracker-page .tap-chip:active { transform: scale(0.97); }
  }
  .tracker-page .tap-seg:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 3px; }

  .tracker-page .tap-meterlabels {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 4px;
    margin-top: 7px;
  }
  .tracker-page .tap-meterlabels span {
    font-size: var(--t-fine);
    line-height: 1.25;
    text-align: center;
    color: var(--faint);
  }
  .tracker-page .tap-meterlabels span.is-on { color: var(--ink); font-weight: 700; }

  /* A measurement cannot be tapped. The rail still earns its place — it says
     which day you are entering — but the card holds a real field. */
  .tracker-page .tap-numwrap { display: flex; align-items: center; gap: 10px; }
  .tracker-page .tap-numwrap input {
    width: 8.5em;
    min-height: 44px;
    padding: 0 12px;
    font-family: inherit;
    /* Hard 16px, not a token: below this iOS zooms the page on focus. */
    font-size: 16px;
    font-variant-numeric: tabular-nums;
    color: var(--ink);
    background: var(--paper);
    border: 1px solid var(--rule-strong);
    border-radius: 4px;
  }
  .tracker-page .tap-numwrap input:focus-visible {
    outline: 2px solid var(--cobalt);
    outline-offset: 1px;
    border-color: var(--cobalt);
  }
  .tracker-page .tap-unit { font-size: var(--t-meta); color: var(--muted); }

  .tracker-page .tap-units { display: flex; }
  .tracker-page .tap-unitbtn {
    min-height: 44px;
    padding: 0 14px;
    font-family: inherit;
    font-size: var(--t-meta);
    color: var(--body);
    background: transparent;
    border: 1px solid var(--rule-strong);
    cursor: pointer;
  }
  .tracker-page .tap-unitbtn:first-child { border-radius: 4px 0 0 4px; }
  .tracker-page .tap-unitbtn:last-child { border-radius: 0 4px 4px 0; margin-left: -1px; }
  .tracker-page .tap-unitbtn[aria-pressed="true"] {
    background: var(--cobalt);
    border-color: var(--cobalt);
    color: var(--paper);
    font-weight: 600;
  }
  .tracker-page .tap-unitbtn:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 2px; position: relative; }

  .tracker-page .tap-choices { display: flex; flex-wrap: wrap; gap: 8px; }
  .tracker-page .tap-chip {
    min-height: 44px;
    padding: 0 15px;
    display: inline-flex;
    align-items: center;
    background: transparent;
    border: 1px solid var(--rule-strong);
    border-radius: 4px;
    color: var(--body);
    font-family: inherit;
    font-size: var(--t-meta);
    line-height: 1.3;
    cursor: pointer;
    text-align: left;
  }
  .tracker-page .tap-chip[aria-pressed="true"] {
    background: var(--cobalt);
    border-color: var(--cobalt);
    color: var(--paper);
    font-weight: 600;
  }
  .tracker-page .tap-chip.is-mark[aria-pressed="true"] {
    background: var(--burgundy);
    border-color: var(--burgundy);
    color: var(--burgundy-ink);
  }
  .tracker-page .tap-chip:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 3px; }

  .tracker-page .tap-noteopen {
    margin-top: 22px;
    min-height: 44px;
    padding: 0;
    background: none;
    border: none;
    color: var(--cobalt);
    font-family: inherit;
    font-size: var(--t-meta);
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
  }
  .tracker-page .tap-noteopen:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 3px; }
  .tracker-page .tap-notewrap { margin-top: 10px; }
  .tracker-page .tap-notewrap textarea {
    width: 100%;
    min-height: 72px;
    resize: vertical;
    font-family: inherit;
    /* Hard 16px, not a token: below this iOS zooms the page on focus. */
    font-size: 16px;
    padding: 10px 12px;
    border: 1px solid var(--rule-strong);
    border-radius: 4px;
    background: var(--paper);
    color: var(--ink);
  }
  .tracker-page .tap-notewrap textarea:focus-visible {
    outline: 2px solid var(--cobalt);
    outline-offset: 1px;
  }

  .tracker-page .tap-saved {
    margin: 18px 0 0;
    font-size: var(--t-small);
    color: var(--faint);
  }

  @media print {
    /* Paper gets the whole week at once, not one day at a time. The rail and
       the entry card are screen affordances; the printed sheet is the table
       the tap UI has been filling in all along. */
    .tracker-page .tap-rail,
    .tracker-page .tap-railnote,
    .tracker-page .tap-card,
    .tracker-page .tap-noteopen { display: none !important; }
    .tracker-page .tap-sheet { display: block !important; }
    .tracker-page .tap-sheet table { width: 100%; border-collapse: collapse; }
    .tracker-page .tap-sheet th,
    .tracker-page .tap-sheet td {
      border: 1px solid var(--rule-strong);
      padding: 6px 7px;
      font-size: var(--t-fine);
      text-align: left;
      vertical-align: top;
    }
    .tracker-page .tap-sheet th { font-weight: 700; }
    .tracker-page .tap-sheet td.is-mark { font-weight: 700; color: var(--burgundy); }
    body.print-blank .tracker-page .tap-sheet td:not(.tap-daycell) { color: var(--faint) !important; font-weight: 400 !important; }
  }
  .tracker-page .tap-sheet { display: none; }

  /* ---- exercise diagrams -------------------------------------------------
     Drawn, not filmed. A loop of an ankle tracing letters is the same size as
     a favicon, translates by swapping the caption, redraws from tokens in
     either theme, and prints as a still. Generated video of a person doing
     these would be heavier, untranslatable, and — the reason that matters —
     unreliable about the one thing the diagram exists to convey, which is the
     exact movement.
     ----------------------------------------------------------------------- */

  .tracker-page .ex-list {
    display: grid;
    gap: 14px;
    margin-top: 4px;
  }
  @media (min-width: 520px) {
    .tracker-page .ex-list { grid-template-columns: 1fr 1fr; }
  }

  .tracker-page .ex {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: 4px;
    padding: 13px 14px;
  }
  .tracker-page .ex svg {
    flex: 0 0 auto;
    width: 74px;
    height: 74px;
    overflow: visible;
  }
  .tracker-page .ex-name {
    margin: 0 0 4px;
    font-family: var(--serif);
    font-weight: 400;
    font-size: var(--t-h4);
    color: var(--ink);
    line-height: 1.2;
  }
  .tracker-page .ex-how {
    margin: 0;
    font-size: var(--t-small);
    color: var(--body);
    line-height: 1.5;
  }
  .tracker-page .ex-when {
    display: inline-block;
    margin-top: 7px;
    font-size: var(--t-fine);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--faint);
  }

  /* Colour comes from tokens, never baked into the markup, so the diagrams
     hold up in dark mode and on paper. */
  .tracker-page .ex-limb { stroke: var(--rule-strong); }
  .tracker-page .ex-move { stroke: var(--cobalt); }
  .tracker-page .ex-ground { stroke: var(--rule-strong); }
  .tracker-page .ex-trace { stroke: var(--cobalt); opacity: 0.4; }

  .tracker-page .ex-pivot {
    transform-box: view-box;
    transform-origin: 60px 74px;
  }
  .tracker-page .ex-standing {
    transform-box: view-box;
    transform-origin: 60px 104px;
  }
  .tracker-page .ex-rise {
    transform-box: view-box;
    transform-origin: 46px 104px;
  }

  @media (prefers-reduced-motion: no-preference) {
    .tracker-page .ex-anim-alphabet { animation: exAlphabet 5s ease-in-out infinite; }
    .tracker-page .ex-anim-band     { animation: exBand 2.6s ease-in-out infinite; }
    .tracker-page .ex-anim-sway     { animation: exSway 4s ease-in-out infinite; }
    .tracker-page .ex-anim-rise     { animation: exRise 2.8s ease-in-out infinite; }
    .tracker-page .ex-anim-bandline { animation: exBandLine 2.6s ease-in-out infinite; }
  }

  @keyframes exAlphabet {
    0%   { transform: rotate(-20deg); }
    20%  { transform: rotate(12deg); }
    40%  { transform: rotate(-8deg); }
    60%  { transform: rotate(24deg); }
    80%  { transform: rotate(-14deg); }
    100% { transform: rotate(-20deg); }
  }
  @keyframes exBand {
    0%, 100% { transform: rotate(-14deg); }
    50%      { transform: rotate(26deg); }
  }
  @keyframes exBandLine {
    0%, 100% { transform: scaleY(1); }
    50%      { transform: scaleY(1.18); }
  }
  @keyframes exSway {
    0%, 100% { transform: rotate(-2.5deg); }
    50%      { transform: rotate(2.5deg); }
  }
  @keyframes exRise {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-11px); }
  }

  /* shoulder */
  .tracker-page .ex-hang { transform-box: view-box; transform-origin: 60px 46px; }
  .tracker-page .ex-shoulder { transform-box: view-box; transform-origin: 44px 50px; }
  .tracker-page .ex-elbow { transform-box: view-box; transform-origin: 60px 62px; }
  @media (prefers-reduced-motion: no-preference) {
    .tracker-page .ex-anim-pendulum { animation: exPendulum 3.4s ease-in-out infinite; }
    .tracker-page .ex-anim-crossbody { animation: exCrossBody 3.6s ease-in-out infinite; }
    .tracker-page .ex-anim-extrot { animation: exExtRot 2.8s ease-in-out infinite; }
    .tracker-page .ex-anim-scap { animation: exScap 3s ease-in-out infinite; }
    .tracker-page .ex-anim-slr { animation: exSlr 3.2s ease-in-out infinite; }
    .tracker-page .ex-anim-sit { animation: exSit 3.4s ease-in-out infinite; }
    .tracker-page .ex-anim-walk { animation: exWalk 1.6s ease-in-out infinite; }
    .tracker-page .ex-anim-slide { animation: exSlide 3.2s ease-in-out infinite; }
  }
  @keyframes exPendulum {
    0%, 100% { transform: rotate(-16deg); }
    50%      { transform: rotate(16deg); }
  }
  @keyframes exCrossBody {
    0%, 100% { transform: rotate(0deg); }
    45%, 75% { transform: rotate(-42deg); }
  }
  @keyframes exExtRot {
    0%, 100% { transform: rotate(0deg); }
    50%      { transform: rotate(-38deg); }
  }
  @keyframes exScap {
    0%, 100% { transform: translateX(0); }
    50%      { transform: translateX(-7px); }
  }
  /* knee */
  .tracker-page .ex-hip { transform-box: view-box; transform-origin: 40px 74px; }
  .tracker-page .ex-knee { transform-box: view-box; transform-origin: 62px 92px; }
  @keyframes exSlr {
    0%, 100% { transform: rotate(0deg); }
    50%      { transform: rotate(-30deg); }
  }
  @keyframes exSit {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-16px); }
  }
  @keyframes exWalk {
    0%, 100% { transform: rotate(-15deg); }
    50%      { transform: rotate(15deg); }
  }
  @keyframes exSlide {
    0%, 100% { transform: rotate(0deg); }
    50%      { transform: rotate(-34deg); }
  }

  /* Provenance, not homework. It sits at the end of a module now, and reads
     as a quiet footnote rather than the first thing under the heading. */
  .tracker-page .source-ledger {
    background: transparent;
    border: none;
    border-top: 1px solid var(--rule);
    border-radius: 0;
    padding: 14px 0 0;
    margin-top: 26px;
    color: var(--faint);
  }
  .tracker-page .source-ledger summary {
    font-weight: 500;
    font-size: var(--t-small);
    color: var(--faint);
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  .tracker-page .ledger-src {
    margin: 4px 0 0;
    font-size: var(--t-fine);
    color: var(--faint);
  }

  /* On a phone the log stops being a table and becomes one labelled block per
     entry. Dragging a seven-column grid sideways one-handed, in pain, at 2am,
     is the difference between filling this in and giving up. */
  /* Always stacked on screen: the site column is 460px everywhere, so a
     680px-wide table would scroll sideways at every viewport. Paper keeps the
     real table — a doctor scanning it wants columns. */
  @media screen {
    .tracker-page .log-table-wrap {
      overflow-x: visible;
      border: none;
      background: transparent;
    }
    .tracker-page .log-table {
      min-width: 0;
      display: block;
    }
    .tracker-page .log-table thead {
      position: absolute;
      width: 1px;
      height: 1px;
      overflow: hidden;
      clip: rect(0 0 0 0);
      white-space: nowrap;
    }
    .tracker-page .log-table tbody,
    .tracker-page .log-table tr,
    .tracker-page .log-table td {
      display: block;
      width: auto;
    }
    .tracker-page .log-table tr {
      border: 1px solid var(--rule-strong);
      border-radius: 4px;
      background: var(--paper);
      padding: 6px 12px 12px;
      margin-bottom: 12px;
    }
    .tracker-page .log-table td {
      border-bottom: none;
      padding: 8px 0 0;
      width: auto !important;
    }
    .tracker-page .log-table td::before {
      content: attr(data-label);
      display: block;
      font-size: var(--t-fine);
      font-weight: 600;
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: 0.04em;
      margin-bottom: 2px;
    }
    .tracker-page .log-table input {
      border: 1px solid var(--rule-strong) !important;
      background: var(--paper) !important;
      padding: 10px !important;
      min-height: 44px;
    }
  }

/* --- Recovery tracker: motion ----------------------------------------------
   This surface is a tool being filled in, not a page being read, so nothing
   here is an entrance and nothing delays access to a field. Each animation
   below does one job: confirm a save, explain a module swap, or point at the
   row the reader just asked for.

   The save note is the load-bearing one. The product's whole promise is that
   these notes are kept on this device, and until something says so the reader
   has no evidence of it. It stays legible under reduced motion for that reason
   — only the movement is dropped, never the confirmation. */

.tracker-page .save-note {
  min-height: 1.2em;
  margin: 6px 0 0;
  font-size: var(--t-small);
  color: var(--faint);
  opacity: 0;
}
.tracker-page .save-note.is-on { opacity: 1; }

@media (prefers-reduced-motion: no-preference) {
  .tracker-page .save-note {
    transform: translateY(-2px);
    transition: opacity 0.18s ease, transform 0.18s ease;
  }
  .tracker-page .save-note.is-on { transform: none; }

  .tracker-page .tracker-module.is-entering {
    animation: trk-swap 0.22s cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  .tracker-page .log-table tr.is-new {
    animation: trk-newrow 1.6s ease-out both;
  }
}

@media (prefers-reduced-motion: reduce) {
  /* Reduced motion means gentler, not silent: the confirmation still appears,
     and the new row still identifies itself — just without movement. */
  .tracker-page .save-note { transition: opacity 0.18s ease; }
  .tracker-page .log-table tr.is-new { animation: trk-newrow-flat 1.6s ease-out both; }
}

@keyframes trk-swap {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
@keyframes trk-newrow {
  0%   { opacity: 0; transform: translateY(5px); border-color: var(--cobalt); }
  30%  { opacity: 1; transform: none;            border-color: var(--cobalt); }
  100% { opacity: 1; transform: none;            border-color: var(--rule-strong); }
}
@keyframes trk-newrow-flat {
  0%   { border-color: var(--cobalt); }
  30%  { border-color: var(--cobalt); }
  100% { border-color: var(--rule-strong); }
}

.tracker-page .metric-sub {
  font-size: var(--t-fine);
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* Axis titles and scale ticks. Recessive by design — they orient the reader
   without competing with the numbers the reader put there. */
.tracker-page .chart-svg-container .ch-axis-title { fill: var(--muted); }
.tracker-page .chart-svg-container .ch-tick { fill: var(--faint); font-variant-numeric: tabular-nums; }

.tracker-page .check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-size: var(--t-meta);
  line-height: 1.4;
  cursor: pointer;
}
.tracker-page .check-row input[type="checkbox"] {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  accent-color: var(--cobalt);
  cursor: pointer;
}

/* ================================================== where-to-go comparison ==
   The page's job is a comparison, so the comparison happens first: three short
   rows answering the questions a reader actually holds — when is it open, can
   it admit me, what does it cost — before any prose. The panels below are
   reference for whoever wants the detail.

   Two rules this layout exists to keep:
     - Capabilities and limitations are labelled and separated. Run together in
       one bullet list, "cannot admit you to hospital" reads at a glance as a
       feature. Colour does no work: the headings carry the meaning, and the
       markers are drawn geometry, not glyphs.
     - The access message is not a capability and never sits in a bullet list
       beside one. It is ruled instead — and deliberately not burgundy. The
       page already has one burgundy moment, and a second stops the first from
       being a signal.
   ========================================================================== */

.wtg-ledger { padding: 42px var(--gutter) 0; display: flex; flex-direction: column; gap: 22px; }
.wtg-ledger-h {
  margin: 0; font-family: var(--serif); font-weight: 400;
  font-size: var(--t-h3); line-height: 1.2; color: var(--ink);
}
.wtg-row { display: flex; flex-direction: column; gap: 9px; }
.wtg-row-q {
  margin: 0; padding-bottom: 7px; border-bottom: 1px solid var(--rule);
  font-size: var(--t-eyebrow); font-weight: 600; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--faint);
}
.wtg-row-a { margin: 0; display: flex; flex-direction: column; gap: 7px; }
/* em-based first column so it tracks the reader's text-size choice instead of
   pinning the place names to a px width that overflows at `larger`. */
.wtg-cell { display: grid; grid-template-columns: 8.4em 1fr; gap: 12px; align-items: baseline; }
.wtg-cell dt { font-size: var(--t-meta); line-height: 1.45; color: var(--muted); }
.wtg-cell dd { margin: 0; font-size: var(--t-meta); line-height: 1.45; color: var(--ink); font-weight: 500; }

.wtg-places { padding: 12px var(--gutter) 0; display: flex; flex-direction: column; }
.wtg-detail-h { margin: 40px 0 4px; }

/* Hairlines, not panels. The ledger above already carries the page's one
   grouped block; a second card system underneath it would compete. */
.wtg-place { display: flex; flex-direction: column; gap: 14px; padding: 24px 0; border-top: 1px solid var(--rule); }
.wtg-place:first-of-type { border-top: none; }

.wtg-place-head { display: flex; flex-direction: column; gap: 4px; }
.wtg-place-head h2 {
  margin: 0; font-family: var(--serif); font-weight: 400;
  font-size: var(--t-h2-sm); line-height: 1.15; letter-spacing: -0.006em;
  text-wrap: balance;
}
.wtg-open { margin: 0; font-size: var(--t-small); line-height: 1.4; color: var(--faint); }

.wtg-when { margin: 0; font-size: var(--t-body); line-height: 1.5; color: var(--ink); }

.wtg-cols { display: flex; flex-direction: column; gap: 14px; }
.wtg-col { display: flex; flex-direction: column; gap: 7px; }
.wtg-col-h {
  margin: 0;
  font-size: var(--t-eyebrow); font-weight: 600; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--faint);
}

.wtg-cols ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.wtg-cols li {
  position: relative; padding-left: 22px;
  font-size: var(--t-meta); line-height: 1.5; color: var(--body);
}
/* A tick for what it can do, a bar for what it cannot. Recessive on purpose —
   the column heading is the signal, these only keep the lists apart. */
.wtg-can li::before {
  content: ''; position: absolute; left: 3px; top: 0.42em;
  width: 5px; height: 9px;
  border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted);
  transform: rotate(42deg);
}
.wtg-cannot li::before {
  content: ''; position: absolute; left: 1px; top: 0.68em;
  width: 11px; height: 0; border-top: 1.5px solid var(--muted);
}

.wtg-cost { margin: 0; font-size: var(--t-meta); line-height: 1.55; color: var(--body); }
.wtg-cost-h {
  display: inline-block; margin-right: 9px;
  font-size: var(--t-eyebrow); font-weight: 600; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--faint);
}

.wtg-access {
  margin: 2px 0 0; padding-top: 12px; border-top: 2px solid var(--ink);
  font-size: var(--t-meta); line-height: 1.5; color: var(--ink); font-weight: 500;
}

/* The ledger is the comparison. On paper it must survive the page break as a
   unit, or a reader gets the question in one hand and the answers in another. */
@media print {
  .wtg-row, .wtg-place { break-inside: avoid; }
}

/* ------------------------------------------------ where-to-go: service lookup
   Spec: after/explore/service-lookup-spec.md.

   A filter over the settings above, never a router: the reader picks an errand
   they already know they need, and every setting that does it is listed —
   including the ones that answer no. No free text, no submit, no second step.

   Ships expanded and is collapsed by script, so it is complete without JS.
   Availability is always a word; the level classes below only set weight. */

.wtg-lookup { padding: 44px var(--gutter) 0; display: flex; flex-direction: column; gap: 14px; }
.wtg-lookup-lede { margin: -4px 0 2px; font-size: var(--t-meta); line-height: 1.55; color: var(--muted); }

.wtg-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.wtg-chip {
  min-height: 44px; padding: 0 15px;
  display: inline-flex; align-items: center; text-align: left;
  background: var(--panel); border: 1px solid var(--rule-strong); border-radius: 0;
  color: var(--ink); font-family: var(--sans); font-size: var(--t-meta); line-height: 1.35;
  cursor: pointer;
}
.wtg-chip:hover { background: var(--panel-hover); }
/* Selected state carries weight and ground, not colour alone. */
.wtg-chip.is-on {
  background: var(--ink); border-color: var(--ink); color: var(--paper); font-weight: 600;
}
@media (prefers-reduced-motion: no-preference) {
  .wtg-chip { transition: background 140ms ease, color 140ms ease, border-color 140ms ease; }
}

/* Answers open below the whole chip group, so revealing one never shifts the
   chips under the reader's thumb. */
.wtg-answers { display: flex; flex-direction: column; gap: 18px; }
/* The open answer reads as the response to the chips, not as more page. */
.wtg-lookup.is-live .wtg-answers { margin-top: 10px; padding-top: 18px; border-top: 1px solid var(--rule); }
.wtg-lookup.is-live.is-empty .wtg-answers { margin-top: 0; padding-top: 0; border-top: none; }

.wtg-answer { display: flex; flex-direction: column; gap: 10px; }
.wtg-answer-h {
  margin: 0; font-family: var(--serif); font-weight: 400;
  font-size: var(--t-h4); line-height: 1.25; color: var(--ink);
}
/* With the script running the chip already names the service, so the repeated
   heading is for screen readers only. Without it, the heading is the label. */
.wtg-lookup.is-live .wtg-answer-h {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

.wtg-answer-list { margin: 0; display: flex; flex-direction: column; gap: 10px; }
.wtg-answer-row { display: grid; grid-template-columns: 8.4em 1fr; gap: 12px; align-items: baseline; }
.wtg-answer-row dt { font-size: var(--t-meta); line-height: 1.45; color: var(--muted); }
.wtg-answer-row dd { margin: 0; display: flex; flex-direction: column; gap: 3px; }
.wtg-lvl { font-size: var(--t-meta); line-height: 1.45; color: var(--ink); font-weight: 500; }
.wtg-lvl-no .wtg-lvl { font-weight: 400; color: var(--muted); }
.wtg-bring { font-size: var(--t-small); line-height: 1.45; color: var(--body); }

.wtg-lookup-fine {
  margin: 2px 0 0; padding-top: 12px; border-top: 1px solid var(--rule);
  font-size: var(--t-small); line-height: 1.5; color: var(--faint);
}

@media print {
  /* Print opens everything — a printed page with content hidden inside it has
     holes. Same rule as the guide fold. */
  .wtg-lookup .wtg-answer { display: flex !important; }
  .wtg-lookup.is-live .wtg-answer-h {
    position: static; width: auto; height: auto; margin: 0; clip-path: none;
  }
  .wtg-chips { display: none; }
  .wtg-answer { break-inside: avoid; }
}

/* -------------------------------------------------------------- about page
   Authorship leads. The one thing that makes this site worth trusting is that
   a named, board-certified emergency physician writes it and signs off on
   every guide, and as five identical h2 sections that read exactly like the
   privacy paragraph.

   Restrained on purpose (brand commitment): a face, a name, a credential, and
   what he is responsible for. No portrait hero, no achievements, no story. */

/* Stacked, not face-beside-name: at phone width a portrait column leaves the
   name about 175px, which breaks "Tameze-Rivas" at its own hyphen. Full width
   lets the name set on one line and reads as a byline rather than a profile. */
.author {
  margin: 30px var(--gutter) 0; padding: 22px 20px;
  background: var(--panel); border-top: 2px solid var(--ink);
  display: flex; flex-direction: column; align-items: flex-start; gap: 14px;
}
.author-face {
  flex: none; width: 84px; height: 84px;
  object-fit: cover; object-position: center top;
  /* Square, not a circle. The circular avatar is the internet's default, and
     this site has a zero-radius vocabulary — a portrait plate is the choice
     that belongs to it. */
  border-radius: 0;
}
.author-said { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.author-said h2 {
  margin: 0; font-family: var(--serif); font-weight: 400;
  font-size: var(--t-h3); line-height: 1.2; text-wrap: balance;
}
/* --muted, not --faint: on the panel ground --faint measures 4.60:1, which
   clears AA by 0.10 and breaks the moment the panel darkens. */
.author-cred { margin: 0; font-size: var(--t-small); line-height: 1.4; color: var(--muted); }
.author-line { margin: 4px 0 0; font-size: var(--t-meta); line-height: 1.55; color: var(--body); }

/* Independence sits with authorship, not inside the prose — it qualifies who
   is speaking. Outside the panel so it does not read as part of the byline. */
.author-independent {
  margin: 14px var(--gutter) 0; font-size: var(--t-meta); line-height: 1.6; color: var(--body);
}

/* The order is the content: the approval gate is last and nothing skips it.
   Cobalt numerals are the takeaways vocabulary from the guides, reused. */
.pipeline {
  margin: 0; padding: 0 var(--gutter) 0 calc(var(--gutter) + 22px);
  display: flex; flex-direction: column; gap: 12px;
}
.pipeline li { font-size: var(--t-body); line-height: 1.55; color: var(--ink); }
.pipeline li::marker { color: var(--cobalt); font-weight: 600; }

/* A prose block continuing after an interruption starts flush, not 30px down. */
.prose-cont { padding-top: 14px; }

/* The 911 line is the one paragraph on this page a reader may need at speed.
   Ruled rather than coloured: burgundy is the emergency signal, and this page
   has no other burgundy on it to keep that signal distinct from. */
.prose .prose-rule {
  margin: 4px 0 14px; padding-top: 12px; border-top: 2px solid var(--ink);
  font-weight: 500; color: var(--ink);
}

/* ------------------------------------- where-to-go at the larger text size ---
   The reader's text-size control scales every token, and an 8.4em label column
   scales with it: at `larger` it took 160px of a 315px line and left the answer
   narrower than its own label. Both paired lists stack instead — the label is
   muted and the answer is ink, so the pairing survives without the column. */
html[data-textsize='larger'] .wtg-cell,
html[data-textsize='larger'] .wtg-answer-row {
  grid-template-columns: 1fr; gap: 2px;
}
html[data-textsize='larger'] .wtg-row-a { gap: 12px; }
html[data-textsize='larger'] .wtg-answer-list { gap: 14px; }

/* --------------------------------------------- service lookup: clustering ---
   Eleven options at one decision point is past what anyone scans, and at phone
   width the labels defeated the wrap: nine chips alone on their own line read
   as a broken toolbar rather than a list. Three named clusters of 3-4. */
.wtg-group { display: flex; flex-direction: column; gap: 8px; }
.wtg-lookup .wtg-group + .wtg-group { margin-top: 16px; }

/* The revealed answer takes focus so the change is announced; it is a scroll
   destination, not a control, so it gets no ring of its own. */
.wtg-answer { scroll-margin-top: calc(var(--bar-h) + 16px); }
.wtg-answer:focus { outline: none; }
.wtg-answer:focus-visible { outline: none; }

/* ==========================================================================
   PREVIEW — branch try/reverse-hero (2026-09-11). Scroll-scrubbed exit clip
   above the homepage search. Not a decision. Delete this whole section to
   remove the experiment. Styles live here, not in the page, per TOOLING.md.
   ========================================================================== */
  /* PREVIEW — reverse-hero experiment. Tokens only; nothing new invented. */
  /* 150svh → 120svh (mobile pass, 2026-09-11): the scrub still plays out,
     but the first guide card arrives a full screen sooner. */
  .exit { height: 120svh; position: relative; }
  /* Stage is shorter than the viewport on purpose: at scroll 0 the site bar
     sits above it, and the headline + search must still be on screen — and
     clear of the tracker button pinned bottom-right. */
  .exit-stage {
    position: sticky; top: var(--bar-h, 44px); height: calc(100svh - 220px); min-height: 500px;
    overflow: hidden; background: var(--ink-deep); color: #fff;
  }
  .exit-video {
    position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: cover; object-position: 50% 60%; transform: scale(1.04);
  }
  .exit-shade {
    position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(14,26,45,.55) 0%, rgba(14,26,45,.05) 40%, rgba(14,26,45,.85) 100%);
  }
  .exit-fade { position: absolute; inset: 0; background: var(--paper); opacity: var(--fade, 0); pointer-events: none; }
  .exit-copy {
    position: absolute; left: var(--gutter); right: var(--gutter); bottom: 64px;
    display: flex; flex-direction: column; gap: 14px; text-align: left;
    color: color-mix(in srgb, var(--ink) calc(var(--fade, 0) * 100%), #fff);
  }
  .exit-copy h1 {
    margin: 0; font-family: var(--serif); font-weight: 400;
    font-size: var(--t-h1); line-height: 1.16; letter-spacing: -0.005em; text-wrap: balance;
  }
  .exit-copy .lede { margin: 0; font-size: var(--t-lede); line-height: 1.6; color: color-mix(in srgb, var(--muted) calc(var(--fade, 0) * 100%), #D5DCE8); }
  /* Search lives in the overlay so it is usable from the first frame. Paper
     panel on top of the video for legibility; the tokens are unchanged. */
  .exit-copy .search { margin: 6px 0 0; background: var(--paper); color: var(--faint); box-shadow: 0 8px 28px rgba(14,26,45,.28); }
  .exit-copy .search input { color: var(--ink); }
  .exit-copy .search:focus-within { outline-color: #fff; }
  .exit-copy .lede { margin-bottom: 4px; }

  /* Reduced motion: no pin, no scrub. A still frame and the same words. */
  html[data-reader-motion='reduce'] .exit { height: auto; --fade: 0 !important; }
  html[data-reader-motion='reduce'] .exit-stage { position: relative; top: auto; }
  html[data-reader-motion='reduce'] .exit-video { visibility: hidden; }
  html[data-reader-motion='reduce'] .exit-stage {
    background: var(--ink-deep) url('/assets/walkout-sun-poster.jpg') center 60% / cover no-repeat;
  }
  @media (prefers-reduced-motion: reduce) {
    .exit { height: auto; }
    .exit-stage { position: relative; height: 70svh; min-height: 520px; }
  }

  /* ?text=below — the clip is only the picture; words sit on paper beneath it. */
  .exit[data-text='below'] { height: auto; }
  .exit[data-text='below'] .exit-stage { position: relative; top: auto; height: 44svh; min-height: 300px; max-height: 480px; }
  .exit[data-text='below'] .exit-shade { background: linear-gradient(180deg, rgba(14,26,45,.25) 0%, rgba(14,26,45,0) 45%); }
  .exit-copy.is-below {
    position: static; padding: 26px var(--gutter) 0;
    align-items: center; text-align: center; color: var(--ink);
  }
  .exit-copy.is-below h1 { color: var(--ink); max-width: 320px; }
  .exit-copy.is-below .lede { color: var(--muted); max-width: 280px; margin-bottom: 0; }
  .exit-copy.is-below .search {
    width: 100%; margin: 8px 0 0; background: var(--panel); color: var(--faint); box-shadow: none;
  }
  .exit-copy.is-below .search:focus-within { outline-color: var(--cobalt); }

  /* --- Guide-card reveal variants (?cards=). "old" = the pre-existing rule. --- */
  @media (prefers-reduced-motion: no-preference) {
    @supports (animation-timeline: view()) {
      .cards[data-cards='lift'] .card.reveal {
        transform: translateY(28px) scale(0.97);
        animation-name: card-lift; animation-range: entry 0% entry 85%;
      }
      .cards[data-cards='slide'] .card.reveal {
        transform: translateX(-22px);
        animation-name: card-slide; animation-range: entry 0% entry 70%;
      }
      .cards[data-cards='stagger'] .card.reveal {
        transform: translateY(24px);
        animation-name: card-lift; animation-range: entry 0% entry 80%;
      }
      .cards[data-cards='stagger'] .card.reveal:nth-child(even) { animation-range: entry 12% entry 92%; }
      .cards[data-cards='stagger'] .card.reveal b,
      .cards[data-cards='stagger'] .card.reveal span {
        opacity: 0; transform: translateY(8px);
        animation-name: rise; animation-duration: auto; animation-fill-mode: forwards;
        animation-timing-function: linear; animation-timeline: view();
      }
      .cards[data-cards='stagger'] .card.reveal b    { animation-range: entry 10% entry 80%; }
      .cards[data-cards='stagger'] .card.reveal span { animation-range: entry 22% entry 95%; }
    }
    /* Fallback: no scroll-driven animations. JS adds .is-in as cards enter. */
    html[data-reveal-fallback='on'] .reveal {
      opacity: 0; transform: translateY(20px);
      transition: opacity 0.55s ease-out, transform 0.55s cubic-bezier(.2,.7,.2,1);
    }
    html[data-reveal-fallback='on'] .reveal.is-in { opacity: 1; transform: none; }
  }
  /* Ease-out encoded in the keyframes: view() timelines are linear by nature. */
  @keyframes card-lift  { 55% { opacity: 0.92; transform: translateY(5px) scale(0.995); } to { opacity: 1; transform: none; } }
  @keyframes card-slide { 55% { opacity: 0.92; transform: translateX(-4px); } to { opacity: 1; transform: none; } }

  /* Homepage guide cards: text only, with a soft silhouette and full summaries. */
  .guides { --guide-card-radius: 16px; scroll-margin-top: calc(var(--bar-h) + 24px); }
  .guides .group { width: 100%; display: flex; flex-direction: column; gap: 12px; }
  .guides .group + .group { margin-top: 26px; }
  .guides .group-h {
    margin: 0; font-family: var(--sans); font-weight: 600;
    font-size: var(--t-small); letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint);
  }
  .cards[data-grid='2'] {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px;
  }
  html[data-cols='1'] .cards[data-grid='2'],
  html[data-cols='auto'][data-textsize='larger'] .cards[data-grid='2'] {
    grid-template-columns: 1fr;
  }
  .guides .card {
    min-width: 0; padding: 18px 16px 16px; gap: 10px;
    border-radius: var(--guide-card-radius);
    background: var(--panel); color: var(--ink);
    transition: background 180ms ease, box-shadow 180ms ease;
  }
  .guides .card b {
    font-size: var(--t-h4); line-height: 1.25; text-wrap: pretty;
    overflow-wrap: anywhere;
  }
  .guides .card .card-summary {
    font-size: var(--t-body); line-height: 1.45; color: var(--muted);
  }
  .guides .card .card-go {
    flex: none; align-self: flex-end; margin-top: auto;
    width: 30px; height: 30px; padding: 6px; box-sizing: border-box;
    border-radius: 50%; background: var(--paper); color: var(--cobalt);
    transition: transform 180ms ease, background 180ms ease, color 180ms ease;
  }
  .guides .card:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 3px; }
  .guides .card:focus-visible .card-go { background: var(--cobalt); color: var(--paper); }
  @media (hover: hover) {
    .guides .card:hover {
      background: var(--panel-hover);
      box-shadow: 0 6px 16px rgba(14,26,45,.08);
    }
    .guides .card:hover .card-go {
      transform: translateX(2px); background: var(--cobalt); color: var(--paper);
    }
  }
  .guides .card:active { background: var(--panel-hover); box-shadow: inset 0 0 0 1px var(--cobalt); }
  /* Keep the entire text visible together; per-line reveals delayed reading. */
  .guides .cards[data-cards] .card.reveal b,
  .guides .cards[data-cards] .card.reveal span {
    animation: none; opacity: 1; transform: none;
  }
  @media (max-width: 350px) {
    .guides .cards[data-grid='2'] { grid-template-columns: 1fr; }
  }
  @media (prefers-reduced-motion: reduce) {
    .guides .card, .guides .card .card-go { transition: none; }
    .guides .card:hover, .guides .card:active,
    .guides .card:hover .card-go { transform: none; }
  }

  /* Cross-document view transition: tapped tile → guide title morph, the rest
     crossfades. Supported in Chrome and Safari 18.2+; older browsers just load
     the page. Off entirely under reduced motion. */
  @media (prefers-reduced-motion: no-preference) {
    @view-transition { navigation: auto; }
    .guide > h1:first-of-type,
    .guide h1:first-child { view-transition-name: guide-title; }
    ::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.28s; }
    ::view-transition-old(guide-title), ::view-transition-new(guide-title) {
      animation-duration: 0.34s; animation-timing-function: cubic-bezier(.2,.7,.2,1);
    }
    ::view-transition-old(guide-title) { animation-name: card-to-title-out; }
    @keyframes card-to-title-out { to { opacity: 0; } }
  }

  /* --- ?nav=menu: hamburger + bottom sheet instead of the shortcut row --- */
  .menu-btn { display: none; }
  html[data-nav='menu'] .nav { display: none; }
  html[data-nav='menu'] .bar .barpad { position: relative; min-height: 44px; padding: 8px 60px; }
  html[data-nav='menu'] .bar .brand { font-size: var(--t-meta); letter-spacing: 0.28em; }
  html[data-nav='menu'] .bar .brand-author { display: none; }
  html[data-nav='menu'] .menu-btn {
    display: flex; align-items: center; justify-content: center;
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
    width: 44px; height: 44px; border: 0; background: transparent; color: var(--ink); cursor: pointer;
  }
  html[data-nav='menu'] .menu-btn:hover { color: var(--cobalt); }
  html[data-nav='menu'] .bar[data-compact='false'] .barpad { padding-bottom: 8px; }
  html[data-nav='menu'] .bar[data-compact='true'] .menu-btn { top: 50%; }

  .menu-sheet {
    position: fixed; inset: auto 0 0 0; margin: 0 auto; width: 100%; max-width: 460px;
    border: 0; padding: 8px 20px 22px; background: var(--paper); color: var(--ink);
    border-radius: 18px 18px 0 0; box-shadow: 0 -12px 40px rgba(14,26,45,.18);
  }
  .menu-sheet::backdrop { background: rgba(14,26,45,.45); }
  .menu-sheet { max-height: calc(100dvh - 24px); overflow-y: auto; overscroll-behavior: contain; }
  .sheet-drag-zone { min-height: 44px; display: flex; align-items: center; justify-content: center; touch-action: none; cursor: grab; }
  .sheet-drag-zone:active { cursor: grabbing; }
  .sheet-handle { width: 40px; height: 4px; border-radius: 2px; background: var(--rule-strong); }
  .sheet-head { display: flex; align-items: center; justify-content: space-between; padding-bottom: 6px; }
  .sheet-brand { font-family: var(--serif); font-size: var(--t-h4); letter-spacing: 0.34em; padding-left: 0.34em; }
  .sheet-close {
    width: 44px; height: 44px; border: 0; background: transparent; color: var(--muted); cursor: pointer;
    display: flex; align-items: center; justify-content: center; margin-right: -12px;
  }
  .sheet-nav { display: flex; flex-direction: column; }
  .sheet-nav a {
    display: flex; align-items: center; justify-content: space-between;
    min-height: 56px; padding: 0 2px; border-top: 1px solid var(--rule);
    font-family: var(--serif); font-size: var(--t-h3); color: var(--ink);
  }
  .sheet-nav a:last-child { border-bottom: 1px solid var(--rule); }
  .sheet-nav a svg { color: var(--cobalt); }
  .sheet-nav a:hover { color: var(--cobalt); }
  .sheet-prefs { display: flex; flex-direction: column; gap: 10px; padding: 14px 0 2px; }
  .sheet-prefs .foot { padding: 0; border-top: 0; }
  .sheet-prefs .lbl { font-size: var(--t-small); color: var(--muted); }
  .sheet-sos {
    display: flex; align-items: center; justify-content: center; min-height: 48px; margin-top: 16px;
    background: var(--burgundy); color: var(--burgundy-ink); text-decoration: none;
    font-size: var(--t-meta); font-weight: 600;
  }
  @media (prefers-reduced-motion: no-preference) {
    .menu-sheet[open] { animation: sheet-up 0.28s cubic-bezier(.2,.7,.2,1); }
    .menu-sheet[open]::backdrop { animation: sheet-fade 0.28s ease-out; }
  }
  @keyframes sheet-up   { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
  @keyframes sheet-fade { from { opacity: 0; } }

  /* --- ?rail=a|b|c — E·R accent on the rail, echoing the wordmark's ER --- */
  /* a: E and R both burgundy, exactly like the wordmark. R's link cue moves
        from colour to an underline so the letter can carry the brand accent. */
  html[data-rail='a'] .rail .ltr[data-ltr='E'],
  html[data-rail='a'] .rail .ltr[data-ltr='R'] { color: var(--burgundy); }
  html[data-rail='a'] .rail .step-r .ltr { color: var(--burgundy); }
  html[data-rail='a'] .rail .step-r small { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--cobalt); color: var(--cobalt); }
  /* b: E burgundy only — it IS the emergency section, so the colour is literal.
        R stays cobalt because it is a link. No rule bent. */
  html[data-rail='b'] .rail .ltr[data-ltr='E'] { color: var(--burgundy); }
  /* c: as a, plus the segment of the rail line between E and R turns burgundy
        so the pair reads as one unit, the way the wordmark does. */
  html[data-rail='c'] .rail .ltr[data-ltr='E'],
  html[data-rail='c'] .rail .step-r .ltr { color: var(--burgundy); }
  html[data-rail='c'] .rail .step-r small { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--cobalt); color: var(--cobalt); }
  html[data-rail='c'] .rail::after {
    content: ''; position: absolute; top: 34px; height: 1px; background: var(--burgundy);
    left: calc(9% + (82% * 3 / 4)); right: 9%;
  }
  /* Dark: burgundy on dark ground vanishes; use the tint-safe text value. */
  html[data-theme='dark'][data-rail] .rail .ltr[data-ltr='E'],
  html[data-theme='dark'][data-rail='a'] .rail .step-r .ltr,
  html[data-theme='dark'][data-rail='c'] .rail .step-r .ltr { color: var(--burgundy-text); }

.return-nav { margin: 12px 0 8px; }
.return-nav a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 0; color: var(--cobalt); line-height: 1.45; }
.return-nav svg { flex-shrink: 0; }
.return-nav a:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 4px; border-radius: 3px; }
@media print { .return-nav { display: none; } }
