/* Design tokens + base layout. Colours carry meaning: oxygen, carbon dioxide and the two states of blood
   keep the same colour everywhere so a child can read a model without labels. */
@font-face { font-family: "Atkinson"; src: url("../assets/fonts/atkinson-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson"; src: url("../assets/fonts/atkinson-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Atkinson"; src: url("../assets/fonts/atkinson-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }

:root {
  --ink: #16222f;
  --ink-soft: #46586a;
  --paper: #eaf0ef;
  --paper-raised: #f6f9f8;
  --line: #c9d6d5;
  --stage: #14304a;
  --stage-deep: #0d2236;
  --stage-glow: #23527a;
  --on-stage: #eef6fb;
  --on-stage-soft: #a9c2d6;
  --tissue: #f2aea6;
  --tissue-deep: #cf7a7c;
  --blood-rich: #d4313d;     /* oxygen-rich blood */
  --blood-poor: #7a2c50;     /* oxygen-poor blood: darker red, never blue */
  --o2: #4cc9e9;
  --co2: #f2b03d;
  --good: #1f8a5b;
  --try: #b4471f;
  --focus: #ffc94d;

  --font: "Atkinson", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --step--1: clamp(0.9rem, 0.86rem + 0.15vw, 0.97rem);
  --step-0: clamp(1.06rem, 1rem + 0.25vw, 1.18rem);
  --step-1: clamp(1.3rem, 1.18rem + 0.5vw, 1.55rem);
  --step-2: clamp(1.65rem, 1.4rem + 1vw, 2.2rem);
  --step-3: clamp(2.1rem, 1.6rem + 2.2vw, 3.6rem);
  --gutter: clamp(16px, 4vw, 40px);
  --tap: 48px;
  --radius-s: 10px;
  --radius-l: 22px;
  --ease: cubic-bezier(.22, .8, .24, 1);
  --topbar-h: 56px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  overflow-x: hidden;
}
h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; letter-spacing: -0.01em; }
h1 { font-size: var(--step-3); }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }
p { margin: 0 0 .9em; max-width: 62ch; }
sub { font-size: .7em; }
img, svg, canvas { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
a { color: inherit; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 50; padding: 10px 16px; background: var(--focus); color: var(--ink); border-radius: 8px; font-weight: 700; }
.skip:focus { top: 10px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.noscript { padding: var(--gutter); }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 var(--gutter);
  padding-top: env(safe-area-inset-top);
  background: var(--stage-deep);
  color: var(--on-stage);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; min-height: var(--tap); }
.brand-mark { width: 26px; height: 26px; color: var(--o2); }
.topnav { margin-left: auto; display: flex; align-items: center; gap: 8px; min-width: 0; }

/* Buttons: one obvious primary action per screen */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: var(--tap); padding: 10px 22px;
  border-radius: 999px; border: 2px solid transparent;
  font-weight: 700; font-size: var(--step-0); line-height: 1.1;
  cursor: pointer; text-decoration: none;
  transition: transform .15s var(--ease), background-color .2s, color .2s, border-color .2s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: #24384c; }
.btn-ghost { background: transparent; border-color: currentColor; }
.btn-quiet { background: transparent; padding-inline: 12px; }
.on-stage .btn-primary { background: var(--on-stage); color: var(--stage-deep); }
.on-stage .btn-primary:hover { background: #fff; }
.btn svg { width: 20px; height: 20px; flex: none; }
.chip-toggle[aria-pressed="true"] { background: var(--on-stage); color: var(--stage-deep); }

.icon-btn {
  width: var(--tap); height: var(--tap); display: grid; place-items: center;
  border-radius: 50%; border: 2px solid currentColor; background: transparent; cursor: pointer;
}
.icon-btn svg { width: 22px; height: 22px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
