/* =========================================================================
   GOALFEED — design system
   =========================================================================
   Concept: a warm siren in a cold arena (branding/BRAND.md, canonical — this
   file implements it, it does not redefine it). Cold dark/ice-white ground,
   precise tabular numerals, one accent (the goal-light red) that flares only
   at the moments that matter: the primary CTA, the goal-flare in the demo,
   the score digit that just changed, and the wordmark gradient. Nowhere
   else — section headings, borders, hovers, and decorative rules use
   --ice, --muted, or --border instead. See BRAND.md's "What not to do".

   This file is a contract other pages (docs, etc.) build on. Read
   site/DESIGN.md first. Section map:

     1. Tokens (color, type, spacing, radius, shadow, layout)
     2. Reset + base elements
     3. Layout primitives (.wrap, section rhythm)
     4. Components (btn, card, code-block, tabs, callout, badge, table,
        header, footer, eyebrow)
     5. Page-specific rules (clearly marked, bottom of file)
   ========================================================================= */

@import url("https://fonts.googleapis.com/css2?family=Big+Shoulders+Display:wght@600;700;800;900&family=Public+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&family=JetBrains+Mono:wght@400;500;600&display=swap");

/* -------------------------------------------------------------------------
   1. TOKENS — values are branding/BRAND.md's closed palette, verbatim.
   Anything not in that table does not ship as a named color; the -wash/
   -glow helpers below are translucency blends of these same tokens, not new
   colors, for hover/focus tints and the goal-flare glow.
   ------------------------------------------------------------------------- */

:root {
  /* --- color: dark is the default expression of the concept --- */
  --bg: #070b14;
  --surface: #0d1522;
  --surface-2: #131d2e;
  --border: #1e2b40;
  --text: #e8eef7;
  --muted: #93a4bd;

  --accent: #ff3b2f;      /* goal light — CTA, flare, changed score digit only */
  --accent-hot: #ff6a3d;  /* gradient partner for the wordmark and flare only */
  --ice: #5cc8ff;         /* links, structural highlights, "watching" state */
  --live: #3ddc97;        /* connection-alive indicators */
  --warn: #ffc447;        /* caveats, work-in-progress badges */

  --accent-glow: rgba(255, 59, 47, 0.35);
  --accent-wash: rgba(255, 59, 47, 0.1);
  --ice-wash: rgba(92, 200, 255, 0.12);
  --live-wash: rgba(61, 220, 151, 0.12);
  --warn-wash: rgba(255, 196, 71, 0.1);

  --on-accent: var(--bg);

  /* --- derived (blends of the tokens above, not new colors) --- */
  --border-soft: color-mix(in srgb, var(--border) 60%, transparent);
  --surface-3: color-mix(in srgb, var(--surface-2) 82%, var(--border) 18%);

  /* --- type --- */
  --font-display: "Big Shoulders Display", "Oswald", "Arial Narrow", sans-serif;
  --font-text: "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono",
    Menlo, Consolas, "Liberation Mono", monospace;

  --fs-h1: clamp(2.4rem, 1.4rem + 4.4vw, 4.6rem);
  --fs-h2: clamp(1.9rem, 1.35rem + 2.3vw, 2.75rem);
  --fs-h3: clamp(1.15rem, 1.02rem + 0.5vw, 1.35rem);
  --fs-lede: clamp(1.05rem, 0.98rem + 0.3vw, 1.2rem);
  --fs-body: 1rem;
  --fs-small: 0.875rem;
  --fs-micro: 0.75rem;

  /* --- spacing --- */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 2.5rem;
  --sp-8: 3rem;
  --sp-9: 4rem;
  --sp-10: 5rem;
  --sp-12: 6rem;

  /* --- radius / shadow / layout --- */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow-flare: 0 12px 40px -8px var(--accent-glow);
  --shadow-pop: 0 20px 60px -20px rgba(0, 0, 0, 0.6);

  --wrap: 1120px;
  --wrap-narrow: 760px;
}

