/* ============================================================
   World Wide Vibes — timeline-first emotional climate observatory
   Cinematic emotional weather. 70% timeline / 30% Earth.
   ============================================================ */

:root {
  color-scheme: dark;

  --bg: #04060c;
  --bg-2: #070b15;
  --ink: #eef2fb;
  --ink-dim: #9aa3ba;
  --ink-faint: #5f6a82;
  --line: rgba(255, 255, 255, 0.08);
  --line-soft: rgba(255, 255, 255, 0.05);
  --glass: rgba(11, 16, 27, 0.55);
  --glass-strong: rgba(9, 13, 23, 0.74);
  --glass-rim: rgba(255, 255, 255, 0.10);

  --pos: #4fe3b0;
  --pos-bright: #74ffcf;
  --blue: #6ba6ff;
  --violet: #927eff;
  --cyan: #5ad7ff;
  --neg: #ff6f6f;
  --amber: #ffb15b;
  --orange: #ff6a3d;

  --serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", monospace;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --rail-w: 282px;
  --topbar-h: 64px;
  --ticker-h: 140px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

button { font-family: inherit; cursor: pointer; }
h1, h2, h3 { margin: 0; font-weight: 400; }
.serif { font-family: var(--serif); font-weight: 400; letter-spacing: 0.01em; }

.eyebrow {
  margin: 0;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ----------------------------------------------------------------
   Stage + background layers
   ---------------------------------------------------------------- */
.stage {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(1200px 700px at 72% -8%, rgba(36, 60, 110, 0.28), transparent 60%),
    radial-gradient(900px 600px at 8% 4%, rgba(60, 40, 110, 0.18), transparent 60%),
    linear-gradient(180deg, #05080f 0%, #04060c 46%, #03040a 100%);
  overflow: hidden;
}

.starfield {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.85;
}

/* ---------------- Earth arc (large, prominent — region glows red for the selected event) ---------------- */
.earth-layer {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

/* WebGL baked globe — fills the layer; draggable on exposed arc areas */
.earth-gl {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: auto;
  display: none;
}
.earth-layer.gl-active .earth-gl { display: block; }
.earth-layer.gl-active .earth-sphere,
.earth-layer.gl-active .earth-atmosphere,
.earth-layer.gl-active .earth-terminator { display: none !important; }

.earth-sphere {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: min(1820px, 172vw);
  aspect-ratio: 1 / 1;
  transform: translate(-50%, 63%);
  border-radius: 50%;
  background-image: url("./assets/earth-night.jpg");
  background-size: cover;
  background-position: 74% 24%;
  transition: background-position 1.6s var(--ease);
  box-shadow:
    inset 0 0 180px 30px rgba(2, 5, 12, 0.62),
    inset 0 22px 120px 0 rgba(0, 0, 0, 0.55),
    inset 0 -40px 200px 60px rgba(0, 0, 0, 0.9);
  filter: saturate(1.04) contrast(1.04) brightness(0.94);
}
.earth-sphere::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(120% 90% at 42% 6%, rgba(150, 205, 255, 0.22) 0%, rgba(120, 180, 255, 0.06) 18%, transparent 38%);
  mix-blend-mode: screen;
}
.earth-sphere::after { display: none; }

.earth-atmosphere {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: min(1980px, 188vw);
  aspect-ratio: 1 / 1;
  transform: translate(-50%, 63%);
  border-radius: 50%;
  background: radial-gradient(closest-side,
    transparent 70%,
    rgba(72, 168, 255, 0.10) 88%,
    rgba(96, 220, 255, 0.20) 95%,
    transparent 100%);
  filter: blur(8px);
  display: block;
}
.earth-terminator {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: min(1830px, 172.4vw);
  aspect-ratio: 1 / 1;
  transform: translate(-50%, 63%);
  border-radius: 50%;
  box-shadow: 0 0 60px 2px rgba(110, 200, 255, 0.18), inset 0 1px 0 rgba(180, 225, 255, 0.18);
  display: block;
}
.earth-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(150% 120% at 50% 120%, transparent 52%, rgba(2, 4, 10, 0.55) 100%);
  display: block;
}

/* selected-region glow on the big earth arc — color set by JS based on dominant emotion */
.region-glow {
  position: absolute;
  left: 56%;
  top: 82%;
  width: 0;
  height: 0;
  transition: left 0.7s var(--ease), top 0.7s var(--ease);
  --region-hue: 0; /* JS sets this hue per dominant emotion */
  --region-color-a: rgba(255, 90, 90, 0.55);
  --region-color-b: rgba(220, 60, 60, 0.18);
  --region-ring-color: rgba(255, 110, 110, 0.7);
}
.region-glow.pos {
  --region-color-a: rgba(116, 255, 207, 0.55);
  --region-color-b: rgba(60, 220, 180, 0.18);
  --region-ring-color: rgba(116, 255, 207, 0.7);
}
.region-core {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 230px;
  height: 150px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--region-color-a), var(--region-color-b) 45%, transparent 72%);
  filter: blur(6px);
}
.region-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 26px;
  height: 26px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1.5px solid var(--region-ring-color);
  animation: regionPulse 3.4s var(--ease) infinite;
}
.region-ring.delay { animation-delay: 1.7s; }
@keyframes regionPulse {
  0%   { width: 18px; height: 12px; opacity: 0.9; }
  100% { width: 220px; height: 140px; opacity: 0; }
}

/* ---------------- FX beam overlay (retired in small-globe layout) ---------------- */
.fx-layer { display: none; }

/* ----------------------------------------------------------------
   Glass card base
   ---------------------------------------------------------------- */
