/* =====================================================================
   KPI demo - THEME tokens (the one place to re-brand)
   Purpose : Colours, fonts, radius and spacing for the whole demo, taken
             from the ADS Branding & Visual Identity sheet (teal #108574,
             deep teal #0c3b36, leaf #6fb55d, olive #89a04a, pine #2d946d,
             slate teal #27768d, gold #bdab38, light gold #e4d36b) and the
             KPI logo's mint-to-teal gradient (#67e1ce to #2c8782).
             Light mode is :root. Four palettes and a dark mode override
             the same tokens through attributes on <html> set by
             js/core/theme.js:  data-palette="teal|slate|pine|gold"
             and data-mode="light|dark". Palettes use only the brand
             colours and darker or lighter steps of them. No logic reads
             raw hex: modules read tokens through getComputedStyle.
   Related : js/core/theme.js (picker), css/base.css, js/core/charts.js
             (--s1..--s4, --q1..--q7, status), js/core/kpmap.js (--map-*)
             v0.6.1: --api colours for the orange "PMRU API" markers.
   Version : 0.6.1
   ===================================================================== */
@font-face {
  font-family: "Red Hat Display";
  src: url("../fonts/red-hat-display-var.woff2") format("woff2");
  font-weight: 300 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Red Hat Text";
  src: url("../fonts/red-hat-text-var.woff2") format("woff2");
  font-weight: 300 700; font-style: normal; font-display: swap;
}

/* ---------- 1. light mode, KPI Teal palette (default) ---------- */
:root {
  color-scheme: light;
  /* --- brand (palette tokens: section 2 overrides these) --- */
  --brand: #108574;          /* primary actions, active states */
  --on-brand: #ffffff;       /* text on --brand fills */
  --brand-ink: #0b5f53;      /* brand text and links on surfaces (7:1) */
  --brand-deep: #0c3b36;     /* sidebar, sign-in panel */
  --brand-deeper: #072a26;
  --chrome-glow: #12524a;    /* light corner of the sign-in panel */
  --brand-tint: #e5f2ef;     /* selected rows, soft fills */
  --brand-tint-2: #cfe8e1;
  --accent: #bdab38;         /* gold: active nav marker, avatar, rule end */
  --rule-a: var(--brand); --rule-b: var(--accent);
  --map-hi: #6fecd8;         /* brand map gradient: centre (logo mint) */
  --map-lo: #2c8883;         /* brand map gradient: edges (logo teal) */
  --logo-hi: #67e1ce; --logo-lo: #2c8782;   /* KPI logo gradient */
  --hero-a: #67e1ce; --hero-b: #3fb2a6;     /* sign-in numbers: light half of the logo gradient (contrast on the dark panel) */

  /* --- fixed brand colours (same in every palette) --- */
  --gold: #bdab38;
  --gold-ink: #6f6210;       /* gold for text on white */
  --gold-tint: #f6f1d6;
  --gold-line: #e6dca3;
  --gold-dot: #9a8a1e;
  --leaf: #6fb55d;
  --olive: #89a04a;
  --pine: #2d946d;
  --slate-teal: #27768d;
  --pin: #1f6a80;            /* data pins: text and rings */
  --pin-fill: #1f6a80;       /* data pins: filled dot and switch (white text) */
  --pin-tint: #e4eff3;
  --pin-tint-2: #d6e8ee;
  --pin-line: #c6dbe2;
  --pin-ink-h: #164f60;
  --pin-int: #8a9894;

  /* --- surfaces and ink --- */
  --page: #f2f5f4;
  --surface: #ffffff;
  --surface-2: #f7f9f8;
  --top-bg: rgba(255, 255, 255, .96);
  --ink: #13201c;
  --ink-2: #44524e;
  --muted: #63706c;
  --line: #e1e7e5;
  --line-2: #cbd5d2;
  --focus: #1f6a80;
  --dummy-ink: #6d7976;
  --dummy-line: #c9d2cf;
  --switch-trk: #b8cfd6;

  /* --- chart roles (validated: adjacent CVD and normal-vision checks pass on #fff) --- */
  --s1: #008a76;   /* teal */
  --s2: #c8851a;   /* amber, from the ADS gold family */
  --s3: #5a4fcf;   /* indigo */
  --s4: #c4457c;   /* magenta */
  --grid: #e6ecea;
  --axis: #c3ccc9;
  /* sequential teal (magnitude): light = less; -fg is the text colour on each step */
  --q1: #e3f3ef; --q2: #c2e5dc; --q3: #93d1c1; --q4: #5fb8a3; --q5: #2f9e88; --q6: #0f846f; --q7: #0b6b5b;
  --q1-fg: #072a26; --q2-fg: #072a26; --q3-fg: #072a26; --q4-fg: #072a26; --q5-fg: #072a26; --q6-fg: #ffffff; --q7-fg: #ffffff;
  /* ordinal teal (stages, light end >= 2:1 on white) */
  --o1: #5fb8a3; --o2: #2f9e88; --o3: #0f846f; --o4: #0b6b5b; --o5: #07524a;

  /* --- status (fixed meaning, always with an icon and a word) --- */
  --good: #0ca30c; --warn: #fab219; --serious: #ec835a; --critical: #d03b3b;
  --good-ink: #0a6e0a; --warn-ink: #7a5300; --serious-ink: #9a3d16; --critical-ink: #a32020;
  --good-tint: #e4f5e4; --warn-tint: #fff4d6; --serious-tint: #fde9e0; --critical-tint: #fbe3e3;
  /* v0.6.1: "PMRU API" markers (data built from the API files PMRU shared); a deep orange kept apart from the
     status colours and always shown with the words "PMRU API" and a plug icon */
  --api: #c2410c; --on-api: #ffffff; --api-rail: #f97316; --api-ink: #9a3412; --api-tint: #fff1e6; --api-line: #fdba74;
  /* district tiles and matrix cells */
  --tile0-bg: #dff0df; --tile0-fg: #0a4a0a; --tile1-bg: #ffefc4; --tile1-fg: #5c3e00;
  --tile2-bg: #fbd8c6; --tile2-fg: #7c2f0f; --tile3-bg: #bf3a33; --tile3-fg: #ffffff;
  --m0: #e6f3e6; --m1: #fff2cf; --m2: #fcdccc; --m3: #f4c4c4;

  /* --- maps (js/core/kpmap.js) --- */
  --map-off: #d3dcd9;        /* districts outside the 12, status maps */
  --map-halo: #ffffff;       /* halo behind map labels */

  /* --- key figures on the command centre: number colour and icon tint --- */
  --k1: #108574; --k1-t: #e5f2ef;   /* dashboards: teal */
  --k2: #27768d; --k2-t: #e4eff3;   /* connections: slate teal */
  --k3: #9a3d16; --k3-t: #fde9e0;   /* alerts: serious */
  --k4: #6f6210; --k4-t: #f6f1d6;   /* decisions: gold */
  --k5: #2d946d; --k5-t: #e6f3ec;   /* records: pine (large text, 3.8:1) */
  --k6: #66792a; --k6-t: #eef2df;   /* field app: olive, deeper step for contrast */

  /* --- type --- */
  --f-display: "Red Hat Display", "Segoe UI", system-ui, sans-serif;
  --f-text: "Red Hat Text", "Segoe UI", system-ui, sans-serif;
  --t-xs: 11.5px; --t-sm: 12.5px; --t-base: 14px; --t-md: 15.5px; --t-lg: 18px; --t-xl: 22px; --t-2xl: 28px; --t-3xl: 38px;

  /* --- shape and space --- */
  --r-sm: 6px; --r-md: 10px; --r-lg: 14px; --r-pill: 999px;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px;
  --side-w: 252px; --top-h: 62px;
  --shadow-pop: 0 12px 32px -12px rgba(7, 42, 38, .28), 0 2px 6px rgba(7, 42, 38, .08);
  --ease: cubic-bezier(.2, .7, .2, 1);
}

