/* ============================================================
   shared/tokens.css — IndustryPulse design tokens
   SINGLE SOURCE OF TRUTH for color, type, radius, elevation, chart palette.
   Consumed by every internal tool AND the customer app (01 Public Website
   links this file — its old duplicate token block was removed). Do not fork.

   Palette finalized from the brandbook (Jun 9 2026). Eight governed roles:
     Graphite #2C3642 · Paper #F4F7FB · Pulse Blue #235AC3 · Signal Teal #239BB4
     Lift Cyan #2DAFC8 · Accent Violet #B478DC · Insight Mint #79D8B5 · Signal Yellow #D7E173
   The signature gradient is the brandbook blue→teal→cyan ramp.
   One sanctioned addition: a muted negative (the brandbook ships no red, but
   honest data viz needs a loss color). It is tuned to sit with the palette.
   A second sanctioned addition (FD-383, 2026-09-24): --customer-input-fill /
   -edge / -ink, THE CUSTOMER'S OWN inputs and figures on any surface - never
   IndustryPulse's. Cross-checked against govern/DESIGN_TOKENS.json by
   observe/customer_input_tokens.py.
   ============================================================ */

/* ---- Brand + scale tokens (theme-independent) ------------ */
:root{
  /* brandbook named roles — reference these by name for clarity */
  --pulse:#235AC3;     /* primary series · leading CTA · link · focus ring · KPI accent */
  --signal-teal:#239BB4;/* secondary series · supportive insight surfaces · progress */
  --lift-cyan:#2DAFC8; /* third series · chart area fills · soft highlights */
  --violet:#B478DC;    /* forecast overlays · locked / premium accents · comparison series */
  --mint:#79D8B5;      /* positive status surfaces · approved-up · success accents */
  --signal-yellow:#D7E173;/* watch backgrounds · threshold zones · caution callouts */
  /* --customer-input-fill / -edge: THE CUSTOMER'S OWN inputs and figures on any surface - never
     IndustryPulse's (FD-383, 2026-09-24). Fill and edge are the founder's own hex values, matched to
     her workbook's yellow entry cells (Product_Visual_System.json: fill FFF5CC, edge D9B94A -
     "Yellow cells are for your entries and selections.") and are the SAME in both themes; only
     --customer-input-ink (small TEXT/icon use, per theme below) differs, because a mid gold that
     reads on white does not read on dark. MEASURED (observe/customer_input_tokens.py, computed from
     these values, never restated by hand): edge on --paper is 1.78:1 - BELOW the 3:1 WCAG non-text
     floor named for a line/border. That is her exact locked value (decision 1, 2026-09-24 lane-2
     brief item d, "do not reopen"), reported for her review, not a defect this token can fix by
     itself. Signal Yellow (above) keeps its own caution role and stays off any customer-plane
     surface where this family appears (decision 3). Never write these two hexes into a page file -
     read the token; the checker refuses a literal spelled anywhere else under product/UI. */
  --customer-input-fill:#FFF5CC;
  --customer-input-edge:#D9B94A;
  --graphite:#2C3642;  /* primary dark type · dark shell base · report covers */
  --paper:#F4F7FB;     /* main shell · document sheets · light-mode layout base */

  /* gradient anchors — kept as --royal/--azure/--cyan so every existing
     reference keeps resolving; now mapped onto the brandbook ramp. The
     Theme Studio "Brand palette" knob overrides exactly these three, so a
     single knob shifts every gradient, button, active nav, pill, focus ring
     AND the primary chart series together. */
  --royal:#235AC3;     /* = Pulse Blue */
  --azure:#239BB4;     /* = Signal Teal */
  --cyan:#2DAFC8;      /* = Lift Cyan */
  --kicker-ink:var(--azure); /* small accent kicker/eyebrow TEXT — themed AA-safe variant of Signal Teal (default = brand teal; per-theme overrides below). Brand teal stays for borders/series/icons. */
  --grad:linear-gradient(100deg, var(--royal), var(--azure) 52%, var(--cyan));
  --grad-soft:linear-gradient(100deg, color-mix(in srgb,var(--royal) 16%,transparent), color-mix(in srgb,var(--cyan) 16%,transparent));
  /* --grad-cta: the accessible WHITE-TEXT variant of the signature ramp.
     The brandbook gradient (--grad) keeps its bright teal/cyan for decorative
     fills (hero, dividers, data bars), but white label/initials text on the
     cyan end of --grad fails WCAG AA (white on Lift Cyan = 2.6:1). This deepens
     azure/cyan toward Graphite just enough that white clears 4.5:1 across the
     whole ramp, still reads blue->teal, and stays derived from the same anchors
     so the Theme Studio palette knob cascades to it for free. Use it on any
     gradient fill that carries white TEXT (btn-primary, lock-badge, avatar). */
  --grad-cta:linear-gradient(100deg, var(--royal), color-mix(in srgb,var(--azure), var(--graphite) 30%) 52%, color-mix(in srgb,var(--cyan), var(--graphite) 44%));
  /* --on-accent: the label/icon color that sits ON A BRAND accent surface — var(--grad-cta) and
     var(--pulse) fills (buttons, badges, avatars, spinners). White clears WCAG AA across the whole
     --grad-cta ramp (see above) and on --pulse, in BOTH themes, so this one is safely
     theme-independent. Reference this instead of a raw #fff on those two surfaces.
     IT IS NOT VALID ON var(--site-accent), and this line used to say that it was. --site-accent is a
     per-SITE identity hex from the sites.js registry, ranging from deep blue through mint to amber.
     White on Innovation Lab's #2FA98E is 2.92:1 — UI/17's selected chip was failing AA while pointing
     at a token whose own comment promised it could not. A constant cannot be safe over a colour it
     does not know. Use --on-site-accent below: it is COMPUTED from the real hex. */
  --on-accent:#FFFFFF;
  /* --on-site-accent: the label/icon colour that sits ON a var(--site-accent) fill. tweaks-boot.js
     resolves this site's identity hex from the registry (including a Theme Studio recolour) and picks
     whichever of white / near-black actually MEASURES higher against it, so the token cannot promise
     safety it does not have. The static value here is the fallback for a page that never runs
     tweaks-boot.js — there --site-accent is still the brand primary, where white is correct. */
  --on-site-accent:var(--on-accent);
  /* --site-accent-ink: the site identity colour when it carries small TEXT (kicker tags, meta,
     arrows, counters) rather than filling a shape. Exactly the relationship --azure has to
     --accent-ink: a hex chosen to be recognisable as a FILL is routinely too light to be READ
     (Innovation Lab's #2FA98E is 2.74:1 on a light card). tweaks-boot.js darkens it on light and
     lifts it on dark until it clears AA on that theme's lightest text surface, so the wayfinding
     colour survives and the text becomes readable. Fallback = the brand teal ink. */
  --site-accent-ink:var(--accent-ink);
  /* --mask-opaque: the FULLY-OPAQUE stop of a CSS mask gradient. Not a visible colour — a mask-image
     gradient is read for its ALPHA, so this value only ever means "keep this part of the element"
     (its transparent counterpart means "hide it"). It was written as a raw #000 in four places across
     three stylesheets (01's components.css twice, 01's pages/landing.css, 07's intranet.css), each
     carrying its own comment explaining that the black is opacity rather than paint — one fact stated
     four times, which is exactly how copies drift. Reference this instead of a raw #000 on any
     mask-image / -webkit-mask-image stop. Theme-independent by construction: alpha does not change
     between light and dark, and the masked artwork underneath supplies the colour. */
  --mask-opaque:#000000;

  /* --site-accent: the per-site IDENTITY colour, surfaced in the internal-shell
     chrome (rail badge + active menu item) so each site is recognisable from the
     inside — not just by reading the workspace name. Set at paint by tweaks-boot.js
     from the sites.js registry (THE single source of truth for site identity);
     defaults to the brand primary where no site identity applies (e.g. the public
     site). The "Wayfinding" knob controls how prominently it shows; a per-site
     Theme Studio override can recolour one site. */
  --site-accent:var(--royal);

  --r-xs:7px; --r-sm:10px; --r-md:14px; --r-lg:20px; --r-xl:28px;
  --maxw:1200px;
  --density:1;         /* spacing multiplier — the "Density" tweak scales this */
  --ease:cubic-bezier(.22,.61,.36,1);
  --ring:var(--royal); /* focus ring (1.4.11 non-text >=3:1) — solid for reliable
     contrast; the dark theme overrides to a lighter blue. Tunable by the Focus knob. */
  --fs-display:"Schibsted Grotesk", system-ui, sans-serif;
  --fs-body:"Hanken Grotesk", system-ui, sans-serif;
  --fs-mono:"IBM Plex Mono", ui-monospace, monospace;

  /* ---- Appearance-control tokens (Theme Studio / Appearance center own these).
     Every one has a no-op default so an unconfigured system looks exactly as
     before; a knob overrides the token and the change cascades. Read these,
     never hard-code the value a knob owns. ---- */
  --bw:1px;                  /* hairline border WIDTH on shared surfaces */
  --display-weight:600;      /* h1–h5 weight */
  --display-tracking:-.018em;/* h1–h5 letter-spacing */
  --h-scale:1;               /* heading size multiplier (display headings) */
  --space-scale:1;           /* density: multiplies shared paddings/gaps */
  --ctrl-py:10px;            /* default control (button) vertical padding */
  --ctrl-px:17px;            /* default control horizontal padding */
  --ctrl-fs:14px;            /* default control font-size */
  --link:var(--royal);       /* inline link color (light passes 6.3:1; dark theme overrides) */
  --accent-ink:#187082;      /* the brand TEAL when used as small TEXT/icons — a
     readable companion to --azure (the gradient/chart anchor, which is too light
     for AA text on light surfaces). Route azure-as-text usages here. Per-theme.
     (AA on white AND on its own teal tints.) */
  --violet-ink:#8447B6;      /* the brand VIOLET when used as small TEXT/icons — a
     readable companion to --violet (the forecast/premium anchor, too light for AA
     text on light surfaces: #B478DC ~2.7:1 on white). Route violet-as-text here. Per-theme. */
  --pulse-ink:#235AC3;       /* the brand PULSE BLUE when used as small TEXT/icons that is NOT a
     link — a readable companion to --pulse for category labels/chips. On LIGHT the brand blue is
     already AA (>=5.4:1); the dark theme lifts it (see below) since #235AC3 is too dark on dark. */
  --link-underline:none;     /* inline link underline */
  --icon-stroke:1.8;         /* line-icon stroke weight */
  --icon-join:round;         /* line-icon corner style */
  --icon-cap:round;          /* line-icon end-cap style */
  --ish-side-w:248px;        /* internal-shell sidebar width (Appearance: Sidebar) */
  --ish-content-w:1320px;    /* internal-shell content max width (Appearance: Content width) */
  /* QA fix (DEC-011, 2026-06-15): --accent and --panel were REFERENCED across surfaces
     (01 Public Website .prn, 15 Walkthrough Audit, 16 UI Benchmark, 03 Strategy docs) but
     NEVER defined → invalid in BOTH themes. Alias existing per-theme tokens so they resolve
     correctly in light AND dark automatically (var() indirection resolves on the element). */
  --accent:var(--accent-ink); /* generic accent for text/border = the readable brand teal (per-theme, AA) */
  --panel:var(--surface);     /* generic card/panel surface (per-theme) */
}

:root[data-theme="light"]{
  --bg:#F4F7FB;        /* Paper */
  --bg2:#E9EEF6;
  --surface:#FFFFFF;
  --surface2:#F5F8FC;
  --raise:#FFFFFF;
  --ink:#2C3642;       /* Graphite — primary type */
  --ink2:#48535F;
  --muted:#5C6675;     /* a11y: darkened from #6A7585 so secondary text clears AA (>=4.5) on bg/chip too */
  --kicker-ink:#0E7082;/* a11y: deeper Signal Teal so small kicker/eyebrow TEXT clears AA on white/paper (brand teal #239BB4 was ~3:1) */
  --dim:#666E79;       /* a11y: darkened from #8C97A6 so small labels/meta clear AA on surface/bg/chip */
  --faint:#B7C0CC;     /* placeholders & inactive separators only — never load-bearing text (1.4.3 exempt) */
  --border:#E1E8F1;
  --border2:#CFD9E6;
  --line:#E6ECF3;      /* QA 2026-06-15: nudged more visible (was #ECF0F6) — hairline dividers were near-invisible (verified via screenshots, both themes) */
  --pos:#177049; --posbg:color-mix(in srgb, var(--mint) 30%, transparent);   /* a11y: pos darkened (#1E8F62->#197852->#177049) for AA on white + ON its own --posbg tint (status chips: green-on-posbg was 4.30:1, now >=4.8:1) */
  --watch:#665B12; --watchbg:color-mix(in srgb, var(--signal-yellow) 34%, transparent);   /* a11y: watch darkened (#786A15->#665B12) so caution text clears AA on white AND on its own yellow --watchbg / signal-yellow chip tints (was ~3.9:1 on the tint) */
  --neg:#AB4135; --negbg:rgba(199,80,63,.12);   /* a11y: neg darkened (#C7503F->#B3463A->#AB4135) for AA on white/bg AND on its own --negbg / neg chip tints (was ~4.37:1 on the tint) */
  --accent-ink:#187082;  /* readable teal for text/icons on light surfaces (AA >=4.5 on white AND on its own teal tints: #1B788C was 4.44:1 on a --azure 12% chip, now >=4.9:1) */
  --violet-ink:#8447B6;  /* readable violet for text/icons on light surfaces (AA >=4.5; brand --violet #B478DC is ~2.7:1) */
  --pulse-ink:#235AC3;   /* readable pulse-blue for non-link text/chips on light (brand blue is already AA >=5.4:1) */
  --customer-input-ink:#766119;  /* a11y: darker gold TEXT/icon for the customer-input family
     (FD-383) on light - 5.59:1 on --paper (>=4.5 AA text). Fill/edge are theme-independent, above;
     only this ink differs per theme (decision 1, 2026-09-24 lane-2 brief item d). */
  /* --site-accent-ink is DERIVED per theme by tweaks-boot.js from this site's real identity hex and
     published as --site-accent-ink-light / -dark, so flipping the theme needs no JS at all. The
     fallback is the brand teal ink, which is AA in this theme. */
  --site-accent-ink:var(--site-accent-ink-light, #187082);   /* theme-ok: -light/-dark are SET AT RUNTIME by tweaks-boot.js from the site's real identity hex; no kit CSS can define them because the hex is per-site and Theme-Studio-overridable, and the fallback here is a real kit token's value, AA in this theme */
  --chip:#EEF3F9;
  --shadow-sm:0 1px 2px rgba(20,30,45,.05);
  --shadow:0 2px 4px rgba(20,30,45,.04), 0 12px 28px -18px rgba(20,30,45,.26);
  --shadow-lg:0 4px 10px rgba(20,30,45,.06), 0 30px 60px -34px rgba(20,30,45,.38);
  /* chart series derive from the brand anchors so the palette knob cascades */
  --ch-1:var(--royal); --ch-2:var(--azure); --ch-3:var(--cyan);
  --ch-4:var(--violet); --ch-5:var(--mint);
  --ch-actual:var(--ch-1); --ch-fc:#94A2BD;
  --ch-grid:#E7ECF3; --ch-axis:#AAB4C2;
  --ch-band:color-mix(in srgb, var(--royal) 10%, transparent);
  --glass:rgba(255,255,255,.72);
  --scrim:rgba(20,30,45,.42);
  /* --logo carries a RELATIVE url(), and a url() inside a custom property is substituted as tokens and
     resolved against the stylesheet that USES the var — not against this file, and not against the
     page. It therefore only ever resolves for a stylesheet that sits beside an assets/ folder, which
     under MODULAR_BUILD_STANDARD.md no page stylesheet does (they live in pages/). UI/07's brand page
     painted its primary wordmark this way and shipped a blank tile. For any wordmark in the product use
     the shared Logo mount in UI/shared/ui.jsx, which derives its path from the shared script's own URL
     and honours an uploaded IPBrand wordmark. This token is kept only to stay in step with the design
     system's own tokens.css, where ds-base.js re-points it per template. */
  --logo:url("assets/logo-light.png");
}

:root[data-theme="dark"]{
  /* FD-454 (founder, 2026-09-27): 'the yellow in dark mode for the customer's data is too bright. needs to be the
     darker yellow' - the fill is Input Gold (the edge value) in dark; words and icons on it are graphite (site-type
     .on-yellow). Light keeps her locked fill. */
  --customer-input-fill:var(--customer-input-edge);
  --bg:#0B0F14;        /* deep graphite-tinted base */
  --bg2:#0F141A;
  --surface:#141A21;
  --surface2:#192029;
  --raise:#1E2630;
  --ink:#EAF0F6;
  --ink2:#C2CCD8;
  --muted:#8593A2;
  --kicker-ink:#45BDD6;/* a11y: brighter Signal Teal so small kicker TEXT clears AA on the dark surface */
  --dim:#868F98;       /* a11y: lifted from #5C6975 so small labels/meta clear AA (>=4.5) on dark surfaces; nudged #808A93->#868F98 (2026-06-30) so it also clears AA on --raise #1E2630 (was 4.34:1 in the freshness popover / dev toggle) */
  --faint:#3C4651;     /* placeholders & inactive separators only — never load-bearing text */
  --border:#222A33;
  --border2:#2F3A45;
  --line:#232C36;      /* QA 2026-06-15: nudged more visible (was #1A2128, ~= the surface) — hairline dividers were near-invisible */
  --pos:#54D6A0; --posbg:color-mix(in srgb, var(--mint) 18%, transparent);
  --watch:#E6D86A; --watchbg:color-mix(in srgb, var(--signal-yellow) 16%, transparent);
  --neg:#F59B8E; --negbg:rgba(238,122,104,.14); /* a11y: lifted from #EE7A68 so small dark-theme blocked/status text clears AA on --negbg plus nearby warning-tinted surfaces. */
  --link:#5E87D6;        /* a11y: inline links — Pulse Blue is too dark on dark (2.8:1); this lifted blue clears AA */
  --ring:#5E87D6;        /* a11y: focus ring lifted for >=3:1 against dark surfaces */
  --accent-ink:#34B6CE;  /* readable teal for text/icons on dark surfaces (AA >=4.5) */
  --violet-ink:#C49BE6;  /* readable violet for text/icons on dark surfaces — lifted from brand --violet so small text clears AA (>=4.5) on every dark surface incl. --raise */
  --pulse-ink:#6E93DC;   /* readable pulse-blue for non-link text/chips on dark — lifted from --pulse #235AC3 (too dark on dark, ~2.8:1) so it clears AA (>=4.5) on every dark surface */
  --customer-input-ink:#CAA72A;  /* a11y: lighter gold TEXT/icon for the customer-input family
     (FD-383) on dark - 5.29:1 on --graphite ("dark shell base" - this token's own comment above is
     the only place in this tree that names it that, which is how observe/customer_input_tokens.py
     resolved what "the dark shell base" in the brief refers to; >=4.5 AA text). */
  --site-accent-ink:var(--site-accent-ink-dark, #34B6CE);   /* theme-ok: see the light block — derived at runtime by tweaks-boot.js, theme-selected here; the fallback is a real kit token's value, AA in this theme */
  --chip:#1A222B;
  --shadow-sm:0 1px 2px rgba(0,0,0,.4);
  --shadow:0 2px 6px rgba(0,0,0,.4), 0 18px 40px -26px rgba(0,0,0,.8);
  --shadow-lg:0 6px 16px rgba(0,0,0,.5), 0 40px 80px -40px rgba(0,0,0,.9);
  /* derive from brand anchors but lift toward white for dark legibility */
  --ch-1:color-mix(in srgb, var(--royal), white 30%);
  --ch-2:color-mix(in srgb, var(--azure), white 24%);
  --ch-3:color-mix(in srgb, var(--cyan), white 18%);
  --ch-4:color-mix(in srgb, var(--violet), white 16%);
  --ch-5:color-mix(in srgb, var(--mint), white 6%);
  --ch-actual:var(--ch-1); --ch-fc:#7E8CA6;
  --ch-grid:#1C242D; --ch-axis:#48545F;
  --ch-band:color-mix(in srgb, var(--ch-1) 16%, transparent);
  --glass:rgba(12,16,22,.66);
  --scrim:rgba(2,4,8,.6);
  --logo:url("assets/logo-dark.png");
}