.card {
  background: linear-gradient(180deg, var(--glass-strong), var(--glass));
  backdrop-filter: blur(20px) saturate(125%);
  -webkit-backdrop-filter: blur(20px) saturate(125%);
  border: 1px solid var(--glass-rim);
  border-radius: 16px;
  box-shadow:
    0 28px 64px -26px rgba(0, 0, 0, 0.85),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* ----------------------------------------------------------------
   Top navigation
   ---------------------------------------------------------------- */
.topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 26px;
  background: linear-gradient(180deg, rgba(4, 7, 14, 0.86), rgba(4, 7, 14, 0.18));
  border-bottom: 1px solid var(--line-soft);
}
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  flex: 0 0 auto;
  color: var(--ink); /* explicit — was inheriting browser default link lavender */
}
.brand:visited, .brand:hover, .brand:focus { color: var(--ink); }
.brand-adverb {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0.13em;
  color: var(--ink);
}
.brand-adverb .plus { color: var(--orange); margin: 0 0.5px; }
.brand-divider { width: 1px; height: 18px; background: var(--line); }
.brand-vibescore {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--pos);
}

.topsearch {
  flex: 1 1 auto;
  max-width: 660px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease);
}
.topsearch:focus-within { border-color: rgba(116, 255, 207, 0.4); background: rgba(255, 255, 255, 0.05); }
.search-icon { width: 16px; height: 16px; color: var(--ink-faint); flex: 0 0 auto; }
.topsearch input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--ink);
  font-family: inherit; /* was rendering in Arial — form inputs don't inherit body font */
  font-size: 13.5px;
  letter-spacing: 0.01em;
}
.topsearch input::placeholder { color: var(--ink-faint); }

.top-actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--ink-dim);
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn:hover { color: var(--ink); background: rgba(255, 255, 255, 0.05); border-color: var(--line); }

.brief-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 38px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-rim);
  border-radius: 10px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  transition: background 0.2s, border-color 0.2s, transform 0.2s var(--ease);
}
.brief-btn svg { width: 17px; height: 17px; }
.brief-btn:hover { background: rgba(116, 255, 207, 0.12); border-color: rgba(116, 255, 207, 0.4); }
.brief-btn:active { transform: translateY(1px); }

/* ----------------------------------------------------------------
   Left control rail
   ---------------------------------------------------------------- */
.rail {
  position: absolute;
  top: var(--topbar-h);
  left: 0;
  bottom: var(--ticker-h);
  z-index: 20;
  width: var(--rail-w);
  padding: 26px 24px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}
.rail-top { display: flex; flex-direction: column; }
.subject-name {
  font-family: var(--serif);
  font-size: 39px;
  line-height: 0.98;
  margin: 8px 0 0;
  color: var(--ink);
}
.live-line {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 14px 0 0;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  color: var(--pos);
}
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--pos);
  box-shadow: 0 0 0 0 rgba(116, 255, 207, 0.6);
  animation: livePulse 2.6s ease-out infinite;
}
@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(116, 255, 207, 0.55); }
  70%, 100% { box-shadow: 0 0 0 8px rgba(116, 255, 207, 0); }
}
.subject-tagline {
  margin: 16px 0 0;
  max-width: 220px;
  font-weight: 300;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--ink-dim);
}
.live-line.archive { color: var(--ink-faint); }
.live-line.archive .live-dot { background: var(--ink-faint); animation: none; box-shadow: none; }
.live-line.stale { color: var(--amber); }
.live-line.stale .live-dot { background: var(--amber); animation: none; box-shadow: 0 0 8px rgba(255, 177, 91, 0.5); }

.lens-switch {
  display: inline-flex;
  margin-top: 18px;
  padding: 3px;
  gap: 2px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.lens-pill {
  padding: 7px 15px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-dim);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: background 0.25s var(--ease), color 0.25s var(--ease);
}
.lens-pill.is-active { background: rgba(116, 255, 207, 0.14); color: var(--pos-bright); }
.lens-pill:not(.is-active):hover { color: var(--ink); }

.freshness {
  margin: 14px 0 0;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  line-height: 1.5;
  color: var(--ink-faint);
}

.rail-field { margin-top: 22px; }
.rail-field .eyebrow { margin-bottom: 8px; }
.field-control {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 13px;
  background: rgba(255, 255, 255, 0.028);
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--ink);
  font-size: 13px;
  letter-spacing: 0.01em;
  transition: border-color 0.2s, background 0.2s;
}
.field-control svg { width: 16px; height: 16px; color: var(--ink-faint); flex: 0 0 auto; }
.field-control:hover { border-color: var(--glass-rim); background: rgba(255, 255, 255, 0.05); }

.save-view {
  margin-top: 26px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 14px;
  background: transparent;
  border: 1px solid var(--glass-rim);
  border-radius: 11px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  transition: background 0.2s, border-color 0.2s;
}
.save-view svg { width: 16px; height: 16px; }
.save-view:hover { background: rgba(255, 255, 255, 0.05); border-color: rgba(116, 255, 207, 0.35); }

/* regional impact card (foot of rail) */
.regional-impact { padding: 18px 20px 20px; }
.regional-impact .eyebrow { color: var(--ink-dim); }
.ri-region, #riRegion {
  font-family: var(--serif);
  font-size: 26px;
  margin: 8px 0 0;
  color: var(--ink);
}
.ri-sub { margin: 16px 0 2px; font-size: 11.5px; color: var(--ink-faint); }
.ri-score {
  font-family: var(--serif);
  font-size: 46px;
  line-height: 1;
  margin: 2px 0 0;
}
.ri-score.pos { color: var(--pos-bright); }
.ri-score.neg { color: var(--neg); }
.ri-delta { margin: 10px 0 0; font-size: 12px; color: var(--ink-dim); }
.ri-delta .arrow { color: var(--pos); margin-right: 3px; }
.ri-delta.down .arrow { color: var(--neg); }