/* Light theme: same system, daylight broadcast-monitor plate. Guarded so a
   future manual toggle ([data-theme="dark"]) can coexist with the media
   query below without fighting it. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f2f6fb;       /* ice white — cold, never cream (BRAND.md) */
    --surface: #ffffff;
    --surface-2: #e7eef7;
    --border: #cbd8e8;
    --text: #0b1626;
    --muted: #4a5c75;

    --accent: #d81f14;
    --accent-hot: #b8430d;
    --ice: #0a6ea8;
    --live: #0d7a4f;
    --warn: #8a5a00;

    --accent-glow: rgba(216, 31, 20, 0.18);
    --accent-wash: rgba(216, 31, 20, 0.08);
    --ice-wash: rgba(10, 110, 168, 0.1);
    --live-wash: rgba(13, 122, 79, 0.1);
    --warn-wash: rgba(138, 90, 0, 0.1);

    --on-accent: var(--surface);
    --border-soft: color-mix(in srgb, var(--border) 60%, transparent);
    --surface-3: color-mix(in srgb, var(--surface-2) 85%, var(--border) 15%);
    --shadow-pop: 0 16px 46px -18px rgba(11, 22, 38, 0.18);
  }
}
:root[data-theme="light"] {
  --bg: #f2f6fb;
  --surface: #ffffff;
  --surface-2: #e7eef7;
  --border: #cbd8e8;
  --text: #0b1626;
  --muted: #4a5c75;

  --accent: #d81f14;
  --accent-hot: #b8430d;
  --ice: #0a6ea8;
  --live: #0d7a4f;
  --warn: #8a5a00;

  --accent-glow: rgba(216, 31, 20, 0.18);
  --accent-wash: rgba(216, 31, 20, 0.08);
  --ice-wash: rgba(10, 110, 168, 0.1);
  --live-wash: rgba(13, 122, 79, 0.1);
  --warn-wash: rgba(138, 90, 0, 0.1);

  --on-accent: var(--surface);
  --border-soft: color-mix(in srgb, var(--border) 60%, transparent);
  --surface-3: color-mix(in srgb, var(--surface-2) 85%, var(--border) 15%);
  --shadow-pop: 0 16px 46px -18px rgba(11, 22, 38, 0.18);
}

/* -------------------------------------------------------------------------
   2. RESET + BASE ELEMENTS
   ------------------------------------------------------------------------- */

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

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-text);
  font-size: var(--fs-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, svg { max-width: 100%; display: block; }

a {
  color: var(--text);
  text-decoration-color: var(--border);
}
a:hover { text-decoration-color: currentColor; }

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

::selection {
  background: var(--ice);
  color: var(--bg);
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.02;
  margin: 0 0 var(--sp-3);
  text-wrap: balance;
}
h1 { font-size: var(--fs-h1); font-weight: 800; }
h2 { font-size: var(--fs-h2); }
h3 {
  font-family: var(--font-text);
  font-size: var(--fs-h3);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

p { margin: 0 0 var(--sp-4); }
p:last-child { margin-bottom: 0; }

.lede {
  color: var(--muted);
  max-width: 62ch;
  font-size: var(--fs-lede);
}

code, kbd, pre { font-family: var(--font-mono); }

code {
  font-size: 0.875em;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  padding: 0.12em 0.4em;
  color: var(--text);
}

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

hr {
  border: 0;
  border-top: 1px solid var(--border-soft);
  margin: var(--sp-8) 0;
}

/* -------------------------------------------------------------------------
   3. LAYOUT PRIMITIVES
   ------------------------------------------------------------------------- */

.wrap {
  width: min(100% - 2.5rem, var(--wrap));
  margin-inline: auto;
}
.wrap-narrow {
  width: min(100% - 2.5rem, var(--wrap-narrow));
  margin-inline: auto;
}

section { padding-block: clamp(3.5rem, 7vw, 6.5rem); }
section + section { border-top: 1px solid var(--border-soft); }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ice);
  color: var(--bg);
  padding: var(--sp-3) var(--sp-4);
  z-index: 100;
  font-weight: 700;
  font-family: var(--font-text);
}
.skip-link:focus { left: var(--sp-3); top: var(--sp-3); }

