/* ============================================================================
   THE BROADCAST — Luke Spooner
   Palette, type scale and layout carried from the original casting
   (commons/basket/The Broadcast (2).html, 2026-07-17).

   One visual world, deliberately: this is a dark instrument panel, not a
   theme-switching document. Every colour is painted explicitly so the page
   holds on any host ground.
   ============================================================================ */

:root {
  /* ground and structure */
  --ground:      #12151c;
  --card:        #1a1f29;
  --card-hi:     #1f2530;
  --rule:        #2a3140;
  --rule-soft:   #232937;
  --dash:        #6b7a99;

  /* ink */
  --cream:       #e8e4d8;
  --body:        #c9c5b8;
  --muted:       #8b8878;
  --faint:       #6a6a60;

  /* node types — carried verbatim from the casting's C map */
  --thesis:      #e0c56a;
  --charter:     #7fb4d9;
  --artifact:    #9d7bd8;
  --paper:       #d4af37;
  --dispatch:    #5cb87a;
  --door:        #d08770;

  --gold:        #e0c56a;
  --blue:        #7fb4d9;

  /* live-instrument semantics — separate from the accent hues above */
  --live:        #5cb87a;
  --live-dim:    #2f5f42;
  --warn:        #e0c56a;
  --cold:        #d08770;
  --dark-ink:    #6b7a99;

  --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;

  --maxw: 940px;
  --maxw-wide: 1140px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--ground);
  color: var(--body);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

h1, h2, h3, h4 {
  font-family: var(--mono);
  color: var(--cream);
  text-wrap: balance;
  margin: 0;
}

/* ─────────────────────────────── header ─────────────────────────────── */

header.top {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(18, 21, 28, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 13px 28px;
  flex-wrap: wrap;
}

.brand {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: 0.08em;
  color: var(--cream);
  white-space: nowrap;
}
.brand .dot { color: var(--gold); }

nav.main {
  display: flex;
  gap: 17px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.03em;
}
nav.main a { color: var(--muted); padding: 2px 0; border-bottom: 1px solid transparent; }
nav.main a:hover { color: var(--cream); }
nav.main a.on { color: var(--cream); border-bottom-color: var(--gold); }

/* the live pulse in the header — the hive's heartbeat, always on screen */
.pulse {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--muted);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 4px 10px;
  white-space: nowrap;
}
.pulse .led {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--dark-ink);
  box-shadow: 0 0 0 0 rgba(92, 184, 122, 0.6);
  flex: none;
}
.pulse.is-live .led { background: var(--live); animation: beat 2.4s ease-out infinite; }
.pulse.is-live { color: var(--body); border-color: var(--live-dim); }
.pulse.is-stale .led { background: var(--warn); }
.pulse.is-stale { color: var(--warn); border-color: #4a4326; }
.pulse.is-dark .led { background: transparent; border: 1px dashed var(--dash); }

@keyframes beat {
  0%   { box-shadow: 0 0 0 0 rgba(92,184,122,0.55); }
  70%  { box-shadow: 0 0 0 7px rgba(92,184,122,0); }
  100% { box-shadow: 0 0 0 0 rgba(92,184,122,0); }
}
@media (prefers-reduced-motion: reduce) {
  .pulse.is-live .led { animation: none; }
  * { scroll-behavior: auto !important; }
}

/* ─────────────────────────────── layout ─────────────────────────────── */

main { min-height: 70vh; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 66px 28px 96px; }
.wrap.wide { max-width: var(--maxw-wide); }

.eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.22em;
  color: var(--gold);
  margin-bottom: 18px;
  text-transform: uppercase;
}

h1.display {
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(2.4rem, 6vw, 4rem);
  line-height: 1.02;
  letter-spacing: 0.01em;
  margin: 0 0 26px;
  color: var(--cream);
}

h2.screen {
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(1.5rem, 3.4vw, 2.1rem);
  letter-spacing: 0.02em;
  margin: 0 0 14px;
  color: var(--cream);
}

.lede {
  font-size: clamp(1.12rem, 2.3vw, 1.55rem);
  line-height: 1.5;
  max-width: 760px;
  margin: 0 0 16px;
  color: var(--cream);
}
.sub { font-size: 1.03rem; color: var(--muted); max-width: 680px; margin: 0 0 48px; }

.section-rule {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 54px 0 30px;
}

.kicker {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.16em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 16px;
}

