/* VENDORED from embersat-design-system@183392c. Bundles tokens/colors.css
   primitive scales + tokens/typography.css + console/tokens.css. Do not
   hand-edit: change in the DS repo, re-run its validator
   (tools/validate-console-colors.py), then re-vendor. */

:root {
  /* ---- Base palette (drawn from the ECOSAIL/EmberSat book imagery) ---- */
  /* Ink & space — deep night skies behind the constellation */
  --ink-950: #070B14;
  --ink-900: #0B1220;
  --ink-800: #121C30;
  --ink-700: #1C2A44;

  /* Ember — ignition, fire horizon, alerts */
  --ember-300: #FFB877;
  --ember-400: #FF8C42;
  --ember-500: #FF6B2C;
  --ember-600: #E8551A;
  --ember-700: #C2410F;

  /* Signal amber — glow of the fire line */
  --amber-400: #FFC24B;
  --amber-500: #F5A623;

  /* Orbit blue — EcoSail heritage, space, data overlays */
  --blue-300: #7FB8E8;
  --blue-400: #3E8DDD;
  --blue-500: #1F6FCB;
  --blue-700: #123E7A;

  /* Canopy — forests under watch */
  --green-300: #A7C77E;
  --green-500: #5C7F4A;
  --green-700: #33472B;

  /* Smoke neutrals */
  --smoke-0: #FFFFFF;
  --smoke-100: #F2F4F7;
  --smoke-200: #E2E6EC;
  --smoke-300: #C4CBD6;
  --smoke-400: #9AA4B2;
  --smoke-500: #6C7684;
  --smoke-600: #4A5361;
}

:root {
  /* Families. Display: Montserrat (brand mandate; substitutes book's Apparat-Black).
     Body: Work Sans (substitutes book's Aktiv Grotesk Light).
     Mono: JetBrains Mono — console data face (timestamps, coordinates, FRP,
     IDs). Loaded in fonts.css. */
  --font-display: 'Montserrat', 'Helvetica Neue', Arial, sans-serif;
  --font-body: 'Work Sans', 'Helvetica Neue', Arial, sans-serif;
  /* Console UI headings use the body face at 600/700 — Montserrat stays
     reserved for the wordmark. Named token because console CSS consumes
     --font-heading directly. */
  --font-heading: var(--font-body);
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;

  /* Weights. Marketing body is a light 300; operational consoles use
     --weight-ui (400) — 300 is illegible at 11-13px dense UI sizes. */
  --weight-body: 300;
  --weight-ui: 400;
  --weight-body-strong: 500;
  --weight-display: 800;
  --weight-display-black: 900;

  /* Scale (print-book proportions: huge display, airy light body) */
  --text-2xs: 11px;         /* console tier: dense labels/meta — never smaller */
  --text-xs: 12px;
  --text-sm-console: 13px;  /* console tier: default dense-UI body size */
  --text-sm: 14px;
  --text-base: 16px;
  --text-lg: 19px;
  --text-xl: 24px;
  --text-2xl: 32px;
  --text-3xl: 44px;
  --text-4xl: 60px;
  --text-5xl: 84px;

  --leading-tight: 1.05;
  --leading-heading: 1.15;
  --leading-body: 1.6;

  /* Display type is set tight and often uppercase */
  --tracking-display: -0.01em;
  --tracking-caps: 0.14em;
  --tracking-wordmark: 0.02em;
}