.eyebrow {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 var(--sp-3);
}
.eyebrow::before {
  content: "";
  width: 8px;
  height: 8px;
  background: var(--ice);
  border-radius: 1px;
  flex: none;
  box-shadow: 0 0 10px 1px var(--ice-wash);
}

.section-head { max-width: 62ch; margin-bottom: var(--sp-7); }

/* -------------------------------------------------------------------------
   4. COMPONENTS
   ------------------------------------------------------------------------- */

/* ---- buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-family: var(--font-text);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  text-decoration: none;
  padding: 0.8rem 1.4rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease,
    box-shadow 0.15s ease, transform 0.1s ease;
}
.btn:hover { border-color: var(--ice); background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  /* the primary CTA — one of the four places --accent is allowed to live */
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.btn-primary:hover {
  background: color-mix(in srgb, var(--accent) 82%, black);
  border-color: color-mix(in srgb, var(--accent) 82%, black);
  box-shadow: var(--shadow-flare);
}
.btn-ghost {
  background: transparent;
}
.btn-sm { padding: 0.45rem 0.85rem; font-size: var(--fs-small); }

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  align-items: center;
}

/* ---- cards ---- */
.card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-5);
  transition: border-color 0.18s ease, background 0.18s ease;
}
.card:hover { border-color: var(--ice); background: var(--surface-3); }
.card .card-tag {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ice);
  margin-bottom: var(--sp-2);
}
.card h3 { margin-bottom: var(--sp-2); }
.card p { color: var(--muted); font-size: 0.95rem; margin: 0; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: var(--sp-4);
}

/* ---- badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
}
.badge--live {
  /* "supported"/connection-alive — this is what --live means, use it */
  color: var(--text);
  background: var(--live-wash);
  border-color: color-mix(in srgb, var(--live) 35%, transparent);
}
.badge--live::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--live);
  box-shadow: 0 0 8px 1px var(--live-wash);
}
.badge--wip {
  color: var(--warn);
  background: var(--warn-wash);
  border-color: color-mix(in srgb, var(--warn) 35%, transparent);
}

/* ---- callouts ---- */
.callout {
  border: 1px solid var(--border);
  border-left: 3px solid var(--warn);
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: var(--sp-5);
}
.callout-tag {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--warn);
  margin-bottom: var(--sp-2);
}
.callout p:last-child { margin-bottom: 0; }
/* "good to know" rather than "caution" — ice, never accent (BRAND.md: accent
   is a signal, not a theme) */
.callout--info { border-left-color: var(--ice); }
.callout--info .callout-tag { color: var(--ice); }

/* ---- code blocks ---- */
.code-block {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--ice);
  border-radius: var(--radius);
  overflow: hidden;
}
.code-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: 0.55rem var(--sp-4);
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface);
}
.code-block-lang {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.code-block pre {
  margin: 0;
  padding: var(--sp-4) var(--sp-5);
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.7;
  color: #d6dae6;
}
:root[data-theme="light"] .code-block pre { color: var(--text); }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .code-block pre { color: var(--text); }
}
.code-block code {
  background: none;
  border: 0;
  padding: 0;
  font-size: inherit;
  color: inherit;
}
.code-block .c { color: var(--muted); }
.code-block .k { color: var(--ice); }
.code-block .s { color: var(--live); }

.copy-btn {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
  flex: none;
}
.copy-btn:hover { color: var(--text); border-color: var(--ice); }
.copy-btn[data-copied="true"] { color: var(--live); border-color: var(--live); }

