/* ============================================================
   HealthLit · PFT Explainer — module styles

   The design tokens below are the repo's existing design system, taken
   from the root index.html :root block so this module and the PMOS
   module render as one product (Build Brief r2 §1, "Look and feel":
   use the design system already in the repo if one exists).

   Both mechanics read these same variable names with fallbacks
   (--sans, --serif, --ink, --paper, --accent, --teal, --fs …), so
   defining them here is what makes an embedded mechanic inherit the
   module's palette rather than render in its standalone defaults.

   Typefaces are self-hosted in ./fonts (Rules 5.1, 5.2, 5.6): the
   module makes no third-party request at any point, so it works
   offline from the first byte rather than from the second visit.
   ============================================================ */

@import url('./fonts/fonts.css');

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

:root {
  --ink: #1a1a18;
  --ink-mid: #4a4a44;
  --ink-light: #8a8a80;
  --ink-faint: #b5b1a8;
  --paper: #f7f4ee;
  --paper-warm: #ede9df;
  --paper-dark: #e2ddd3;
  /* Three tokens carry a measured value rather than the repository's, so the
     module meets WCAG AA (Rule 5.5). The repository's values were measured
     and reported; `tools/contrast_check.js` is what found each one, and the
     build report records the before-and-after ratio for Module Design to
     rule on. The root PMOS module carries the repository's values and so
     carries the same three findings.

     --paper-deep was #d6cfc2, which gives 1.41:1 against --paper. It is the
     border colour of nearly every control in the module and in both
     mechanics, which read the same token, so a control's only visible
     boundary was failing 1.4.11's 3:1 everywhere at once. #8a7f6f is the
     same warm family at 3.58:1 on --paper and 3.24:1 on --paper-warm, so it
     clears 3:1 on both grounds a control can sit on. */
  --paper-deep: #8a7f6f;

  /* --accent was #c4530a. The mechanics set --paper text on an --accent
     ground for their primary control, which came to 4.17:1 — under AA for
     normal text — and the same colour as text on --paper came to the same
     4.17:1. #a3440a takes both to 5.65:1. The hue is the repository's, one
     step deeper. --accent-deep moves down with it so the pair stays
     distinguishable. */
  --accent: #a3440a;
  --accent-deep: #8f3b08;
  --accent-light: #f0e8df;
  --accent-soft: #fbf3e9;

  --teal: #1a6b5a;
  --teal-light: #dff0eb;
  --amber: #8b5e08;
  --amber-light: #f5eddb;
  --blue: #1a4a7a;
  --blue-light: #deeaf5;
  --green: #2d5a1a;
  --green-light: #e4f0dc;
  --rose: #8a1a3a;
  --rose-light: #f3dde4;

  --serif: 'Playfair Display', Georgia, serif;
  --sans: 'DM Sans', system-ui, sans-serif;
  --mono: 'DM Mono', ui-monospace, monospace;

  --shadow-sm: 0 1px 3px rgba(26,26,24,.06);
  --shadow-md: 0 4px 16px rgba(26,26,24,.08);
  --shadow-lg: 0 12px 36px rgba(26,26,24,.16);

  --fs: 1;
}

html, body { height: 100%; }