/* ============================================================
   EmberSat Console Tier — semantic tokens for operational UIs
   (dispatcher portal, analyst dashboard).

   RELATIONSHIP TO THE MARKETING SYSTEM
   - Primitives (ink/ember/amber/blue/smoke scales, spacing, radii,
     type, motion) are SHARED. Import order: ../styles.css first,
     then this file.
   - Semantics are CONSOLE-OWNED. Marketing pages never reference
     --console-* tokens. Consoles never use --accent (ember) for
     interactive chrome: in the console, ember belongs to fire.
     Interactive chrome is orbit blue / neutral ink; ember chrome
     survives only in the wordmark and the focus ring.

   THEMING — dark-first, deterministic
   Apply class="console" to the root element (dark theme). Add
   class="console--day" for the day (light) theme. Theme switching
   must be a manual, persisted control; you may initialize it from
   prefers-color-scheme at boot, but no media query flips it here —
   a shift console must never change appearance on its own.

   VALIDATION
   Every color pairing declared here is machine-checked by
   ../tools/validate-console-colors.py:
     - WCAG AA 4.5:1 for ALL text (including 10-11px labels — never
       exempt as "large text"), 3:1 for non-text status fills;
     - pairwise CIEDE2000 distance between status fills under
       Machado-simulated protanopia/deuteranopia (floor 15) and
       tritanopia (floor 10) — legacy weak pairs scored 3.2-12.3;
     - grayscale separation ΔL* >= 6 between all status fills.
   Do not edit a color without re-running the validator.

   REDUNDANT ENCODING IS NOT OPTIONAL
   Color is never the only channel for a status: map markers carry
   the shape spec in console/status-labels.json (filled ring / filled
   / hollow circle / hollow diamond / x-glyph) and UI chrome carries
   the text label. The CVD floors above are defense-in-depth, not a
   license to drop shapes or labels.
   ============================================================ */

