/* Lets Secure design tokens (DESIGN.md, STAT-422).
   One semantic palette for the public site and the portal. Loaded after bootstrap.min.css (where present) and before
   custom.css. Dark is the fallback on :root; html[data-bs-theme="light"] switches the palette. Loaded after Bootstrap, so
   these variables win over Bootstrap's own [data-bs-theme] values.
   The public site is locked to dark; the portal follows the saved choice or the system preference (theme-init.js).
   Contrast of the text roles is recorded in DESIGN.md. */

:root,
html[data-bs-theme="dark"] {
  color-scheme: dark;
  --ls-bg: #04070d;
  --ls-bg-glow: rgba(14, 116, 144, 0.18);
  --ls-panel: #0a1524;
  --ls-surface: #10203a;
  --ls-line: rgba(148, 197, 230, 0.14);
  --ls-line-strong: rgba(125, 211, 252, 0.34);
  --ls-text: #e8eef6;
  --ls-muted: #a3b3c6;
  --ls-faint: #7d8ea3;
  --ls-link: #7dd3fc;
  --ls-link-hover: #67e8f9;
  --ls-accent: #22d3ee;
  --ls-accent-soft: rgba(34, 211, 238, 0.12);
  /* Buttons use the logo blue (owner 2026-10-12); white text 5.2:1 */
  --ls-button: #0866e6;
  --ls-button-hover: #1d6ff2;
  --ls-button-text: #ffffff;
  --ls-pass: #65dfb5;
  --ls-pass-soft: rgba(101, 223, 181, 0.14);
  --ls-warn: #f3c969;
  --ls-warn-soft: rgba(243, 201, 105, 0.14);
  --ls-fail: #ff7d87;
  --ls-fail-soft: rgba(255, 125, 135, 0.14);
  --ls-neutral-soft: rgba(163, 179, 198, 0.14);
  --ls-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

html[data-bs-theme="light"] {
  color-scheme: light;
  --ls-bg: #eef3fa;
  --ls-bg-glow: rgba(8, 102, 230, 0.08);
  --ls-panel: #ffffff;
  --ls-surface: #e6edf7;
  --ls-line: rgba(15, 40, 70, 0.14);
  --ls-line-strong: rgba(8, 102, 230, 0.38);
  --ls-text: #0b1424;
  --ls-muted: #475569;
  --ls-faint: #4f5f73;  /* 5.1:1 or more on the table header backgrounds (STAT-496; #5b6b80 was 4.25:1) */
  /* Logo blue (owner 2026-10-12): darker shade for text links (5.5:1 on surfaces), logo blue for focus and active */
  --ls-link: #0a58ca;
  /* Inline code: Bootstrap's #d63384 is 3.8:1 on the light surface; this is 6:1 (STAT-430) */
  --bs-code-color: #a61e4d;
  --ls-link-hover: #0847a3;
  --ls-accent: #0866e6;
  --ls-accent-soft: rgba(8, 102, 230, 0.1);
  --ls-button: #0866e6;
  --ls-button-hover: #0a58ca;
  --ls-button-text: #ffffff;
  --ls-pass: #047857;
  --ls-pass-soft: rgba(4, 120, 87, 0.1);
  --ls-warn: #92400e;
  --ls-warn-soft: rgba(217, 119, 6, 0.12);
  --ls-fail: #b91c1c;
  --ls-fail-soft: rgba(185, 28, 28, 0.09);
  --ls-neutral-soft: rgba(71, 85, 105, 0.1);
  --ls-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

:root {
  --ls-radius: 16px;
  --ls-radius-sm: 10px;
  --ls-font: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --ls-font-mono: "Cascadia Code", Consolas, "SFMono-Regular", Menlo, monospace;

  /* Bootstrap 5.3 variables, so Bootstrap components follow the same palette */
  --bs-body-font-family: var(--ls-font);
  --bs-body-bg: var(--ls-bg);
  --bs-body-color: var(--ls-text);
  --bs-secondary-color: var(--ls-muted);
  --bs-tertiary-color: var(--ls-faint);
  --bs-secondary-bg: var(--ls-surface);
  --bs-tertiary-bg: var(--ls-surface);
  --bs-border-color: var(--ls-line);
  --bs-border-color-translucent: var(--ls-line);
  --bs-link-color: var(--ls-link);
  --bs-link-hover-color: var(--ls-link-hover);
  --bs-link-color-rgb: var(--ls-link-rgb, 14, 116, 144);
  --bs-link-hover-color-rgb: var(--ls-link-rgb, 14, 116, 144);
  --bs-emphasis-color: var(--ls-text);
  --bs-heading-color: var(--ls-text);
  --bs-focus-ring-color: var(--ls-accent-soft);

  /* Aliases for the existing portal CSS (custom.css, ui-consistency.css) during the migration */
  --sp-radius: var(--ls-radius);
  --sp-bg: var(--ls-bg);
  --sp-text: var(--ls-text);
  --sp-muted: var(--ls-muted);
  --sp-primary: var(--ls-link);
  --sp-primary-600: var(--ls-link-hover);
  --sp-primary-button: var(--ls-button);
  --sp-primary-button-hover: var(--ls-button-hover);
  --sp-accent: var(--ls-accent);
  --sp-card: var(--ls-panel);
  --sp-card-soft: var(--ls-surface);
  --sp-card-border: var(--ls-line);
  --sp-card-shadow: var(--ls-shadow);
  --sp-nav-border: var(--ls-line);
  --primary-inverse: var(--ls-button-text);
}

:root,
html[data-bs-theme="dark"] {
  --ls-link-rgb: 125, 211, 252;
}

html[data-bs-theme="light"] {
  --ls-link-rgb: 10, 88, 202;
}