body {
  font-family: var(--sans);
  background: var(--paper-warm);
  color: var(--ink);
  font-size: calc(15px * var(--fs));
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
button:disabled { cursor: not-allowed; opacity: .5; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
/* The header is the module's one dark ground, where --accent gives the ring
   2.81:1 — under 1.4.11's 3:1. The same light tint the wordmark uses gives
   6.55:1. A focus ring that cannot be seen is not an indicator. */
.hdr :focus-visible { outline-color: #e08a45; }

/* Rule 5.3: every animation stills under prefers-reduced-motion. The
   module's own scaffolds also check the query in script before they
   animate at all, so a stilled animation is a still picture rather than
   a fast one. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .btn-primary:hover { transform: none; }
  .option:hover { transform: none; }
}

/* ───── App frame ───── */
.app {
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--paper);
  box-shadow: var(--shadow-lg);
  position: relative;
  display: flex;
  flex-direction: column;
}
@media (min-width: 720px) {
  .app { margin: 2rem auto; min-height: calc(100vh - 4rem); border-radius: 14px; }
  body { padding: 0 1rem; }
}

/* ───── Header strip ───── */
.hdr {
  background: var(--ink);
  color: var(--paper);
  padding: .8rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-shrink: 0;
}
.hdr-brand { display: flex; flex-direction: column; gap: 1px; }
.hdr-mark {
  font-family: var(--mono);
  font-size: calc(9.5px * var(--fs));
  letter-spacing: .16em;
  text-transform: uppercase;
  /* Not --accent: the wordmark sits on --ink, where the accent gives 3.81:1
     at 9.5px — under AA. A light tint of the same hue gives 6.55:1 and still
     reads as the accent. The token is not changed, because --accent is
     correct everywhere it sits on paper; only this one placement is on ink. */
  color: #e08a45;
}
.hdr-title {
  font-family: var(--serif);
  font-size: calc(13px * var(--fs));
  line-height: 1.3;
}
.hdr-credits {
  font-size: calc(11px * var(--fs));
  /* --paper-warm, not --paper-deep: this link is on the --ink header, and
     --paper-deep is now the measured border tone, which would leave an 11px
     link at 4.44:1. 14.38:1 here. */
  color: var(--paper-warm);
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: .35rem .2rem;
  flex-shrink: 0;
}
.hdr-credits:hover { color: var(--paper); }

/* ───── Progress dots (decorative; the count is not read out) ───── */
.progress { display: flex; gap: 5px; padding: .7rem 1.25rem 0; flex-shrink: 0; }
.progress i {
  height: 3px;
  flex: 1;
  border-radius: 2px;
  background: var(--paper-dark);
}
.progress i.done { background: var(--ink-faint); }
.progress i.here { background: var(--accent); }

/* ───── Screen body ───── */
.screen {
  flex: 1;
  padding: 1.1rem 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .9rem;
}
.eyebrow {
  font-family: var(--mono);
  font-size: calc(9.5px * var(--fs));
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
}
.screen h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: calc(25px * var(--fs));
  line-height: 1.22;
  letter-spacing: -.01em;
}
.screen h1:focus { outline: none; }
.screen h1:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
.screen h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: calc(17px * var(--fs));
  margin-top: .4rem;
}
.screen p { font-size: calc(15px * var(--fs)); }
.screen p + p { margin-top: -.1rem; }
.quote-line {
  font-family: var(--serif);
  font-style: italic;
  font-size: calc(17px * var(--fs));
  color: var(--accent-deep);
  padding-left: .75rem;
  border-left: 3px solid var(--accent-light);
}

/* ───── Tap-to-define connector (Rule 1.3) ───── */
.term {
  font-weight: 600;
  color: var(--accent-deep);
  border-bottom: 2px dotted var(--accent);
  padding: 0 1px;
  line-height: inherit;
  text-align: left;
}
.term:hover { background: var(--accent-soft); }
.term[aria-expanded="true"] { background: var(--accent-light); }

/* A gloss is owned by the paragraph that holds its word, so removing the
   paragraph removes the gloss and no teardown path has to remember to
   tidy up. Same ruling the Visit Prep Builder records for its rows. */
.gloss {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0;
  padding: .6rem .75rem;
  margin: .45rem 0 .1rem;
  font-size: calc(14px * var(--fs));
  color: var(--ink-mid);
}
.gloss dt { font-weight: 600; color: var(--ink); display: inline; }
.gloss dd { display: inline; }
.gloss dt::after { content: ' — '; }

/* ───── Option buttons (Screens 0 and 12) ─────
   Style Guide, "Answer-option controls": the selected state gets its own
   circular mark (filled, with a checkmark) rather than relying on the
   border/fill change alone — the pattern PMOS already had and this module
   didn't. Canonical CSS, adapted to this module's existing .option name so
   nothing calling it had to change. */