.ghost-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  margin-top: 18px;
  padding: 11px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  transition: background 0.2s, border-color 0.2s;
}
.ghost-btn svg { width: 15px; height: 15px; color: var(--ink-dim); flex: 0 0 auto; }
.ghost-btn:hover { background: rgba(255, 255, 255, 0.06); border-color: var(--glass-rim); }
.ghost-btn.wide { margin-top: 14px; }

/* ----------------------------------------------------------------
   Timeline hero
   ---------------------------------------------------------------- */
.timeline-region {
  position: absolute;
  top: var(--topbar-h);
  left: var(--rail-w);
  right: 348px;                 /* leave room for the single readout column */
  height: calc(60vh - var(--topbar-h));
  min-height: 340px;
  z-index: 12;
  padding: 20px 38px 0 14px;
  display: flex;
  flex-direction: column;
}
.tl-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  flex: 0 0 auto;
}
.tl-title-line { display: flex; align-items: center; gap: 9px; }
.tl-title h2 {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.22em;
  color: var(--ink);
}
.tl-sub { margin: 6px 0 0; font-size: 13px; color: var(--ink-dim); font-weight: 300; }
.info-dot {
  width: 18px; height: 18px; padding: 0;
  display: grid; place-items: center;
  background: none; border: none; color: var(--ink-faint);
}
.info-dot svg { width: 16px; height: 16px; }
.info-dot:hover { color: var(--ink-dim); }

.tl-tools { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; justify-content: flex-end; }
.scale-legend { text-align: left; }
.scale-row { display: flex; align-items: center; gap: 9px; margin-top: 8px; }
.scale-min, .scale-max { font-family: var(--mono); font-size: 10px; color: var(--ink-faint); }
.scale-bar {
  width: 168px; height: 5px; border-radius: 3px;
  background: linear-gradient(90deg, rgba(116, 255, 207, 0.12) 0%, rgba(90, 215, 255, 0.45) 50%, #74ffcf 100%);
  box-shadow: 0 0 12px rgba(116, 255, 207, 0.18);
}
.scale-zero { display: block; text-align: center; margin-top: 3px; font-family: var(--mono); font-size: 9.5px; color: var(--ink-faint); }

.confidence-toggle .eyebrow { margin-bottom: 8px; }
.conf-control {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 13px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink); font-size: 12.5px;
  transition: border-color 0.2s, background 0.2s;
}
.conf-control svg { width: 15px; height: 15px; color: var(--ink-faint); }
.conf-control:hover { border-color: var(--glass-rim); }
.conf-control.off { color: var(--ink-faint); }

.chart {
  position: relative; flex: 1 1 auto; min-height: 0; margin-top: 6px;
  overflow-x: auto; overflow-y: hidden;            /* scroll through days */
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}
.chart::-webkit-scrollbar { height: 8px; }
.chart::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.16); border-radius: 4px; }
.chart::-webkit-scrollbar-track { background: transparent; }
.chart svg { display: block; height: 100%; overflow: visible; }   /* width = content (set per render) */
.day-line { stroke: rgba(255, 255, 255, 0.035); stroke-width: 1; }
#chartYAxis { pointer-events: none; }

/* "Ages of Feeling" — era bands + the floating age readout (history lens) */
.age-band { opacity: 0.06; }
.age-divider { stroke: rgba(255, 255, 255, 0.12); stroke-width: 1; stroke-dasharray: 2 5; }
.age-name { font-family: var(--mono); font-size: 10px; letter-spacing: 0.18em; fill: var(--ink-faint); }
.age-readout {
  position: absolute;
  left: 52px; bottom: 16px;
  z-index: 9;
  max-width: 290px;
  padding: 11px 15px;
  border-left: 2px solid rgba(255, 255, 255, 0.28);
  background: linear-gradient(90deg, rgba(8, 12, 22, 0.86), rgba(8, 12, 22, 0.32));
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-radius: 4px;
  opacity: 0; transform: translateY(6px);
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
  pointer-events: none;
}
.age-readout.show { opacity: 1; transform: translateY(0); }
.age-r-head { margin: 0; display: flex; align-items: baseline; gap: 9px; }
.age-r-name { font-family: var(--serif); font-size: 20px; color: var(--ink); }
.age-r-range { font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; color: var(--ink-faint); }
.age-r-char { margin: 4px 0 0; font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-dim); }
.age-r-lesson { margin: 8px 0 0; font-size: 12.5px; font-weight: 300; line-height: 1.45; color: var(--ink-dim); }