/* ---------------- DARK THEME (default) ---------------- */
.console {
  color-scheme: dark;

  /* ---- Surfaces ---- */
  --console-surface-page: var(--ink-950);
  --console-surface-panel: var(--ink-900);
  --console-surface-raised: var(--ink-800);
  --console-surface-hover: var(--ink-700);
  --console-border-subtle: rgba(255, 255, 255, 0.10);
  --console-border-strong: rgba(255, 255, 255, 0.22);

  /* ---- Text ramp (AA vs page, panel, and raised) ---- */
  --console-text-primary: var(--smoke-0);      /* 18.7:1 vs panel */
  --console-text-secondary: var(--smoke-300);  /* 10.4:1 vs raised */
  --console-text-tertiary: var(--smoke-400);   /*  6.8:1 vs raised */

  /* ---- Interactive chrome (orbit blue; never ember) ---- */
  --console-link: var(--blue-300);             /* 8.9:1 vs panel */
  --console-link-hover: var(--smoke-0);
  --console-selection-bg: #152B46;             /* blue-400 @20% over ink-900 */
  --console-focus-ring: var(--ember-400);      /* 8.1:1 vs panel — the one ember chrome use */

  /* ---- Status: detection confidence ----
     Names follow status codes (see status-labels.json), NEVER agency
     alert levels. Per status:
       -fill     marker/banner surface
       -on-fill  text placed ON the fill
       -text     status-colored text on theme surfaces
       -wash     tinted badge/row background (always paired with -text) */
  --console-status-confirmed-fill: var(--ember-600);   /* fire wears the brand */
  --console-status-confirmed-on-fill: var(--ink-950);
  --console-status-confirmed-text: var(--ember-400);
  --console-status-confirmed-wash: #2E1D1F;

  --console-status-likely-fill: var(--amber-400);
  --console-status-likely-on-fill: var(--ink-950);
  --console-status-likely-text: var(--amber-400);
  --console-status-likely-wash: #322E27;

  --console-status-provisional-fill: #639DE9;
  --console-status-provisional-on-fill: var(--ink-950);
  --console-status-provisional-text: var(--blue-300);
  --console-status-provisional-wash: #192840;

  --console-status-monitoring-fill: #008097;   /* slate teal — green is banned from status */
  --console-status-monitoring-on-fill: var(--smoke-0);
  --console-status-monitoring-text: #8AB7CB;
  --console-status-monitoring-wash: #092433;

  --console-status-retracted-fill: #5B5448;    /* warm ash — recessive by design */
  --console-status-retracted-on-fill: var(--smoke-0);
  --console-status-retracted-text: #B0AAA2;
  --console-status-retracted-wash: #181D26;

  /* CLOSED renders as retracted (terminal states share one recessive look) */
  --console-status-closed-fill: var(--console-status-retracted-fill);
  --console-status-closed-on-fill: var(--console-status-retracted-on-fill);
  --console-status-closed-text: var(--console-status-retracted-text);
  --console-status-closed-wash: var(--console-status-retracted-wash);

  /* ---- Urgency: time-to-impact tiers. Red owns "act now"; it appears
     nowhere else in the console. SOON deliberately shares the amber
     family with status-likely ("elevated"); WATCH is neutral —
     informational tiers get no color of their own. Urgency chips are
     ALWAYS text-labeled (CRITICAL / SOON / 1-2 DAYS). ---- */
  --console-urgency-critical-fill: #DF574E;
  --console-urgency-critical-on-fill: var(--ink-950);
  --console-urgency-critical-text: #E88078;
  --console-urgency-critical-wash: #2D1D27;
  --console-urgency-soon-fill: var(--console-status-likely-fill);
  --console-urgency-soon-on-fill: var(--console-status-likely-on-fill);
  --console-urgency-soon-text: var(--console-status-likely-text);
  --console-urgency-soon-wash: var(--console-status-likely-wash);
  --console-urgency-watch-text: var(--console-text-secondary);

  /* ---- Environmental readings (wind, slope, precip, terrain) ----
     Neutral chips by default; color begins at "dangerous". A calm
     wind is not good news to celebrate in green — it is data. */
  --console-env-chip-bg: rgba(255, 255, 255, 0.06);
  --console-env-chip-text: var(--console-text-secondary);
  --console-env-danger-text: var(--console-urgency-soon-text);
  --console-env-danger-wash: var(--console-urgency-soon-wash);
  --console-env-extreme-text: var(--console-urgency-critical-text);
  --console-env-extreme-wash: var(--console-urgency-critical-wash);

  /* ---- System health (never shares status hues; pair dot with shape:
     filled = up, hollow = down — the color alone is not the signal) ---- */
  --console-health-ok: var(--smoke-400);
  --console-health-fail-text: var(--console-urgency-critical-text);
  --console-health-fail-fill: var(--console-urgency-critical-fill);

  /* ---- Data visualization ---- */
  /* Sequential intensity ramp (fire probability, thermal anomaly):
     single-hue ember, monotonic L* 92->36, steps >= 8 — ordering
     survives grayscale and every dichromacy. Replaces rainbow ramps. */
  --console-dv-seq-1: #FFE4C9;
  --console-dv-seq-2: var(--ember-300);
  --console-dv-seq-3: var(--ember-400);
  --console-dv-seq-4: var(--ember-600);
  --console-dv-seq-5: #9C2E06;
  --console-dv-unscored: var(--smoke-600);
  /* Highlight outline (e.g. in-complex pixels): ALWAYS draw the 1px
     inset in -inset color inside the 3-4px -highlight stroke; the
     pair is what guarantees contrast on any underlay. */
  --console-dv-highlight: #00C2E0;
  --console-dv-highlight-inset: var(--ink-950);
  --console-dv-line-frp: var(--blue-400);
  --console-dv-baseline: var(--smoke-500);

  /* ---- Categorical: qualitative map-context layers (land ownership,
     jurisdiction) — NOT status, NOT a magnitude ramp (use --console-dv-seq
     for ordered magnitude). Muted and recessive so fire status + ember
     always dominate. Applied as a FULL-OPACITY stroke (the identity channel)
     plus a ~0.25 fill wash; the layer label is a mandatory third channel
     (principles §3). cat-1..4 are the CVD-separable primaries (crisp in
     normal vision, separable under dichromacy by residual hue OR lightness);
     cat-5..7 + neutral are recessive tints that lean on the label and are
     exempt from the pairwise CVD floor, like retracted. The family is
     domain-general; the NAZ SMA class mapping and the datavis-vs-categorical
     rule live in console/components/categorical-layer.md. ---- */
  --console-cat-1: #C6A867;        /* tan / rangeland */
  --console-cat-2: #57A05A;        /* green — land/veg context (banned from status, fine here) */
  --console-cat-3: #D689AC;        /* mauve */
  --console-cat-4: #8B82D2;        /* violet */
  --console-cat-5: #8FA76B;        /* sage (recessive) */
  --console-cat-6: #7C8EA0;        /* steel (recessive) */
  --console-cat-7: #AC7F77;        /* clay (recessive) */
  --console-cat-neutral: #9E968C;  /* unclassified / private */

  /* Dispatch/command boundary: the "who do I call" jurisdiction outline.
     Persistent, OUTLINE-ONLY (no fill). A distinct magenta held clear of the
     fire status family, orbit chrome, the dv-highlight SELECTION cyan, and
     every --console-cat-* stroke — so it never reads as an alarm, a control,
     a selection, or a land-owner region. Emphasis comes from a heavier line
     weight, not an alarm hue. See components/categorical-layer.md. */
  --console-dispatch-boundary: #DA2E88;

  /* ---- Panel/map seam elevation ---- */
  --console-shadow-seam: 0 0 14px rgba(0, 0, 0, 0.55);

  /* ---- Satellite-hybrid basemap: tone applied to the imagery tile pane
     (principles §7 — imagery may be the default only desaturated, with a
     label overlay, and with marker contrast verified). Night dims hard so
     the map doesn't glow beside dark chrome. ---- */
  --console-imagery-filter: saturate(0.55) brightness(0.55) contrast(1.05);

  /* ---- Map markers ---- */
  --console-marker-stroke: var(--ink-950);
  --console-marker-retracted-opacity: 0.6;

  /* ---- Console typography defaults ---- */
  --console-font-ui: var(--font-body);
  --console-font-data: var(--font-mono);
  --console-weight-ui: var(--weight-ui);
  --console-weight-ui-strong: var(--weight-body-strong);
  --console-text-label: var(--text-2xs);       /* 11px caps labels */
  --console-text-body: var(--text-sm-console); /* 13px dense body */
  --console-text-value: var(--text-xs);        /* 12px data values */
}

