/* ============================================================================
   ds-tokens.css — Distinct Revelations design system tokens, direction A "Ledger", re-themed to the new logo 2026-12-01
   (approved 2026-11-26; plan docs/ux-plan/ux-plan_v1.md §8–9, guide docs/design-system/).

   All tokens are prefixed --ds- so they can never collide with the legacy
   variables (--border, --muted, --text, --color-*) older stylesheets use.

   Dark mode is OPT-IN per page: it applies only when <html data-theme="dark">
   is set by the app shell. Legacy cards are not dark-ready yet, so this file
   deliberately does NOT follow prefers-color-scheme on its own; the shell
   decides (user setting "Match system" → sets data-theme from the media query).
   ============================================================================ */
:root {
  /* Brand (from the logo) */
  --ds-brand-navy: #06203A;
  --ds-brand-gold: #7A5A0E;        /* gold as TEXT: AA on white and cream */
  --ds-brand-gold-bright: #CB8F19; /* logo gold: decorative, current step, focus */
  --ds-brand-red: #A31809;          /* logo red: decoration only, never means "bad" */
  --ds-brand-teal: #02525B;
  --ds-brand-sand: #EDD3A2;
  --ds-brand-cream: #FBF6EC;

  /* Surfaces & text */
  --ds-bg: #FBF6EC;          /* page: light cream (approved 2026-12-01) */
  --ds-surface: #FFFFFF;     /* cards, dialogs */
  --ds-surface-2: #F6EEDD;   /* tinted panels, banded rows */
  --ds-surface-3: #EFE4CC;   /* hover on tinted */
  --ds-border: #E6DAC2;
  --ds-border-strong: #CDBD9C;
  --ds-text: #13202E;
  --ds-text-2: #46505E;      /* secondary */
  --ds-text-3: #5A6170;      /* muted: still 4.5:1 on --ds-bg */
  --ds-text-inverse: #FFFFFF;

  /* Actions */
  --ds-primary: #06203A;
  --ds-primary-hover: #12365A;
  --ds-primary-active: #031424;
  --ds-on-primary: #FFFFFF;
  --ds-accent: #7A5A0E;
  --ds-accent-soft: #FBEFD5;
  --ds-link: #0B5F69;         /* teal from the logo */
  --ds-danger: #D92D20;       /* status red (not the logo red) */
  --ds-danger-hover: #B42318;
  --ds-on-danger: #FFFFFF;
  --ds-focus: #CB8F19;
  --ds-focus-ring: 0 0 0 3px #FFFFFF, 0 0 0 6px var(--ds-focus);

  /* Status (always paired with an icon + text) */
  --ds-good: #1F6F43;  --ds-good-bg: #E3F1E8;
  --ds-warn: #8A5A00;  --ds-warn-bg: #FBEFD5;
  --ds-bad: #C2271C;   --ds-bad-bg: #FDE7E4;
  --ds-info: #1E4E8C;  --ds-info-bg: #E2EBF7;
  --ds-neutral: #4A5568; --ds-neutral-bg: #EEF0F3;

  /* Type */
  --ds-font-head: "Libre Baskerville", Georgia, "Times New Roman", serif;   /* pairing B, approved 2026-12-01 */
  --ds-font-body: "Source Sans 3", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;

  /* Chart series, fixed order, never cycled (validated light + dark for colour-blind separation) */
  --ds-chart-1: #2F6DB5; --ds-chart-2: #B07A0E; --ds-chart-3: #00939F;
  --ds-chart-4: #B23A1F; --ds-chart-5: #7B5CC2; --ds-chart-6: #4E8F3A;
  --ds-font-mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  --ds-text-xs: 0.75rem;     /* 12 */
  --ds-text-sm: 0.84375rem;  /* 13.5 */
  --ds-text-md: 0.9375rem;   /* 15 — body */
  --ds-text-lg: 1.125rem;    /* 18 */
  --ds-text-xl: 1.375rem;    /* 22 */
  --ds-text-2xl: 1.75rem;    /* 28 */
  --ds-leading: 1.5;
  --ds-leading-tight: 1.25;
  --ds-weight-regular: 400; --ds-weight-semibold: 600; --ds-weight-bold: 700;

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

  /* Shape & elevation */
  --ds-radius-sm: 4px; --ds-radius: 8px; --ds-radius-lg: 12px; --ds-radius-pill: 999px;
  --ds-shadow-1: 0 1px 2px rgba(6, 32, 58, .06), 0 1px 3px rgba(6, 32, 58, .08);
  --ds-shadow-2: 0 12px 32px rgba(6, 32, 58, .18), 0 2px 6px rgba(6, 32, 58, .10);
  --ds-overlay: rgba(11, 18, 32, .55);

  /* Sizing */
  --ds-control-h: 40px;          /* Guided default */
  --ds-control-h-compact: 32px;  /* Expert */
  --ds-touch: 44px;
  --ds-icon: 18px;
  --ds-z-toast: 2147482500;      /* below drError (2147483000), above modals */
  --ds-duration: 160ms;
}

/* Expert density (set by the shell on <html data-density="compact">) */
:root[data-density="compact"] {
  --ds-control-h: var(--ds-control-h-compact);
  --ds-text-md: 0.84375rem;
}

:root[data-theme="dark"] {
  --ds-bg: #0B1A2C;
  --ds-surface: #12263D;
  --ds-surface-2: #17304C;
  --ds-surface-3: #1D3A5B;
  --ds-border: #27466A;
  --ds-border-strong: #35587F;
  --ds-text: #EEF2F7;
  --ds-text-2: #C3CEDB;
  --ds-text-3: #9FB0C2;
  --ds-text-inverse: #06203A;
  --ds-primary: #E9BE5A;
  --ds-primary-hover: #F0CB72;
  --ds-primary-active: #CB8F19;
  --ds-on-primary: #06203A;
  --ds-accent: #E9BE5A;
  --ds-accent-soft: #2B2A1E;
  --ds-link: #6CC4CE;
  --ds-danger: #E5574A;
  --ds-danger-hover: #EC7366;
  --ds-on-danger: #FFFFFF;
  --ds-focus: #E9BE5A;
  --ds-focus-ring: 0 0 0 3px #0B1A2C, 0 0 0 6px var(--ds-focus);
  --ds-good: #7FD1A0;  --ds-good-bg: #173326;
  --ds-warn: #F0C46B;  --ds-warn-bg: #3A2E14;
  --ds-bad: #F2978A;   --ds-bad-bg: #3C1E1A;
  --ds-info: #93B8F0;  --ds-info-bg: #1A2C48;
  --ds-neutral: #B6C2D3; --ds-neutral-bg: #24324A;
  --ds-shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
  --ds-shadow-2: 0 12px 32px rgba(0, 0, 0, .55);
  --ds-overlay: rgba(0, 0, 0, .65);
  --ds-chart-1: #4A82C8; --ds-chart-2: #BE8826; --ds-chart-3: #1C99A4;
  --ds-chart-4: #CF5A3B; --ds-chart-5: #8871CC; --ds-chart-6: #609E48;
}

@media (prefers-reduced-motion: reduce) {
  :root { --ds-duration: 0ms; }
}