/* chart svg element classes (created in app.js) */
.grid-line { stroke: rgba(255, 255, 255, 0.05); stroke-width: 1; }
.grid-line.zero { stroke: rgba(255, 255, 255, 0.12); stroke-dasharray: 2 4; }
.y-label, .x-label {
  font-family: var(--mono); font-size: 10px; fill: var(--ink-faint); letter-spacing: 0.04em;
}
.x-label.sel { fill: var(--ink); font-weight: 500; }
.conf-band { fill: url(#bandGrad); opacity: 0.5; transition: opacity 0.3s var(--ease); }
.vibe-line { fill: none; stroke: url(#lineGrad); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; filter: url(#lineGlow); }
.marker-stem { stroke: rgba(255, 255, 255, 0.16); stroke-width: 1; stroke-dasharray: 2 3; }
.marker-dot { fill: var(--bg); stroke: var(--ink-dim); stroke-width: 1.5; cursor: pointer; transition: stroke 0.2s; }
.marker-dot:hover { stroke: var(--pos); }
.marker-label-date { font-family: var(--mono); font-size: 9px; fill: var(--ink-faint); letter-spacing: 0.08em; }
.marker-label-title { font-family: var(--sans); font-size: 12px; fill: var(--ink-dim); }
.marker-hit { fill: transparent; cursor: pointer; }
.marker-hit:hover + .marker-grp .marker-label-title,
.marker-grp:hover .marker-label-title { fill: var(--ink); }
.sel-tick-ring { fill: none; stroke: var(--pos-bright); stroke-width: 2; }
.sel-tick-core { fill: var(--pos-bright); filter: drop-shadow(0 0 8px rgba(116, 255, 207, 0.9)); }
.sel-box { fill: rgba(9, 14, 24, 0.86); stroke: rgba(116, 255, 207, 0.5); stroke-width: 1; }
.sel-box-date { font-family: var(--mono); font-size: 9.5px; fill: var(--ink-dim); letter-spacing: 0.1em; }
.sel-box-title { font-family: var(--serif); font-size: 16px; fill: var(--ink); }

/* ---------------- Constellation timeline ---------------- */
.dotgrid .grid-dot { fill: rgba(255, 255, 255, 0.045); }
.stars .star { opacity: 0.92; transition: opacity 0.4s var(--ease); }
.stars .star.soft { opacity: 0.6; }            /* dense "moment" stars sit quieter */
.chart:hover .stars .star.soft { opacity: 0.78; }
.marker-halo { opacity: 0.20; }
.marker-grp:hover .marker-halo { opacity: 0.34; }

/* viewpoint (temporal-scale) switcher — instrument register */
.viewpoint-switch { text-align: left; }
.vp-pills {
  display: inline-flex;
  gap: 3px;
  margin-top: 8px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.025);
}
.vp-pill {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  background: transparent;
  border: 0;
  padding: 5px 11px;
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}
.vp-pill:hover:not(:disabled) { color: var(--ink-dim); }
.vp-pill.is-active {            /* match the app's lens-pill control idiom */
  color: var(--pos-bright);
  background: rgba(116, 255, 207, 0.14);
}
.vp-pill:disabled { opacity: 0.3; cursor: not-allowed; }

/* ---------------- floating insight card ---------------- */
.insight-card {
  position: fixed;
  z-index: 16;
  right: 34px;
  top: 150px;
  left: auto;
  width: 300px;
  padding: 18px 20px 16px;
  background: linear-gradient(180deg, var(--glass-strong), var(--glass));
  backdrop-filter: blur(22px) saturate(125%);
  -webkit-backdrop-filter: blur(22px) saturate(125%);
  border: 1px solid var(--glass-rim);
  border-radius: 16px;
  box-shadow: 0 30px 70px -28px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.45s var(--ease), transform 0.45s var(--ease), left 0.5s var(--ease), top 0.5s var(--ease);
  pointer-events: none;
}
.insight-card.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.insight-meta {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 12px;
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.08em; color: var(--ink-dim);
}
.insight-spark { color: var(--pos); display: grid; place-items: center; }
.insight-spark svg { width: 15px; height: 15px; }
.insight-card h3 { font-size: 25px; line-height: 1.05; color: var(--ink); }
.insight-desc { margin: 9px 0 0; font-size: 13px; font-weight: 300; line-height: 1.5; color: var(--ink-dim); }
.insight-divider { height: 1px; margin: 16px 0 13px; background: var(--line); }
.link-btn {
  display: flex; align-items: center; gap: 8px;
  background: none; border: none; padding: 0;
  color: var(--pos); font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em;
  transition: gap 0.2s var(--ease), color 0.2s;
}
.link-btn svg { width: 14px; height: 14px; }
.link-btn:hover { gap: 12px; color: var(--pos-bright); }

/* ---------------- event summary ---------------- */
.event-summary {
  position: fixed;
  right: 352px;
  bottom: calc(var(--ticker-h) + 22px);
  z-index: 18;
  width: 300px;
  padding: 18px 22px 20px;
  max-height: calc(100vh - var(--topbar-h) - var(--ticker-h) - 44px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.18) transparent;
}
.event-summary::-webkit-scrollbar { width: 6px; }
.event-summary::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.14); border-radius: 3px; }
/* same treatment on the insights list, in case it also grows */
.insights {
  max-height: calc(100vh - var(--topbar-h) - var(--ticker-h) - 44px);
  overflow-y: auto;
  scrollbar-width: thin;
}
.insights::-webkit-scrollbar { width: 6px; }
.insights::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.14); border-radius: 3px; }
.es-grid { margin: 16px 0 0; display: flex; flex-direction: column; }
.es-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 0; border-top: 1px solid var(--line-soft);
}
.es-row:first-child { border-top: none; }
.es-row dt { margin: 0; font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); }
.es-row dd { margin: 0; font-size: 15px; color: var(--ink); }
.es-emotion { color: var(--pos-bright); font-weight: 500; }
.es-emotion.alt { color: var(--blue); }
.es-summary { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.es-summary p:last-child { margin: 8px 0 0; font-size: 13.5px; font-weight: 300; line-height: 1.5; color: var(--ink-dim); }

/* ---------------- insights list ---------------- */
.insights {
  position: fixed;
  right: 28px;
  bottom: calc(var(--ticker-h) + 22px);
  z-index: 18;
  width: 300px;
  padding: 18px 18px 16px;
}
.insight-list { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.insight-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px;
  border-radius: 11px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.insight-list li:hover { background: rgba(255, 255, 255, 0.04); }
.insight-list li.active {
  background: rgba(116, 255, 207, 0.07);
  border-color: rgba(116, 255, 207, 0.25);
}
.il-num {
  width: 24px; height: 24px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  font-family: var(--mono); font-size: 11px; color: var(--ink-dim);
}
.insight-list li.active .il-num { border-color: var(--pos); color: var(--pos); }
.il-body { flex: 1 1 auto; min-width: 0; }
.il-title { font-size: 13.5px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.il-date { margin-top: 2px; font-family: var(--mono); font-size: 9px; letter-spacing: 0.06em; color: var(--ink-faint); }
.il-score { font-family: var(--serif); font-size: 19px; flex: 0 0 auto; }
.il-score.pos { color: var(--pos-bright); }
.il-score.neg { color: var(--neg); }

/* connections — "moments that rhyme" (subject + vibe parallels) */
.conn-sub { margin: 4px 0 12px; font-size: 11.5px; font-weight: 300; line-height: 1.35; color: var(--ink-dim); }
.conn-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.conn-tag {
  font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 2px 6px; border-radius: 5px; border: 1px solid var(--line); color: var(--ink-faint);
}
.conn-tag.subject { color: var(--blue); border-color: rgba(107, 166, 255, 0.32); }
.conn-tag.vibe { color: var(--pos-bright); border-color: rgba(116, 255, 207, 0.32); }
.conn-empty { padding: 10px 4px; font-size: 12px; color: var(--ink-faint); font-style: italic; }

/* ---------------- ONE focused readout column (replaces scattered boxes) ---------------- */
.readout-col {
  position: fixed;
  right: 22px;
  top: calc(var(--topbar-h) + 20px);
  bottom: calc(var(--ticker-h) + 14px);
  width: 318px;
  z-index: 18;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
  padding-right: 2px;
}
.readout-col::-webkit-scrollbar { width: 6px; }
.readout-col::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); border-radius: 3px; }
/* inner cards flow in the column instead of floating bottom-right */
.readout-col .event-summary,
.readout-col .insights {
  position: static;
  right: auto;
  bottom: auto;
  width: 100%;
  max-height: none;
  overflow: visible;
  flex: 0 0 auto;
}
/* the reading column is the single source of detail — retire the redundant boxes */
.regional-impact,
.measure-card,
.insight-card { display: none !important; }

/* ---------------- trust note ---------------- */
.trust-note {
  position: fixed;
  left: calc(var(--rail-w) + (100% - var(--rail-w)) / 2);
  transform: translateX(-50%);
  bottom: calc(var(--ticker-h) + 8px);
  z-index: 14;
  margin: 0;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
}
.trust-more {
  background: none; border: none; padding: 0 0 0 4px;
  color: var(--ink-dim); font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em;
  text-decoration: underline; text-underline-offset: 2px;
}
.trust-more:hover { color: var(--pos); }

/* ---------------- bottom measurement ticker (the constant) ---------------- */
.ticker {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 26;
  height: var(--ticker-h);
  display: flex;
  flex-direction: column;
  padding: 9px 18px 8px;
  background: linear-gradient(180deg, rgba(6, 10, 18, 0.82), rgba(3, 6, 12, 0.97));
  border-top: 1px solid var(--glass-rim);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 -18px 40px -20px rgba(0, 0, 0, 0.8);
}
.ticker-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 14px;
  flex: 0 0 auto; margin-bottom: 2px;
}
.ticker-meta { font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; color: var(--ink-faint); }
.ticker-scroll {
  flex: 1 1 auto;
  position: relative;                 /* minimap: fixed overview, scrub to move main timeline */
  overflow: hidden;
  cursor: pointer; touch-action: none;
}
.ticker-scroll.dragging { cursor: grabbing; }
/* the window showing which slice of time the scrollable main timeline is viewing */
.minimap-viewport {
  position: absolute;
  top: 2px; bottom: 18px;             /* sit over the bars, above the date axis */
  left: 0; width: 60px;
  border: 1px solid rgba(116, 255, 207, 0.55);
  background: rgba(116, 255, 207, 0.08);
  border-radius: 5px;
  box-shadow: 0 0 14px rgba(116, 255, 207, 0.14), inset 0 0 0 1px rgba(0, 0, 0, 0.2);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s var(--ease);
}
.ticker-scroll::-webkit-scrollbar { height: 7px; }
.ticker-scroll::-webkit-scrollbar-track { background: transparent; }
.ticker-scroll::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); border-radius: 4px; }
.ticker-scroll::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.26); }
.ticker-svg { display: block; height: 100%; }
.tick-baseline { stroke: rgba(255, 255, 255, 0.08); stroke-width: 1; }
.tick-bar { stroke-width: 3; opacity: 0.5; cursor: pointer; transition: opacity 0.15s, stroke-width 0.15s; }
.tick-bar:hover { opacity: 0.95; stroke-width: 4; }
.tick-bar.sel { opacity: 1; stroke-width: 5; }
.tick-date { font-family: var(--mono); font-size: 8.5px; fill: var(--ink-faint); letter-spacing: 0.04em; }

