/* Atlas tokens (shared). Editorial medical illustration on warm paper. Style guide: v2/ART.md.
   Fonts (link before this file):
   <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,500;0,6..72,600;1,6..72,400;1,6..72,500&family=Source+Sans+3:wght@400;500;600;700&display=swap">

   Naming: surfaces and ink, tissues (--t-NAME, -shade, -line), meaning colours,
   signal series, the personal layer, type, space, shape, motion, shell tracks. */

:root {
  color-scheme: light;

  /* ---------- Surfaces and ink ---------- */
  --bg: #ffffff;            /* white page */
  --surface: #ffffff;
  --surface-2: #f4f2ef;     /* wells */
  --ink: #2b241e;           /* sepia black */
  --ink-2: #5f5348;
  --ink-3: #8b7e70;
  --line: #e4dfd8;          /* hairline */
  --line-2: #cdc5bb;
  --wash: #f3e5bf;          /* highlighter wash behind key phrases */
  --halo: var(--bg);        /* text halo on illustrations */
  --paper-light: #ffffff;   /* light used for two-tone shading */
  --accent: var(--ink);     /* controls are drawn in ink */
  --accent-soft: #efebe5;
  --focus: #62309a;

  /* ---------- Tissues: base, shade, line (line = darker shade of the same hue) ---------- */
  --t-skin: #ecc8ab;       --t-skin-shade: #d5a281;      --t-skin-line: #96613f;
  --t-muscle: #bf7765;     --t-muscle-shade: #98564a;    --t-muscle-line: #62291f;
  --t-artery: #cc4b40;     --t-artery-shade: #a1322b;    --t-artery-line: #661a15;
  --t-vein: #6e89b3;       --t-vein-shade: #506c97;      --t-vein-line: #2e4569;
  --t-blood: #b8423b;      --t-blood-shade: #8f2c27;     --t-blood-line: #5f1a17;
  --t-fat: #f0da9d;        --t-fat-shade: #dcbd73;       --t-fat-line: #a5863c;
  --t-plaque: #ddb874;     --t-plaque-shade: #bf9449;    --t-plaque-line: #85601f;
  --t-bone: #ede2c9;       --t-bone-shade: #d4c19d;      --t-bone-line: #96805a;
  --t-cartilage: #cfe0d9;  --t-cartilage-shade: #a6c3b9; --t-cartilage-line: #628a7e;
  --t-mucosa: #e6a59b;     --t-mucosa-shade: #cd8378;    --t-mucosa-line: #984d43;
  --t-gland: #d49c6b;      --t-gland-shade: #b47a4b;     --t-gland-line: #774824;
  --t-nerve: #ebcf63;      --t-nerve-shade: #d0ad3d;     --t-nerve-line: #8f7012;
  --t-air: #e5edef;        --t-air-shade: #c8d8dd;       --t-air-line: #87a2ab;
  --t-fluid: #b5d2dc;      --t-fluid-shade: #8db6c5;     --t-fluid-line: #527d8e;
  --t-gas: #dbe2cb;        --t-gas-shade: #bfc9a6;       --t-gas-line: #83905d;
  --t-food: #d5b38a;       --t-food-shade: #ba9365;      --t-food-line: #7f5f39;
  --t-microbe: #9bb87b;    --t-microbe-shade: #7a9a5a;   --t-microbe-line: #4c6a33;
  --t-device: #b2bbc3;     --t-device-shade: #8a96a1;    --t-device-line: #535f6b;
  /* extra tissues the kit uses for vessel walls */
  --t-connective: #ebdcc7; --t-connective-shade: #d5bea0; --t-connective-line: #9b8162;
  --t-lining: #f1d5c9;     --t-lining-shade: #dfb2a3;    --t-lining-line: #a8705f;
  --t-elastin: #ead27f;    --t-elastin-shade: #d2b356;   --t-elastin-line: #9a7a1c;

  /* ---------- Meaning: same meaning in every item; always paired with a word or glyph ----------
     Validated as one set (healthy, flag, affected, treated, you, severe) on --bg: worst pair
     ΔE 10.1 under deuteranopia and protanopia, 16.3 with normal vision. They also step in
     lightness: flag lightest, you darkest. Never mix two meaning colours into a third. */
  --healthy: #2b9a7c;      /* teal green */
  --affected: #cf5f1e;     /* burnt orange */
  --severe: #8e1d47;       /* deep carmine */
  --treated: #2f6fc0;      /* clear blue */
  --uncertain: #8d8478;    /* warm grey, always dashed or hatched */
  --healthy-soft: #d3ebe3;  --healthy-ink: #1d6b56;
  --affected-soft: #f6dcc8; --affected-ink: #9c4413;
  --severe-soft: #ecd2db;   --severe-ink: #7a1a3e;
  --treated-soft: #d7e3f4;  --treated-ink: #24569a;
  --uncertain-soft: #ebe7e1; --uncertain-ink: #625a50;  /* soft fill and text for uncertain bands and words */

  /* ---------- Signal: categorical series, fixed order (validated for CVD) ---------- */
  --sig-1: #2368a8;
  --sig-2: #c95f38;
  --sig-3: #3a9a7a;

  /* ---------- The personal layer ---------- */
  --you: #62309a;          /* plum: one colour, one glyph (youMarker) */
  --you-soft: #e6dcf0;     --you-ink: #4f2680;
  --flag: #d8a51c;         /* neutral "outside the range" attention, always with its pennant */
  --flag-soft: #f6e7bd;    --flag-ink: #6f5206;
  --lost: #b5aa99;         /* lost function or years, used with hatching */

  /* ---------- Type ---------- */
  --font-text: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-ui: "Source Sans 3", "Source Sans Pro", -apple-system, "Segoe UI", system-ui, sans-serif;
  --fw-regular: 400; --fw-medium: 500; --fw-semibold: 600; --fw-bold: 700;
  --fs-1: 12px;    /* ticks, kicker */
  --fs-2: 13.5px;  /* small ui */
  --fs-3: 15px;    /* labels */
  --fs-4: 17px;    /* emphasised labels, sub */
  --fs-5: 22px;    /* caption */
  --fs-6: 30px;    /* title */
  --fs-7: 64px;    /* hero number */
  --lh-text: 1.38;
  --track-caps: 0;  /* no capitals in the interface */
  /* Roles for SVG text (font shorthand; the kit measures with these) */
  --type-label: 600 15px var(--font-ui);
  --type-label-em: 700 16px var(--font-ui);
  --type-sub: 400 16px var(--font-text);
  --type-tick: 500 12.5px var(--font-ui);
  --type-axis: 400 15px var(--font-text);
  --type-status: 700 12.5px var(--font-ui);
  --type-hero: 400 64px var(--font-text);
  --type-unit: 500 15px var(--font-ui);
  --type-node: 600 16px var(--font-ui);

  /* ---------- Space, shape, depth ---------- */
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 40px;
  --radius-s: 3px; --radius: 6px; --radius-lg: 12px; --radius-pill: 999px;
  --shadow-1: 0 1px 2px rgba(74, 52, 30, 0.10);
  --shadow-2: 0 10px 28px -14px rgba(74, 52, 30, 0.38), 0 1px 2px rgba(74, 52, 30, 0.10);
  --hair: 1px;
  --leader: 0.9px;       /* leader line width on illustrations */
  --outline: 1.15px;     /* tissue outline width */

  /* ---------- Motion (mirrors stage.js `motion`) ---------- */
  --dur-fast: 200ms; --dur-state: 450ms; --dur-zoom: 850ms;
  --ease: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);

  /* ---------- Shell ---------- */
  --track: #ddd7cf;
  --track-fill: var(--ink);
  --stage-bg: transparent;   /* the picture sits on the page, no box */
  --grain: none;

  /* legacy names from the baseline tokens, kept so older pages still resolve */
  --font: var(--font-ui);
  --font-num: var(--font-ui);
  --fs-caption: var(--fs-5);
  --fs-label: var(--fs-3);
  --fs-small: var(--fs-1);
  --t-cell: #f2c9c1;
  --radius: 6px;
  --gap: 12px;
}

