/* ============================================================
   Marathon Ballot - NEWS SECTION  ·  Direction A: "THE WIRE"
   Production component styles. Consumes the existing design
   tokens from styles.css (colors, --font, --mono, spacing,
   motion) - introduces NO new tokens, colours, radii or shadows.
   Load AFTER styles.css.

   Surfaces:
     1. Nav        - NEWS item + live dot, and the WIRE ticker masthead
     2. Homepage   - the "LATEST" wire (3 rows) below the hero
     3. /news      - index: filter bar + lead dispatch + wire log
     4. /news/<slug> - the dispatch reading page
     5. /races/<race> - the "Related news" block (slots into .rsec)
   ============================================================ */

/* ------------------------------------------------------------
   1b · THE WIRE - masthead ticker
   A thin horizontally-scrolling strip under <nav class="nav">,
   inside .wrap. "Bloomberg terminal meets race bib": fixed
   section tag + clock, latest dispatches marquee between them.
   ------------------------------------------------------------ */
.mb-wire {
  display: flex; align-items: center;
  height: 40px;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-mute);
  overflow: hidden;
}
.mb-wire-sec {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 8px;
  padding-right: 16px;
  color: var(--accent); font-weight: 600; white-space: nowrap;
}
.mb-wire-sec .d { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.mb-wire-rule { flex-shrink: 0; width: 1px; align-self: stretch; margin: 9px 0; background: var(--line-strong); }

/* viewport masks the marquee so items fade in/out at both edges */
.mb-wire-vp {
  position: relative; flex: 1; min-width: 0; overflow: hidden; align-self: stretch;
  display: flex; align-items: center;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 28px, #000 calc(100% - 44px), transparent 100%);
          mask-image: linear-gradient(90deg, transparent 0, #000 28px, #000 calc(100% - 44px), transparent 100%);
}
.mb-wire-track {
  display: inline-flex; align-items: center;
  white-space: nowrap; width: max-content;
  padding-left: 20px;
  animation: mb-wire-marquee 46s linear infinite;
  will-change: transform;
}
/* pause when the reader wants to read */
.mb-wire:hover .mb-wire-track,
.mb-wire:focus-within .mb-wire-track { animation-play-state: paused; }
@keyframes mb-wire-marquee { to { transform: translateX(-50%); } }

.mb-wire-item {
  display: inline-flex; align-items: baseline; gap: 9px;
  padding: 0 20px; position: relative; color: var(--ink-mute);
}
/* leading orange tick between dispatches */
.mb-wire-item::before {
  content: ""; position: absolute; left: -2px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 4px; border-radius: 50%; background: var(--accent); opacity: 0.55;
}
.mb-wire-item .t { color: var(--ink); font-variant-numeric: tabular-nums; }
.mb-wire-item .c { color: var(--ink-soft); }
.mb-wire-item .h {
  color: var(--ink); font-family: var(--font); font-size: 12px;
  text-transform: none; letter-spacing: -0.01em;
}
.mb-wire-item .r { color: var(--ink-mute); }
.mb-wire-item:hover .h { color: var(--accent); }

.mb-wire-clock {
  flex-shrink: 0; align-self: stretch; display: inline-flex; align-items: center;
  padding: 0 0 0 16px; margin-left: 4px;
  border-left: 1px solid var(--line-strong);
  color: var(--ink-mute); font-variant-numeric: tabular-nums; white-space: nowrap;
}

/* reduced motion: no marquee - static, manually scrollable, no edge mask */
@media (prefers-reduced-motion: reduce) {
  .mb-wire-track { animation: none; }
  .mb-wire-vp { overflow-x: auto; -webkit-mask-image: none; mask-image: none; }
  .mb-wire-vp::-webkit-scrollbar { display: none; }
}
@media (max-width: 640px) {
  .mb-wire { font-size: 10px; }
  .mb-wire-clock { display: none; }
  .mb-wire-sec { padding-right: 12px; }
}

/* ------------------------------------------------------------
   Shared - category tag, section note
   ------------------------------------------------------------ */
.wire-note {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink-mute);
}
.wire-note a { color: var(--accent); }
.wire-note .mb-wire-clock { border-left: 0; padding: 0; margin: 0; display: inline; color: var(--ink-mute); }

/* ------------------------------------------------------------
   2 + 3 · THE WIRE list  (homepage LATEST, /news log)
   Round 2: uniform rows, time + headline only (no race cell).
   Whole row -> post. Hover borrows the schedule row's orange bar.
   ------------------------------------------------------------ */
.wire { border-top: 1px solid var(--line-strong); }
.wire-row {
  display: grid; grid-template-columns: 132px 1fr; gap: 22px; align-items: center;
  padding: 18px 8px; border-bottom: 1px solid var(--line); position: relative;
  transition: background 180ms ease, padding-left 220ms ease; cursor: pointer;
}
.wire-row::before {
  content: ""; position: absolute; left: -8px; top: 50%; height: 0; width: 2px;
  background: var(--accent); transform: translateY(-50%); transition: height 220ms ease;
}
.wire-row:hover { background: var(--bg-2); padding-left: 16px; }
.wire-row:hover::before { height: 64%; }
.wire-time {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.06em;
  color: var(--ink-mute); font-variant-numeric: tabular-nums;
  display: flex; align-items: center; gap: 8px;
}
.wire-time .d { color: var(--ink); }
.wire-time .live { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.wire-head { font-size: 17px; font-weight: 500; letter-spacing: -0.01em; line-height: 1.25; color: var(--ink); }

@media (max-width: 720px) {
  .wire-row { grid-template-columns: 1fr; gap: 4px; padding: 16px 4px; }
  .wire-row:hover { padding-left: 4px; }
  .wire-head { font-size: 16px; }
}

/* ------------------------------------------------------------
   3 · /news INDEX - tools-hub hero band
   Shares the .hero/.eb/.tools-h1/.globe-wrap pattern from tools.css
   (loaded on every news page): bordered band, eyebrow + big split
   title, globe faded on the right. .news-band aliases the --t-*
   tokens those shared rules read, so the band stays theme-aware
   through the site palette. Race archives carry the band too, minus
   the globe.
   ------------------------------------------------------------ */
.news-band {
  --t-line: var(--line);
  --t-line-strong: var(--line-strong);
  --t-sub: var(--ink-mute);
  --t-ghost: var(--ink-faint);
}
/* .hero.news-band beats tools.css .hero .hin (equal-specificity, later file) */
.hero.news-band .hin { padding: 76px 0 68px; }
.news-band .tools-h1 { font-size: clamp(40px, 4.6vw, 64px); margin-bottom: 0; }
.news-band .sub { margin-top: 18px; }
/* padding-block only: the shorthand would zero the .wrap gutters on mobile */
.news-feed { padding-block: 40px 56px; }
/* Globe: relocatable #globe-stage (view-transition-name: mb-globe), same fade
   treatment as the tools hub: mask + opacity on the stage itself so they ride
   inside the view-transition snapshot. news.js fills #globe at 620. */
.news-band .globe-wrap { opacity: 1; -webkit-mask-image: none; mask-image: none; }
section[data-route="news"] .globe-stage {
  width: 620px; height: 620px; aspect-ratio: auto;
  pointer-events: none; cursor: default; transition: none;
  opacity: 0.6;
  -webkit-mask-image: radial-gradient(closest-side, #000 45%, transparent 96%);
  mask-image: radial-gradient(closest-side, #000 45%, transparent 96%);
}
section[data-route="news"] .globe-stage .whirl,
section[data-route="news"] .globe-stage .orbit { display: none; }
/* Radar "ping" on the news globe markers only (home/simulator keep the subtle 3x
   pulse). non-scaling-stroke keeps the ring a crisp 1px line as it expands, so it
   reads as a clean radar sweep, not a fat donut. Moderate 5x reach. globe.js staggers
   each marker's animationDelay, so the pings ripple around the globe. */
@keyframes news-marker-scan {
  0%   { transform: scale(1);   opacity: 0; }
  22%  { opacity: 0.7; }
  100% { transform: scale(5);   opacity: 0; }
}
section[data-route="news"] .marker-ring {
  animation-name: news-marker-scan;
  animation-duration: 2.6s;
  animation-timing-function: cubic-bezier(.15,.6,.3,1);
  vector-effect: non-scaling-stroke;
  stroke-width: 1.3;
}
/* Mirrors the tools-hub mobile treatment: band tightens, globe shrinks + fades
   further right instead of disappearing. Globe rules ride the hamburger
   breakpoint (900), the band sizing stays at 720. */
@media (max-width: 900px) {
  .news-band .globe-wrap { right: -140px; }
  section[data-route="news"] .globe-stage { width: 440px; height: 440px; opacity: 0.4; }
}
@media (max-width: 720px) {
  .hero.news-band .hin { padding: 52px 0 56px; }
  .news-band .tools-h1 { font-size: 36px; }
}

/* defensive empty state for a filtered log with no posts */
.news-empty {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-mute); padding: 40px 8px; border-top: 1px solid var(--line-strong);
}

/* ------------------------------------------------------------
   4 · /news/<slug> - the dispatch reading page
   Fixed metadata rail (filing header) + a tight-measure body.
   ------------------------------------------------------------ */
.dsp { display: grid; grid-template-columns: 210px 1fr; gap: 60px; align-items: start; }
.dsp-rail { border-top: 1px solid var(--ink); }
.dsp-rail .m { padding: 12px 0; border-bottom: 1px solid var(--line); }
.dsp-rail .m .k { font-family: var(--mono); font-size: 9px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-mute); }
.dsp-rail .m .v { font-size: 14px; margin-top: 4px; color: var(--ink); font-weight: 500; }
.dsp-rail .m .v.accent { color: var(--accent); }
.dsp-body { min-width: 0; max-width: 64ch; }
.dsp-slug { font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-mute); }
.dsp-slug .br { color: var(--accent); }
.dsp-body h1 { font-size: clamp(28px, 3.4vw, 44px); font-weight: 700; letter-spacing: -0.025em; line-height: 1.04; margin: 12px 0 20px; text-wrap: balance; color: var(--ink); }
.dsp-body h2 { font-size: 21px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; margin: 30px 0 12px; color: var(--ink); }
.dsp-body p { font-size: 16px; line-height: 1.7; color: var(--ink-soft); margin: 0 0 18px; }
.dsp-body p.lead { font-size: 19px; line-height: 1.55; color: var(--ink); }
.dsp-body p strong, .dsp-body li strong { color: var(--ink); font-weight: 600; }
.dsp-body a { color: var(--accent); border-bottom: 1px solid var(--line-strong); }
.dsp-body a:hover { border-color: var(--accent); }
.dsp-body ul { margin: 0 0 18px; padding-left: 20px; }
.dsp-body li { font-size: 16px; line-height: 1.7; color: var(--ink-soft); margin: 0 0 6px; }
.dsp-body .news-end { margin: 26px 0; }
@media (max-width: 760px) {
  .dsp { grid-template-columns: 1fr; gap: 24px; }
  .dsp-rail { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
}

/* end block "Countdown" - one merged block per post, replaces the legacy
   .relrace card and .soft-cta band. Selectors carry .news-end so they win
   over the .dsp-body a / .dsp-body p article rules. */
.news-end {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 32px;
  padding: 26px 28px;
  border: 1px solid var(--line-strong);
}
.news-end.no-num { grid-template-columns: 1fr auto; }
.news-end .ne-num {
  font-size: 64px; font-weight: 700; letter-spacing: -0.03em; line-height: 0.9;
  font-variant-numeric: tabular-nums; color: var(--ink);
}
.news-end .ne-num small {
  display: block; font-family: var(--mono); font-size: 10px; font-weight: 400;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-mute); margin-top: 10px;
}
.news-end .ne-k {
  display: block; font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-mute); margin-bottom: 7px;
}
.news-end .ne-name {
  font-size: 22px; font-weight: 600; letter-spacing: -0.015em; color: var(--ink);
  text-decoration: none; border-bottom: 0;
  transition: color var(--dur-base) var(--ease-snap);
}
.news-end .ne-name:hover,
.news-end .ne-name:focus-visible { color: var(--accent); outline: none; }
.news-end .ne-cp { font-size: 15px; line-height: 1.45; color: var(--ink-soft); max-width: 34ch; margin: 7px 0 0; }
/* Orange Lead primary: accent bg, ink text, hover fills cream. */
.news-end .ne-btn {
  display: inline-flex; align-items: center; gap: 9px;
  background: var(--accent); color: #1a0f06;
  border: 1px solid var(--accent); border-radius: 2px;
  font: 600 15px/1 var(--font); letter-spacing: -0.005em;
  padding: 13px 22px; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition:
    background var(--dur-base) var(--ease-snap),
    color var(--dur-base) var(--ease-snap),
    border-color var(--dur-base) var(--ease-snap);
}
.news-end .ne-btn:hover,
.news-end .ne-btn:focus-visible {
  background: #f6efe6; border-color: #f6efe6; color: #1a0f06; outline: none;
}
.news-end .ne-bell { width: 16px; height: 16px; flex-shrink: 0; display: block; }
@media (max-width: 640px) {
  .news-end, .news-end.no-num { grid-template-columns: 1fr; gap: 20px; padding: 22px; }
  .news-end .ne-num { font-size: 52px; }
  .news-end .ne-btn { justify-content: center; }
}