/* ---------------- toast ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 16px);
  z-index: 60;
  padding: 11px 18px;
  background: var(--glass-strong);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-rim);
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--ink);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ----------------------------------------------------------------
   Selected measurement card — the single detail panel (per Trent's sketch)
   ---------------------------------------------------------------- */
.measure-card {
  position: fixed;
  top: calc(var(--topbar-h) + 32px);
  left: 50%;
  transform: translateX(-50%);
  width: 420px;
  max-height: calc(100vh - var(--topbar-h) - var(--ticker-h) - 110px);
  z-index: 14;
  background: linear-gradient(180deg, var(--glass-strong), var(--glass));
  backdrop-filter: blur(24px) saturate(130%);
  -webkit-backdrop-filter: blur(24px) saturate(130%);
  border: 1px solid var(--glass-rim);
  border-radius: 22px;
  box-shadow: 0 38px 90px -28px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.mc-media {
  flex: 0 0 auto;
  height: 220px;
  position: relative;
  background-image: url("./assets/earth-night.jpg");
  background-size: cover;
  background-position: 56% 32%;
  transition: background-position 1.4s var(--ease);
  filter: saturate(1.05) contrast(1.05) brightness(0.92);
}
.mc-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, transparent 40%, rgba(8, 12, 20, 0.55) 100%),
    radial-gradient(120% 90% at 40% 12%, rgba(150, 205, 255, 0.18) 0%, transparent 38%);
  pointer-events: none;
}
.mc-body {
  padding: 18px 24px 20px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.mc-vibe-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
}
.mc-vibe {
  font-family: var(--serif);
  font-size: 54px;
  line-height: 0.95;
  color: var(--ink);
  font-weight: 400;
}
.mc-vibe-label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--ink-faint);
  text-transform: uppercase;
  line-height: 1.3;
}
.mc-vibe-scale { color: var(--ink-faint); }
.mc-dominant {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  align-self: center;
}
.mc-emotions {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.mc-emotions li {
  display: grid;
  grid-template-columns: 96px 1fr 36px;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  color: var(--ink-dim);
  text-transform: uppercase;
}
.mc-emo-track {
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.06);
  position: relative;
  overflow: hidden;
}
.mc-emo-bar {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 2px;
  transition: width 0.5s var(--ease);
}
.mc-emo-val {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--ink-faint);
  text-align: right;
}
.mc-headline {
  margin: 8px 0 14px;
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.32;
  color: var(--ink);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.mc-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mc-source {
  margin: 0;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--ink-dim);
  text-transform: uppercase;
}

