/* Aurorix theme tokens — dark-first "night-sky mission control".
   Minimal, token-driven, WCAG-AA. brand.css layers the aurora accent on top.
   v0 replaces components' markup/styles but should keep these token NAMES so the
   engine bindings and layout primitives keep working. */
:root {
  /* palette — dark is the default (this is a night-sky tool) */
  --bg: #0a0e17;
  --bg-elev: #121826;
  --bg-elev-2: #1a2233;
  --line: #26304a;
  --line-soft: #1c2436;
  --ink: #e8edf7;
  --ink-soft: #aeb8cc;
  --ink-mute: #7c869c;

  /* status colors (accessible on --bg) */
  --quiet: #7c869c;
  --watch: #f2c94c;   /* amber */
  --primed: #7ad9ff;  /* electric cyan */
  --active: #59e6a6;  /* aurora green */
  --danger: #ff6b6b;
  --southward: #ff6b6b; /* Bz southward emphasis */

  /* brand accent (brand.css can override) */
  --accent: #59e6a6;
  --accent-2: #7ad9ff;
  --accent-ink: #04140d;

  /* type + rhythm */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --maxw: 1120px;
  --radius: 14px;
  --radius-sm: 9px;
  --gap: 18px;
  --shadow: 0 6px 24px rgba(0,0,0,.35);
}

