/* ECMO-SIM design system v1: one set of tokens for the simulator, the trainer site and the recorder.
 * docs/DESIGN-SYSTEM.md explains every choice and what each surface still has to change to adopt it.
 * Reconciled from index.html :root, src/theme.css, site/assets/site.css and recorder/index.html.
 * Not linked from any page yet: adoption is one surface per PR. tests/tokens.test.mjs checks the contrast pairs.
 * No network URLs here; fonts are named, not loaded (see the doc, "Fonts"). */

:root {
  /* ---- neutrals */
  --bg: #f3f5f7;          /* page ground */
  --surface: #ffffff;     /* panels, cards, fields, dialogs */
  --surface-2: #eef1f4;   /* table heads, hover, chips, context boxes */
  --line: #d9dfe5;        /* borders and dividers (1.3:1 on surface: controls are told apart by label and shape) */
  --muted: #4b5765;       /* secondary text: 7.4:1 on surface, 6.7:1 on bg */
  --ink: #17202a;         /* text */

  /* ---- interaction: the main action is ink, red is reserved for brand and caution */
  --primary: var(--ink);
  --on-primary: #ffffff;

  /* ---- brand, status, focus; each with a soft fill */
  --brand: #a3172b;       --brand-soft: #f6e3e6;     --on-brand: #ffffff;
  --brand-text: var(--brand);                         /* red as text (step ids); lighter on dark themes */
  --info: #1f4e8c;        --info-soft: #e3ecf7;      /* links, notes, the current step (the site's old --venous) */
  --ok: #1d6b45;          --ok-soft: #e0f1e8;
  --warn: #8a5a00;        --warn-soft: #fbefd2;
  --critical: #b3261e;    --critical-soft: #f9e3e1;  /* uncovered, errors: never the theme's primary */
  --focus: #1a5fd0;       --focus-soft: #e2ecfb;
  --hard-stop-bg: #fbf1f2;                            /* recorder: hard-stop step card */
  --pill-bg: #fbefd2;     --pill-ink: #6b4b00;        /* the Not validated pill */

  /* ---- data colours: the same in every theme (light/dark variants only). Pair each with a letter, glyph or pattern. */
  --blood-arterial: #d0182a;   /* return line */
  --blood-venous: #6b0f1a;     /* drainage line (the sim app's old --venous) */
  --role-active: #c77a1e;      --on-role-active: var(--ink);   /* white on it is 3.4:1, ink 4.9:1 */
  --role-scrubbed: #2f7a52;

  /* ---- type */
  --f-display: "Archivo", system-ui, sans-serif;
  --f-body: "Atkinson Hyperlegible", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --fs-display: 44px;  --fs-h1: clamp(1.55rem, 4vw, 2.1rem);  --fs-h2: 1.4rem;  --fs-h3: 1.05rem;
  --fs-body-lg: 17px;  --fs-body: 16px;  --fs-body-dense: 15px;  --fs-small: 13px;  --fs-label: 11px;  --fs-readout: 14px;
  --lh-heading: 1.15;  --lh-body: 1.6;  --lh-dense: 1.45;
  --ls-heading: -.01em;  --ls-label: .1em;

  /* ---- shape: Standard values; html[data-shape] in src/theme.css sets Soft and Sharp and wins */
  --r-xs: 4px;  --r-sm: 7px;  --r-md: 10px;  --r-lg: 12px;  --r-xl: 18px;  --r-pill: 999px;

  /* ---- space: 4 px base */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px;  --sp-4: 16px;  --sp-5: 24px;  --sp-6: 32px;  --sp-7: 48px;  --sp-8: 72px;

  /* ---- size and layout */
  --tap: 40px;  --top: 48px;  --head: 50px;  --panel-w: 380px;  --wrap: 1240px;  --wrap-narrow: 900px;

  /* ---- elevation: panels are flat; only what floats carries a shadow */
  --shadow-1: 0 1px 2px rgba(23,32,42,.07), 0 8px 22px rgba(23,32,42,.05);
  --shadow-2: 0 6px 24px rgba(0,0,0,.16);
  --shadow-float: 0 4px 14px rgba(0,0,0,.25);
  --ring-current: 0 0 0 3px rgba(31,78,140,.15);
  --backdrop: rgba(10,14,18,.55);

  /* ---- motion */
  --ease: cubic-bezier(.2, .7, .2, 1);  --dur-fast: 150ms;  --dur-panel: 220ms;

  color-scheme: light;
}
@media (pointer: coarse) { :root { --tap: 50px; } }

/* ---- kit themes (src/theme.css sets data-theme and data-tone): v1 names read the kit's tokens */
html[data-tone] {
  --bg: var(--s); --surface: var(--p); --surface-2: var(--mid); --line: var(--l); --muted: var(--i2); --ink: var(--i);
  --primary: var(--pos); --on-primary: var(--on-accent); --focus: var(--pos);
  --ok: var(--good); --critical: var(--neg);
  --warn-soft: var(--warn-fill);   /* the kit's --warn is the same role as v1's --warn and is read as is */
  --critical-soft: color-mix(in srgb, var(--neg) 12%, var(--p));
}
html[data-tone="dark"] {
  --brand-text: #f0707c;   /* --brand is 2.2:1 on the dark panels; this is 5.0:1 or better on every dark ground */
  --role-active: #e89a3c;  --on-role-active: #141413;   /* 8.0:1; the dark themes' light ink is about 2:1 on it */
  /* new in v1, not yet in the sim; each at least 3:1 on the three dark panels. Venous and arterial are close in
     lightness here, so on dark themes the line labels carry the difference. */
  --blood-arterial: #e2434f;  --blood-venous: #b8404e;  --role-scrubbed: #4fae7e;
  --shadow-2: 0 6px 24px rgba(0,0,0,.45);
  color-scheme: dark;
}

/* ---- motion off: Reduce motion (Access, or the device) */
html[data-motion="still"] { --dur-fast: 0ms; --dur-panel: 0ms; }