/* ----------------------------------------------------------------
   Two-layer ticker enhancements + connection line + hide redundant
   ---------------------------------------------------------------- */
/* The fine-bar ticker layer + the coarse date axis layer stack inside the scroll */
.ticker-scroll { display: flex; flex-direction: column; }
.ticker-svg { flex: 1; }
.ticker-axis {
  flex: 0 0 28px;
  display: block;
  height: 28px;
  margin-top: 4px;
}
.tick-axis-mark { stroke: rgba(255, 255, 255, 0.22); stroke-width: 1; }
.tick-axis-mark-major { stroke: rgba(255, 255, 255, 0.36); stroke-width: 1.4; }
.tick-axis-date {
  font-family: var(--mono);
  font-size: 9.5px;
  fill: var(--ink-dim);
  letter-spacing: 0.05em;
}
/* Selected — a tall RED line above the colored bar */
.tick-bar.sel { stroke: #ff5252 !important; stroke-width: 2.5 !important; opacity: 1 !important; }

/* Center playhead line — the scroll-to-scrub reference point. (.ticker is already position:fixed, which is a containing block.) */
.ticker-playhead {
  position: absolute;
  top: 30px;
  bottom: 36px;
  left: 50%;
  width: 1px;
  background: rgba(255, 110, 110, 0.65);
  pointer-events: none;
  z-index: 4;
  box-shadow: 0 0 10px rgba(255, 110, 110, 0.5);
}
.ticker-playhead::before, .ticker-playhead::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 8px;
  height: 8px;
  transform: translateX(-50%) rotate(45deg);
  background: rgba(255, 110, 110, 0.85);
  box-shadow: 0 0 6px rgba(255, 110, 110, 0.7);
}
.ticker-playhead::before { top: -4px; }
.ticker-playhead::after { bottom: -4px; }

/* Card close button + hidden state + restore chip */
.card-close, .insight-card .card-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--ink-faint);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  z-index: 5;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.card-close:hover {
  background: rgba(255, 90, 90, 0.12);
  color: #ff8080;
  border-color: rgba(255, 90, 90, 0.3);
}
.card-hidden { display: none !important; }

.panel-restore {
  position: fixed;
  top: calc(var(--topbar-h) + 10px);
  right: 16px;
  z-index: 50;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--glass-strong);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-rim);
  border-radius: 999px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--ink);
  transition: background 0.2s, border-color 0.2s;
}
.panel-restore.show { display: inline-flex; }
.panel-restore:hover { background: rgba(116, 255, 207, 0.14); border-color: rgba(116, 255, 207, 0.4); color: var(--pos-bright); }
.panel-restore svg { width: 14px; height: 14px; }
.restore-count { font-size: 9px; color: var(--ink-faint); padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line); }
.tick-sel-overlay {
  stroke: #ff5252;
  stroke-width: 2;
  stroke-linecap: round;
}

