/* China Research Map design tokens, v1 (proposed 2026-11-13).
   The only place colours, type sizes, spacing, radii, borders, shadows, motion and layout sizes are defined.
   Every other stylesheet uses var(--…) from here. Spec and usage rules: platform_v2/design_system/DESIGN.md. Copied to site_v3/assets/ and loaded first on every page.
   Values come from the approved home, city, hospital and disease pages (home.css, chrome.css, city.css, hosp.css, dz.css). */

:root {
  /* Colour: text and surfaces */
  --ink: #15202B;        /* main text, headings, ink buttons, ink band */
  --ink-2: #4A5866;      /* secondary text, captions, meta */
  --page: #FFFFFF;       /* page background */
  --soft: #F3F5F7;       /* quiet fill: table header, empty states, code */
  --track: #E6EBEF;      /* empty part of a bar */
  --hair: #D8DEE3;       /* decorative rules and card outlines (not for controls) */
  --line: #7C8A97;       /* borders of inputs, selects, outline buttons (3:1 on page) */
  --on-ink: #FFFFFF;     /* text on --ink */
  --veil: rgba(255,255,255,.92);   /* text plates over the map */
  --link: #1A5A8A;

  /* Colour: meaning */
  --g-cancer: #B23A48;   /* disease group: cancer */
  --g-blood: #2D5DA8;    /* disease group: blood */
  --g-other: #916414;    /* disease group: other (was #A8741A, 4.1:1; now 4.8:1 on --soft) */
  --hl: #F5CF5A;         /* highlighter: the one thing being looked at */
  --hl-soft: #FCF2CC;    /* selected row / tile fill */
  --hl-edge: #8F6E0E;    /* highlighter outline and its text */
  --rec: #17663F;        /* open / recruiting trial */
  --warn: #8A3A25;       /* caution notes, retracted, data gaps */

  /* Colour: behind screenshots and illustrations (stays light in dark mode); --shot dims screenshots at night */
  --art: #F2F1EF; --shot: none;

  /* Colour: map */
  --sea: #D7E4EC; --land: #FCFCFA; --coast: #9DB2C0; --city: #4A5866;

  /* Colour: ink band and brand mark */
  --band: #15202B; --band-text: #E7ECF1; --band-text-2: #B9C4CF; --band-rule: #2B3845;
  --brand-a: #1F7A68; --brand-b: #3D4FA0;   /* the two squares of the wordmark and favicon only */

  color-scheme: light;

  /* Type */
  --display: "Newsreader", "Iowan Old Style", "Charter", "Georgia", "Songti SC", STSong, serif;
  --sans: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", "Avenir Next", "Segoe UI", system-ui, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --fs-hero: clamp(40px, 5.6vw, 72px);   /* page h1 */
  --fs-h2: clamp(30px, 3.4vw, 44px);     /* section heading */
  --fs-h3: 28px;                         /* panel heading */
  --fs-h4: 22px;                         /* card title, tile name */
  --fs-lede: 19px;                       /* first paragraph, search input */
  --fs-body: 16px;                       /* running text */
  --fs-list: 15px;                       /* rows, cards, table cells */
  --fs-meta: 14px;                       /* captions, source lines, buttons */
  --fs-micro: 13px;                      /* chips, labels, footnotes; never smaller */
  --fs-num: 44px;                        /* stat numbers */
  --fs-num-xl: clamp(56px, 8vw, 88px);   /* one headline number per section at most */
  --lh-tight: 1.05; --lh-head: 1.2; --lh-snug: 1.35; --lh-body: 1.5;
  --fw-regular: 400; --fw-num: 500; --fw-display-strong: 600; --fw-bold: 700;   /* Newsreader ships 400–600 only; 700 is for the sans */

  /* Space (only these) */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px;
  --s-7: 32px; --s-8: 40px; --s-9: 48px; --s-10: 56px; --s-11: 72px; --s-12: 88px;
  --section: var(--s-12);   /* between page sections */

  /* Layout */
  --max: 1296px; --gut: 24px; --hdr: 64px; --measure: 68ch;

  /* Radius (only these) */
  --r-0: 0;          /* bands, tables, full-width sections */
  --r-mark: 2px;     /* data marks: bars, swatches, highlighter */
  --r-s: 6px;        /* chips, tags, nav items, segmented controls, tooltips, matrix cells */
  --r-m: 10px;       /* buttons, inputs, selects, suggestion lists, link cards, tiles */
  --r-l: 14px;       /* plates and large cards: maps, trial and study cards, panels, dialogs */
  --r-pill: 999px;   /* count pills, status badges, pill tabs */
  /* 50% only for round dots and markers */

  /* Border */
  --bw: 1px; --bw-2: 2px; --bw-4: 4px;   /* hairline; selected/emphasis; side marker */
  --focus: 3px solid var(--link); --focus-off: 2px;

  /* Elevation (only these two) */
  --lift: 0 1px 0 var(--hair), 0 8px 24px rgba(21,32,43,.07);   /* sticky header, floating map controls */
  --pop: 0 1px 0 var(--hair), 0 14px 34px rgba(21,32,43,.12);   /* menus, popovers, dialogs, map popups */

  /* Motion */
  --t-fast: 150ms; --t-base: 250ms; --t-slow: 450ms; --t-stagger: 60ms;
  --ease: cubic-bezier(.2,.7,.2,1); --ease-io: cubic-bezier(.45,0,.55,1);
}

