/* Contrast (node tools/contrast.mjs), WCAG 2.x. Text pairs need 4.5:1, borders and marks 3:1.
theme  foreground            background             ratio   min   result
light  text-primary #15181d          bg-primary #fdfdfc               17.48:1  4.5   pass
light  text-primary #15181d          bg-secondary #f5f5f3             16.30:1  4.5   pass
light  text-primary #15181d          bg-tertiary #ececea              15.04:1  4.5   pass
light  text-primary #15181d          bg-highlight #f6e6a3             14.21:1  4.5   pass
light  text-secondary #474e58        bg-primary #fdfdfc                8.26:1  4.5   pass
light  text-secondary #474e58        bg-secondary #f5f5f3              7.70:1  4.5   pass
light  text-secondary #474e58        bg-tertiary #ececea               7.11:1  4.5   pass
light  text-tertiary #59616c         bg-primary #fdfdfc                6.16:1  4.5   pass
light  text-tertiary #59616c         bg-secondary #f5f5f3              5.74:1  4.5   pass
light  text-tertiary #59616c         bg-tertiary #ececea               5.30:1  4.5   pass
light  text-brand #a52f24            bg-primary #fdfdfc                6.80:1  4.5   pass
light  text-brand #a52f24            bg-secondary #f5f5f3              6.34:1  4.5   pass
light  text-brand #a52f24            bg-tertiary #ececea               5.86:1  4.5   pass
light  text-brand-hover #8a251c      bg-primary #fdfdfc                8.73:1  4.5   pass
light  text-brand-hover #8a251c      bg-secondary #f5f5f3              8.14:1  4.5   pass
light  text-on-brand #ffffff         bg-brand-solid #a52f24            6.93:1  4.5   pass
light  text-on-brand #ffffff         bg-brand-solid_hover #8a251c      8.89:1  4.5   pass
light  text-error #b42318            bg-primary #fdfdfc                6.46:1  4.5   pass
light  text-error #b42318            bg-secondary #f5f5f3              6.02:1  4.5   pass
light  border-primary #7e8590        bg-primary #fdfdfc                3.66:1    3   pass
light  border-primary #7e8590        bg-secondary #f5f5f3              3.41:1    3   pass
light  focus-ring #b5372b            bg-primary #fdfdfc                5.82:1    3   pass
light  focus-ring #b5372b            bg-secondary #f5f5f3              5.43:1    3   pass
light  fg-brand #b5372b              bg-primary #fdfdfc                5.82:1    3   pass
light  fg-brand #b5372b              bg-secondary #f5f5f3              5.43:1    3   pass
dark   text-primary #eceef1          bg-primary #101216               16.13:1  4.5   pass
dark   text-primary #eceef1          bg-secondary #171a20             14.99:1  4.5   pass
dark   text-primary #eceef1          bg-tertiary #20242b              13.40:1  4.5   pass
dark   text-primary #eceef1          bg-highlight #4d4521              8.25:1  4.5   pass
dark   text-secondary #b0b7c1        bg-primary #101216                9.28:1  4.5   pass
dark   text-secondary #b0b7c1        bg-secondary #171a20              8.62:1  4.5   pass
dark   text-secondary #b0b7c1        bg-tertiary #20242b               7.70:1  4.5   pass
dark   text-tertiary #9aa2ad         bg-primary #101216                7.27:1  4.5   pass
dark   text-tertiary #9aa2ad         bg-secondary #171a20              6.76:1  4.5   pass
dark   text-tertiary #9aa2ad         bg-tertiary #20242b               6.04:1  4.5   pass
dark   text-brand #f08a7c            bg-primary #101216                7.71:1  4.5   pass
dark   text-brand #f08a7c            bg-secondary #171a20              7.16:1  4.5   pass
dark   text-brand #f08a7c            bg-tertiary #20242b               6.40:1  4.5   pass
dark   text-brand-hover #f6aa9e      bg-primary #101216                9.96:1  4.5   pass
dark   text-brand-hover #f6aa9e      bg-secondary #171a20              9.26:1  4.5   pass
dark   text-on-brand #ffffff         bg-brand-solid #b8392c            5.74:1  4.5   pass
dark   text-on-brand #ffffff         bg-brand-solid_hover #9d3024      7.29:1  4.5   pass
dark   text-error #fda29b            bg-primary #101216                9.66:1  4.5   pass
dark   text-error #fda29b            bg-secondary #171a20              8.98:1  4.5   pass
dark   border-primary #6f7782        bg-primary #101216                4.14:1    3   pass
dark   border-primary #6f7782        bg-secondary #171a20              3.85:1    3   pass
dark   focus-ring #ec7f70            bg-primary #101216                7.00:1    3   pass
dark   focus-ring #ec7f70            bg-secondary #171a20              6.50:1    3   pass
dark   fg-brand #ec7f70              bg-primary #101216                7.00:1    3   pass
dark   fg-brand #ec7f70              bg-secondary #171a20              6.50:1    3   pass
*/