/* Dark mode: only has to hold together. Paper becomes a deep umber sheet. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #1d1915; --surface: #26211c; --surface-2: #302922;
    --ink: #f1e9dd; --ink-2: #c9bcaa; --ink-3: #978a7a;
    --line: #3d352d; --line-2: #54493d; --wash: #4a3f22;
    --paper-light: #f6e9d6; --accent-soft: #3a3128;
    --track: #4a4036;
    --you: #9e66dc; --you-soft: #352646; --you-ink: #c9a6f0; --flag: #f2c654; --flag-soft: #4a3c18; --flag-ink: #f6d98a;
    --healthy: #38a987; --affected: #e0662e; --severe: #e0607f; --treated: #78b0f0;
    --healthy-soft: #17352c; --affected-soft: #3f2416; --severe-soft: #3d1a26; --treated-soft: #1c2c44; --uncertain-soft: #2e2923;
    --healthy-ink: #7fd3b8; --affected-ink: #f2a27a; --severe-ink: #f39ab4; --treated-ink: #a9cbf5; --uncertain-ink: #c2b8aa;
    --shadow-2: 0 10px 28px -14px rgba(0, 0, 0, 0.6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1d1915; --surface: #26211c; --surface-2: #302922;
  --ink: #f1e9dd; --ink-2: #c9bcaa; --ink-3: #978a7a;
  --line: #3d352d; --line-2: #54493d; --wash: #4a3f22;
  --paper-light: #f6e9d6; --accent-soft: #3a3128;
  --track: #4a4036;
  --you: #9e66dc; --you-soft: #352646; --you-ink: #c9a6f0; --flag: #f2c654; --flag-soft: #4a3c18; --flag-ink: #f6d98a;
  --healthy: #38a987; --affected: #e0662e; --severe: #e0607f; --treated: #78b0f0;
  --healthy-soft: #17352c; --affected-soft: #3f2416; --severe-soft: #3d1a26; --treated-soft: #1c2c44; --uncertain-soft: #2e2923;
  --healthy-ink: #7fd3b8; --affected-ink: #f2a27a; --severe-ink: #f39ab4; --treated-ink: #a9cbf5; --uncertain-ink: #c2b8aa;
  --shadow-2: 0 10px 28px -14px rgba(0, 0, 0, 0.6);
}
