/* ─────────────────────────────────────────────────────────────
   LevTech tokens — Wave 1
   Near-monochrome warm-blue-grey neutrals + living accent.
   Lifted verbatim from design_handoff_levtech_wave1/tokens.css.
   ───────────────────────────────────────────────────────────── */

/* Self-hosted variable fonts. The woff2 files live under
   customer/static/customer/fonts/ — see Wave 1 Step 1 plan. */
@font-face {
  font-family: 'Inter';
  src: url("../fonts/Inter-Variable.2bf3d951bf9d.woff2") format('woff2-variations'),
       url("../fonts/Inter-Variable.2bf3d951bf9d.woff2") format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url("../fonts/JetBrainsMono-Variable.b058178d7f30.woff2") format('woff2-variations'),
       url("../fonts/JetBrainsMono-Variable.b058178d7f30.woff2") format('woff2');
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

@property --accent {
  syntax: '<color>';
  inherits: true;
  initial-value: #4E5BD6;
}
@property --accent-weak {
  syntax: '<color>';
  inherits: true;
  initial-value: #EEF0FB;
}

:root {
  /* Type */
  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --text-display: 40px;
  --text-h1: 28px;
  --text-h2: 20px;
  --text-h3: 16px;
  --text-body-lg: 16px;
  --text-body: 14px;
  --text-caption: 13px;
  --text-micro: 11px;
  --text-num-lg: 28px;

  /* Neutrals — warm-tinged blue-grey */
  --n-0:   #FFFFFF;
  --n-25:  #FAFAFB;
  --n-50:  #F4F4F6;
  --n-100: #ECECEF;
  --n-150: #DEDFE4;
  --n-200: #CDCED4;
  --n-300: #B0B2BA;
  --n-400: #8B8D97;
  --n-500: #6B6D78;
  --n-600: #4F525C;
  --n-700: #383A43;
  --n-800: #1F2128;
  --n-900: #111319;

  /* Surfaces */
  --bg-root: var(--n-25);
  --bg-raised: var(--n-0);
  --bg-sunken: var(--n-50);
  --bg-inset: var(--n-100);

  /* Borders */
  --border-subtle: rgba(17, 19, 25, 0.06);
  --border-default: rgba(17, 19, 25, 0.10);
  --border-strong: rgba(17, 19, 25, 0.18);
  --border-divider: rgba(17, 19, 25, 0.08);

  /* Text */
  --text-primary: var(--n-900);
  --text-secondary: var(--n-600);
  --text-tertiary: var(--n-400);
  --text-quaternary: var(--n-300);

  /* Semantic status (badges/dots, independent of living accent) */
  --status-healthy: #2E8B57;
  --status-healthy-weak: #E8F4ED;
  --status-degraded: #B47B2B;
  --status-degraded-weak: #FBF3E3;
  /* Ink for text sitting ON -weak. Darker than --status-degraded on purpose,
     and the reason is measurable: --status-degraded on --status-degraded-weak
     is only 3.28:1, which FAILS WCAG AA for text (4.5:1), while this reads
     5.19:1 and passes. So it is an accessibility requirement, not a shade
     preference — do not "simplify" it back to --status-degraded. It was
     already used twice as a bare hex (here and insights-report.css); naming
     it means the next reuse inherits the passing contrast instead of
     guessing. Measured 2026-07-29. */
  --status-degraded-ink: #8A5D1F;
  --status-offline: #B53A2E;
  --status-offline-weak: #FBECEA;

  /* Living accent — defaults to healthy. 🚨 This SHIFTS with camera health
     (see [data-state] below): indigo when healthy, amber degraded, red
     offline. Never use it to colour a FACT — only a live status. */
  --accent: #4E5BD6;
  --accent-weak: #EEF0FB;
  --accent-ink: #FFFFFF;

  /* Fixed brand indigo. Same value as the healthy accent, but it does NOT
     move with camera health (2026-08-30).
     WHY: "a confirmed incident, alert sent" is a historical fact — it must
     look identical everywhere. Using --accent made it RED on Overview (whose
     12 offline cameras put the page in `offline` state) and INDIGO on
     Incidents (which sets no data-state), so the same information wore two
     colours on two tabs and the red implied a problem with the alert. */
  --brand: #4E5BD6;
  --brand-weak: #EEF0FB;

  /* Spacing */
  --space-0: 0px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 999px;

  /* Shadows */
  --shadow-1: 0 1px 0 rgba(17,19,25,0.04), 0 1px 2px rgba(17,19,25,0.04);
  --shadow-2: 0 1px 0 rgba(17,19,25,0.04), 0 6px 16px rgba(17,19,25,0.06);
  --shadow-3: 0 1px 0 rgba(17,19,25,0.04), 0 10px 28px rgba(17,19,25,0.10);
  --shadow-overlay:
    0 0 0 0.5px rgba(255,255,255,0.5) inset,
    0 1px 0 rgba(255,255,255,0.5) inset,
    -24px 0 80px rgba(17,19,25,0.16);

  /* Motion */
  --dur-1: 120ms;
  --dur-2: 200ms;
  --dur-3: 320ms;
  --dur-4: 480ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

:root[data-state="healthy"]  { --accent: #4E5BD6; --accent-weak: #EEF0FB; }
:root[data-state="degraded"] { --accent: #B17A2A; --accent-weak: #FAF1DD; }
:root[data-state="offline"]  { --accent: #B53A2E; --accent-weak: #FBECEA; }

/* Living accent animates between states */
html { transition: --accent var(--dur-4) var(--ease-in-out),
                   --accent-weak var(--dur-4) var(--ease-in-out); }

@media (prefers-reduced-motion: reduce) {
  html { transition: none; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg-root);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: 1.5;
  font-feature-settings: "cv11", "ss01";
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Typography utilities ─── */
.t-display { font-size: var(--text-display); line-height: 1.10; font-weight: 500; letter-spacing: -0.022em; }
.t-h1      { font-size: var(--text-h1);      line-height: 1.20; font-weight: 600; letter-spacing: -0.018em; }
.t-h2      { font-size: var(--text-h2);      line-height: 1.30; font-weight: 600; letter-spacing: -0.012em; }
.t-h3      { font-size: var(--text-h3);      line-height: 1.40; font-weight: 600; letter-spacing: -0.006em; }
.t-body-lg { font-size: var(--text-body-lg); line-height: 1.55; font-weight: 400; }
.t-body    { font-size: var(--text-body);    line-height: 1.50; font-weight: 400; }
.t-caption { font-size: var(--text-caption); line-height: 1.45; font-weight: 500; color: var(--text-secondary); }
.t-micro   { font-size: var(--text-micro);   line-height: 1.40; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-tertiary); }
.t-num-lg  { font-size: var(--text-num-lg);  line-height: 1.0;  font-weight: 500; font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.t-mono    { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.t-tnum    { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* ─── Card ─── */
.card {
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}
.card-pad { padding: var(--space-5); }

/* ─── Buttons ─── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background: var(--bg-raised);
  color: var(--text-primary);
  font: 500 14px/1 var(--font-sans);
  cursor: default;
  transition: background var(--dur-2) var(--ease-out), border-color var(--dur-2) var(--ease-out);
}
.btn:hover { background: var(--bg-sunken); }
.btn-primary {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-ink);
}
.btn-primary:hover { background: var(--accent); filter: brightness(0.94); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-sunken); color: var(--text-primary); }

/* ─── Inputs ─── */
.input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background: var(--bg-raised);
  color: var(--text-primary);
  font: 400 14px/1 var(--font-sans);
  transition: border-color var(--dur-2) var(--ease-out), box-shadow var(--dur-2) var(--ease-out);
  outline: none;
}
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 22%, transparent);
}

/* ─── Badges ─── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 22px;
  padding: 0 9px;
  border-radius: var(--radius-full);
  font-size: var(--text-micro);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge--healthy   { background: var(--status-healthy-weak); color: #1F6B41; }
.badge--degraded  { background: var(--status-degraded-weak); color: var(--status-degraded-ink); }
.badge--offline   { background: var(--status-offline-weak); color: #8B2A20; }
.badge--neutral   { background: var(--bg-sunken); color: var(--text-secondary); }
/* --brand, not --accent: "alert sent" is a fact about the past, so it must
   render the same on every page. Under --accent it turned red on Overview
   (offline state) and stayed indigo on Incidents. */
.badge--sent      { background: var(--brand-weak); color: var(--brand); border-color: color-mix(in oklab, var(--brand) 18%, transparent); }
.badge--muted     { background: transparent; color: var(--text-tertiary); border-color: var(--border-default); }
.badge--dot::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; display: inline-block;
}

/* ─── Status dot ─── */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.dot--healthy  { background: var(--status-healthy); }
.dot--degraded { background: var(--status-degraded); }
.dot--offline  { background: var(--status-offline); }

/* ─── Focus ring ─── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