.options { display: flex; flex-direction: column; gap: .5rem; margin-top: .3rem; }
.option {
  display: flex;
  align-items: center;
  gap: .65rem;
  text-align: left;
  border: 2px solid var(--paper-deep);
  background: var(--paper);
  border-radius: 10px;
  padding: .7rem .85rem;
  font-size: calc(14.5px * var(--fs));
  line-height: 1.45;
  transition: border-color .14s, background-color .14s, transform .14s, box-shadow .14s;
}
.option:hover { border-color: var(--ink-faint); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.option[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); font-weight: 500; }
.option-mark {
  width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0;
  border: 1.5px solid var(--ink-faint);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; line-height: 1;
}
.option[aria-pressed="true"] .option-mark { border-color: var(--accent); background: var(--accent); color: var(--paper); }

/* ───── Narration control (Rule 5.7) ───── */
.listen {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  align-self: flex-start;
  border: 1.5px solid var(--paper-deep);
  border-radius: 999px;
  padding: .4rem .8rem;
  font-size: calc(12.5px * var(--fs));
  color: var(--ink-mid);
  background: var(--paper);
}
.listen:hover { border-color: var(--accent); color: var(--accent-deep); }
.listen.speaking { border-color: var(--accent); color: var(--accent-deep); background: var(--accent-soft); }
.listen-ico { font-size: calc(10px * var(--fs)); }

/* A temporary notice, removed with the fallback it describes. */
.listen-provisional {
  font-size: calc(11px * var(--fs));
  color: var(--ink-light);
  font-style: italic;
}

/* ───── Nav dock ───── */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  padding: .85rem 1.25rem calc(1.1rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--paper-dark);
  background: var(--paper);
  flex-shrink: 0;
}
.btn {
  border-radius: 999px;
  padding: .62rem 1.1rem;
  font-size: calc(14px * var(--fs));
  font-weight: 500;
  line-height: 1.3;
}
/* Style Guide, "Navigation & forward progression": the forward control must
   read as the one thing to do, the way the main site's Continue button does
   — not as a third, roughly-equal control next to Back and Skip to any part.
   It was --ink (near-black, sized to its text, no depth) until this pass,
   which is correct on everything Rule 3.9(f) actually governs — label,
   placement, timing — but carried none of the main site's visual weight.
   --accent fill, flex so it fills the row, and a shadow that lifts on hover
   give it that weight without touching what the rule governs. */
.btn-primary {
  background: var(--accent);
  color: var(--paper);
  flex: 1 1 auto;
  min-width: 0;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--accent-deep); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-primary:disabled { box-shadow: none; transform: none; }
.btn-text { color: var(--ink-mid); padding-left: .3rem; padding-right: .55rem; }
.btn-text:hover { color: var(--accent-deep); }
.btn-ghost { border: 1.5px solid var(--paper-deep); color: var(--ink-mid); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-deep); }
.nav-spacer { flex: 1; }

/* ───── Rule 3.9(f): the standing bottom bar and its screen index ───── */
.nav-skip { flex: 0 0 auto; margin: 0 auto; }
.skip-panel {
  border-top: 1px solid var(--paper-dark);
  background: var(--paper);
  max-height: 46vh;
  overflow-y: auto;
  padding: .5rem .9rem .7rem;
}
.skip-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.skip-item {
  width: 100%;
  text-align: left;
  padding: .55rem .2rem;
  font-size: calc(15px * var(--fs));
  color: var(--ink);
  border-bottom: 1px solid var(--paper-dark);
}
.skip-item:last-child { border-bottom: 0; }
.skip-item:hover { color: var(--accent-deep); }
.skip-item.is-here { color: var(--accent-deep); font-weight: 700; }

/* ───── Credits screen ───── */
.credits-list { display: flex; flex-direction: column; gap: .5rem; }
.credits-list h2 { font-size: calc(15px * var(--fs)); margin: .7rem 0 0; }
.credits-list h2:first-child { margin-top: 0; }
.credits-list p { font-size: calc(13.5px * var(--fs)); color: var(--ink-mid); }
.credits-sources { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .55rem; }
.credits-sources li { font-size: calc(13.5px * var(--fs)); color: var(--ink-mid); line-height: 1.5; }
.credits-sources a { color: var(--accent-deep); }

/* ───── Rule 3.9(b): the post-question's verdict ───── */
.verdict {
  margin: .9rem 0 0;
  font-weight: 700;
  font-size: calc(16px * var(--fs));
  color: var(--ink);
  min-height: 1.4em;
}
.verdict.is-right { color: var(--teal); }