/* ---- tabs ---- */
.tabs { margin-top: var(--sp-5); }
.tab-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  list-style: none;
  padding: 0;
  margin: 0 0 var(--sp-4);
  border-bottom: 1px solid var(--border-soft);
}
.tab-list button {
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  letter-spacing: 0.03em;
  color: var(--muted);
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 0.65rem 0.2rem;
  margin-right: var(--sp-5);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.tab-list button:hover { color: var(--text); }
.tab-list button[aria-selected="true"] {
  color: var(--text);
  border-bottom-color: var(--ice);
}
.tab-panel[hidden] { display: none; }

/* ---- tables ---- */
.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
table {
  border-collapse: collapse;
  width: 100%;
  min-width: 32rem;
  font-size: 0.93rem;
}
th, td {
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: top;
}
thead th {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-2);
  font-weight: 500;
}
tbody tr:last-child td { border-bottom: 0; }
td:first-child { color: var(--text); font-weight: 600; }
td { color: var(--muted); }
td code { white-space: nowrap; }

/* ---- header ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
}
.header-in {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  min-height: 64px;
}
.brand {
  display: flex;
  align-items: center;
  line-height: 0;
}
.brand img { height: 22px; width: auto; }
.site-header nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.site-header nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.2rem 0;
  border-bottom: 1px solid transparent;
}
.site-header nav a:hover,
.site-header nav a[aria-current="page"] {
  color: var(--text);
  border-bottom-color: var(--ice);
}
.site-header nav a.nav-cta {
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
}
.site-header nav a.nav-cta:hover { border-color: var(--ice); }

/* ---- footer ---- */
.site-footer {
  border-top: 1px solid var(--border-soft);
  padding-block: var(--sp-7) var(--sp-8);
  font-size: var(--fs-small);
  color: var(--muted);
}
.footer-in {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4) var(--sp-6);
  align-items: center;
}
.footer-in img { height: 18px; width: auto; opacity: 0.85; }
.footer-note { color: var(--muted); }
.footer-links {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-5);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--text); }
.footer-meta {
  width: 100%;
  padding-top: var(--sp-4);
  margin-top: var(--sp-2);
  border-top: 1px solid var(--border-soft);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.03em;
}

/* ---- breadcrumb ---- */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4em;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: var(--sp-5);
}
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--ice); }
.breadcrumb span[aria-current="page"] { color: var(--text); }
.breadcrumb .sep { color: var(--border); }

/* ---- docs shell (site/docs/*.html — see site/docs/_shell.html) ---- */
.doc-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: var(--sp-8);
  align-items: start;
}
.doc-sidebar {
  position: sticky;
  top: calc(64px + var(--sp-6));
  font-family: var(--font-mono);
  font-size: var(--fs-small);
}
.doc-sidebar h2 {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: var(--sp-5) 0 var(--sp-2);
}
.doc-sidebar h2:first-child { margin-top: 0; }
.doc-sidebar ul {
  list-style: none;
  margin: 0 0 var(--sp-2);
  padding: 0;
  border-left: 1px solid var(--border);
}
.doc-sidebar a {
  display: block;
  padding: 0.35rem var(--sp-4);
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--muted);
  text-decoration: none;
}
.doc-sidebar a:hover { color: var(--text); }
.doc-sidebar a[aria-current="page"] {
  color: var(--text);
  border-left-color: var(--ice);
  background: var(--surface-2);
}
.doc-content {
  min-width: 0;
  max-width: var(--wrap-narrow);
}
.doc-content h2 { margin-top: var(--sp-8); }
.doc-content h2:first-child { margin-top: 0; }
.doc-content h3 { margin-top: var(--sp-6); }
.doc-content > .lede { font-size: var(--fs-lede); margin-bottom: var(--sp-6); }
.doc-content .code-block,
.doc-content .table-scroll,
.doc-content .callout { margin: var(--sp-5) 0; }
.doc-content ul, .doc-content ol { padding-left: 1.25em; }
.doc-content li + li { margin-top: 0.35em; }
@media (max-width: 860px) {
  .doc-layout { grid-template-columns: 1fr; }
  .doc-sidebar {
    position: static;
    border-bottom: 1px solid var(--border-soft);
    padding-bottom: var(--sp-5);
    margin-bottom: var(--sp-2);
  }
}