/* ---------- 2. palettes, light mode ---------- */
/* Slate Teal: slate teal actions, logo mint accent */
[data-palette="slate"] {
  --brand: #27768d; --brand-ink: #1f6a80; --brand-deep: #0e2f3a; --brand-deeper: #081f27; --chrome-glow: #164556;
  --brand-tint: #e4eff3; --brand-tint-2: #cde2ea; --accent: #67e1ce;
  --map-hi: #67e1ce; --map-lo: #27768d; --hero-a: #67e1ce; --hero-b: #7fc0d2;
}
/* Pine & Leaf: pine actions (deeper pine step for white text), leaf accent */
[data-palette="pine"] {
  --brand: #1f7a5a; --brand-ink: #17654a; --brand-deep: #0f3326; --brand-deeper: #08231a; --chrome-glow: #17503b;
  --brand-tint: #e6f3ec; --brand-tint-2: #cde8d8; --accent: #6fb55d;
  --map-hi: #9fd68e; --map-lo: #2d946d; --hero-a: #9fd68e; --hero-b: #6fb55d;
}
/* Deep Teal & Gold: deep teal actions, gold and olive accents */
[data-palette="gold"] {
  --brand: #0c3b36; --brand-ink: #0b5f53; --brand-deep: #0c3b36; --brand-deeper: #072a26; --chrome-glow: #1d5048;
  --brand-tint: #f6f1d6; --brand-tint-2: #ece2ad; --accent: #bdab38; --rule-a: #bdab38; --rule-b: #89a04a;
  --map-hi: #e4d36b; --map-lo: #89a04a; --hero-a: #e4d36b; --hero-b: #bdab38;
}