/* ───── r7: the one control that opens a screen's questions ───── */
.check-knowledge { margin-top: .9rem; align-self: flex-start; }
.check-answers { margin-top: .9rem; align-self: flex-start; }

/* ───── r7: a step or question marker, drawn rather than written into the
   copy, so the capture toggles and the notes keep the plain sentence ───── */
/* --ink-light gives 3.17:1 on --paper, which is below AA for text this size;
   --ink-mid is the lightest token that carries it (Rule 5.5). */
.ord { color: var(--ink-mid); font-variant-numeric: tabular-nums; }

/* ───── r7: a scaffold set beside its sentence rather than under it ───── */
.line-beside { display: flex; align-items: flex-start; gap: .7rem; }
.line-beside > p { flex: 1 1 auto; margin: 0; }
.line-beside > .scaffold { flex: 0 0 auto; margin-top: .1rem; }

/* ───── r7 Screen 3: the days-of-week picker ─────
   The mark and the legend word carry the meaning together; colour only
   reinforces them, so the row still reads with colour removed. Nothing
   here animates, so prefers-reduced-motion costs it nothing. */
.wk { margin: .4rem 0 .9rem; }
.wk-caption { font-size: calc(13.5px * var(--fs)); color: var(--ink-mid); margin: 0 0 .45rem; }
.wk-row { display: flex; gap: .35rem; flex-wrap: wrap; }
.wk-tile {
  flex: 1 1 2.4rem;
  min-width: 2.4rem;
  border: 1.5px solid var(--paper-deep);
  border-radius: 8px;
  background: var(--paper);
  padding: .35rem .2rem .3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .1rem;
}
.wk-tile:hover { border-color: var(--accent); }
.wk-abbr { font-size: calc(12.5px * var(--fs)); color: var(--ink-mid); }
.wk-mark {
  font-size: calc(15px * var(--fs));
  line-height: 1.1;
  min-height: 1.2em;
  color: var(--ink);
}
.wk-tile.is-test { border-color: var(--accent); background: var(--accent-soft); }
.wk-tile.is-test .wk-abbr, .wk-tile.is-test .wk-mark { color: var(--accent-deep); }
.wk-tile.is-ask { border-color: var(--ink-mid); }
.wk-legend {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem 1.1rem;
  margin: .5rem 0 0;
  font-size: calc(12.5px * var(--fs));
  color: var(--ink-mid);
}
.wk-key { white-space: nowrap; }

/* ───── Rule 5.9 numeral scaffolds (code-drawn; see scaffolds.js) ─────
   Each shape is complete without motion. The animations below only add
   travel to a picture that already reads, so the global
   prefers-reduced-motion rule above stills them at no cost to meaning. */

.scaffold {
  margin: .15rem 0 .35rem;
  display: flex;
  justify-content: flex-start;
}
.scaffold svg { height: auto; overflow: visible; }

.sc-airflow svg  { width: 100%; max-width: 220px; }
.sc-breath svg   { width: 100%; max-width: 200px; }
.sc-age svg      { width: 68px; }
.sc-tally svg    { width: 130px; }
.sc-clock svg    { width: 62px; }
.sc-hold-row svg { width: 100%; max-width: 204px; }

/* Airflow and breath ribbons */
.sc-ribbon-base {
  fill: none;
  stroke: var(--paper-deep);
  stroke-width: 7;
  stroke-linecap: round;
}
.sc-ribbon-flow {
  fill: none;
  stroke: var(--accent);
  stroke-width: 7;
  stroke-linecap: round;
  stroke-dasharray: 14 18;
  animation: sc-flow 2.4s linear infinite;
}
.sc-ribbon-flow.is-fast { animation-duration: .9s; }
@keyframes sc-flow { to { stroke-dashoffset: -64; } }

.sc-breath-grow {
  fill: none;
  stroke: var(--teal);
  stroke-width: 7;
  stroke-linecap: round;
  stroke-dasharray: 400;
  stroke-dashoffset: 0;
  animation: sc-grow 3s ease-in-out infinite;
}
@keyframes sc-grow {
  0%   { stroke-dashoffset: 340; }
  55%  { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 0; }
}