/* =========================================================================
   5. PAGE-SPECIFIC — index.html
   ========================================================================= */

/* ---- hero ---- */
.hero {
  position: relative;
  overflow: hidden;
  padding-block: clamp(3.5rem, 9vw, 7rem) clamp(3rem, 6vw, 5rem);
}
.hero::before {
  /* ambient chrome, not the goal flare — the arena is cold and quiet here;
     red only fires in the demo, so this glow stays ice-tinted. */
  content: "";
  position: absolute;
  top: -10%;
  left: 50%;
  translate: -50% 0;
  width: 60rem;
  height: 34rem;
  background: radial-gradient(ellipse at center, var(--ice-wash), transparent 65%);
  opacity: 0.55;
  pointer-events: none;
  z-index: 0;
}
.hero .wrap { position: relative; z-index: 1; }
.hero-inner { max-width: 46rem; }
.hero img.wordmark { width: min(560px, 100%); height: auto; margin-bottom: var(--sp-6); }
.hero h1 {
  font-size: var(--fs-h1);
  max-width: 18ch;
  margin-bottom: var(--sp-4);
}
.hero h1 .accent-word { color: var(--ice); }
.hero .lede { font-size: var(--fs-lede); max-width: 54ch; margin-bottom: var(--sp-6); }
.hero .cta-row { margin-bottom: var(--sp-5); }
.hero .meta {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* ---- the moment (goal event demo) ---- */
.moment-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--sp-8);
  align-items: start;
  margin-top: var(--sp-7);
}

.stage {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  position: relative;
  box-shadow: var(--shadow-pop);
}
.stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-4);
}
.stage-title {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.stage-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.stage-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--live);
  box-shadow: 0 0 8px 1px var(--live-wash);
}

.scoreline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-4);
  padding: var(--sp-5) 0 var(--sp-6);
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: var(--sp-4);
}
.scoreline .team {
  text-align: center;
  min-width: 5.5rem;
}
.scoreline .team-code {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.4rem;
  letter-spacing: 0.02em;
}
.scoreline .team-score {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(3rem, 3vw + 2rem, 4.2rem);
  line-height: 1;
  margin-top: 0.15em;
  transition: color 0.2s ease, text-shadow 0.2s ease;
}
.scoreline .team.is-flaring .team-score {
  /* the score digit that just changed — permitted accent use #3 */
  color: var(--accent);
  text-shadow: 0 0 24px var(--accent-glow);
}
.scoreline .sep {
  font-family: var(--font-mono);
  color: var(--border);
  font-size: 1.5rem;
  align-self: flex-start;
  margin-top: 0.9rem;
}
.scoreline .clock {
  align-self: flex-start;
  margin-top: 0.9rem;
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  color: var(--muted);
  text-align: center;
  min-width: 4.5rem;
}
.scoreline .clock b {
  display: block;
  color: var(--text);
  font-size: 1rem;
}

.event-feed {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  min-height: 12rem;
}
.event-row {
  display: flex;
  align-items: baseline;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-3);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: var(--font-mono);
  font-size: var(--fs-small);
}
.event-row .ts {
  color: var(--muted);
  min-width: 4.5rem;
  flex: none;
}
.event-row .label {
  color: var(--text);
}
.event-row .label b { color: inherit; }
.event-row.is-goal {
  /* the goal-flare in the demo — permitted accent use #2 */
  background: var(--accent-wash);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}
.event-row.is-goal .ts { color: var(--accent); }
.event-row.is-new {
  animation: row-flare 1.1s ease-out;
}
@keyframes row-flare {
  0% { background: var(--accent); border-color: var(--accent); transform: translateY(-4px); opacity: 0; }
  40% { opacity: 1; transform: translateY(0); }
  100% { background: var(--accent-wash); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
}

.stage-foot {
  margin-top: var(--sp-4);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border-soft);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  color: var(--muted);
}