/* Pilot & Proof design tokens (GA346). The single source for every colour, type size, radius, shadow and
   spacing step. The names are the Untitled UI roles the product screens use (PROFESSIONAL-LOOK.md).
   site.css reads these and holds no colour of its own.

   Brand red, two roles:
   - Button fills and brand text use the darker red (--color-bg-brand-solid, --color-text-brand), which
     passes AA for label text in both themes.
   - The bright red (--color-fg-brand, --color-focus-ring) is for the proof-mark, the focus ring and
     decorative strokes. It is never small text.

   Themes: :root is light. prefers-color-scheme: dark applies dark unless the visitor chose light
   (:root:not([data-theme="light"])), and :root[data-theme="dark"] forces dark. theme.js sets data-theme.
   The two dark blocks must match; tools/contrast.mjs checks that and the table above. */

:root {
  --font-body: "Inclusive Sans", "Helvetica Neue", Arial, system-ui, sans-serif;
  --font-mono: "Fragment Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  /* Spacing: a 4px base. --space-N is N steps. */
  --spacing: 4px;
  --space-0-5: calc(var(--spacing) * 0.5);
  --space-1: calc(var(--spacing) * 1);
  --space-2: calc(var(--spacing) * 2);
  --space-3: calc(var(--spacing) * 3);
  --space-4: calc(var(--spacing) * 4);
  --space-5: calc(var(--spacing) * 5);
  --space-6: calc(var(--spacing) * 6);
  --space-7: calc(var(--spacing) * 7);
  --space-8: calc(var(--spacing) * 8);
  --space-9: calc(var(--spacing) * 9);
  --space-10: calc(var(--spacing) * 10);
  --space-11: calc(var(--spacing) * 11);
  --space-12: calc(var(--spacing) * 12);
  --space-14: calc(var(--spacing) * 14);
  --space-16: calc(var(--spacing) * 16);
  --space-20: calc(var(--spacing) * 20);
  --space-24: calc(var(--spacing) * 24);
  --space-30: calc(var(--spacing) * 30);
  --gutter: clamp(20px, 4vw, 56px);
  --max: 1200px;

  /* Type scale (Untitled UI), each size with its line height. */
  --text-xs: 12px;
  --text-xs--line-height: 18px;
  --text-sm: 14px;
  --text-sm--line-height: 20px;
  --text-md: 16px;
  --text-md--line-height: 24px;
  --text-lg: 18px;
  --text-lg--line-height: 28px;
  --text-xl: 20px;
  --text-xl--line-height: 30px;
  --text-display-xs: 24px;
  --text-display-xs--line-height: 32px;
  --text-display-sm: 30px;
  --text-display-sm--line-height: 38px;
  --text-display-md: 36px;
  --text-display-md--line-height: 44px;
  --text-display-lg: 48px;
  --text-display-lg--line-height: 60px;
  --text-display-xl: 60px;
  --text-display-xl--line-height: 72px;

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-xl: 12px;
  --radius-2xl: 16px;
  --radius-full: 9999px;

  --shadow-xs: 0px 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-sm: 0px 1px 3px rgba(16, 24, 40, 0.1), 0px 1px 2px -1px rgba(16, 24, 40, 0.1);
  --shadow-md: 0px 4px 6px -1px rgba(16, 24, 40, 0.1), 0px 2px 4px -2px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0px 12px 16px -4px rgba(16, 24, 40, 0.08), 0px 4px 6px -2px rgba(16, 24, 40, 0.03);
  --shadow-xl: 0px 20px 24px -4px rgba(16, 24, 40, 0.08), 0px 8px 8px -4px rgba(16, 24, 40, 0.03);

  /* Light: near-white surfaces, near-ink text. */
  --color-bg-primary: #fdfdfc;
  --color-bg-secondary: #f5f5f3;
  --color-bg-tertiary: #ececea;
  --color-bg-highlight: #f6e6a3;
  --color-text-primary: #15181d;
  --color-text-secondary: #474e58;
  --color-text-tertiary: #59616c;
  --color-text-brand: #a52f24;
  --color-text-brand-hover: #8a251c;
  --color-text-on-brand: #ffffff;
  --color-text-error: #b42318;
  --color-bg-brand-solid: #a52f24;
  --color-bg-brand-solid_hover: #8a251c;
  --color-fg-brand: #b5372b;
  --color-border-primary: #7e8590;
  --color-border-secondary: #dfe0dc;
  --color-focus-ring: #b5372b;
  /* Ink and red for the stippled instrument drawings (client/fieldnotes/stipple.ts reads these). */
  --stipple-ink: rgba(21, 24, 29, 0.88);
  --stipple-red: rgba(181, 55, 43, 0.95);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  @media screen {
    :root:not([data-theme="light"]) {
      --color-bg-primary: #101216;
      --color-bg-secondary: #171a20;
      --color-bg-tertiary: #20242b;
      --color-bg-highlight: #4d4521;
      --color-text-primary: #eceef1;
      --color-text-secondary: #b0b7c1;
      --color-text-tertiary: #9aa2ad;
      --color-text-brand: #f08a7c;
      --color-text-brand-hover: #f6aa9e;
      --color-text-on-brand: #ffffff;
      --color-text-error: #fda29b;
      --color-bg-brand-solid: #b8392c;
      --color-bg-brand-solid_hover: #9d3024;
      --color-fg-brand: #ec7f70;
      --color-border-primary: #6f7782;
      --color-border-secondary: #2b3039;
      --color-focus-ring: #ec7f70;
      --stipple-ink: rgba(236, 238, 241, 0.8);
      --stipple-red: rgba(236, 127, 112, 0.95);
      color-scheme: dark;
    }
  }
}

/* Screens only: a printed page always takes the light values above. */
@media screen {
  :root[data-theme="dark"] {
    --color-bg-primary: #101216;
    --color-bg-secondary: #171a20;
    --color-bg-tertiary: #20242b;
    --color-bg-highlight: #4d4521;
    --color-text-primary: #eceef1;
    --color-text-secondary: #b0b7c1;
    --color-text-tertiary: #9aa2ad;
    --color-text-brand: #f08a7c;
    --color-text-brand-hover: #f6aa9e;
    --color-text-on-brand: #ffffff;
    --color-text-error: #fda29b;
    --color-bg-brand-solid: #b8392c;
    --color-bg-brand-solid_hover: #9d3024;
    --color-fg-brand: #ec7f70;
    --color-border-primary: #6f7782;
    --color-border-secondary: #2b3039;
    --color-focus-ring: #ec7f70;
    --stipple-ink: rgba(236, 238, 241, 0.8);
    --stipple-red: rgba(236, 127, 112, 0.95);
    color-scheme: dark;
  }
}
