/* Paper Digest palette. Reference tokens (oklch) first, then semantic tokens.
   Components must use only the semantic tokens. Colour is applied to text, icons and thin bars;
   boxes stay neutral (paper / surface / surface-strong). Contrast verified in palette-report.md. */

:root {
  /* ---- reference tokens ---- */

  /* warm paper neutrals, light end */
  --ref-paper-0: oklch(99.2% 0.006 80);
  --ref-paper-1: oklch(96.5% 0.012 78);
  --ref-paper-2: oklch(94.5% 0.014 78);
  --ref-paper-3: oklch(87.5% 0.02 75);
  --ref-paper-4: oklch(80% 0.025 72);

  /* warm near-black neutrals, dark end */
  --ref-bark-950: oklch(14% 0.008 60);
  --ref-bark-900: oklch(20% 0.01 60);
  --ref-bark-800: oklch(23.5% 0.011 60);
  --ref-bark-700: oklch(32% 0.013 60);
  --ref-bark-600: oklch(42% 0.015 60);

  /* sable: dark warm brown-black */
  --ref-sable-900: oklch(22% 0.018 55);
  --ref-sable-800: oklch(30% 0.035 58);
  --ref-sable-700: oklch(38% 0.032 60);
  --ref-sable-600: oklch(43.5% 0.03 62);
  --ref-sable-500: oklch(63% 0.05 70);

  /* sable fur: lighter tan-brown tones */
  --ref-fur-100: oklch(94% 0.014 82);
  --ref-fur-200: oklch(88.5% 0.045 78);
  --ref-fur-300: oklch(80% 0.035 76);
  --ref-fur-400: oklch(70% 0.035 72);
  --ref-fur-500: oklch(52% 0.04 70);

  /* mahogany: reddish-brown wood */
  --ref-mahogany-800: oklch(38% 0.105 35);
  --ref-mahogany-700: oklch(42% 0.112 35);
  --ref-mahogany-600: oklch(45% 0.112 35);
  --ref-mahogany-400: oklch(72% 0.1 38);
  --ref-mahogany-300: oklch(77% 0.09 38);
  --ref-mahogany-200: oklch(80% 0.075 38);

  /* ink-blue, for links (hue 245-255, low chroma) */
  --ref-blue-800: oklch(36% 0.11 255);
  --ref-blue-700: oklch(43% 0.135 255);
  --ref-blue-600: oklch(52% 0.14 255);
  --ref-blue-300: oklch(78% 0.1 245);
  --ref-blue-200: oklch(83% 0.09 245);
  --ref-blue-400: oklch(72% 0.12 250);

  /* moss green (muted, hue 135-138) */
  --ref-moss-700: oklch(39% 0.09 140);
  --ref-moss-500: oklch(47% 0.09 140);
  --ref-moss-300: oklch(83% 0.12 135);
  --ref-moss-400: oklch(64% 0.1 138);

  /* ochre (earthy amber, hue 78-88) */
  --ref-ochre-700: oklch(52% 0.105 80);
  --ref-ochre-500: oklch(60% 0.11 80);
  --ref-ochre-300: oklch(80% 0.13 68);
  --ref-ochre-400: oklch(74% 0.12 85);

  /* brick red (hue 22-24, more chroma than mahogany so it never reads as it) */
  --ref-brick-700: oklch(46% 0.17 18);
  --ref-brick-500: oklch(58% 0.15 22);
  --ref-brick-300: oklch(72% 0.145 20);
  --ref-brick-400: oklch(60% 0.15 22);

  /* plum / aubergine (glossary) */
  --ref-plum-700: oklch(42% 0.1 335);
  --ref-plum-500: oklch(55% 0.1 335);
  --ref-plum-300: oklch(79% 0.09 335);
  --ref-plum-400: oklch(70% 0.1 335);

  /* deep teal (figures; hue 195-205, apart from link blue 255 and moss 140) */
  --ref-teal-700: oklch(41% 0.07 205);
  --ref-teal-300: oklch(84% 0.06 195);

  /* dusk violet (comparison words; hue 290-295, apart from link blue 255 and plum 335) */
  --ref-violet-800: oklch(35% 0.1 295);
  --ref-violet-300: oklch(86% 0.07 290);

  /* ---- semantic tokens: light (default) ---- */
  color-scheme: light;
  --paper: var(--ref-paper-1);   /* page background (the paper colour; paper texture overlays this) */
  --surface: oklch(99.2% 0.006 80 / 0.62); /* frosted-glass card fill, translucent (backdrop-filter blur on top); neutral, never coloured */
  --surface-strong: var(--ref-paper-0); /* opaque card/popover fill where text must sit on a known background */
  --rule: var(--ref-paper-3);    /* hairline / divider / card border */
  --field: var(--ref-paper-2);   /* input field background */
  --ink: var(--ref-sable-900);   /* primary body text */
  --ink-2: var(--ref-sable-700); /* secondary text */
  --ink-3: var(--ref-sable-600); /* tertiary / meta text (captions, timestamps) */
  --mahogany: var(--ref-mahogany-600); /* mahogany emphasis: key-term text, icons, thin accent bars */
  --sable: var(--ref-sable-800); /* sable emphasis: headings and strong text */
  --primary: var(--ref-mahogany-600); /* primary button background */
  --primary-hover: var(--ref-mahogany-800); /* primary button hover background */
  --on-primary: var(--ref-paper-1); /* text/icon on primary button */
  --link: var(--ref-blue-700);   /* hyperlink text (underlined) at rest */
  --link-hover: var(--ref-blue-800); /* hyperlink hover / active text */
  --positive: var(--ref-moss-700); /* text/icon: claim supported */
  --caution: var(--ref-ochre-700); /* text/icon: claim partly supported */
  --negative: var(--ref-brick-700); /* text/icon: error / claim not supported */
  --gloss: var(--ink);  /* glossary-term text: plain ink; the dotted underline marks it (decided 9 Oct 2026: no plum) */
  --num: var(--mahogany); /* statistics and figures: mahogany, bold; text only */
  --compare: var(--sable); /* comparison words: sable, bold; text only */
  --focus: var(--ref-blue-600);  /* keyboard focus ring (3:1 non-text) */
  --gauge-asserted: var(--ref-sable-500); /* claim-vs-evidence bar: what the source asserts */
  --gauge-supported: var(--ref-moss-500); /* claim-vs-evidence bar: portion supported by evidence */
  --gauge-gap: var(--ref-brick-500); /* claim-vs-evidence bar: unsupported gap (draw hatched) */
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    /* ---- semantic tokens: dark ---- */
    color-scheme: dark;
    --paper: var(--ref-bark-950);  /* page background (the paper colour; paper texture overlays this) */
    --surface: oklch(24% 0.010 60 / 0.58); /* frosted-glass card fill, translucent (backdrop-filter blur on top); neutral, never coloured */
    --surface-strong: var(--ref-bark-900); /* opaque card/popover fill where text must sit on a known background */
    --rule: var(--ref-bark-700);   /* hairline / divider / card border */
    --field: var(--ref-bark-800);  /* input field background */
    --ink: var(--ref-fur-100);     /* primary body text */
    --ink-2: var(--ref-fur-300);   /* secondary text */
    --ink-3: var(--ref-fur-400);   /* tertiary / meta text (captions, timestamps) */
    --mahogany: var(--ref-mahogany-400); /* mahogany emphasis: key-term text, icons, thin accent bars */
    --sable: var(--ref-fur-200);   /* sable emphasis: headings and strong text */
    --primary: var(--ref-mahogany-300); /* primary button background */
    --primary-hover: var(--ref-mahogany-200); /* primary button hover background */
    --on-primary: var(--ref-bark-950); /* text/icon on primary button */
    --link: var(--ref-blue-300);   /* hyperlink text (underlined) at rest */
    --link-hover: var(--ref-blue-200); /* hyperlink hover / active text */
    --positive: var(--ref-moss-300); /* text/icon: claim supported */
    --caution: var(--ref-ochre-300); /* text/icon: claim partly supported */
    --negative: var(--ref-brick-300); /* text/icon: error / claim not supported */
    --gloss: var(--ink);  /* glossary-term text: plain ink; the dotted underline marks it (decided 9 Oct 2026: no plum) */
    --num: var(--mahogany); /* statistics and figures: mahogany, bold; text only */
    --compare: var(--sable); /* comparison words: sable, bold; text only */
    --focus: var(--ref-blue-400);  /* keyboard focus ring (3:1 non-text) */
    --gauge-asserted: var(--ref-fur-500); /* claim-vs-evidence bar: what the source asserts */
    --gauge-supported: var(--ref-moss-400); /* claim-vs-evidence bar: portion supported by evidence */
    --gauge-gap: var(--ref-brick-400); /* claim-vs-evidence bar: unsupported gap (draw hatched) */
  }
}