.moment-copy .lede { margin-bottom: var(--sp-5); }
.moment-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}
.moment-list li {
  display: flex;
  gap: var(--sp-3);
  align-items: baseline;
}
.moment-list .n {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--ice);
  font-size: 1.1rem;
  min-width: 1.4rem;
}

/* ---- pipeline ---- */
.pipeline {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-3);
  margin-top: var(--sp-7);
  counter-reset: step;
}
.pipeline-step {
  position: relative;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-5) var(--sp-4) var(--sp-4);
}
.pipeline-step::before {
  counter-increment: step;
  content: counter(step, decimal-leading-zero);
  display: block;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  color: var(--ice);
  letter-spacing: 0.08em;
  margin-bottom: var(--sp-3);
}
.pipeline-step h3 { margin-bottom: var(--sp-2); font-size: 1.02rem; }
.pipeline-step p { color: var(--muted); font-size: 0.9rem; margin: 0; }
.pipeline-arrow {
  display: none;
}
@media (min-width: 861px) {
  .pipeline { align-items: stretch; }
  .pipeline-step:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 50%;
    right: -0.95rem;
    width: 0.9rem;
    height: 1px;
    background: var(--border);
  }
  .pipeline-step:not(:last-child)::after {
    background: linear-gradient(90deg, var(--border), var(--ice));
  }
}

/* ---- leagues ---- */
.league-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--sp-3);
  margin-top: var(--sp-7);
}
.league-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-5) var(--sp-4);
  text-align: center;
}
.league-card .league-code {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.8rem;
  letter-spacing: 0.01em;
}
.league-card .league-name {
  font-size: var(--fs-small);
  color: var(--muted);
  margin-top: 0.2rem;
}
.league-card .badge { margin-top: var(--sp-3); }
.league-card.is-wip { opacity: 0.85; }

/* ---- install ---- */
.install-panel { margin-top: var(--sp-2); }
.install-panel p.lede { margin-bottom: var(--sp-4); }

/* ---- automation ---- */
.automation-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: var(--sp-7);
  margin-top: var(--sp-7);
  align-items: start;
}
.automation-copy .moment-list { margin-top: var(--sp-5); }

/* ---- developers ---- */
.dev-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--sp-4);
  margin-top: var(--sp-7);
}

/* ---- responsive ---- */
@media (max-width: 980px) {
  /* minmax(0, 1fr), not a bare 1fr — a grid track's implicit min-width is
     "auto" (its content's min-content size), so a bare 1fr still refuses to
     shrink below the scoreline's intrinsic width and blows out at narrow
     viewports. minmax(0, 1fr) is the actual fix, not just the column count. */
  .moment-grid { grid-template-columns: minmax(0, 1fr); }
  .automation-grid { grid-template-columns: minmax(0, 1fr); }
  .pipeline { grid-template-columns: repeat(2, 1fr); }
  .pipeline-step:not(:last-child)::after { display: none; }
}
@media (max-width: 720px) {
  .header-in nav { gap: var(--sp-3); }
  .site-header nav a.opt { display: none; }
  .scoreline { gap: var(--sp-2); }
  .scoreline .team { min-width: 4rem; }
}
@media (max-width: 400px) {
  /* smallest supported width (360px, per PROJECT-STANDARDS.md's SITE
     STANDARD) — the scoreline's team codes/scores and the clock still need
     to fit three-across without pushing the stage wider than the page. */
  .scoreline { gap: var(--sp-1); }
  .scoreline .team { min-width: 3.25rem; }
  .scoreline .team-score { font-size: clamp(2.2rem, 9vw, 3rem); }
  .scoreline .clock { min-width: 3.5rem; }
}
@media (max-width: 560px) {
  .pipeline { grid-template-columns: 1fr; }
  .footer-links { margin-left: 0; }
}