/* ──────────────────────────────── cards ─────────────────────────────── */

.card {
  display: block;
  background: var(--card);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--muted);
  border-radius: 3px;
  padding: 22px 24px;
  color: inherit;
  transition: border-color 140ms ease, background 140ms ease;
}
a.card:hover { background: var(--card-hi); }
.card h3 {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: 0.04em;
  color: var(--cream);
}
.card p { margin: 0; color: var(--body); font-size: 1rem; }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

/* status badges — the casting's own three-tier rule */
.badge {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  padding: 3px 10px;
  border-radius: 2px;
  white-space: nowrap;
}
.badge.solid   { background: var(--cream); color: var(--ground); border: 1px solid var(--cream); }
.badge.outline { background: transparent; color: var(--cream); border: 1px solid var(--muted); }
.badge.ghost   { background: transparent; color: var(--muted); border: 1px dashed var(--dash); }

.type-tag {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ───────────────────────── the live instrument ──────────────────────── */
/* Everything in here obeys the fog law: a number that was not measured
   renders as DARK, never as zero, and every reading carries its age. */

.inst {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 18px 20px;
}
.inst .label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.inst .value {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.9rem;
  line-height: 1.1;
  color: var(--cream);
  font-variant-numeric: tabular-nums;
}
.inst .value .unit { font-size: 0.9rem; font-weight: 400; color: var(--muted); margin-left: 4px; }
.inst .age {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--faint);
  margin-top: 7px;
  font-variant-numeric: tabular-nums;
}

/* the dark chip: what an unmeasured value looks like. It must never be a 0. */
.dark-chip {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.86rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--dark-ink);
  border: 1px dashed var(--dash);
  border-radius: 2px;
  padding: 3px 10px;
}

.inst.is-dark .value { color: var(--dark-ink); }

/* severity stripes for live rows */
.row-live { border-left: 3px solid var(--live); }
.row-warn { border-left: 3px solid var(--warn); }
.row-cold { border-left: 3px solid var(--cold); }
.row-dark { border-left: 3px dashed var(--dash); }

table.ledger {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 13px;
}
table.ledger th {
  text-align: left;
  font-weight: 500;
  font-size: 10.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--rule);
  padding: 8px 12px 8px 0;
}
table.ledger td {
  padding: 10px 12px 10px 0;
  border-bottom: 1px solid var(--rule-soft);
  color: var(--body);
  vertical-align: top;
}
table.ledger td.num { font-variant-numeric: tabular-nums; text-align: right; padding-right: 18px; }
.scroll-x { overflow-x: auto; }

/* dam / door list */
.dam {
  display: flex;
  gap: 14px;
  align-items: baseline;
  padding: 13px 16px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--cold);
  border-radius: 3px;
}
.dam .key {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--gold);
  white-space: nowrap;
}
.dam .what { flex: 1; font-size: 0.97rem; color: var(--body); }
.dam .waited {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* prose blocks on detail pages */
.prose p { color: var(--body); margin: 0 0 14px; }
.prose h3 {
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  margin: 30px 0 12px;
}
.prose ul { margin: 0 0 14px; padding-left: 20px; color: var(--body); }
.prose li { margin-bottom: 8px; }

.edge-line {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  padding: 7px 0;
  border-bottom: 1px solid var(--rule-soft);
}
.edge-line .rel { color: var(--faint); }
.edge-line a { color: var(--blue); }

.back {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--muted);
  display: inline-block;
  margin-bottom: 26px;
}
.back:hover { color: var(--cream); }

.filter-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; }
.chip {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  padding: 5px 11px;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.chip:hover { color: var(--cream); border-color: var(--muted); }
.chip.on { color: var(--ground); background: var(--cream); border-color: var(--cream); }

footer.bot {
  border-top: 1px solid var(--rule);
  padding: 30px 28px 46px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.8;
  text-align: center;
}
footer.bot a { color: var(--muted); }
footer.bot a:hover { color: var(--cream); }

.loop-line {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--body);
  padding: 11px 0 11px 16px;
  border-left: 2px solid var(--rule);
}
.loop-line:hover { border-left-color: var(--gold); }

@media (max-width: 640px) {
  header.top { padding: 11px 16px; gap: 12px; }
  .wrap { padding: 44px 18px 72px; }
  body { font-size: 16px; }
  nav.main { gap: 13px; font-size: 11.5px; }
}
