/* Atlas design tokens: one file for every Atlas surface.
   Spec: C:\Atlas\memory\decisions\2026-11-07-atlas-design-system.md
   Colours: the Foundry's own palette (apps/foundry-library/reader.html), Alex's pick 2026-11-07:
   "simple, darker toned, easier to read, and easier on my eyes." Shapes and components: Atlas OS.

   Use: link this file, then style with var(--...) only. No hex values in a surface's own CSS.
   Theme: DARK by default. data-theme="light" on <html> (or on any element) makes it light;
   data-theme="auto" on <html> follows the device setting. The two light blocks below must stay identical. */

@font-face { font-family: 'Instrument Sans'; src: url('fonts/instrument-sans-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Instrument Sans'; src: url('fonts/instrument-sans-latin-400-italic.woff2') format('woff2'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: 'Instrument Sans'; src: url('fonts/instrument-sans-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Instrument Sans'; src: url('fonts/instrument-sans-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Instrument Serif'; src: url('fonts/instrument-serif-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Instrument Serif'; src: url('fonts/instrument-serif-latin-400-italic.woff2') format('woff2'); font-weight: 400; font-style: italic; font-display: swap; }

:root {
  color-scheme: dark;

  /* Surfaces (Foundry dark): panels one step lighter than the ground. No borders on panels, no shadows at rest. */
  --ground: #131521;
  --surface: #1b1e2b;        /* panels and cards */
  --raised: #262a3b;         /* inputs, the selected segment, a card inside a panel */
  --active: #2a2f42;         /* selected row, current track, active tab */
  --border: #2c3143;
  --rule: #262a3a;           /* row rules inside a panel */
  --control: #3a4057;        /* input and secondary-button outline */
  --control-strong: #6c7488; /* decoration only (scrubber ring, underlines), never text */
  --track: #2c3143;          /* progress and audio tracks */
  --skeleton: #242838;
  --scrim: rgba(5, 6, 12, 0.6);

  /* Ink: soft white, not pure white, and one grey; both well above 4.5:1 */
  --text: #e4e6ed;
  --muted: #9ba1b4;

  /* The one accent: Foundry brass. The primary button, links, the current value, progress, focus. */
  --accent: #d9a94e;
  --accent-soft: #2b2618;    /* brass tint for a highlighted figure or a bar's track */
  --primary: #d9a94e;
  --on-primary: #131521;
  --focus: #d9a94e;

  /* Status: one red mark per object, on the failing fact. Warning is orange so it never reads as brass. */
  --positive: #5fbf92;
  --negative: #e4796b;
  --warning: #e89a62;
  --pill-pos-bg: #173026;  --pill-pos-ink: #7fd3aa;
  --pill-neg-bg: #33201f;  --pill-neg-ink: #f0a197;
  --pill-warn-bg: #33241a; --pill-warn-ink: #f0b58a;
  --pill-neutral-bg: #262a3a; --pill-neutral-ink: #c9ccd8;

  /* Charts: brass for the series that matters, ink and grey for the rest */
  --data-1: #d9a94e;
  --data-2: #e4e6ed;
  --data-3: #6c7488;

  /* 3D: the stage behind a model, and anatomy colours. Anatomy colours are the subject's, not the UI's,
     and are the same in both themes (values from the animation kit, 2026-11). */
  --stage: #0e1018;
  --stage-ink: #9ba1b4;
  --anat-bone: #e9c98f;
  --anat-nearby: #a39d92;
  --anat-muscle: #c0392b;
  --anat-ligament: #13857a;
  --anat-joint: #d97f1e;
  --anat-disc: #2b6cd4;
  --anat-nerve: #c43a6c;

  /* Type: Instrument Sans for everything you read; Instrument Serif for one line per screen
     (the greeting or a reading page's title); mono for code and the terminal only. Sized up for reading. */
  --font: 'Instrument Sans', Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Instrument Serif', Georgia, serif;
  --mono: ui-monospace, 'Cascadia Code', 'SF Mono', Consolas, monospace;
  --fs-meta: 13px;    --lh-meta: 18px;    /* captions, timestamps, tab labels; nothing smaller */
  --fs-body: 15px;    --lh-body: 22px;    /* app text, rows, buttons */
  --fs-ui-lg: 17px;   --lh-ui-lg: 24px;   /* sheet titles, values in key-value rows, reading h3 */
  --fs-read: 18px;    --lh-read: 30px;    /* long-form reading and Patient mode */
  --fs-lead: 21px;    --lh-lead: 30px;    /* the one sentence that matters on a panel, reading h2 */
  --fs-title: 26px;   --lh-title: 32px;   /* screen title, sans 500 */
  --fs-figure: 24px;  --lh-figure: 30px;  /* KPI figures, regular weight, tabular */
  --fs-display: 30px; --lh-display: 36px; /* serif: the greeting, a reading page's h1 */
  --w-regular: 400;
  --w-medium: 500;
  --w-strong: 600;

  /* Space: 4px base */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --space-16: 64px;
  --gap: 16px;          /* between panels, both directions */
  --pad: 20px;          /* inside a panel */
  --margin: 16px;       /* page edge on a phone */
  --column: 1100px;     /* app column on wide screens */
  --measure: 680px;     /* reading column */
  --sidebar: 240px;     /* desktop nav, on the page ground */
  --topbar: 48px;
  --tabbar: 64px;
  --target: 44px;       /* smallest touch target */
  --control-h: 44px;    /* buttons and inputs on a phone */
  --control-h-dense: 36px; /* desktop toolbars and 3D chips (Patient mode keeps 44) */
  --row-h: 56px;

  /* Radius: soft cards, pill controls, square media */
  --radius-card: 22px;
  --radius-row: 14px;
  --radius-input: 18px;
  --radius-small: 6px;
  --radius-control: 999px;

  /* Shadow: only what floats (sheet, menu, popover, the composer). Nothing at rest. */
  --shadow-float: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-sheet: 0 -8px 32px rgba(0, 0, 0, 0.5);

  /* Motion: transform and opacity only */
  --dur-press: 120ms;
  --dur-ui: 200ms;
  --dur-sheet: 280ms;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --press-scale: 0.97;
}

@media (min-width: 700px) {
  :root {
    --margin: 20px;
    --fs-read: 19px;    --lh-read: 32px;
    --fs-figure: 34px;  --lh-figure: 42px;
    --fs-display: 34px; --lh-display: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-press: 0ms;
    --dur-ui: 0ms;
    --dur-sheet: 0ms;
    --press-scale: 1;
  }
}

/* Light: the Foundry's paper (grey ground, white panels, brass darkened to read on white). */
[data-theme='light'] {
  color-scheme: light;
  --ground: #f3f4f6;
  --surface: #ffffff;
  --raised: #ffffff;
  --active: #eceef2;
  --border: #e3e5ea;
  --rule: #eceef2;
  --control: #cdd1d9;
  --control-strong: #8a90a0;
  --track: #e3e5ea;
  --skeleton: #eceef2;
  --scrim: rgba(23, 26, 32, 0.32);
  --text: #171a20;
  --muted: #5a6070;
  --accent: #8a6413;
  --accent-soft: #f6eedc;
  --primary: #8a6413;
  --on-primary: #ffffff;
  --focus: #8a6413;
  --positive: #2e7d5b;
  --negative: #c2483c;
  --warning: #a8521a;
  --pill-pos-bg: #ddf3e8;  --pill-pos-ink: #0f3d28;
  --pill-neg-bg: #fbe9e6;  --pill-neg-ink: #7a2219;
  --pill-warn-bg: #fcebdd; --pill-warn-ink: #7a3a10;
  --pill-neutral-bg: #eceef2; --pill-neutral-ink: #3a3f4c;
  --data-1: #8a6413;
  --data-2: #171a20;
  --data-3: #8a90a0;
  --stage: #e6e9ee;
  --stage-ink: #3d434c;
  --shadow-float: 0 8px 32px rgba(20, 24, 38, 0.12);
  --shadow-sheet: 0 -8px 32px rgba(20, 24, 38, 0.12);
}

@media (prefers-color-scheme: light) {
  :root[data-theme='auto'] {
    color-scheme: light;
    --ground: #f3f4f6;
    --surface: #ffffff;
    --raised: #ffffff;
    --active: #eceef2;
    --border: #e3e5ea;
    --rule: #eceef2;
    --control: #cdd1d9;
    --control-strong: #8a90a0;
    --track: #e3e5ea;
    --skeleton: #eceef2;
    --scrim: rgba(23, 26, 32, 0.32);
    --text: #171a20;
    --muted: #5a6070;
    --accent: #8a6413;
    --accent-soft: #f6eedc;
    --primary: #8a6413;
    --on-primary: #ffffff;
    --focus: #8a6413;
    --positive: #2e7d5b;
    --negative: #c2483c;
    --warning: #a8521a;
    --pill-pos-bg: #ddf3e8;  --pill-pos-ink: #0f3d28;
    --pill-neg-bg: #fbe9e6;  --pill-neg-ink: #7a2219;
    --pill-warn-bg: #fcebdd; --pill-warn-ink: #7a3a10;
    --pill-neutral-bg: #eceef2; --pill-neutral-ink: #3a3f4c;
    --data-1: #8a6413;
    --data-2: #171a20;
    --data-3: #8a90a0;
    --stage: #e6e9ee;
    --stage-ink: #3d434c;
    --shadow-float: 0 8px 32px rgba(20, 24, 38, 0.12);
    --shadow-sheet: 0 -8px 32px rgba(20, 24, 38, 0.12);
  }
}