/* ---------- 3. dark mode (deep shades of the same brand family) ---------- */
[data-mode="dark"] {
  color-scheme: dark;
  --brand-ink: #6fd9c6;
  --brand-deep: #0b2f2b; --brand-deeper: #061d1a; --chrome-glow: #104a42;
  --brand-tint: #12302b; --brand-tint-2: #1b443d;
  --gold-ink: #e4d36b; --gold-tint: #2b2a12; --gold-line: #5a5220; --gold-dot: #9a8a1e;
  --pin: #6fb6cc; --pin-fill: #27768d; --pin-tint: #11303a; --pin-tint-2: #173f4c; --pin-line: #24505e; --pin-ink-h: #a9dbe9; --pin-int: #5f706c;

  --page: #0a1413;
  --surface: #0f1d1b;
  --surface-2: #142624;
  --top-bg: rgba(15, 29, 27, .94);
  --ink: #e3eeeb;
  --ink-2: #b7c9c4;
  --muted: #8fa5a0;
  --line: #1f3330;
  --line-2: #2d4642;
  --focus: #74ead8;
  --dummy-ink: #94a8a3;
  --dummy-line: #3d5551;
  --switch-trk: #3a5a63;

  /* charts (validated on #0f1d1b: lightness band, chroma, CVD, normal vision, contrast) */
  --s1: #1fa98f; --s2: #c08421; --s3: #8b83f0; --s4: #cf5b8e;
  --grid: #1d302d; --axis: #3a524d;
  /* sequential: dark = less, bright = more (validated ordinal ramp) */
  --q1: #1d5549; --q2: #23685a; --q3: #2b7d6a; --q4: #379c85; --q5: #4fb59a; --q6: #7ccdb7; --q7: #b0e8d8;
  --q1-fg: #ffffff; --q2-fg: #ffffff; --q3-fg: #ffffff; --q4-fg: #0b1f1c; --q5-fg: #0b1f1c; --q6-fg: #0b1f1c; --q7-fg: #0b1f1c;
  --o1: #1d7a64; --o2: #2f9e88; --o3: #5fc2aa; --o4: #8fd9c5; --o5: #bdeee0;

  --good: #22a722; --warn: #fab219; --serious: #ef8a5f; --critical: #e5534b;
  --good-ink: #84d884; --warn-ink: #f6c859; --serious-ink: #f3a583; --critical-ink: #f59a9a;
  --good-tint: #12301a; --warn-tint: #33280b; --serious-tint: #36200f; --critical-tint: #3a1414;
  --api: #fb8a3c; --on-api: #1c0b02; --api-rail: #fb8a3c; --api-ink: #fdba74; --api-tint: #36190a; --api-line: #8a3d12;
  --tile0-bg: #173a22; --tile0-fg: #a8e3a8; --tile1-bg: #3b300c; --tile1-fg: #f3d27a;
  --tile2-bg: #45240f; --tile2-fg: #f5b597; --tile3-bg: #b8403a; --tile3-fg: #ffffff;
  --m0: #163222; --m1: #3a2f0d; --m2: #40230f; --m3: #451a1a;

  --map-off: #2a3c39;
  --map-halo: #0f1d1b;

  --k1: #6fd9c6; --k1-t: #12302b;
  --k2: #8cc9da; --k2-t: #11303a;
  --k3: #f3a583; --k3-t: #36200f;
  --k4: #e4d36b; --k4-t: #2b2a12;
  --k5: #8fd07f; --k5-t: #12301f;
  --k6: #c3d58a; --k6-t: #262c12;
  --shadow-pop: 0 14px 36px -12px rgba(0, 0, 0, .6), 0 2px 6px rgba(0, 0, 0, .35);
}
[data-mode="dark"][data-palette="slate"] {
  --brand-ink: #8cc9da; --brand-deep: #0b2630; --brand-deeper: #06181f; --chrome-glow: #123c4a;
  --brand-tint: #10303a; --brand-tint-2: #174150;
}
[data-mode="dark"][data-palette="pine"] {
  --brand-ink: #8fd07f; --brand-deep: #0c2a1f; --brand-deeper: #071b14; --chrome-glow: #134432;
  --brand-tint: #12301f; --brand-tint-2: #1a402b;
}
[data-mode="dark"][data-palette="gold"] {
  --brand: #bdab38; --on-brand: #0c3b36; --brand-ink: #e4d36b; --brand-deep: #0b2f2b; --brand-deeper: #061d1a; --chrome-glow: #14463f;
  --brand-tint: #2b2a12; --brand-tint-2: #3a3818;
}