/* Re-enable fx-layer for the connection line (card → selected tick) */
.fx-layer {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 13;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.conn-line {
  fill: none;
  stroke: rgba(255, 90, 90, 0.55);
  stroke-width: 1.4;
  stroke-dasharray: 3 4;
}
.conn-dot {
  fill: #ff5252;
}

/* The big center measurement card is retired — right-column cards return as the readout per the mockups */
.measure-card { display: none !important; }
/* The floating insight card is retired — its content lives in Event Summary now (one composed card) */
.insight-card { display: none !important; }
/* connection line is no longer needed (no center card to connect) */
.fx-layer { display: none !important; }
.trust-note { bottom: calc(var(--ticker-h) + 4px); left: 18px; transform: none; }

/* Event Summary — the single composed readout (headline + when + emotions + summary + view source) */
.es-when {
  margin: 12px 0 6px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.es-headline {
  margin: 0 0 14px;
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1.22;
  color: var(--ink);
}
.es-divider {
  height: 1px;
  margin: 0 0 4px;
  background: var(--line);
}
.es-source {
  margin-top: 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  padding: 0;
  color: var(--pos);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  cursor: pointer;
  transition: gap 0.2s var(--ease), color 0.2s;
}
.es-source:hover { gap: 12px; color: var(--pos-bright); }
.es-source svg { width: 14px; height: 14px; }
.es-source[hidden] { display: none; }
.event-summary { padding-top: 22px; }
.event-summary .es-grid { margin-top: 8px; }

/* Emotion vector bars — the 8-dimension breakdown of the selected measurement */
.es-emotions-wrap {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}
.es-emotions-wrap .eyebrow { margin: 0 0 10px; }
.es-emotions {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.es-emotions li {
  display: grid;
  grid-template-columns: 78px 1fr 28px;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--ink-dim);
  text-transform: uppercase;
}
.es-emo-track {
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.06);
  position: relative;
  overflow: hidden;
}
.es-emo-bar {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 2px;
  transition: width 0.45s var(--ease), background 0.3s;
}
.es-emo-val {
  text-align: right;
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 9.5px;
}
/* highlight the dominant row */
.es-emotions li.dominant { color: var(--ink); }
.es-emotions li.dominant .es-emo-val { color: var(--ink); }
.es-emo-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.es-emo-head .eyebrow { margin: 0; }
.es-emo-toggle {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--pos);
  transition: color 0.2s;
}
.es-emo-toggle:hover { color: var(--pos-bright); }

/* ---------------- Search-as-you-type dropdown ---------------- */
.topsearch-wrap {
  flex: 1 1 auto;
  max-width: 660px;
  margin: 0 auto;
  position: relative;
}
.topsearch-wrap .topsearch { max-width: none; margin: 0; }
.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 40;
  max-height: 360px;
  overflow-y: auto;
  background: var(--glass-strong);
  backdrop-filter: blur(22px) saturate(125%);
  -webkit-backdrop-filter: blur(22px) saturate(125%);
  border: 1px solid var(--glass-rim);
  border-radius: 14px;
  box-shadow: 0 28px 60px -22px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255,255,255,0.05);
  padding: 6px;
  scrollbar-width: thin;
}
.search-results[hidden] { display: none; }
.search-group { padding: 6px 6px 8px; }
.search-group + .search-group { border-top: 1px solid var(--line-soft); margin-top: 4px; }
.search-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 4px 8px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.search-group-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.search-result {
  display: grid;
  grid-template-columns: 12px 1fr 36px;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.search-result:hover { background: rgba(255, 255, 255, 0.05); }
.search-result-dot { width: 8px; height: 8px; border-radius: 50%; }
.search-result-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.search-result-title { font-size: 13px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-result-meta { font-family: var(--mono); font-size: 9px; letter-spacing: 0.06em; color: var(--ink-faint); }
.search-result-score { font-family: var(--serif); font-size: 17px; text-align: right; }
.search-empty { padding: 14px 12px; color: var(--ink-faint); font-size: 12.5px; text-align: center; }

/* ---------------- Topic filter chip row (under topbar) ---------------- */
.filter-row {
  position: absolute;
  top: var(--topbar-h);
  left: var(--rail-w);
  right: 0;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 26px;
  overflow-x: auto;
  scrollbar-width: none;
  z-index: 19;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(4, 7, 14, 0.6), rgba(4, 7, 14, 0.3));
  backdrop-filter: blur(8px);
}
.filter-row::-webkit-scrollbar { display: none; }
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-dim);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.18s, border-color 0.18s, color 0.18s;
  flex: 0 0 auto;
}
.filter-chip:hover { color: var(--ink); background: rgba(255, 255, 255, 0.04); }
.filter-chip.is-active {
  background: rgba(116, 255, 207, 0.12);
  border-color: rgba(116, 255, 207, 0.4);
  color: var(--pos-bright);
}
.filter-chip .chip-count {
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink-faint);
}
.filter-chip.is-active .chip-count { background: rgba(116, 255, 207, 0.2); color: var(--pos-bright); }
.filter-row.empty { display: none; }

/* push the rail + timeline-region down to clear the filter row */
.has-filters .rail { top: calc(var(--topbar-h) + 40px); }
.has-filters .timeline-region { top: calc(var(--topbar-h) + 40px); height: calc(60vh - var(--topbar-h) - 40px); }

/* ----------------------------------------------------------------
   Brief overlay (printable report)
   ---------------------------------------------------------------- */