:root[data-theme="dark"] {
  /* ---- semantic tokens: dark (manual override; keep identical to the media block) ---- */
  color-scheme: dark;
  --paper: var(--ref-bark-950);  /* page background (the paper colour; paper texture overlays this) */
  --surface: oklch(24% 0.010 60 / 0.58); /* frosted-glass card fill, translucent (backdrop-filter blur on top); neutral, never coloured */
  --surface-strong: var(--ref-bark-900); /* opaque card/popover fill where text must sit on a known background */
  --rule: var(--ref-bark-700);   /* hairline / divider / card border */
  --field: var(--ref-bark-800);  /* input field background */
  --ink: var(--ref-fur-100);     /* primary body text */
  --ink-2: var(--ref-fur-300);   /* secondary text */
  --ink-3: var(--ref-fur-400);   /* tertiary / meta text (captions, timestamps) */
  --mahogany: var(--ref-mahogany-400); /* mahogany emphasis: key-term text, icons, thin accent bars */
  --sable: var(--ref-fur-200);   /* sable emphasis: headings and strong text */
  --primary: var(--ref-mahogany-300); /* primary button background */
  --primary-hover: var(--ref-mahogany-200); /* primary button hover background */
  --on-primary: var(--ref-bark-950); /* text/icon on primary button */
  --link: var(--ref-blue-300);   /* hyperlink text (underlined) at rest */
  --link-hover: var(--ref-blue-200); /* hyperlink hover / active text */
  --positive: var(--ref-moss-300); /* text/icon: claim supported */
  --caution: var(--ref-ochre-300); /* text/icon: claim partly supported */
  --negative: var(--ref-brick-300); /* text/icon: error / claim not supported */
  --gloss: var(--ink);  /* glossary-term text: plain ink; the dotted underline marks it (decided 9 Oct 2026: no plum) */
  --num: var(--mahogany); /* statistics and figures: mahogany, bold; text only */
  --compare: var(--sable); /* comparison words: sable, bold; text only */
  --focus: var(--ref-blue-400);  /* keyboard focus ring (3:1 non-text) */
  --gauge-asserted: var(--ref-fur-500); /* claim-vs-evidence bar: what the source asserts */
  --gauge-supported: var(--ref-moss-400); /* claim-vs-evidence bar: portion supported by evidence */
  --gauge-gap: var(--ref-brick-400); /* claim-vs-evidence bar: unsupported gap (draw hatched) */
}