/* sources line - closes every post */
.sources {
  margin-top: 30px; padding-top: 16px; border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; color: var(--ink-mute); line-height: 1.75;
}
.sources .lbl { color: var(--accent); letter-spacing: 0.14em; text-transform: uppercase; margin-right: 8px; }
.sources a { color: var(--ink-soft); border-bottom: 1px solid var(--line-strong); }
.sources a:hover { color: var(--accent); border-color: var(--accent); }

/* ------------------------------------------------------------
   5 · /races/<race> - "Related news" block
   Slots into the race page's .rsec rhythm (220px label + content).
   Compact wire rows, same label voice as climate / ballot history.
   ------------------------------------------------------------ */
.race-news { border-top: 1px solid var(--line-strong); }
.rn-row {
  display: grid; grid-template-columns: 96px 1fr auto; gap: 18px; align-items: center;
  padding: 16px 6px; border-bottom: 1px solid var(--line); position: relative;
  transition: background 180ms ease, padding-left 200ms ease; cursor: pointer;
}
.rn-row::before {
  content: ""; position: absolute; left: -6px; top: 50%; height: 0; width: 2px;
  background: var(--accent); transform: translateY(-50%); transition: height 200ms ease;
}
.rn-row:hover { background: var(--bg-2); padding-left: 12px; }
.rn-row:hover::before { height: 60%; }
.rn-date { font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; color: var(--ink-mute); font-variant-numeric: tabular-nums; }
.rn-cat { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft); }
.rn-head { font-size: 15px; font-weight: 500; letter-spacing: -0.005em; line-height: 1.3; color: var(--ink); }
.rn-arrow { color: var(--ink-mute); justify-self: end; transition: transform 160ms ease, color 160ms ease; }
.rn-row:hover .rn-arrow { color: var(--accent); transform: translateX(3px); }
.race-news-all {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 16px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent);
}
.race-news-all .arrow { transition: transform 160ms ease; }
.race-news-all:hover .arrow { transform: translateX(4px); }
@media (max-width: 720px) {
  .rn-row { grid-template-columns: 1fr auto; gap: 4px 12px; padding: 14px 2px; }
  .rn-row:hover { padding-left: 2px; }
  .rn-date { order: 1; }
  .rn-head { order: 2; grid-column: 1 / -1; }
  .rn-arrow { display: none; }
}
