/* ═══════════════════════════════════════════════════
   Morse Micro HaLow Evaluation Platform theme — the single place to rebrand.
   Every color, radius, easing and font in the portal, the Admin Dashboard, the Use Case Catalog,
   the legal pages, the GPS demo, the partner overview and the social/poster templates derives from
   these tokens. Component stylesheets use only var(--…); canvas, SVG and map code resolves them
   through portal/theme.js.

   Two palettes share one set of names. Dark is defined on :root; light overrides the same
   primitives under prefers-color-scheme: light (unless <html data-theme="dark">) and under
   <html data-theme="light">. The two light blocks must stay identical.
   `theme-color` metas and manifest.webmanifest must match --brand-ink of each palette.
   Contract: docs/product/BRAND.md. Implementation: docs/product/app-theme.md → Theme System.
   ═══════════════════════════════════════════════════ */

/* Lato 2.015 (SIL OFL 1.1), Latin subsets self-hosted from portal/assets/fonts. The subsets are
   modified versions, so per the OFL Reserved Font Name clause they are named "HaLow Sans". */
@font-face {
  font-family: "HaLow Sans";
  src: url("assets/fonts/lato-400.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "HaLow Sans";
  src: url("assets/fonts/lato-500.woff2") format("woff2");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "HaLow Sans";
  src: url("assets/fonts/lato-600.woff2") format("woff2");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "HaLow Sans";
  src: url("assets/fonts/lato-900.woff2") format("woff2");
  font-style: normal;
  font-weight: 900;
  font-display: swap;
}
/* Metric-matched fallback (hhea metrics, average Latin advance) so the webfont swap does not
   shift layout. */
@font-face {
  font-family: "HaLow Sans Fallback";
  src: local("Arial"), local("Helvetica Neue"), local("Helvetica"), local("Liberation Sans");
  ascent-override: 99.12%;
  descent-override: 21.39%;
  line-gap-override: 0%;
  size-adjust: 99.58%;
}

:root {
  color-scheme: dark;

  /* Morse Micro brand colors (BRAND.md). Reference these through the theme primitives below. */
  --morse-black: #000000;
  --morse-kalish-violet: #571C76;
  --morse-heliotrope: #9A8CA0;
  --morse-white: #FFFFFF;
  --morse-russian-violet: #3D1A50;
  --morse-fuchsia-nebula: #7719AA;
  --morse-silver-metallic: #AEA9B6;
  --morse-cultured: #EFEEF0;

  /* ── Theme primitives: dark palette ── */
  --brand-accent: #BF8FE0;               /* accent text, links, focus, selection, live meters */
  --brand-accent-bright: #D4B3EC;
  --brand-accent-deep: var(--morse-fuchsia-nebula);
  --brand-accent-fill: var(--morse-fuchsia-nebula);   /* primary action fill */
  --brand-accent-fill-hover: #8B3BB7;
  --brand-on-accent: var(--morse-white); /* text on accent fills */
  --brand-ink: #120A18;                  /* page, header, theme-color */
  --brand-gold: #FFCB05;

  /* Neutral ramp: violet-tinted ink surfaces and paper text */
  --ink-1: #170E1E;
  --ink-2: #1C1225;
  --ink-3: #271B31;
  --paper-1: var(--morse-cultured);
  --paper-2: var(--morse-silver-metallic);
  --paper-3: var(--morse-heliotrope);
  --shadow-color: #000;
  --footer-surface: #0D0712;             /* full-bleed footers, one step below the page */

  /* Logo rendering per palette: positive icon → negative on dark; white lockup stays white;
     the dark Pace logo turns white. */
  --brand-mark-filter: invert(1);
  --brand-lockup-filter: none;
  --logo-filter: brightness(0) invert(1);

  /* Print and paper decks: always light */
  --print-paper: #fff;
  --print-ink: #000;
  --print-ink-soft: #222;
  --print-accent: var(--morse-kalish-violet);
  --print-on-accent: #ffffff;
  --print-panel: #f6f5f7;
  --print-panel-inner: #efeef0;
  --print-panel-hover: #e7e4ea;
  --print-text: #140B1A;
  --print-subtle: #4B4153;
  --print-muted: #6B6173;
  --print-green: #1f7a4d;
  --print-backdrop: #e7e4ea;

  /* Status */
  --status-positive: #4cc38a;
  --status-negative: #f06a6e;
  --status-negative-strong: #c9424c;
  --status-negative-text: #ffa3ab;
  --status-warning: #f5a524;
  --status-warning-text: #ffd28a;
  --status-offline: #ffb347;

  /* Data series: readings, meters and charts only, never chrome */
  --data-gold: #ffd166;
  --data-teal: #3DDAC5;
  --data-blue: #8fb7e8;
  --data-slate: #a8b7ca;
  --data-orange: #ff9f43;
  --data-violet: #bd8cff;
  --data-lime: #7ee787;
  --data-green: #5be36d;

  /* Signal-quality scale, weak → strong: GPS coverage layers and their legends */
  --scale-signal-1: #ff6b6b;
  --scale-signal-2: #f5b64a;
  --scale-signal-3: #31d7ac;
  --scale-signal-4: #33c6ff;

  /* Map basemap (Google Maps styles resolve these through portal/theme.js) */
  --map-land: #160E1C;
  --map-park: #141A17;
  --map-road: #2A2032;
  --map-highway: #35293F;
  --map-water: #0C0711;
  --map-label: var(--paper-3);
  --map-label-strong: var(--paper-2);
  --map-label-halo: var(--brand-ink);

  /* ── Roles ── what component rules reference */
  --halo-accent: var(--brand-accent);
  --halo-accent-bright: var(--brand-accent-bright);
  --halo-accent-dim: var(--brand-accent-deep);
  --halo-accent-glow: color-mix(in srgb, var(--brand-accent) 16%, transparent);
  --halo-accent-glow-strong: color-mix(in srgb, var(--brand-accent) 28%, transparent);
  --halo-accent-fill: var(--brand-accent-fill);
  --halo-accent-fill-hover: var(--brand-accent-fill-hover);
  --halo-on-accent: var(--brand-on-accent);
  --halo-teal: var(--data-teal);
  --halo-gold: var(--brand-gold);
  --halo-green: var(--status-positive);
  --halo-green-dim: color-mix(in srgb, var(--status-positive) 16%, transparent);
  --halo-red: var(--status-negative);
  --halo-red-strong: var(--status-negative-strong);
  --halo-red-text: var(--status-negative-text);
  --halo-amber: var(--status-warning);
  --halo-amber-text: var(--status-warning-text);
  --halo-offline: var(--status-offline);
  --halo-shadow: var(--shadow-color);

  /* ── Surfaces ── */
  --halo-bg: var(--brand-ink);
  --halo-deep: var(--brand-ink);
  --halo-footer: var(--footer-surface);
  --halo-panel: var(--ink-2);
  --halo-panel-inner: var(--ink-1);
  --halo-panel-hover: var(--ink-3);
  --halo-raised: var(--ink-1);
  --halo-raised-hover: var(--ink-3);
  --halo-border: color-mix(in srgb, var(--paper-1) 8%, transparent);
  --halo-border-strong: color-mix(in srgb, var(--paper-1) 14%, transparent);
  --halo-fill: color-mix(in srgb, var(--paper-1) 4%, transparent);
  --halo-fill-strong: color-mix(in srgb, var(--paper-1) 8%, transparent);
  --halo-scrim: color-mix(in srgb, #000 76%, transparent);
  /* Product cutout photos sit on a light well in both palettes (a faint violet-white in light, so it
     separates from the grey base band and the white cards). */
  --product-well: var(--morse-cultured);
  /* Overlays drawn on photos and video stay dark in both palettes. */
  --image-scrim: #000;
  --on-image: #fff;

  /* ── Public site (docs/product/app-theme.md → Public Layout System) ──
     The public hero and closing call-to-action bands stay dark in both palettes, like the Morse
     Micro site; everything drawn on them uses these hero tokens, never the page roles. */
  --hero-bg: #0A0510;
  --hero-surface: color-mix(in srgb, #FFFFFF 7%, var(--hero-bg));
  --hero-ink: #FFFFFF;
  --hero-subtle: #D5CDDC;
  --hero-muted: #ABA1B5;
  --hero-accent: #CFA9EC;
  --hero-line: color-mix(in srgb, #FFFFFF 14%, transparent);
  --hero-line-strong: color-mix(in srgb, #FFFFFF 28%, transparent);
  --hero-fill: color-mix(in srgb, #FFFFFF 7%, transparent);
  --hero-fill-strong: color-mix(in srgb, #FFFFFF 13%, transparent);
  --hero-ring: color-mix(in srgb, #A66BD1 30%, transparent);
  --hero-action: var(--morse-fuchsia-nebula);   /* primary buttons on the hero, both palettes */
  --hero-action-hover: #8B3BB7;
  --hero-gold: #FFCB05;
  /* Full-width content bands alternate base and raised surfaces with an occasional violet tint. */
  --band-base: var(--halo-deep);
  --band-raised: var(--halo-panel);
  /* Cards on a raised band: one step off the band (a grey step in light, so white bands keep cards visible). */
  --band-raised-card: var(--halo-panel-inner);
  --band-tint: color-mix(in srgb, var(--brand-accent) 7%, var(--brand-ink));
  --halo-text: var(--paper-1);
  --halo-subtle: var(--paper-2);
  --halo-muted: var(--paper-3);
  --halo-subtext: var(--paper-3);
  --halo-scrollbar-track: color-mix(in srgb, var(--paper-1) 3%, transparent);
  --halo-scrollbar-thumb: color-mix(in srgb, var(--paper-1) 16%, transparent);
  --halo-scrollbar-thumb-hover: color-mix(in srgb, var(--paper-1) 28%, transparent);

  /* ── Radii ── controls / tiles / cards / panels; chips and tags use --halo-radius-chip */
  --halo-radius-chip: 6px;
  --halo-radius-control: 10px;
  --halo-radius-tile: 12px;
  --halo-radius-card: 16px;
  --halo-radius-panel: 20px;

  /* ── Type ── one interface family plus a mono for IDs, part numbers and meta.
     --font-weight-display (Lato Black) is only for public-page primary headlines (BRAND.md). */
  --font-sans: "HaLow Sans", "HaLow Sans Fallback", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --font-weight-display: 900;

  /* ── Motion ── one curve; durations 150 (feedback), 200 (menus), 360 (entrances) */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ── Light palette ── keep both blocks identical. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --brand-accent: var(--morse-kalish-violet);
    --brand-accent-bright: var(--morse-fuchsia-nebula);
    --brand-accent-deep: var(--morse-russian-violet);
    --brand-accent-fill: var(--morse-kalish-violet);
    --brand-accent-fill-hover: var(--morse-fuchsia-nebula);
    --brand-on-accent: var(--morse-white);
    --brand-ink: var(--morse-cultured);
    --brand-gold: #865F00;
    --ink-1: #F7F6F8;
    --ink-2: #FFFFFF;
    --ink-3: #E7E4EA;
    --paper-1: #140B1A;
    --paper-2: #4B4153;
    --paper-3: #6B6173;
    --shadow-color: rgb(61 26 80 / 0.18);
    --footer-surface: #E7E4EA;
    --brand-mark-filter: none;
    --brand-lockup-filter: invert(1);
    --logo-filter: brightness(0);
    --status-positive: #17663F;
    --status-negative: #AC2830;
    --status-negative-strong: #A3222B;
    --status-negative-text: #A3222B;
    --status-warning: #B26A00;
    --status-warning-text: #8A5300;
    --status-offline: #B45309;
    --data-gold: #865F00;
    --data-teal: #0E8C7E;
    --data-blue: #3567B0;
    --data-slate: #5B6B7F;
    --data-orange: #C95A12;
    --data-violet: var(--morse-fuchsia-nebula);
    --data-lime: #4F8F1F;
    --data-green: #23913B;
    --scale-signal-1: #D23F3F;
    --scale-signal-2: #C98112;
    --scale-signal-3: #12946F;
    --scale-signal-4: #1C82C4;
    --map-land: #F1EFF3;
    --map-park: #E1EBE2;
    --map-road: #FFFFFF;
    --map-highway: #E3DDE8;
    --map-water: #C9D8E6;
    --map-label-halo: #FFFFFF;
    --halo-border: color-mix(in srgb, var(--paper-1) 12%, transparent);
    --halo-border-strong: color-mix(in srgb, var(--paper-1) 20%, transparent);
    --halo-fill: color-mix(in srgb, var(--paper-1) 3%, transparent);
    --halo-fill-strong: color-mix(in srgb, var(--paper-1) 7%, transparent);
    --halo-scrim: color-mix(in srgb, var(--morse-russian-violet) 45%, transparent);
    --halo-scrollbar-track: color-mix(in srgb, var(--paper-1) 4%, transparent);
    --halo-scrollbar-thumb: color-mix(in srgb, var(--paper-1) 22%, transparent);
    --halo-scrollbar-thumb-hover: color-mix(in srgb, var(--paper-1) 36%, transparent);
    --hero-bg: #1B0F24;
    --hero-ring: color-mix(in srgb, #A66BD1 34%, transparent);
    --product-well: color-mix(in srgb, var(--morse-kalish-violet) 5%, var(--morse-white));
    --band-raised-card: var(--morse-cultured);
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --brand-accent: var(--morse-kalish-violet);
  --brand-accent-bright: var(--morse-fuchsia-nebula);
  --brand-accent-deep: var(--morse-russian-violet);
  --brand-accent-fill: var(--morse-kalish-violet);
  --brand-accent-fill-hover: var(--morse-fuchsia-nebula);
  --brand-on-accent: var(--morse-white);
  --brand-ink: var(--morse-cultured);
  --brand-gold: #865F00;
  --ink-1: #F7F6F8;
  --ink-2: #FFFFFF;
  --ink-3: #E7E4EA;
  --paper-1: #140B1A;
  --paper-2: #4B4153;
  --paper-3: #6B6173;
  --shadow-color: rgb(61 26 80 / 0.18);
  --footer-surface: #E7E4EA;
  --brand-mark-filter: none;
  --brand-lockup-filter: invert(1);
  --logo-filter: brightness(0);
  --status-positive: #17663F;
  --status-negative: #AC2830;
  --status-negative-strong: #A3222B;
  --status-negative-text: #A3222B;
  --status-warning: #B26A00;
  --status-warning-text: #8A5300;
  --status-offline: #B45309;
  --data-gold: #865F00;
  --data-teal: #0E8C7E;
  --data-blue: #3567B0;
  --data-slate: #5B6B7F;
  --data-orange: #C95A12;
  --data-violet: var(--morse-fuchsia-nebula);
  --data-lime: #4F8F1F;
  --data-green: #23913B;
  --scale-signal-1: #D23F3F;
  --scale-signal-2: #C98112;
  --scale-signal-3: #12946F;
  --scale-signal-4: #1C82C4;
  --map-land: #F1EFF3;
  --map-park: #E1EBE2;
  --map-road: #FFFFFF;
  --map-highway: #E3DDE8;
  --map-water: #C9D8E6;
  --map-label-halo: #FFFFFF;
  --halo-border: color-mix(in srgb, var(--paper-1) 12%, transparent);
  --halo-border-strong: color-mix(in srgb, var(--paper-1) 20%, transparent);
  --halo-fill: color-mix(in srgb, var(--paper-1) 3%, transparent);
  --halo-fill-strong: color-mix(in srgb, var(--paper-1) 7%, transparent);
  --halo-scrim: color-mix(in srgb, var(--morse-russian-violet) 45%, transparent);
  --halo-scrollbar-track: color-mix(in srgb, var(--paper-1) 4%, transparent);
  --halo-scrollbar-thumb: color-mix(in srgb, var(--paper-1) 22%, transparent);
  --halo-scrollbar-thumb-hover: color-mix(in srgb, var(--paper-1) 36%, transparent);
  --hero-bg: #1B0F24;
  --hero-ring: color-mix(in srgb, #A66BD1 34%, transparent);
  --product-well: color-mix(in srgb, var(--morse-kalish-violet) 5%, var(--morse-white));
  --band-raised-card: var(--morse-cultured);
}
