/*
 * Design tokens.
 *
 * Deep teal, not red. Red was tried and abandoned: this tool is full of
 * status - confidence LOW/MEDIUM/HIGH, warnings, destructive actions - and a
 * red brand competes with every one of them. Teal reads as measurement rather
 * than alarm and leaves the whole red/amber/green axis free to mean something.
 *
 * The chart colours are NOT chosen by eye. They were run through the
 * colour-blindness / contrast validator and pass every gate on the light
 * surface: lightness band, chroma floor, adjacent CVD separation (worst pair
 * ΔE 9.6 deutan), normal-vision separation (worst 23.7), and 3:1 contrast.
 * Under any-to-any comparison the first four pass outright and the fifth sits
 * in the 6-8 warn band, which is legal only alongside a second cue - hence the
 * dash patterns on the compare chart. See charts.ts.
 * Re-run the validator before changing any --series value.
 */
:root {
  /* Brand. 5.10:1 on white, so white button text and teal link text both
     clear 4.5:1 without a second thought. */
  --brand: #00798d;
  --brand-dark: #00636f;
  --brand-darker: #004d57;
  --brand-tint: #e6f4f7;
  --brand-tint-strong: #c5e5ec;

  /* Ink and neutrals - a touch cool, to sit with the teal */
  --ink: #16191c;
  --ink-soft: #414952;
  --muted: #667079;
  --border: #e2e6e9;
  --border-strong: #c6ced4;
  --surface: #f7f9fa;
  --surface-sunken: #eef2f4;
  --bg: #ffffff;

  /* Status. Distinct steps, and never used to carry meaning alone - every
     badge and alert pairs them with a word. */
  --success: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;

  /* Destructive actions. Now unambiguous: nothing else on the page is red. */
  --danger: #b3261e;
  --danger-tint: #fdecea;

  /* Chart series - validated, see the note above. Fixed order, never cycled.
     Red and green are deliberately absent from the leading slots: both are
     spoken for by status, and a series must never impersonate one. */
  --series-1: #0089a0;
  --series-2: #9e3667;
  --series-3: #c57f00;
  --series-4: #5b4aa8;
  --series-5: #2f6b32;

  /* Aliases kept so existing rules keep working; --brand is the real name. */
  --accent: var(--brand);
  --accent-soft: var(--brand-tint);
  --error: var(--danger);

  --radius: 10px;
  --radius-lg: 14px;
  --gap: 16px;
  --container: 1240px;
  --margin: 40px;

  --shadow-sm: 0 1px 2px rgba(26, 23, 25, 0.06);
  --shadow: 0 2px 8px rgba(26, 23, 25, 0.08);
  --shadow-lg: 0 12px 32px rgba(26, 23, 25, 0.14);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* The `hidden` attribute is enforced by a UA rule of the form
   `[hidden] { display: none }`, which any class setting `display` outranks -
   `.loader { display: flex }` and `.button { display: inline-flex }` both did,
   leaving the loading spinner permanently on screen. This wins over both. */
[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  margin: 0 0 8px;
  line-height: 1.18;
  font-weight: 700;
  letter-spacing: -0.015em;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; }

p { margin: 0 0 12px; }

a {
  color: var(--brand-dark);
  text-underline-offset: 2px;
}

a:hover { color: var(--brand-darker); }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
  background: var(--surface-sunken);
  padding: 1px 5px;
  border-radius: 4px;
}

.muted {
  color: var(--muted);
  font-size: 0.875rem;
}

.error {
  color: var(--danger);
  font-size: 0.875rem;
  margin: 0 0 12px;
}

.empty {
  color: var(--muted);
  padding: 40px 0;
  text-align: center;
}

/* Keyboard access */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--brand);
  color: #fff;
  padding: 10px 16px;
  z-index: 100;
}

.skip-link:focus {
  left: 8px;
  top: 8px;
}

:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Badges and chips. Every one carries a word - colour never carries the
   meaning on its own. */
.badge {
  display: inline-block;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
  white-space: nowrap;
}

.badge--high { background: var(--success); }
.badge--medium { background: #a97400; }
.badge--low { background: var(--critical); }

.chip {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  font-size: 0.7rem;
  color: var(--muted);
  white-space: nowrap;
}

.chip--ok {
  border-color: var(--success);
  color: #0a7d0a;
  background: rgba(12, 163, 12, 0.07);
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: -2px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