/* Dark */
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #E7ECF1; --ink-2: #A9B5C1; --page: #0E161F; --soft: #15202B; --track: #22303D; --hair: #2B3845; --line: #5C6B79;
  --on-ink: #0E161F; --veil: rgba(14,22,31,.92); --link: #8DC3EE;
  --g-cancer: #F0909A; --g-blood: #92B6F4; --g-other: #DDB061;
  --hl: #E9C350; --hl-soft: #3A3219; --hl-edge: #D9B23F; --rec: #72CF9D; --warn: #F0A58A;
  --sea: #122130; --land: #1B2834; --coast: #3B4B5A; --city: #9DAAB6;
  --band: #070C11; --art: #E9E7E3; --shot: brightness(.9);
  --lift: 0 1px 0 var(--hair), 0 8px 24px rgba(0,0,0,.35); --pop: 0 1px 0 var(--hair), 0 14px 34px rgba(0,0,0,.45);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  color-scheme: dark;
  --ink: #E7ECF1; --ink-2: #A9B5C1; --page: #0E161F; --soft: #15202B; --track: #22303D; --hair: #2B3845; --line: #5C6B79;
  --on-ink: #0E161F; --veil: rgba(14,22,31,.92); --link: #8DC3EE;
  --g-cancer: #F0909A; --g-blood: #92B6F4; --g-other: #DDB061;
  --hl: #E9C350; --hl-soft: #3A3219; --hl-edge: #D9B23F; --rec: #72CF9D; --warn: #F0A58A;
  --sea: #122130; --land: #1B2834; --coast: #3B4B5A; --city: #9DAAB6;
  --band: #070C11; --art: #E9E7E3; --shot: brightness(.9);
  --lift: 0 1px 0 var(--hair), 0 8px 24px rgba(0,0,0,.35); --pop: 0 1px 0 var(--hair), 0 14px 34px rgba(0,0,0,.45);
} }

/* Colour-vision friendly palette (Display panel); pairs with the shape and label rules in DESIGN.md */
:root[data-palette="cvd"] { --g-cancer: #1F4E9A; --g-blood: #8C5A00; --g-other: #B0306A; --link: #1F4E9A; --rec: #1F4E9A; --hl: #F0D35A; --hl-edge: #6E5400; }
:root[data-palette="cvd"][data-theme="dark"] { --g-cancer: #8FB2F0; --g-blood: #E0A94A; --g-other: #EE8FC0; --link: #8FB2F0; --rec: #8FB2F0; --hl-edge: #E0C04A; }
@media (prefers-color-scheme: dark) { :root[data-palette="cvd"]:not([data-theme="light"]) { --g-cancer: #8FB2F0; --g-blood: #E0A94A; --g-other: #EE8FC0; --link: #8FB2F0; --rec: #8FB2F0; --hl-edge: #E0C04A; } }

/* Phone */
@media (max-width: 759px) {
  :root { --gut: 16px; --hdr: 58px; --section: var(--s-10);
          --fs-h3: 24px; --fs-h4: 20px; --fs-lede: 17px; --fs-num: 34px; }
}

/* Reduced motion: no movement, only instant or opacity changes */
@media (prefers-reduced-motion: reduce) { :root { --t-fast: 0ms; --t-base: 0ms; --t-slow: 0ms; --t-stagger: 0ms; } }
