/* ============================================================
   GORILLA APPS — site tokens + shared components
   Brand: firefighter-gorilla badge — near-black ground, flame
   orange accent, silver beveled display type, EKG motif.
   Playbook rules: tokens or nothing; one accent, spent on data
   and the single primary action per page; both themes first-class;
   WCAG-AA contrast; ≥44px targets; reduce-motion respected.
   ============================================================ */

:root {
  /* palette — dark is the brand default */
  --bg: #0c0e12;
  --surface: #14171d;
  --surface-2: #1b1f27;
  --line: #2a2f39;
  --text: #f2f3f5;
  --muted: #b6bac2;          /* ~9:1 on --bg */
  --faint: #8b909a;          /* labels/eyebrows only */
  --accent: #f4581f;         /* flame orange — graphic accent */
  --accent-ink: #ff8a4d;     /* accent as text on dark, AA-safe */
  --accent-soft: rgba(244, 88, 31, 0.14);
  --focus: #ff8a4d;

  /* silver bevel for the wordmark */
  --steel-hi: #ffffff;
  --steel-mid: #c9ccd4;
  --steel-lo: #8f94a0;

  /* type scale — Archivo Black carries display tiers, Inter carries body */
  --font-display: 'Archivo Black', 'Arial Black', sans-serif;
  --font-body: 'Inter', 'Segoe UI', system-ui, sans-serif;
  --tier-poster: clamp(56px, 12vw, 140px);
  --tier-h1: clamp(26px, 4.5vw, 38px);
  --tier-h2: clamp(18px, 2.6vw, 22px);
  --tier-body: 17px;
  --tier-small: 14px;
  --tier-eyebrow: 13px;

  --radius: 10px;
  --gap: clamp(20px, 4vw, 40px);
  --measure: 62ch;
}

:root[data-theme="light"] {
  --bg: #f6f5f3;
  --surface: #ffffff;
  --surface-2: #efedea;
  --line: #dad7d2;
  --text: #171a1f;
  --muted: #464b52;
  --faint: #6b7078;
  --accent: #d9480f;
  --accent-ink: #ab3a0c;     /* AA on light surfaces */
  --accent-soft: rgba(217, 72, 15, 0.12);
  --focus: #ab3a0c;

  --steel-hi: #3a3e47;
  --steel-mid: #23262d;
  --steel-lo: #14161b;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--tier-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* focus is visible, always */
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 2px;
}

a { color: inherit; }

.wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 clamp(20px, 5vw, 48px);
}

/* ---------- header ---------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(20px, 5vw, 48px);
  max-width: 1040px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  text-decoration: none;
  min-height: 44px;
  align-items: center;
}

.brand .name {
  font-family: var(--font-display);
  font-size: 17px;
  letter-spacing: 0.02em;
  line-height: 1;
  text-transform: uppercase;
  font-style: italic;
}

.brand .name-apps {
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--accent-ink);
  padding-left: 2px;
}

.site-nav { display: flex; align-items: center; gap: 4px; }

.site-nav a,
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0 14px;
  font-family: var(--font-body);
  font-size: var(--tier-small);
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  background: none;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
}

.site-nav a:hover,
.theme-toggle:hover { color: var(--text); background: var(--surface); }

.site-nav a[aria-current="page"] { color: var(--text); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 26px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: var(--tier-body);
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--surface);
}

.btn:hover { background: var(--surface-2); }

/* the ONE loud element per page */
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #1c0a03;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0 34px;
}

.btn-primary:hover {
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

@media (prefers-reduced-motion: no-preference) {
  .btn-primary { transition: transform 120ms ease, box-shadow 120ms ease; }
  .btn-primary:hover { transform: translateY(2px); } /* physical press, not a glow filter */
}

/* ---------- type helpers ---------- */
.eyebrow {
  font-size: var(--tier-eyebrow);
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--faint);
}

h1, h2, h3 { line-height: 1.15; }

.display {
  font-family: var(--font-display);
  font-weight: 400;
  text-transform: uppercase;
}

.measure { max-width: var(--measure); }

.muted { color: var(--muted); }

.num { font-variant-numeric: tabular-nums; }

/* ---------- EKG divider (the brand motif) ---------- */
.ekg {
  display: block;
  width: min(240px, 60vw);
  height: 28px;
  color: var(--accent);
}

/* ---------- cards ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card:hover { border-color: var(--accent); }

@media (prefers-reduced-motion: no-preference) {
  .card { transition: border-color 150ms ease, transform 150ms ease; }
  .card:hover { transform: translateY(-2px); }
}

.card .card-num {
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--faint);
  letter-spacing: 0.1em;
}

.card h3 {
  font-family: var(--font-display);
  font-size: var(--tier-h2);
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.card p { color: var(--muted); font-size: var(--tier-small); line-height: 1.6; }

/* ---------- status chips (color + text, never color alone) ---------- */
.chip {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}

.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }

.chip-live {
  border-color: transparent;
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.chip-live::before { background: var(--accent); }

/* ---------- gear stripe divider (turnout-coat reflective trim) ---------- */
.gear-stripe {
  height: 12px;
  width: 100%;
  background: repeating-linear-gradient(
    45deg,
    var(--line) 0px,
    var(--line) 8px,
    transparent 8px,
    transparent 16px
  );
  opacity: 0.55;
}

/* ---------- EKG draw-on when scrolled into view ---------- */
@media (prefers-reduced-motion: no-preference) {
  .ekg-draw path {
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
  }
  .ekg-draw.is-visible path {
    animation: ekg-draw 1.4s ease forwards;
  }
  @keyframes ekg-draw {
    to { stroke-dashoffset: 0; }
  }
}

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  margin-top: clamp(60px, 10vw, 120px);
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 28px;
  padding-bottom: 36px;
  font-size: var(--tier-small);
  color: var(--faint);
}
