/*
 * SmartInventory web — new design tokens.
 *
 * Source of truth: web/new_design/design_handoff_smart_inventory_site/README.md
 * (sections 3.1 and 3.2) plus subpage-shared.css :root block.
 *
 * Scoped to the redesigned public pages (landing, FAQ, privacy, terms).
 * The authenticated dashboard under web/public/web/ keeps
 * its Inspinia palette (#1ab394 / #23c6c8) until those pages are migrated
 * separately.
 *
 * Tracking: GitHub issue #838.
 *
 * --- Dashboard-scoped tokens (#2588, part of #963) -------------------------
 * The block below this one adds a SEPARATE, additively-scoped token set
 * for the upcoming dashboard redesign (umbrella #963). These tokens are
 * derived from docs/reference/new-design/web-app-shell.css's
 * :root block (the app-shell design handoff), except `--border-focus`
 * (solid `--blue-text` in light and dark) and the added
 * `--border-focus-on-dark` (#3543), and are namespaced with
 * hyphenated names (e.g. --ink-2) to avoid colliding with the existing
 * camelCase public-page tokens above (e.g. --ink2). This file is additive
 * only as of #2588 — no HTML/page currently references the dashboard
 * tokens, so there is zero visual change to any shipped page. Consumption
 * begins in the follow-up sub-issues (B onward) tracked under #963.
 */

