/* Numbervane app — design tokens. Brand system: "Field Ledger" (docs/design/brand.md).
   Paper, ink, hairline rules, monospaced figures and one tape-measure-yellow marker.

   Theme: <html data-theme="light|dark"> is set before first paint by js/theme-boot.js.
   Tenant accent: js/shell.js sets --accent-base from the tenant theme. It colours ONLY the tenant's logo tile and
   chart series; the chrome is ink + paper + marker. Good / bad / warn appear only on data.
   Contrast: every text token below is >= 4.5:1 on --paper and --sheet in its own theme (WCAG AA). Marker is a
   background, never a text colour; text on marker is always --on-marker. */

:root {
  color-scheme: light;

  /* type (self-hosted in /assets/fonts/; the fallbacks keep the layout stable while they load) */
  --font-display: "Bricolage Grotesque", "Bricolage Fallback", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --font-sans: "Hanken Grotesk", "Hanken Fallback", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --fs-10: .65625rem;
  --fs-11: .6875rem;
  --fs-12: .75rem;
  --fs-13: .8125rem;
  --fs-14: .875rem;
  --fs-15: .9375rem;
  --fs-16: 1rem;
  --fs-18: 1.125rem;
  --fs-20: 1.25rem;
  --fs-24: 1.5rem;
  --fs-28: 1.75rem;
  --fs-32: 2rem;
  --fs-40: 2.5rem;
  --lh-tight: 1.02;
  --lh-snug: 1.3;
  --lh-body: 1.5;
  --track-label: .06em;

  /* space (8px base, 4px half-step) */
  --s-1: .25rem; --s-2: .5rem; --s-3: .75rem; --s-4: 1rem; --s-5: 1.25rem;
  --s-6: 1.5rem; --s-8: 2rem; --s-10: 2.5rem; --s-12: 3rem; --s-16: 4rem;

  /* shape: 2px everywhere */
  --r: 2px;

  /* layout */
  --sidebar-w: 216px;
  --topbar-h: 56px;
  --tabbar-h: 54px;
  --content-max: 1200px;

  /* motion: almost none */
  --dur-1: 120ms;
  --dur-2: 160ms;
  --ease: ease-out;

  /* colour — light (paper) */
  --paper: #F3EFE6;
  --sheet: #FBF9F4;
  --ink: #15130F;
  --ink-2: #4A463E;
  --ink-3: #696458;                      /* brand #7A7468 darkened to hold 4.5:1 on paper */
  --rule: rgba(21, 19, 15, .16);
  --rule-2: rgba(21, 19, 15, .32);
  --rule-strong: #15130F;
  --marker: #FFD400;
  --marker-soft: #FFF1A8;
  --on-marker: #15130F;
  --good: #1F6B3A;
  --bad: #B3261E;
  --warn: #8A5A00;
  --wash: rgba(21, 19, 15, .045);        /* the faintest ink wash: hover rows, bar tracks */
  --scrim: rgba(21, 19, 15, .42);

  /* aging ramp: ink at 34 / 56 / 80 %, red only for 90+ */
  --age-1: color-mix(in srgb, var(--ink) 34%, var(--paper));
  --age-2: color-mix(in srgb, var(--ink) 56%, var(--paper));
  --age-3: color-mix(in srgb, var(--ink) 80%, var(--paper));
  --age-4: var(--bad);
  --neutral-mark: color-mix(in srgb, var(--ink) 38%, var(--paper));

  /* tenant accent (logo tile + chart series only) */
  --accent-base: #15130F;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #141311;
  --sheet: #1C1A17;
  --ink: #F1EDE4;
  --ink-2: #B9B3A6;
  --ink-3: #8F897C;
  --rule: rgba(241, 237, 228, .16);
  --rule-2: rgba(241, 237, 228, .34);
  --rule-strong: #F1EDE4;
  --marker: #FFD400;
  --marker-soft: #4A3F00;
  --good: #6FCF8E;
  --bad: #FF8A80;
  --warn: #F2B84B;
  --wash: rgba(241, 237, 228, .06);
  --scrim: rgba(0, 0, 0, .62);
}

:root, .accent-scope {
  --accent: var(--accent-base);
  --on-accent: #FBF9F4;
}
/* dark: lift the tenant accent until it reads on warm near-black */
:root[data-theme="dark"], :root[data-theme="dark"] .accent-scope {
  --accent: color-mix(in oklab, var(--accent-base) 52%, #ffffff);
  --on-accent: #15130F;
}

/* a tenant whose accent sits on the semantic "good" green keeps it on the logo tile, but its chart series draw in ink:
   a green bar beside a red one reads as a verdict the data never gave (js/format.js greenAccent) */
:root[data-series="ink"] { --logo: var(--accent-base); --on-logo: #FBF9F4; --accent: var(--ink); --on-accent: var(--paper); }
:root[data-theme="dark"][data-series="ink"] { --logo: color-mix(in oklab, var(--accent-base) 52%, #ffffff); --on-logo: #15130F; --accent: var(--ink); --on-accent: var(--paper); }

/* a tenant whose accent is itself near-neutral (ink, slate) simply draws in ink, in either theme */
:root[data-accent="ink"], :root[data-theme] .accent-scope[data-accent="ink"] { --accent: var(--ink); --on-accent: var(--paper); }

@media (prefers-reduced-motion: reduce) {
  :root { --dur-1: 0ms; --dur-2: 0ms; }
}