/* ---------------- DAY THEME ---------------- */
.console--day {
  color-scheme: light;

  /* ---- Surfaces: page (chrome) > panel (sidebar) > raised (cards) form a
     visible ladder; the map (Voyager cream) is a fourth tone, so panels
     never sit white-on-white against the basemap. ---- */
  --console-surface-page: var(--smoke-200);
  --console-surface-panel: var(--smoke-100);
  --console-surface-raised: var(--smoke-0);
  --console-surface-hover: var(--smoke-200);
  --console-border-subtle: rgba(11, 18, 32, 0.12);
  --console-border-strong: rgba(11, 18, 32, 0.28);

  /* ---- Text ramp ---- */
  --console-text-primary: var(--ink-900);      /* 17.0:1 vs page */
  --console-text-secondary: #3A4350;           /*  9.1:1 vs page */
  --console-text-tertiary: var(--smoke-600);   /*  7.1:1 vs page */

  /* ---- Interactive chrome ---- */
  --console-link: var(--blue-700);             /* 8.3:1 vs page — blue-500 fails on smoke-200 */
  --console-link-hover: var(--blue-500);
  --console-selection-bg: #D9E4F2;
  --console-focus-ring: var(--ember-700);      /* 4.1:1 vs smoke-200; ember-600 falls under 3:1 there */

  /* ---- Status ---- */
  --console-status-confirmed-fill: #8F3012;
  --console-status-confirmed-on-fill: var(--smoke-0);
  --console-status-confirmed-text: #934126;
  --console-status-confirmed-wash: #EEE0DB;

  --console-status-likely-fill: #A27406;
  --console-status-likely-on-fill: var(--ink-950);
  --console-status-likely-text: #7E570B;
  --console-status-likely-wash: #F1EADA;

  --console-status-provisional-fill: #006DBE;
  --console-status-provisional-on-fill: var(--smoke-0);
  --console-status-provisional-text: #1A619F;
  --console-status-provisional-wash: #D9E9F5;

  --console-status-monitoring-fill: #0099B4;
  --console-status-monitoring-on-fill: var(--ink-950);
  --console-status-monitoring-text: #315F71;
  --console-status-monitoring-wash: #D9F0F4;

  --console-status-retracted-fill: #C0BBB2;
  --console-status-retracted-on-fill: var(--ink-950);
  --console-status-retracted-text: #5E5951;
  --console-status-retracted-wash: #F6F5F3;

  --console-status-closed-fill: var(--console-status-retracted-fill);
  --console-status-closed-on-fill: var(--console-status-retracted-on-fill);
  --console-status-closed-text: var(--console-status-retracted-text);
  --console-status-closed-wash: var(--console-status-retracted-wash);

  /* ---- Urgency ---- */
  --console-urgency-critical-fill: #9E282E;
  --console-urgency-critical-on-fill: var(--smoke-0);
  --console-urgency-critical-text: #9E282E;
  --console-urgency-critical-wash: #F0DFE0;
  --console-urgency-soon-fill: var(--console-status-likely-fill);
  --console-urgency-soon-on-fill: var(--console-status-likely-on-fill);
  --console-urgency-soon-text: var(--console-status-likely-text);
  --console-urgency-soon-wash: var(--console-status-likely-wash);
  --console-urgency-watch-text: var(--console-text-secondary);

  /* ---- Environmental ---- */
  --console-env-chip-bg: rgba(11, 18, 32, 0.05);
  --console-env-chip-text: var(--console-text-secondary);
  --console-env-danger-text: var(--console-urgency-soon-text);
  --console-env-danger-wash: var(--console-urgency-soon-wash);
  --console-env-extreme-text: var(--console-urgency-critical-text);
  --console-env-extreme-wash: var(--console-urgency-critical-wash);

  /* ---- System health ---- */
  --console-health-ok: var(--smoke-500);
  --console-health-fail-text: var(--console-urgency-critical-text);
  --console-health-fail-fill: var(--console-urgency-critical-fill);

  /* ---- Data visualization (seq ramp is theme-invariant; lines adapt) ---- */
  --console-dv-unscored: var(--smoke-200);
  --console-dv-line-frp: var(--blue-500);
  --console-dv-baseline: var(--smoke-400);

  /* ---- Categorical map-context palette (day). Darker strokes for the
     cream basemap; same tier structure as dark. See tokens above and
     console/components/categorical-layer.md. ---- */
  --console-cat-1: #7C6446;        /* taupe / rangeland */
  --console-cat-2: #1F5A29;        /* green */
  --console-cat-3: #9C3E66;        /* mauve */
  --console-cat-4: #5A44A2;        /* violet */
  --console-cat-5: #4E6A34;        /* sage (recessive) */
  --console-cat-6: #4E6377;        /* steel (recessive) */
  --console-cat-7: #7C544E;        /* clay (recessive) */
  --console-cat-neutral: #6C655C;  /* unclassified / private */

  /* Dispatch/command boundary (day: brighter magenta for the cream basemap). */
  --console-dispatch-boundary: #E14B96;

  /* ---- Panel/map seam elevation ---- */
  --console-shadow-seam: 0 2px 14px rgba(11, 18, 32, 0.22);

  /* ---- Satellite-hybrid basemap, day tone ---- */
  --console-imagery-filter: saturate(0.65) brightness(1.03) contrast(0.97);

  /* ---- Map markers ---- */
  --console-marker-stroke: var(--smoke-0);
}