:root {
    --blue: #1E5FE6;
    --blueDeep: #0B1F5C;
    --blueDark: #06123D;
    --red: #E53935;
    --redDeep: #B91C1C;
    --ink: #0A1628;
    --ink2: #3D4A5E;
    --ink3: #6B7689;
    /* #963: reconciled to design ds.css :root — pure white surface (was #F7F9FC).
     * The design's former #F7F9FC value is now --surface-2 in the dashboard block. */
    --surface: #FFFFFF;
    --surface2: #EEF2FA;
    --border: rgba(15, 30, 80, 0.08);

    --footer-bg: #040712;

    --hero-gradient: linear-gradient(140deg, #06123D 0%, #0B1F5C 50%, #2a0d4a 100%);
    --accent-gradient: linear-gradient(135deg, #1E5FE6, #E53935);

    --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'DM Mono', 'SFMono-Regular', Menlo, Monaco, Consolas, monospace;
}

/* ─────────────────────────────────────────────────────────────────────────
 * Dashboard-scoped tokens (#2588)
 * Values from docs/reference/new-design/web-app-shell.css :root, except
 * `--border-focus`, which #3543 sets to `var(--blue-text)` here and in the
 * dark block (the handoff value is `rgba(30,95,230,0.35)`). The same issue
 * adds `--border-focus-on-dark` in the design-system block below.
 * Hyphenated naming (--ink-2, --surface-2, ...) intentionally mirrors the
 * reference file and is distinct from this file's existing camelCase
 * public-page tokens (--ink2, --surface2, ...) declared above — do NOT
 * merge or rename either set. No selector in this repo references these
 * dashboard tokens yet; they are dormant until consumed by #963 sub-issues.
 * ───────────────────────────────────────────────────────────────────────── */
:root {
    /* Brand */
    --blue-700:    #1949B8;
    --blue-deep:   #0B1F5C;
    --blue-dark:   #06123D;
    --red-deep:    #B91C1C;
    --green:       #10B981;
    --amber:       #F59E0B;

    /* Surface */
    --bg:          #F4F6FB;
    --surface-2:   #F7F9FC;
    --surface-3:   #EEF2FA;

    /* Ink */
    --ink-2:       #3D4A5E;
    --ink-3:       #6B7689;
    --ink-4:       #98A2B3;

    /* Borders */
    /* --border-strong reconciled to design ds.css :root (was 0.14). */
    --border-strong: rgba(15,30,80,0.15);
    /* Component boundary (#3543, WCAG 1.4.11). The 35% blue was 1.70:1 on
     * white. This follows --blue-text: #1E5FE6 here (5.48:1 on white) and
     * #7AA7FF in the dark block (6.57:1 on the dark card). */
    --border-focus:  var(--blue-text);

    /* Shadows — reconciled to design ds.css :root (md was 12px/…, lg was …0.10). */
    --shadow-sm: 0 1px 2px rgba(11,30,90,0.06);
    --shadow-md: 0 4px 14px rgba(11,30,90,0.08);
    --shadow-lg: 0 12px 32px rgba(11,30,90,0.12);

    /* Radii */
    --r-sm:   8px;
    --r:     12px;
    --r-lg:  16px;
    --r-xl:  20px;
    --r-full: 999px;

    /* Spacing scale (4-based) */
    --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
    --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px;
    --s-12: 48px; --s-16: 64px;

    /* Layout */
    --sidebar-w:           264px;
    --sidebar-w-collapsed: 76px;
    --topbar-h:            64px;
}

/* ─────────────────────────────────────────────────────────────────────────
 * Design-system tokens (#963, ds-components.css consumer)
 *
 * Net-new tokens required by the ported design system (docs/new-design/web/
 * ds.css) that the #2588 dashboard block above does not already cover. The
 * shared brand tokens (--blue #1E5FE6, --red #E53935, --blue-700, --ink
 * scale, --surface scale, --border(-strong), --shadow-*, --r-*, --sidebar-w)
 * are NOT re-declared here — ds-components.css consumes the existing ones so
 * the brand stays single-sourced. Only the values ds.css introduces on top
 * are added: the extra brand accents, the chip color pairs, the sidebar
 * gradient/ink, and the --font / --mono aliases the component sheet uses
 * (aliased to the existing --font-sans / --font-mono so there is one font
 * source of truth).
 * ───────────────────────────────────────────────────────────────────────── */
:root {
    /* Extra brand accents used by chips / stat deltas / AI accent */
    --blue-700:    #1949B8;

    /* Brand blue as TEXT (#3533): every blue text colour and icon glyph in
     * the dashboard sheets (links, card links, set filter chips, sort arrows,
     * the blue ghost buttons) and the keyboard focus ring. Fills and
     * backgrounds keep --blue. A border uses --blue-text where it marks the
     * same state as its text (the expanded "+ Link" chip, the selected
     * .ds-tabs tab). --border-focus is this token too, so focus rings,
     * selected rings and radio accents clear 3:1 on the card in both themes
     * (#3543): --blue is only 2.86:1 on the dark card. Light: --blue itself
     * (5.48:1 on the white --surface, 4.88:1 on --surface-3). The dark block
     * below lightens it. */
    --blue-text:   var(--blue);
    /* Ring on the always-dark sidebar (#3543). Light --blue-text is #1E5FE6,
     * 2.81:1 on the sidebar gradient's lightest stop #0B1F5C, so
     * --border-focus cannot be used there. #7AA7FF is 6.45:1 on that stop
     * and 7.23:1 on the dark sidebar's #081744, and it stays this colour in
     * both themes (2.39:1 on white, so it is not a content-surface ring). */
    --border-focus-on-dark: #7AA7FF;
    /* Hover and focus state of --blue-text links (#3533). Light: --blue-700,
     * the darker blue those links always took (7.82:1 on the white
     * --surface). The dark block below lightens it instead, because
     * --blue-700 is 2.01:1 on the dark card surface. */
    --blue-text-hover: var(--blue-700);
    /* A mark drawn on a --blue-text fill (the checked checkbox tick, #3593):
       white in light, the dark card colour in dark, where the fill is light. */
    --on-blue-text: #FFFFFF;
    /* The darker brand blue as RESTING text (#3533): the search match chip,
     * the field example chip and the primary import/export row label, which
     * were --blue-700 before. Light keeps exactly that (6.97:1 on
     * --surface-3, 7.82:1 on --surface); the dark block below lightens it. */
    --blue-text-strong: var(--blue-700);

    /* Filled primary button (#4949): white on blue in both themes. Light
     * reproduces the old hand-written .btn-pri look exactly: --blue to
     * --blue-700, white text (5.48:1), the same shadow. Use these, not
     * --blue-text, for a filled button; --blue-text is for text and links. */
    --fill-primary: #1E5FE6;
    --fill-primary-end: #1949B8;
    --fill-primary-hover: #1949B8;
    --on-fill-primary: #FFFFFF;
    --fill-primary-gradient: linear-gradient(135deg, var(--fill-primary), var(--fill-primary-end));
    --fill-primary-shadow: 0 3px 10px rgba(30,95,230,.28);
    --green-deep:  #047857;
    --amber-deep:  #B45309;
    --violet:      #7C64D9;
    --teal:        #0D9488;

    /* Chip color pairs (light theme) */
    --chip-blue-bg:   #E0EAFB; --chip-blue-ink:   #0B1F5C;
    --chip-red-bg:    #FEE2E2; --chip-red-ink:    #B91C1C;
    --chip-green-bg:  #D1FAE5; --chip-green-ink:  #047857;
    --chip-amber-bg:  #FEF3C7; --chip-amber-ink:  #92400E;
    --chip-violet-bg: #EDE9FE; --chip-violet-ink: #5B21B6;

    /* Sidebar (shared with dashboard-shell.css's hardcoded gradient) */
    --sidebar-bg:  linear-gradient(180deg, #06123D 0%, #0B1F5C 62%, #1a0e3c 100%);
    --sidebar-ink: rgba(255, 255, 255, 0.75);

    /* Font aliases consumed by ds-components.css (single source: the
     * --font-sans / --font-mono declared in the public-page :root above). */
    --font: var(--font-sans);
    --mono: var(--font-mono);
}

/*
 * Dark-mode dashboard variants (#2588, values from the design's ds.css).
 * They apply when <html> carries data-theme="dark". js/util/theme.js, loaded
 * early in the <head> of every dashboard page, sets it when the user picks
 * Dark in Settings or, with no saved choice, when the OS prefers a dark
 * scheme (#963). Without the attribute the light :root values apply.
 *
 * Keep this block AFTER every :root block (#3533). `[data-theme="dark"]` and
 * `:root` are both 0,1,0, so the dark values win only by coming later in the
 * file; moved above a :root block, that block's light values would win in
 * dark mode. redesignA11yCss.test.js fails if the order changes.
 */
[data-theme="dark"] {
    /* Dark tokens reconciled byte-equal to design ds.css html[data-theme="dark"].
     * ds.css has no dark --border-focus. Ours follows --blue-text (#3543):
     * the 45% blue was 1.56:1 on the dark card, under the 3:1 UI-component bar. */
    --bg:          #0B1122;
    --surface:     #18223F;
    --surface-2:   #131C36;
    --surface-3:   #24304F;

    --ink:         #F5F8FF;
    --ink-2:       rgba(245,248,255,0.82);
    --ink-3:       rgba(245,248,255,0.62);
    --ink-4:       rgba(245,248,255,0.46);

    --border:        rgba(255,255,255,0.11);
    --border-strong: rgba(255,255,255,0.2);
    --border-focus:  var(--blue-text);

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 14px rgba(0,0,0,0.35);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.45);

    /* Dark sidebar gradient + chip pairs (#963, ds-components.css consumer).
     * The light-theme values for these live in the design-system :root block
     * above; the dark theme flips them here per docs/new-design/web/ds.css. */
    --sidebar-bg: linear-gradient(180deg, #050d2b 0%, #081744 62%, #150b30 100%);

    --chip-blue-bg:   rgba(30,95,230,0.22); --chip-blue-ink:   #93c5fd;
    --chip-red-bg:    rgba(229,57,53,0.20); --chip-red-ink:    #fca5a5;
    --chip-green-bg:  rgba(16,185,129,0.18); --chip-green-ink: #6ee7b7;
    --chip-amber-bg:  rgba(245,158,11,0.18); --chip-amber-ink: #fcd34d;
    --chip-violet-bg: rgba(124,100,217,0.22); --chip-violet-ink: #c4b5fd;

    /* "deep" signal colors are used as TEXT on dark surfaces (e.g. critical
     * quantity, up/down deltas). The light-theme deep reds/greens/ambers are
     * too dark to read on the dark bg, so lighten them per the updated
     * design ds.css html[data-theme="dark"] block. */
    --red-deep:   #FF8A85;
    --green-deep: #5EE9B5;
    --amber-deep: #FCD34D;

    /* Brand blue as TEXT on dark surfaces (#3533). WCAG AA needs 4.5:1 for
     * text. #7AA7FF is 7.87:1 on the page --bg #0B1122, 6.57:1 on the card
     * --surface #18223F, 7.06:1 on --surface-2 #131C36 and 5.46:1 on the
     * hover --surface-3 #24304F. The set filter chip (.fchip.set) puts the
     * translucent --chip-blue-bg under the text. It sits only on the page
     * --bg, in the item list's filter bar: 6.48:1. Over the other surfaces
     * the chip would be 5.74:1 (--surface-2), 5.37:1 (--surface) and, the
     * worst case, 4.59:1 (--surface-3). redesignA11yCss.test.js checks every
     * one of these against 4.5:1. */
    --blue-text: #7AA7FF;

    /* Hover and focus state of --blue-text links on dark surfaces (#3533):
     * a step LIGHTER than #7AA7FF (1.38:1 between the two, close to the
     * 1.43:1 step from --blue to --blue-700 in light). #A8C6FF is 10.91:1 on
     * --bg, 9.10:1 on --surface, 9.77:1 on --surface-2 and 7.57:1 on
     * --surface-3. */
    --blue-text-hover: #A8C6FF;
    --on-blue-text: #18223F;

    /* Resting --blue-700 text on dark surfaces (#3533): the same lighter
     * blue as the hover state, since --blue-700 is 1.67:1 on --surface-3,
     * where the two chips sit. #A8C6FF is 7.57:1 there. */
    --blue-text-strong: var(--blue-text-hover);

    /* Filled primary (#4949): a saturated blue that keeps white text at
     * 4.5:1 or more (4.69:1 on the fill, 5.17:1 at the end/hover) and stands
     * 3.35:1 off the dark --surface. */
    --fill-primary: #2B6CEE;
    --fill-primary-end: #2563EB;
    --fill-primary-hover: #2563EB;
    --on-fill-primary: #FFFFFF;
    /* Re-declared here on purpose: a custom property holding var() is
       computed where it is declared, so the :root gradient would keep the
       light colours inside an element-scoped [data-theme="dark"] (the cookie
       banner on always-dark pages). */
    --fill-primary-gradient: linear-gradient(135deg, var(--fill-primary), var(--fill-primary-end));
    --fill-primary-shadow: 0 3px 10px rgba(0,0,0,.35);
}