.brief-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  overflow-y: auto;
  background: rgba(3, 5, 11, 0.86);
  backdrop-filter: blur(10px);
  padding: 40px 20px 80px;
}
.brief-overlay[hidden] { display: none; }
.brief-doc {
  max-width: 820px;
  margin: 0 auto;
  background: #f7f5ef;
  color: #16181d;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 40px 120px -30px rgba(0, 0, 0, 0.8);
  font-family: var(--sans);
}
.brief-toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 820px;
  margin: -20px auto 18px;
  padding: 12px 16px;
  background: var(--glass-strong);
  border: 1px solid var(--glass-rim);
  border-radius: 12px;
  backdrop-filter: blur(16px);
}
.brief-toolbar .bt-title { font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em; color: var(--ink-dim); }
.brief-toolbar .bt-actions { display: flex; gap: 10px; }
.bt-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 15px; border-radius: 9px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.14em;
  border: 1px solid var(--glass-rim); background: rgba(255,255,255,0.05); color: var(--ink);
}
.bt-btn.primary { background: var(--pos); border-color: var(--pos); color: #04140e; font-weight: 500; }
.bt-btn:hover { filter: brightness(1.08); }

.brief-page { padding: 56px 60px; border-bottom: 1px solid #e3ded1; }
.brief-page:last-child { border-bottom: none; }
.brief-cover {
  background: linear-gradient(160deg, #0a1020 0%, #0c1830 55%, #0a1428 100%);
  color: #eef2fb;
  padding: 64px 60px 56px;
}
.brief-cover .bc-kicker { font-family: var(--mono); font-size: 11px; letter-spacing: 0.24em; color: var(--pos); }
.brief-cover h1 { font-family: var(--serif); font-size: 56px; line-height: 1.02; margin: 18px 0 0; }
.brief-cover .bc-meta { margin-top: 26px; display: flex; flex-wrap: wrap; gap: 28px; }
.bc-meta div .lbl { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.16em; color: #8a96b5; text-transform: uppercase; }
.bc-meta div .val { font-size: 15px; margin-top: 4px; }
.brief-cover .bc-line { margin-top: 30px; font-size: 18px; font-weight: 300; line-height: 1.5; max-width: 560px; color: #d6def2; }
.bc-figures { margin-top: 34px; display: flex; gap: 44px; }
.bc-figures .fig .num { font-family: var(--serif); font-size: 50px; line-height: 1; }
.bc-figures .fig .num.pos { color: var(--pos-bright); }
.bc-figures .fig .num.neg { color: var(--neg); }
.bc-figures .fig .cap { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.14em; color: #8a96b5; margin-top: 8px; text-transform: uppercase; }

.brief-page h2 { font-family: var(--mono); font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; color: #6b7280; }
.brief-page .bp-lead { font-family: var(--serif); font-size: 27px; line-height: 1.18; margin: 14px 0 0; color: #16181d; }
.brief-page p { font-size: 15px; line-height: 1.6; color: #2c3038; }
.bp-grid { margin-top: 22px; display: grid; grid-template-columns: 1fr 1fr; gap: 22px 40px; }
.bp-grid .cell .k { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; color: #8a8f9c; }
.bp-grid .cell .v { font-size: 17px; margin-top: 5px; color: #16181d; }
.bp-grid .cell .v.pos { color: #11a877; }
.bp-grid .cell .v.neg { color: #d6433f; }
.brief-method { background: #eeebe1; }
.brief-method ul { margin: 18px 0 0; padding-left: 18px; }
.brief-method li { font-size: 14px; line-height: 1.7; color: #3a3f49; }
.brief-trust { margin-top: 22px; padding: 16px 18px; background: #fff; border-left: 3px solid var(--pos); border-radius: 0 6px 6px 0; font-size: 14px; line-height: 1.55; color: #2c3038; }
.brief-foot { margin-top: 30px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; color: #9aa0ac; }

/* ----------------------------------------------------------------
   Responsive — mobile stack (per brief §13)
   ---------------------------------------------------------------- */
@media (max-width: 900px) {
  html, body { overflow: auto; }
  .stage { position: relative; min-height: 100vh; overflow: visible; display: flex; flex-direction: column; padding-bottom: 104px; }
  .starfield { position: fixed; }
  .fx-layer { display: none; }

  .topbar { order: 1; position: sticky; top: 0; flex-wrap: wrap; height: auto; padding: 10px 16px; gap: 12px; }
  .topsearch { order: 3; width: 100%; max-width: none; flex-basis: 100%; }

  .rail { order: 2; position: relative; top: 0; left: 0; bottom: auto; width: 100%; height: auto; padding: 22px 18px 6px; overflow: visible; }
  .subject-name { font-size: 34px; }
  .subject-tagline { max-width: none; }

  .timeline-region { order: 3; position: relative; top: 0; left: 0; right: 0; bottom: auto; height: 54vh; min-height: 300px; padding: 12px 14px 0; }
  .tl-head { flex-direction: column; gap: 14px; }
  .tl-tools { gap: 18px; flex-wrap: wrap; }
  .insight-card { position: relative !important; left: auto !important; right: auto !important; top: auto !important; width: auto; margin: 10px 14px 0; opacity: 1; transform: none; }

  .event-summary { order: 4; }
  .earth-layer { order: 5; position: relative; left: auto; bottom: auto; width: 168px; height: 168px; margin: 18px auto 4px; }
  .insights { order: 6; }
  .trust-note { order: 7; position: relative; left: auto; bottom: auto; transform: none; margin: 16px 14px 10px; }

  .event-summary, .insights, .regional-impact {
    position: relative; right: auto; bottom: auto; width: auto; margin: 14px;
  }

  /* the ticker stays the constant — fixed bottom, scrollable */
  .ticker { height: 96px; padding: 8px 14px 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .live-dot, .region-ring { animation: none; }
  * { transition-duration: 0.001ms !important; }
}

/* ----------------------------------------------------------------
   Print — the brief becomes a clean document
   ---------------------------------------------------------------- */
@media print {
  body { overflow: visible; background: #fff; }
  .stage, .toast { display: none !important; }
  .brief-overlay { position: static; background: #fff; padding: 0; backdrop-filter: none; }
  .brief-toolbar { display: none !important; }
  .brief-doc { max-width: none; margin: 0; box-shadow: none; border-radius: 0; }
  .brief-page { page-break-after: always; padding: 40px 44px; }
  .brief-cover { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .brief-cover, .brief-method, .brief-trust, .bc-figures .num, .bp-grid .v.pos, .bp-grid .v.neg {
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
}