/* Age marker */
.sc-tile { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2.5; }
.sc-tile-num {
  fill: var(--ink);
  font-family: var(--serif);
  font-weight: 600;
  font-size: 40px;
}
.sc-tile-word {
  fill: var(--ink-mid);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .08em;
}

/* Calendar strip: the test day is ringed, the day to ask on is filled, and
   the span between them is drawn with one dot per day so the two is
   countable without reading a number. */
.sc-day { fill: var(--paper-warm); stroke: var(--paper-deep); stroke-width: 2; }
.sc-day.is-test { fill: var(--paper); stroke: var(--ink); stroke-width: 3; }
.sc-day.is-ask { fill: var(--accent-light); stroke: var(--accent); stroke-width: 3; }
.sc-span { stroke: var(--accent); stroke-width: 2; fill: none; }
.sc-span-end { stroke: var(--accent); stroke-width: 2; fill: none; }
.sc-span-dot { fill: var(--accent); }

/* Blow tally */
.sc-tick path {
  fill: none;
  stroke: var(--teal);
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sc-more path { fill: none; stroke: var(--ink-light); stroke-width: 3.5; stroke-linecap: round; }

/* Clock arcs. The wedge is filled solid rather than tinted: a pale wedge on
   pale paper does not read as "half" at a glance, which is the whole job of
   the scaffold. */
.sc-clock-face { fill: var(--paper-dark); }
.sc-clock-wedge { fill: var(--amber); }
.sc-clock-rim { fill: none; stroke: var(--ink-mid); stroke-width: 2.5; }

/* Breath-hold counter. The dots are filled at all times and the animation
   only runs a brightness wave along them, because a counter that spends
   half its cycle as ten empty circles does not read as ten of anything for
   half of the time a reader is looking at it. */
.sc-hold {
  fill: var(--blue);
  animation: sc-hold-wave 4s ease-in-out infinite;
  animation-delay: calc(var(--sc-i) * .18s);
}
@keyframes sc-hold-wave {
  0%, 100% { opacity: .45; }
  50%      { opacity: 1; }
}

/* With motion stilled, the counter must still read as ten of something
   rather than ten identical blanks, so it settles on the filled colour. */
@media (prefers-reduced-motion: reduce) {
  .sc-hold { fill: var(--blue); opacity: 1; }
  .sc-ribbon-flow { stroke-dasharray: none; }
  .sc-breath-grow { stroke-dashoffset: 0; }
}

/* ───── Reveals (Rule 3.5) ───── */
.reveal-step {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  align-self: flex-start;
  border: 1.5px solid var(--accent);
  border-radius: 999px;
  padding: .5rem .95rem;
  font-size: calc(13.5px * var(--fs));
  font-weight: 500;
  color: var(--accent-deep);
  background: var(--accent-soft);
}
.reveal-step:hover { background: var(--accent-light); }
.reveal-step .reveal-ico { font-size: calc(10px * var(--fs)); }

.reveal-choice {
  text-align: left;
  border: 2px solid var(--paper-deep);
  background: var(--paper);
  border-radius: 10px;
  padding: .65rem .8rem;
  font-size: calc(14px * var(--fs));
  font-weight: 600;
  color: var(--ink);
}
.reveal-choice:hover { border-color: var(--accent); color: var(--accent-deep); }
.reveal-choices { display: flex; flex-direction: column; gap: .45rem; }

.revealed:focus { outline: none; }
.revealed:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

/* ───── Screen 9 build interaction: order the practice steps ───── */
.build-cards { display: flex; flex-direction: column; gap: .5rem; }
.build-card {
  display: flex;
  align-items: center;
  gap: .6rem;
  border: 2px solid var(--paper-deep);
  background: var(--paper);
  border-radius: 10px;
  padding: .55rem .7rem;
}
.build-card.is-selected { border-color: var(--accent); background: var(--accent-soft); }
.build-card.is-settled { border-color: var(--teal); background: var(--teal-light); }
.build-card-text { flex: 1; font-size: calc(14px * var(--fs)); text-align: left; }
.build-card-move {
  border: 1.5px solid var(--paper-deep);
  border-radius: 7px;
  width: 30px;
  height: 30px;
  font-size: calc(12px * var(--fs));
  color: var(--ink-mid);
  flex-shrink: 0;
}
.build-card-move:hover { border-color: var(--accent); color: var(--accent-deep); }
.build-order {
  font-family: var(--mono);
  font-size: calc(11px * var(--fs));
  color: var(--ink-light);
  width: 1.2em;
  flex-shrink: 0;
}

/* ───── Images (Rule 1.2 as excepted) ─────
   Only the files in Build Brief r2 §5 appear anywhere in the module. Each is
   decorative to a screen reader: the concept is carried by the authored copy
   and the narration, and where §5 requires a drawing's label as real text,
   that text is rendered separately rather than as an alt attribute. */

.figure {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .3rem;
  margin: .2rem 0 .1rem;
}
/* The anatomy beats of Screen 2, as a sequence that reads left to right. */
.figure-beats {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: .45rem;
  margin: .3rem 0 .2rem;
}
.figure-beats .asset-window { max-width: 112px; border-radius: 6px; }
/* Screen 9: the breath and what it moves, side by side, so the ribbon
   lengthening and the pinwheel turning read as one action. */
.figure-practice { flex-direction: row; align-items: center; gap: .8rem; flex-wrap: nowrap; }
.figure-practice #s9-pinwheel { flex: 0 0 auto; }
.figure-practice #s9-pinwheel svg { width: 84px; height: auto; }
.figure-practice .scaffold { flex: 1 1 auto; min-width: 0; margin: 0; }

/* A window onto a file's own content box, so the subject fills its space
   without the surrounding empty canvas. The numbers come from module.js,
   measured per file; see the CROPS table there. */
.asset-window {
  display: block;
  position: relative;
  overflow: hidden;
  width: 100%;
  max-width: 290px;
  border-radius: 8px;
}
.asset-window img {
  position: absolute;
  max-width: none;
  height: auto;
  user-select: none;
}
.asset-beat { max-width: 240px; }
.figure svg { max-width: 100%; height: auto; }

/* Screen 1: the ribcage's own pair of figures is the breath — air in on one,
   air out on the other — so nothing has to move for the beat to land. The
   airflow ribbon runs a little faster alongside it. */
.asset-ribcage { max-width: 290px; }
.is-breathing .sc-ribbon-flow { animation-duration: .9s; }

/* Screen 8: the medicine opens the airways, so the airway widens a little. */
.asset-widening img { animation: widen 4s ease-in-out infinite; transform-origin: 50% 40%; }
@keyframes widen {
  0%, 100% { transform: scaleX(1); }
  50%      { transform: scaleX(1.05); }
}

/* Screen 3: the line rises to its mark. `both` means that with motion
   stilled it lands on the final state rather than never arriving. */
#gc-child-height { animation: none; }
.is-shown #gc-child-height { animation: rise .75s ease-out both; }
@keyframes rise {
  from { transform: translateY(40px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* Screen 9: only the blades turn; the stick stays put, which is why this
   drawing is injected inline rather than loaded as an image. */
#pw-blades {
  transform-box: view-box;
  transform-origin: 70px 66px;
  animation: spin 3.4s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Text present for a screen reader and not shown on screen. Used where §5
   requires a drawing's label to exist as real text. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ───── Host-owned delivery screen (spec Part 4 §4.2) ───── */
.delivery-controls { display: flex; flex-direction: column; gap: .7rem; margin: .5rem 0 .3rem; }
.delivery-control { display: flex; flex-direction: column; gap: .2rem; align-items: flex-start; }
.delivery-note { font-size: calc(13px * var(--fs)); color: var(--ink-mid); }

.delivery-done {
  min-height: 1.4em;
  margin: .6rem 0 .2rem;
  font-size: calc(14px * var(--fs));
  color: var(--ink-mid);
}

/* ───── Scan to phone (spec Part 4 §4.4) ───── */

.qr-panel {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .55rem;
  margin: .6rem 0 .2rem;
  padding: .8rem;
  border: 1px solid var(--paper-deep);
  border-radius: 10px;
  background: var(--paper);
}
.qr-panel:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Sized in ems so the code grows with the type-scale control, and capped so
   it never outgrows a narrow tablet column. The notes are a 660-character
   payload, which is an 89-module code: it needs the width to stay
   comfortably scannable, so this is as wide as the column allows. */
.qr {
  width: min(21em, 84vw);
  height: auto;
  display: block;
  /* The pixels are the message: never smoothed, never scaled unevenly. */
  image-rendering: pixelated;
  shape-rendering: crispEdges;
}
/* High contrast, and the light square on the outside, which is what a
   camera needs. Fixed rather than themed: a code that takes an accent
   colour can stop scanning. */
.qr-paper { fill: #FFFFFF; }
.qr-ink { fill: #111111; }

.qr-line {
  font-size: calc(14px * var(--fs));
  color: var(--ink);
  max-width: 26em;
}

/* ───── The printed page (spec Part 4 §4.3, printed via §4.4) ─────

   The same document the PDF writer emits, from the same contract, built as
   real DOM so the browser's own print produces the §4.3 layout rather than
   a picture of the screen. Hidden on screen; the print stylesheet below is
   the only place it is visible. */

.sheet { display: none; }

@media print {
  /* Nothing of the module's own chrome prints: no header, no wordmark
     beyond the sheet's own footer line, no progress, no controls, no
     narration control, no mechanic. §4.3 is "nothing else". */
  .hdr, .progress, .nav, .listen, .listen-provisional,
  .delivery-controls, .delivery-done, .btn, .qr-panel,
  .credits-list { display: none !important; }

  /* The screen layout fills the viewport, which on a printer means a
     second, empty sheet. §4.3 is one page: every height that was there to
     fill a tablet is released here. */
  html, body { height: auto; min-height: 0; background: #FFFFFF; }
  .app {
    display: block;
    height: auto;
    min-height: 0;
    max-width: none;
    margin: 0;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .screen { min-height: 0; padding: 0; box-shadow: none; border: 0; background: #FFFFFF; }
  /* The screen's own heading is "Your notes are ready", which belongs on
     the screen and not on the page: the page carries the PDF's title. */
  .screen > h1 { display: none; }
  .screen > p { display: none; }

  .sheet {
    display: block;
    /* Points, not pixels: this element is only ever measured by a printer.
       The margins are the PDF writer's own. */
    margin: 0;
    padding: 0;
    color: #000000;
    font-family: var(--sans);
  }
  @page { size: letter portrait; margin: 56pt 56pt 52pt; }

  /* Every rule below is written .sheet .x rather than .x, so it outranks
     the screen's own .screen h2 / .screen p sizes. Without that the printed
     title comes out smaller than the group headings under it. */
  .sheet .sheet-title { font-family: var(--serif); font-size: 22pt; line-height: 1.18; font-weight: 600; margin: 0; }
  .sheet .sheet-subtitle { font-size: 14pt; line-height: 1.3; margin: 8pt 0 0; }
  .sheet .sheet-note { font-size: 14pt; line-height: 1.3; margin: 6pt 0 0; }
  .sheet .sheet-heading { font-size: 16pt; line-height: 1.25; font-weight: 700; margin: 22pt 0 0; }

  .sheet .sheet-lines { list-style: none; margin: 8pt 0 0; padding: 0; }
  .sheet .sheet-lines li {
    font-size: 14pt;
    line-height: 1.5;
    margin: 0;
    display: flex;
    align-items: flex-start;
    gap: 9.5pt;
    /* A line is never split across the page break, and the page is one
       page: §4.3. */
    break-inside: avoid;
  }
  /* The empty checkbox §4.3 asks for, so the page can be ticked on the
     day. A drawn square, like the PDF writer's: no font carries one. */
  .sheet .sheet-box {
    flex: 0 0 auto;
    width: 10.5pt;
    height: 10.5pt;
    margin-top: 3.5pt;
    border: .9pt solid #333333;
  }
  .sheet .sheet-line { display: block; }

  .sheet .sheet-footer {
    margin: 28pt 0 0;
    font-size: 9pt;
    line-height: 1.33;
    color: #000000;
  }
}