/* Light theme for daytime / preference. Aurora tools are used at night, but the
   explainer pages get read in daylight — support both. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f6f8fc; --bg-elev: #ffffff; --bg-elev-2: #eef2f9;
    --line: #d7deec; --line-soft: #e6ebf4;
    --ink: #121826; --ink-soft: #3d4763; --ink-mute: #67718c;
    --shadow: 0 6px 20px rgba(20,30,60,.10);
    --accent-ink: #04140d;
  }
}
:root[data-theme="light"] {
  --bg: #f6f8fc; --bg-elev: #ffffff; --bg-elev-2: #eef2f9;
  --line: #d7deec; --line-soft: #e6ebf4;
  --ink: #121826; --ink-soft: #3d4763; --ink-mute: #67718c;
  --shadow: 0 6px 20px rgba(20,30,60,.10);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 17px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 1.4em 0 .5em; font-weight: 700; }
h1 { font-size: clamp(1.7rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.3rem, 3vw, 1.7rem); }
h3 { font-size: 1.15rem; }
p { margin: .6em 0; }
img { max-width: 100%; height: auto; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; border-radius: 4px; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 8px; z-index: 100; }

/* header / nav */
.site-header { border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 86%, transparent); position: sticky; top: 0; backdrop-filter: blur(8px); z-index: 20; }
.site-header .wrap { display: flex; align-items: center; gap: 18px; height: 60px; }
.brand { font-weight: 800; letter-spacing: -.02em; font-size: 1.2rem; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.nav { margin-left: auto; display: flex; gap: 16px; flex-wrap: wrap; }
.nav a { color: var(--ink-soft); font-size: .95rem; }
.nav a:hover { color: var(--ink); }

/* The toggle only exists once JS has upgraded the header (see .js-nav below). */
.nav-toggle { display: none; }

/* --- mobile navigation (audit issue 10) ---------------------------------
   Seven primary links cannot fit beside the wordmark on a 390px viewport. The
   header used to be a hard 60px with a wrapping .nav inside it, so the second
   row of links overflowed the header box. Two layers fix that:

   1. NO JS: the header becomes auto-height and the nav drops to its own full
      width row. Nothing is hidden — it just wraps somewhere it fits.
   2. WITH JS: app.js sets .js-nav on <html>, which collapses that row behind a
      Menu button. Progressive enhancement in this order matters — building the
      menu JS-first is exactly how primary navigation goes missing on mobile. */
@media (max-width: 760px) {
  .site-header .wrap { height: auto; min-height: 60px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; row-gap: 4px; }
  .nav { width: 100%; margin-left: 0; gap: 14px 18px; }

  .js-nav .nav-toggle {
    display: inline-flex; align-items: center; gap: 8px; margin-left: auto;
    background: var(--bg-elev); color: var(--ink); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 8px 14px; font: inherit; font-size: .95rem; cursor: pointer;
  }
  .js-nav .nav-toggle:hover { border-color: var(--ink-mute); }
  .nav-toggle-bars { width: 16px; height: 2px; background: currentColor; box-shadow: 0 -5px 0 currentColor, 0 5px 0 currentColor; }
  .js-nav .nav { display: none; }
  .js-nav .nav-toggle[aria-expanded="true"] + .nav { display: flex; flex-direction: column; gap: 0; padding: 6px 0 4px; }
  .js-nav .nav-toggle[aria-expanded="true"] + .nav a { padding: 11px 2px; border-top: 1px solid var(--line-soft); }
}

/* cards / grid */
.grid { display: grid; gap: var(--gap); grid-template-columns: repeat(12, 1fr); }
.card { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card h2, .card h3 { margin-top: 0; }
.col-12 { grid-column: span 12; } .col-8 { grid-column: span 8; } .col-6 { grid-column: span 6; }
.col-4 { grid-column: span 4; } .col-3 { grid-column: span 3; }
@media (max-width: 860px) { .col-8, .col-6, .col-4, .col-3 { grid-column: span 12; } }

/* status banner */
.status-banner { border-radius: var(--radius); padding: 22px; border: 1px solid var(--line); background: linear-gradient(180deg, var(--bg-elev-2), var(--bg-elev)); }
.status-banner[data-state="ACTIVE"] { border-color: var(--active); box-shadow: 0 0 0 1px var(--active) inset; }
.status-banner[data-state="PRIMED"] { border-color: var(--primed); box-shadow: 0 0 0 1px var(--primed) inset; }
.status-banner[data-state="WATCH"] { border-color: var(--watch); }
.status-banner[data-state="UNAVAILABLE"] { border-color: var(--danger); }
.status-banner[data-state="UNAVAILABLE"] [data-ue="headline"] { color: var(--danger); }
/* The site's one question, as a real heading. On / it is the page's <h1>; on
   /tonight/ the same element renders as an <h2> under that page's own <h1>. */
.status-question { font-size: clamp(1.15rem, 2.4vw, 1.45rem); font-weight: 600; line-height: 1.25; letter-spacing: -.01em; color: var(--ink-soft); margin: 0 0 12px; }
.status-headline { font-size: clamp(1.4rem, 3.5vw, 2rem); font-weight: 800; margin: 0 0 6px; }
/* Reserved height for the two variable-length nodes the worker (server-side) and
   /ax/app.js (client-side) rewrite. Without this the banner grows as the real
   status lands and shoves the whole dashboard down. `lh` where supported, an em
   approximation everywhere else — both are floors, so real text never clips. */
.status-reason { color: var(--ink-soft); margin: 4px 0; min-height: 4.4em; min-height: 3lh; }
.confidence, .status-reason { text-wrap: pretty; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); text-transform: uppercase; letter-spacing: .04em; }
.badge[data-state="QUIET"] { color: var(--quiet); }
/* UNAVAILABLE is not a space-weather severity — it means we have no reading at
   all. It must not borrow QUIET's calm grey (that reads as "all clear"), so it
   takes the muted-warning treatment: visibly different, clearly not a forecast. */
.badge[data-state="UNAVAILABLE"] { color: var(--danger); border-color: var(--danger); }
.badge[data-state="ACTIVE"] { color: var(--active); border-color: var(--active); }
.badge[data-state="PRIMED"] { color: var(--primed); border-color: var(--primed); }
.badge[data-state="WATCH"], .badge[data-type="watch"] { color: var(--watch); border-color: var(--watch); }

/* stamps + staleness */
.stamp { font-family: var(--mono); font-size: .78rem; color: var(--ink-mute); }
.staleness-strip { background: color-mix(in srgb, var(--watch) 18%, var(--bg-elev)); border: 1px solid var(--watch); color: var(--ink); border-radius: var(--radius-sm); padding: 8px 12px; font-size: .88rem; margin: 8px 0; }
.confidence { font-size: .82rem; color: var(--ink-mute); min-height: 1.5em; min-height: 1lh; }

/* buttons + inputs */
/* A button that reads as a link — used where the action is inline in a sentence
   but must not be an <a href="#"> (which does nothing without JS). */
.linklike { font: inherit; color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; }
.linklike:hover { color: var(--ink); }
.btn { display: inline-flex; align-items: center; gap: 8px; font: inherit; font-weight: 700; border-radius: 10px; padding: 10px 16px; border: 1px solid var(--line); background: var(--bg-elev-2); color: var(--ink); cursor: pointer; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn:hover { text-decoration: none; filter: brightness(1.05); }
input[type="text"], input[type="email"], input[type="search"] { font: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); width: 100%; }
label { font-size: .9rem; color: var(--ink-soft); }

/* metric readouts */
.metric { display: flex; flex-direction: column; gap: 2px; }
.metric .value { font-size: 2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.metric .unit { color: var(--ink-mute); font-size: .85rem; }
.metric.southward .value { color: var(--southward); }

/* ad + affiliate + disclosure */
/* An ad slot rests at ZERO — no height, margin, border or label — and only claims
   space once AdSense reports data-ad-status="filled" and the <head> script (see
   headExtras() in build/lib.mjs) stamps [data-filled]. Reserving 100px up front
   meant every unfilled unit pushed real content down and then yanked it back, on
   a page whose whole job is a status readout. Unknown status is treated as empty,
   so a slot that never reports costs nothing. Mirrors the portfolio-wide rule in
   engine/scaffold/assets/components.css; aurorix ships its own CSS, so it needs
   its own copy of the contract. */
.ad-slot { display: block; min-height: 0; margin: 0; padding: 0; border: 0; overflow: hidden; }
.ad-slot .adsbygoogle { display: block; width: 100%; }
.ad-slot .ad-label { display: none; }
.ad-slot[data-filled] { min-height: 100px; margin: 22px 0; border: 1px dashed var(--line); border-radius: var(--radius-sm); }
.ad-slot[data-filled] .ad-label { display: block; font-size: .68rem; color: var(--ink-mute); text-transform: uppercase; letter-spacing: .08em; padding: 4px 8px; }
.ad-slot[data-empty] { display: none; }
.affiliate { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 16px 0; background: var(--bg-elev); }
.affiliate .aff-items { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.ftc { font-size: .8rem; color: var(--ink-mute); margin: 8px 0; }

/* tables (chart fallback) */
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line-soft); }
th { color: var(--ink-soft); font-weight: 600; }
.table-scroll { overflow-x: auto; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* footer */
.site-footer { border-top: 1px solid var(--line); margin-top: 48px; padding: 28px 0; color: var(--ink-mute); font-size: .9rem; }
.site-footer .cols { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.site-footer a { color: var(--ink-soft); }
.sources-block { font-size: .85rem; color: var(--ink-mute); border-top: 1px solid var(--line-soft); padding-top: 12px; margin-top: 20px; }

/* charts */
.chart svg { width: 100%; height: auto; display: block; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .82rem; color: var(--ink-soft); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: middle; background: currentColor; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
