:root {
  --bg: #07090d;
  --bg-2: #0c1117;
  --bg-3: #131a23;
  --line: #1d2632;
  --line-bright: #2a3647;
  --ink: #e9eef5;
  --ink-dim: #9ca8bb;
  --ink-faint: #6b7787;
  --accent: #ff5d3a;        /* signal orange */
  --accent-2: #4cd1ff;      /* sigint cyan */
  --warn: #ffbf3a;
  --good: #66e08c;
  --redact: #ff3838;
  --grid-mono: 'IBM Plex Mono', 'JetBrains Mono', 'SFMono-Regular', ui-monospace, Menlo, Consolas, monospace;
  --grid-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--grid-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  background-image:
    radial-gradient(1200px 600px at 80% -10%, rgba(255,93,58,0.08), transparent 60%),
    radial-gradient(1000px 500px at -10% 100%, rgba(76,209,255,0.07), transparent 60%);
}

a { color: var(--accent-2); }

/* ---------- viewport stack ----------
   The map fills the whole viewport. Banner, tabs, and the year scrubber
   all overlay on top of it. Filters and the records grid live below the
   fold, accessible by scrolling. */
.viewport-stack {
  position: relative;
  height: 100vh;
  width: 100%;
  overflow: visible;
}

/* (Old top banner removed — branding now lives in the sidebar.) */
.banner-rule {
  font-family: var(--grid-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--ink-faint);
  border-bottom: 1px dashed var(--line);
  padding-bottom: 8px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.banner-rule::before {
  content: "■";
  color: var(--accent);
}
.banner-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
}
.banner-mark {
  width: 56px; height: 56px;
  color: var(--accent);
  display: grid; place-items: center;
  border: 1px solid var(--line-bright);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 30%, rgba(255,93,58,0.18), transparent 60%);
}
.banner-mark svg { width: 38px; height: 38px; }
.banner h1 {
  margin: 0;
  font-size: clamp(22px, 3vw, 34px);
  letter-spacing: 0.04em;
  font-weight: 700;
}
.banner h1::after {
  content: " // PURSUE";
  color: var(--ink-faint);
  letter-spacing: 0.18em;
  font-weight: 400;
  font-size: 0.55em;
}
.subtitle {
  margin: 2px 0 0;
  font-family: var(--grid-mono);
  font-size: 12px;
  color: var(--ink-dim);
  letter-spacing: 0.04em;
}
.banner-stats {
  display: flex; gap: 22px;
  font-family: var(--grid-mono);
  font-size: 11px;
  color: var(--ink-dim);
  letter-spacing: 0.08em;
  text-align: right;
}
.banner-stats .stat .num {
  display: block;
  color: var(--ink);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0;
}

/* ---------- view tabs ---------- */
.view-tabs {
  position: absolute;
  top: 92px;            /* sits below the banner */
  left: 0; right: 0;
  display: flex;
  gap: 0;
  border-bottom: 1px solid rgba(29, 38, 50, 0.6);
  padding: 0 20px;
  background: rgba(7, 9, 13, 0.78);
  /* backdrop-filter removed: each one creates its own offscreen render
     layer and was stacking up with the other overlays. */
  z-index: 19;
  overflow-x: auto;
}
.view-tabs .view-tab { padding: 10px 16px; }
.view-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--ink-dim);
  padding: 14px 18px;
  font-family: var(--grid-mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
  white-space: nowrap;
}
.view-tab:hover { color: var(--ink); }
.view-tab.is-active {
  color: var(--ink);
  border-bottom-color: var(--accent);
  background: linear-gradient(180deg, transparent, rgba(255,93,58,0.06));
}

/* ---------- main layout ---------- */
main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  padding: 0 0 24px;
  max-width: 1480px;
  margin: 0 auto;
}

/* ---------- map ---------- */
.map-shell {
  position: relative;
  border-bottom: 1px solid var(--line);
  background: var(--bg-3);
  /* Allow the hover popup to spill outside the map container so cards
     near the edges don't get clipped. */
  overflow: visible;
}
.map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  /* MapLibre sets overflow:hidden on .maplibregl-map by default. We
     override so popups can render outside the canvas. */
}
.map-shell {
  position: absolute;
  top: 0;
  left: 280px;     /* leaves room for the sidebar so no markers hide behind it */
  right: 0;
  bottom: 0;
  min-width: 0;
}
/* Override Mapbox internals so popups can escape the canvas bounds. */
.maplibregl-map { overflow: visible !important; }
.maplibregl-canvas-container.maplibregl-interactive { overflow: visible !important; }
.uap-popup { z-index: 6 !important; }
/* Decorative inset borders removed for memory — they were two extra
   compositor layers on top of the map at all times. */
.map-overlay-tl {
  position: absolute;
  z-index: 4;
  background: rgba(7, 9, 13, 0.78);
  /* backdrop-filter removed for memory; dark rgba bg is enough. */
  border: 1px solid var(--line-bright);
  padding: 10px 12px;
  font-family: var(--grid-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink);
  pointer-events: auto;
  top: 148px;     /* clear the banner + tabs */
  left: 240px;    /* clear the timeline-side scrubber on the left */
  min-width: 220px;
}

/* Giant year readout placed to the right of the .map-overlay-tl block.
   Stays in sync with the scrubber: a single highlighted year when
   yearLow == yearHigh, otherwise the upper bound with a "→" prefix. */
.big-year {
  position: absolute;
  top: 148px;
  left: 488px;     /* sits to the right of the overlay-tl block */
  z-index: 4;
  height: 52px; /* matches the overlay-tl panel height */
  font-family: var(--grid-mono);
  color: var(--scrub, #4cd1ff);
  text-shadow: 0 0 18px rgba(76, 209, 255, 0.45);
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
  user-select: none;
}
.big-year .by-num {
  font-size: 38px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
}
.big-year .by-tag {
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--ink-faint);
  text-transform: uppercase;
}
.big-year.is-empty .by-num { color: var(--ink-faint); text-shadow: none; }
/* Bottom-left stack: projection / style toolbar above the agency legend.
   Each child carries its own panel chrome so they read as separate
   controls. */
.map-overlay-bl {
  position: absolute;
  z-index: 4;
  bottom: 22px;
  right: 22px;     /* moved to right side; left is the year scrubber */
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-family: var(--grid-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink);
  align-items: flex-end;
}
.map-overlay-bl .agency-card,
.map-overlay-bl .layers-card {
  background: rgba(7, 9, 13, 0.78);
  /* backdrop-filter removed for memory; dark rgba bg is enough. */
  border: 1px solid var(--line-bright);
  padding: 10px 12px;
  pointer-events: auto;
}
.layers-list { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.layer-row {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--ink);
  cursor: pointer;
  padding: 2px 0;
  transition: color 120ms ease;
}
.layer-row input[type="checkbox"] {
  appearance: none;
  width: 14px; height: 14px;
  border: 1px solid var(--line-bright);
  background: transparent;
  cursor: pointer;
  position: relative;
  margin: 0;
}
.layer-row input[type="checkbox"]:checked {
  background: var(--scrub, #4cd1ff);
  border-color: var(--scrub, #4cd1ff);
  box-shadow: 0 0 8px rgba(76, 209, 255, 0.5);
}
.layer-row input[type="checkbox"]:checked::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--bg);
  font-size: 11px;
  line-height: 1;
}
.layer-name { letter-spacing: 0.04em; }
.layer-meta {
  font-size: 9px;
  letter-spacing: 0.16em;
  color: var(--ink-faint);
  text-transform: uppercase;
}
.layer-row.is-disabled { opacity: 0.45; cursor: not-allowed; }
.layer-row.is-disabled input { cursor: not-allowed; }
.overlay-line { line-height: 1.5; }
.overlay-line.dim { color: var(--ink-dim); }
.legend-title {
  color: var(--ink-faint);
  font-size: 10px;
  letter-spacing: 0.2em;
  margin-bottom: 6px;
}
.legend { list-style: none; padding: 0; margin: 0; }
.legend li {
  display: flex; align-items: center; gap: 8px;
  padding: 3px 0;
  color: var(--ink);
}
.legend .swatch {
  width: 10px; height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 12px currentColor;
}

.off-earth-pill {
  position: absolute;
  right: 22px;
  top: 22px;
  z-index: 4;
  background: rgba(7, 9, 13, 0.78);
  border: 1px solid var(--line-bright);
  color: var(--ink);
  font-family: var(--grid-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.off-earth-pill .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 10px var(--accent-2);
}
.off-earth-pill:hover { border-color: var(--accent-2); }

.map-toolbar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.seg {
  display: flex;
  background: rgba(7, 9, 13, 0.78);
  border: 1px solid var(--line-bright);
  /* backdrop-filter removed for memory; dark rgba bg is enough. */
}
.seg-btn {
  background: transparent;
  border: none;
  color: var(--ink-dim);
  font-family: var(--grid-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  padding: 7px 10px;
  cursor: pointer;
  transition: color 140ms ease, background 140ms ease;
}
.seg-btn:hover { color: var(--ink); }
.seg-btn.is-active {
  color: var(--bg);
  background: var(--ink);
}
.seg-btn + .seg-btn { border-left: 1px solid var(--line); }

.off-earth-pill {
  /* shifted below the toolbar so it doesn't overlap. */
  top: 64px !important;
}

.isolation-banner {
  position: absolute;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  background: rgba(7, 9, 13, 0.92);
  border: 1px solid var(--accent);
  padding: 8px 14px;
  font-family: var(--grid-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ink);
  display: flex;
  align-items: center;
  max-width: calc(100% - 60px);
  box-shadow: 0 0 24px rgba(255, 93, 58, 0.18);
}
.isolation-banner .ghost { padding: 4px 10px; }

/* ---------- vertical year scrubber (left overlay on the map) ---------- */
.map-row {
  position: absolute;
  inset: 0;        /* fills the .viewport-stack */
}
.timeline-side {
  position: absolute;
  top: 0;          /* full-height sidebar — no top banner anymore */
  left: 0;
  bottom: 0;
  width: 280px;
  z-index: 6;
  border-right: 1px solid var(--line-bright);
  background: linear-gradient(180deg, rgba(76, 209, 255, 0.04), transparent 40%), rgba(7, 9, 13, 0.95);
  display: flex;
  flex-direction: column;
  min-height: 0;
  /* When total content exceeds viewport (e.g. on shorter laptop screens),
     the whole sidebar scrolls — prevents controls from leaking onto the
     records grid below. */
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(76,209,255,0.25) transparent;
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.4);
}

/* Sidebar brand header (replaces old top banner). */
.ts-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--line);
}
.ts-mark {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  color: var(--accent);
  border: 1px solid var(--line-bright);
  border-radius: 50%;
  flex-shrink: 0;
  background: radial-gradient(circle at 50% 30%, rgba(255,93,58,0.18), transparent 60%);
}
.ts-mark svg { width: 22px; height: 22px; }
.ts-brand-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ts-brand-text h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  line-height: 1.1;
}
.ts-brand-text h1::after { content: none; }
.ts-brand-tag {
  font-family: var(--grid-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--ink-dim);
  margin-top: 3px;
}
.ts-banner-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  font-family: var(--grid-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
  text-align: center;
}
.ts-banner-stats .stat .num {
  display: block;
  color: var(--ink);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0;
  margin-bottom: 3px;
}

/* View tabs inside the sidebar — small horizontal pill row. */
.ts-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
}
.ts-tabs .view-tab {
  background: transparent;
  border: 1px solid var(--line-bright);
  color: var(--ink-dim);
  padding: 9px 6px;
  font-family: var(--grid-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 140ms ease, border-color 140ms ease, background 140ms ease;
  white-space: nowrap;
  text-align: center;
}
.ts-tabs .view-tab:hover { color: var(--ink); border-color: var(--ink-faint); }
.ts-tabs .view-tab.is-active {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
}
/* In-panel readout: big year + record count + status. */
.ts-readout {
  padding: 4px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ts-readout .big-year {
  position: static;
  height: auto;
  text-shadow: none;
  gap: 8px;
  margin: 0;
  align-items: baseline;
}
.ts-readout .by-num { font-size: 34px; line-height: 1; }
.ts-readout .by-tag { font-size: 9px; color: var(--ink-faint); letter-spacing: 0.14em; }
.ts-stats { display: flex; flex-direction: column; gap: 2px; font-family: var(--grid-mono); font-size: 11px; letter-spacing: 0.04em; }
.ts-stats .overlay-line { line-height: 1.45; color: var(--ink); }
.ts-stats .overlay-line.dim { color: var(--ink-dim); }

/* In-panel data-viz controls: basemap toggle + layers + agency legend.
   Compact restyles since they're now in a 240px sidebar instead of
   floating overlays on the map. */
.ts-controls {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ts-controls .map-toolbar {
  display: flex;
  gap: 6px;
}
.ts-controls .seg {
  width: 100%;
  display: flex;
  background: transparent;
  border: 1px solid var(--line-bright);
}
.ts-controls .seg-btn { flex: 1; padding: 7px 8px; font-size: 9px; }
.ts-controls .ts-reset-map {
  width: 100%;
  padding: 8px 10px;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-align: center;
  color: var(--ink);
}
.ts-controls .ts-reset-map:hover { color: var(--accent); border-color: var(--accent); }

/* Collapsible card sections — each <details> shows a header bar with
   caret. Body slides in/out when toggled. Default state is closed so
   the year rail above stays the primary visual affordance. */
.ts-collapse {
  border: 1px solid var(--line);
  background: transparent;
}
.ts-collapse > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  user-select: none;
  -webkit-user-select: none;
  transition: color 140ms ease;
}
.ts-collapse > summary::-webkit-details-marker { display: none; }
.ts-collapse > summary .legend-title { margin: 0; color: var(--ink-dim); }
.ts-collapse > summary:hover .legend-title { color: var(--ink); }
.ts-collapse .ts-caret {
  font-family: var(--grid-mono);
  font-size: 10px;
  color: var(--ink-faint);
  transition: transform 160ms ease;
  display: inline-block;
}
.ts-collapse[open] > summary .ts-caret { transform: rotate(180deg); }
.ts-collapse > .layers-list,
.ts-collapse > .datasets-list,
.ts-collapse > .map-toolbar,
.ts-collapse > .legend {
  padding: 4px 12px 10px;
}
.ts-controls .legend-title {
  margin-bottom: 8px;
  font-size: 9px;
  color: var(--ink-dim);
  letter-spacing: 0.2em;
}
.ts-controls .layers-list { gap: 6px; margin-top: 4px; }
.ts-controls .layer-row { font-size: 11px; padding: 2px 0; gap: 10px; }
.ts-controls .layer-meta { font-size: 9px; }
.ts-controls .legend { font-size: 11px; }
.ts-controls .legend li { padding: 3px 0; gap: 8px; }
.ts-controls .legend li .swatch { width: 9px; height: 9px; }
.ts-controls .legend li > span:last-child { color: var(--ink-dim); font-variant-numeric: tabular-nums; }

/* Datasets card — checkboxes lazy-load each source on toggle. */
.datasets-list { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.dataset-row {
  display: grid;
  grid-template-columns: 14px 8px 1fr auto;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--ink);
  cursor: pointer;
  padding: 2px 0;
  transition: color 120ms ease;
}
.dataset-row input[type="checkbox"] {
  appearance: none;
  width: 14px; height: 14px;
  border: 1px solid var(--line-bright);
  background: transparent;
  cursor: pointer;
  position: relative;
  margin: 0;
}
.dataset-row input[type="checkbox"]:checked {
  background: var(--ds-color, var(--scrub, #4cd1ff));
  border-color: var(--ds-color, var(--scrub, #4cd1ff));
}
.dataset-row input[type="checkbox"]:checked::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--bg);
  font-size: 11px;
  line-height: 1;
}
.dataset-row .ds-swatch {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--ds-color, currentColor);
  box-shadow: 0 0 6px var(--ds-color, currentColor);
}
.dataset-row .ds-name { letter-spacing: 0.04em; line-height: 1.3; }
.dataset-row .ds-meta {
  font-family: var(--grid-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}
.dataset-row.is-loading .ds-meta { color: var(--scrub, #4cd1ff); }
.dataset-row.is-error .ds-meta { color: var(--accent); }
.dataset-row.is-locked input { opacity: 0.5; cursor: not-allowed; }
.dataset-row.is-locked { cursor: default; }
.ts-head {
  padding: 14px 18px 8px;
  display: flex; flex-direction: column; gap: 4px;
}
.ts-window {
  font-family: var(--grid-mono);
  font-size: 15px;
  color: var(--scrub, #4cd1ff);
  letter-spacing: 0.04em;
  font-weight: 500;
}
.ts-actions {
  display: flex; gap: 8px;
  padding: 6px 18px 14px;
  border-bottom: 1px solid var(--line);
}
.ts-rail {
  flex: 1 1 220px;     /* force a minimum ~12 visible year rows */
  min-height: 220px;
  overflow-y: auto;
  padding: 10px 0 14px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  border-bottom: 1px solid var(--line);
  user-select: none;
  -webkit-user-select: none;
  scrollbar-width: thin;
  scrollbar-color: rgba(76,209,255,0.3) transparent;
}
.ts-rail::-webkit-scrollbar { width: 4px; }
.ts-rail::-webkit-scrollbar-thumb { background: rgba(76,209,255,0.3); border-radius: 2px; }
.ts-row {
  display: grid;
  grid-template-columns: 40px 1fr 26px;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  height: 18px;
  cursor: pointer;
  font-family: var(--grid-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--ink-dim);
  position: relative;
  transition: background 120ms ease, color 120ms ease;
}
.ts-row .y-label {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--ink-faint);
}
.ts-row .y-bar {
  height: 6px;
  background: rgba(76, 209, 255, 0.08);
  position: relative;
  overflow: hidden;
}
.ts-row .y-bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(90deg, #4cd1ff, #7aa6ff);
  box-shadow: 0 0 6px rgba(76, 209, 255, 0.5);
}
.ts-row .y-count {
  font-size: 9px;
  color: var(--ink-faint);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.ts-row.in-window {
  color: var(--ink);
  background: linear-gradient(90deg, rgba(76, 209, 255, 0.08), transparent 60%);
}
.ts-row.in-window .y-label { color: var(--scrub, #4cd1ff); font-weight: 600; }
.ts-row.is-handle::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--scrub, #4cd1ff);
  box-shadow: 0 0 10px var(--scrub, #4cd1ff);
}
.ts-row:hover .y-bar-fill { filter: brightness(1.2); }
.ts-row.dragging { background: rgba(76, 209, 255, 0.18); color: var(--ink); }
.ts-row.is-zero { opacity: 0.45; }
.ts-row.is-zero .y-label { color: var(--ink-faint); }
.ts-row.is-zero .y-bar {
  background: transparent;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}
.ts-row.is-zero .y-count { color: rgba(255,255,255,0.18); }
.ts-row.is-zero:hover { opacity: 0.7; }
.ts-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  text-align: center;
  background: rgba(7, 9, 13, 0.7);
}
.ts-foot .kicker { font-size: 9px; color: var(--ink-faint); }
.kicker {
  font-family: var(--grid-mono);
  font-size: 10px;
  color: var(--ink-faint);
  letter-spacing: 0.2em;
}
.ghost {
  background: transparent;
  border: 1px solid var(--line-bright);
  color: var(--ink);
  font-family: var(--grid-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  padding: 6px 12px;
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease;
}
.ghost:hover { border-color: var(--accent); color: var(--accent); }
.ghost.is-active { border-color: var(--accent); color: var(--accent); }

/* (legacy horizontal histogram + range slider removed; replaced by the
   vertical .timeline-side scrubber above) */

/* ---------- filters ---------- */
.filters {
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 28px;
  align-items: center;
}
.filter-group { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filter-group.grow { min-width: 200px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  background: transparent;
  border: 1px solid var(--line-bright);
  color: var(--ink-dim);
  font-family: var(--grid-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  padding: 5px 10px;
  cursor: pointer;
  transition: color 140ms ease, border-color 140ms ease, background 140ms ease;
}
.chip:hover { color: var(--ink); }
.chip.is-active {
  color: var(--bg);
  border-color: var(--accent);
  background: var(--accent);
}
#searchInput {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line-bright);
  color: var(--ink);
  font-family: var(--grid-mono);
  padding: 8px 12px;
  font-size: 12px;
  letter-spacing: 0.04em;
  width: 100%;
  max-width: 360px;
}
#searchInput::placeholder { color: var(--ink-faint); }
#searchInput:focus { outline: none; border-color: var(--accent); }

/* ---------- record grid ---------- */
.record-grid {
  padding: 18px 28px 32px;
}
.grid-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 14px;
}
.dim { color: var(--ink-dim); }
.record-list {
  list-style: none; padding: 0; margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 12px;
}
.record-card {
  border: 1px solid var(--line-bright);
  background: linear-gradient(180deg, rgba(255,255,255,0.02), transparent);
  padding: 14px 14px 12px;
  cursor: pointer;
  display: flex; flex-direction: column; gap: 8px;
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
  position: relative;
  text-align: left;
  font-family: var(--grid-sans);
  color: var(--ink);
}
.record-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.record-card .meta {
  display: flex; gap: 8px; font-family: var(--grid-mono);
  font-size: 10px; letter-spacing: 0.12em; color: var(--ink-faint);
  text-transform: uppercase;
}
.record-card .meta .agency-dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block; align-self: center;
  box-shadow: 0 0 8px currentColor;
}
.record-card h3 {
  margin: 0; font-size: 14px; font-weight: 600; line-height: 1.35;
  word-break: break-word;
}
.record-card .place {
  font-family: var(--grid-mono);
  font-size: 11px; color: var(--ink-dim); letter-spacing: 0.04em;
}
.record-card .corner {
  position: absolute;
  top: -1px; right: -1px;
  background: var(--accent);
  color: var(--bg);
  font-family: var(--grid-mono);
  font-size: 10px;
  padding: 2px 6px;
  letter-spacing: 0.12em;
}

/* ---------- detail drawer ---------- */
.detail {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(520px, 100%);
  background: var(--bg-2);
  border-left: 1px solid var(--line-bright);
  z-index: 100;
  overflow-y: auto;
  transform: translateX(0);
}
.detail[hidden] { display: block !important; transform: translateX(105%); transition: transform 220ms ease; visibility: hidden; }
.detail-shell { padding: 28px 28px 32px; position: relative; }
.detail-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 36px; height: 36px;
  background: transparent;
  border: 1px solid var(--line-bright);
  color: var(--ink-dim);
  font-size: 22px;
  cursor: pointer;
}
.detail-close:hover { color: var(--accent); border-color: var(--accent); }
.detail-tag {
  display: inline-block;
  font-family: var(--grid-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 3px 8px;
  margin-bottom: 12px;
}
.detail h2 {
  margin: 0 0 14px;
  font-size: 18px;
  word-break: break-word;
  line-height: 1.35;
}
.facts {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 6px 16px;
  margin: 0 0 18px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-family: var(--grid-mono);
  font-size: 12px;
}
.facts dt { color: var(--ink-faint); letter-spacing: 0.08em; }
.facts dd { margin: 0; color: var(--ink); word-break: break-word; }
.detail-media { margin: 0 0 14px; }
.detail-media img {
  width: 100%; height: auto;
  border: 1px solid var(--line-bright);
  background: #000;
}
.detail-desc {
  font-size: 14px; line-height: 1.55; color: var(--ink); white-space: pre-wrap;
  margin: 0 0 18px;
}

/* Weather block in detail drawer. Reads as a one-glance meteorology card
   for the day of the incident. */
.weather-block {
  margin: 0 0 18px;
  padding: 12px 14px 10px;
  border: 1px solid rgba(76, 209, 255, 0.35);
  background: linear-gradient(180deg, rgba(76, 209, 255, 0.06), transparent 80%);
}
.wb-head { display: flex; align-items: center; margin-bottom: 8px; }
.wb-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  font-family: var(--grid-mono);
  font-size: 12px;
}
.wb-cell { line-height: 1.4; }
.wb-k {
  font-size: 9px;
  letter-spacing: 0.16em;
  color: var(--ink-faint);
  text-transform: uppercase;
}
.wb-v { color: var(--ink); }
.wb-foot {
  margin-top: 10px;
  font-family: var(--grid-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
}
.detail-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn {
  font-family: var(--grid-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 10px 14px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--bg);
  text-decoration: none;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}
.btn:hover { background: transparent; color: var(--accent); }
.btn.secondary { background: transparent; color: var(--ink); border-color: var(--line-bright); }
.btn.secondary:hover { color: var(--accent-2); border-color: var(--accent-2); }

/* ---------- map markers ----------
   NOTE: Do NOT set position/transform on .uap-marker itself — Mapbox owns
   the marker element's position and transform via the anchor option.
   We let Mapbox center the element, then absolutely-position the visual
   dot + ping ring inside it relative to (0, 0). */
.uap-marker {
  width: 18px; height: 18px;
  cursor: pointer;
  pointer-events: auto;
}
.uap-marker::before {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 8px; height: 8px;
  margin-left: -4px; margin-top: -4px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.9;
  box-shadow: 0 0 0 2px rgba(7,9,13,0.7);
}
/* Halo ring removed — singles show just the dot now. Cluster bubbles
   keep their own ::after styling further down. */
.uap-marker:hover::before { width: 12px; height: 12px; margin-left: -6px; margin-top: -6px; }

/* When a single record is isolated on the map, dial its marker up so it
   stands out against the empty atlas. */
.uap-marker.is-isolated::before {
  width: 14px; height: 14px;
  margin-left: -7px; margin-top: -7px;
  box-shadow: 0 0 0 3px rgba(7,9,13,0.85), 0 0 24px currentColor;
}
.uap-marker.is-isolated::after {
  width: 36px; height: 36px;
  margin-left: -18px; margin-top: -18px;
  animation-duration: 1.4s;
  border-width: 2px;
}

/* Weather-overlay glyph that floats on the upper-right of a marker.
   Only injected when state.layers.weather is true. */
.uap-weather-badge {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(4px, -22px);
  background: rgba(7, 9, 13, 0.85);
  border: 1px solid rgba(76, 209, 255, 0.5);
  font-size: 11px;
  line-height: 1;
  padding: 2px 4px 3px;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
  font-family: var(--grid-mono);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.uap-weather-badge .wx-glyph { font-size: 11px; line-height: 1; }
.uap-weather-badge .wx-temp { font-size: 9px; color: var(--ink-dim); letter-spacing: 0.04em; }

.uap-moon-badge {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(4px, 8px);
  background: rgba(7, 9, 13, 0.85);
  border: 1px solid rgba(255, 213, 100, 0.4);
  font-size: 11px;
  line-height: 1;
  padding: 2px 4px 3px;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
  font-family: var(--grid-mono);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.uap-moon-badge.is-down { opacity: 0.4; border-color: rgba(255,255,255,0.1); }
.uap-moon-badge .moon-glyph { font-size: 11px; line-height: 1; }
.uap-moon-badge .moon-ill { font-size: 9px; color: var(--ink-dim); letter-spacing: 0.04em; }

/* Video thumbnail badge on the marker — anchored upper-left so it doesn't
   collide with the weather/moon badges on the right. */
.uap-video-thumb {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-56px, -16px);
  width: 48px; height: 28px;
  border: 1px solid var(--accent);
  background: #000;
  overflow: hidden;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 0 12px rgba(255, 93, 58, 0.35);
  transition: transform 140ms ease, box-shadow 140ms ease;
}
.uap-video-thumb:hover {
  transform: translate(-56px, -16px) scale(1.08);
  box-shadow: 0 0 20px rgba(255, 93, 58, 0.6);
}
.uap-video-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.uap-video-thumb.no-thumb {
  background: linear-gradient(135deg, rgba(255,93,58,0.2), rgba(255,93,58,0.05));
}
.uap-video-thumb .play {
  position: absolute;
  inset: 0;
  display: grid; place-items: center;
  color: white;
  font-size: 14px;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.9), 0 0 2px rgba(0, 0, 0, 1);
  background: linear-gradient(180deg, transparent 50%, rgba(0, 0, 0, 0.5));
  pointer-events: none;
}

/* Detail-drawer video poster card. */
.detail-video-card {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line-bright);
  background: #000;
  cursor: pointer;
  padding: 0;
  overflow: hidden;
  transition: border-color 140ms ease;
}
.detail-video-card:hover { border-color: var(--accent); }
.detail-video-card img,
.detail-video-card .dvc-fallback {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.detail-video-card .dvc-fallback {
  background:
    linear-gradient(135deg, rgba(255, 93, 58, 0.08), rgba(76, 209, 255, 0.04)),
    repeating-linear-gradient(45deg, rgba(255,255,255,0.02) 0 6px, transparent 6px 12px);
}
.detail-video-card .dvc-play {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 56px; height: 56px;
  display: grid; place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  color: white;
  font-size: 22px;
  background: rgba(0, 0, 0, 0.4);
  text-shadow: 0 0 4px black;
  transition: background 140ms ease;
}
.detail-video-card:hover .dvc-play { background: var(--accent); border-color: var(--accent); }
.detail-video-card .dvc-tag {
  position: absolute;
  bottom: 10px; left: 10px;
  font-family: var(--grid-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: white;
  background: rgba(0, 0, 0, 0.65);
  padding: 4px 8px;
  text-shadow: 0 0 4px black;
}

.weather-block.moon-block { border-color: rgba(255, 213, 100, 0.35); background: linear-gradient(180deg, rgba(255, 213, 100, 0.05), transparent 80%); }
.up-tag {
  font-family: var(--grid-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  padding: 1px 5px;
  margin-left: 6px;
  border: 1px solid currentColor;
}
.up-tag.up { color: var(--good); }
.up-tag.down { color: var(--ink-faint); }

/* Media coverage block in detail drawer. */
.news-block {
  margin: 0 0 18px;
  padding: 12px 14px 10px;
  border: 1px solid var(--line-bright);
  background: rgba(255, 255, 255, 0.02);
}
.news-section { margin-top: 10px; }
.news-section:first-of-type { margin-top: 6px; }
.news-section-head {
  font-family: var(--grid-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--ink-faint);
  margin-bottom: 6px;
  text-transform: uppercase;
}
.news-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.news-item {
  border: 1px solid var(--line);
  padding: 8px 10px;
  background: rgba(255,255,255,0.015);
  transition: border-color 140ms ease;
}
.news-item:hover { border-color: var(--accent-2); }
.news-meta {
  display: flex; gap: 8px; align-items: center;
  font-family: var(--grid-mono); font-size: 10px;
  color: var(--ink-faint); letter-spacing: 0.06em;
  margin-bottom: 4px;
}
.news-source { color: var(--ink); }
.news-pref { color: var(--accent); }
.news-title {
  display: block;
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
  line-height: 1.35;
  word-break: break-word;
}
.news-title:hover { color: var(--accent-2); }
.news-summary {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--ink-dim);
}
.news-actions { margin-top: 4px; display: flex; gap: 10px; }
.news-link {
  font-family: var(--grid-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--accent-2);
  text-decoration: none;
}
.news-link:hover { text-decoration: underline; }

.yt-list { gap: 8px; }
.yt-card {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}
.yt-card img,
.yt-thumb-fallback {
  width: 100px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: 1px solid var(--line);
  background: #000;
  display: grid;
  place-items: center;
  color: var(--ink-faint);
  font-size: 18px;
}

.corroboration-block {
  border-color: rgba(76, 209, 255, 0.35);
  background: linear-gradient(180deg, rgba(76, 209, 255, 0.04), transparent 80%);
}

.news-empty {
  font-family: var(--grid-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  padding: 14px 12px;
  border: 1px dashed var(--line);
  text-align: center;
  text-transform: lowercase;
}

/* Cluster bubble — replaces the dot with a big count circle. No halo,
   no glow — just the solid filled circle with the count inside. */
.uap-marker.is-cluster::before {
  width: 36px; height: 36px;
  margin-left: -18px; margin-top: -18px;
  opacity: 1;
  background: currentColor;
  box-shadow: 0 0 0 2px rgba(7, 9, 13, 0.7);
}
/* Cluster halo removed — just the solid count circle now. */
.uap-cluster-count {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--grid-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--bg);
  text-shadow: 0 0 4px rgba(0,0,0,0.4);
  pointer-events: none;
  z-index: 1;
  line-height: 1;
}

.uap-popup .maplibregl-popup-content {
  background: var(--bg-2);
  border: 1px solid var(--line-bright);
  color: var(--ink);
  border-radius: 0;
  font-family: var(--grid-sans);
  font-size: 12px;
  padding: 0;
  letter-spacing: 0;
  max-width: 320px;
  cursor: pointer;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 93, 58, 0.08);
  transition: border-color 140ms ease;
}
.uap-popup .maplibregl-popup-content:hover { border-color: var(--accent); }
.uap-popup .maplibregl-popup-tip { display: none; }
.uap-popup .pop-card { display: flex; flex-direction: column; }
.uap-popup .pop-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: #000 center/cover no-repeat;
  border-bottom: 1px solid var(--line-bright);
  overflow: hidden;
}
.uap-popup .pop-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 50%, rgba(7, 9, 13, 0.85));
  pointer-events: none;
}
.uap-popup .pop-thumb-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(7, 9, 13, 0.85);
  color: var(--accent);
  border: 1px solid var(--accent);
  font-family: var(--grid-mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  padding: 2px 6px;
  z-index: 1;
}
.uap-popup .pop-thumb-cluster {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(255, 93, 58, 0.9);
  color: var(--bg);
  font-family: var(--grid-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  padding: 3px 7px;
  font-weight: 600;
  z-index: 1;
}
.uap-popup .pop-no-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 16 / 7;
  background:
    linear-gradient(135deg, rgba(255, 93, 58, 0.06), rgba(76, 209, 255, 0.04)),
    repeating-linear-gradient(45deg, rgba(255,255,255,0.02) 0 6px, transparent 6px 12px);
  border-bottom: 1px solid var(--line-bright);
  font-family: var(--grid-mono);
  font-size: 10px;
  color: var(--ink-faint);
  letter-spacing: 0.18em;
}
.uap-popup .pop-body { padding: 10px 12px 12px; }
.uap-popup .pop-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--grid-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 6px;
}
.uap-popup .pop-meta .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}
.uap-popup .pop-title {
  font-size: 13px; font-weight: 600;
  margin: 0 0 4px;
  line-height: 1.3;
  word-break: break-word;
}
.uap-popup .pop-loc {
  font-family: var(--grid-mono);
  font-size: 11px;
  color: var(--ink-dim);
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.uap-popup .pop-desc {
  font-size: 11px;
  color: var(--ink-dim);
  line-height: 1.4;
  margin: 6px 0 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.uap-popup .pop-cta {
  margin-top: 8px;
  font-family: var(--grid-mono);
  font-size: 10px;
  color: var(--accent);
  letter-spacing: 0.12em;
}
.uap-popup .pop-wx {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0 0;
  padding: 6px 8px;
  font-family: var(--grid-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: rgba(76, 209, 255, 0.06);
  border: 1px solid rgba(76, 209, 255, 0.25);
}
.uap-popup .pop-wx .pop-wx-glyph { font-size: 14px; line-height: 1; }
.uap-popup .pop-wx .dim { color: var(--ink-faint); font-size: 9px; }

/* Off-earth list item — replaces inline onmouseover handlers (which
   would violate the strict CSP). */
.off-earth-item {
  cursor: pointer;
  border: 1px solid var(--line);
  padding: 10px;
  transition: border-color 140ms ease;
}
.off-earth-item:hover { border-color: var(--accent); }

/* ---------- intro modal (first-visit) ---------- */
.intro-modal {
  position: fixed;
  inset: 0;
  z-index: 250;
  background: rgba(4, 6, 10, 0.94);
  display: grid;
  place-items: center;
  padding: 24px;
  overflow-y: auto;
}
.intro-modal[hidden] { display: none; }
.intro-shell {
  width: min(720px, 100%);
  background: var(--bg-2);
  border: 1px solid var(--line-bright);
  padding: 32px 36px 28px;
  position: relative;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 93, 58, 0.05);
}
.intro-shell::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent));
}
.intro-rule {
  font-family: var(--grid-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--accent);
  border-bottom: 1px dashed var(--line);
  padding-bottom: 10px;
  margin-bottom: 16px;
}
.intro-mark {
  width: 56px; height: 56px;
  display: grid; place-items: center;
  color: var(--accent);
  border: 1px solid var(--line-bright);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 30%, rgba(255,93,58,0.18), transparent 60%);
  margin-bottom: 16px;
}
.intro-mark svg { width: 38px; height: 38px; }
.intro-shell h2 {
  margin: 0 0 6px;
  font-size: 28px;
  letter-spacing: 0.02em;
  font-weight: 700;
}
.intro-sub {
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-dim);
  margin: 0 0 24px;
  max-width: 60ch;
}
.intro-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin: 0 0 22px;
}
.intro-card {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.015);
  padding: 12px 14px;
}
.intro-card .intro-k {
  font-family: var(--grid-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--ink-faint);
  margin-bottom: 6px;
  text-transform: uppercase;
}
.intro-card p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink);
}
.intro-card a { color: var(--accent-2); }
.intro-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 12px;
}
.intro-foot {
  margin: 0;
  font-family: var(--grid-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
}
.intro-foot a { color: var(--ink-dim); text-decoration: underline; }
@media (max-width: 720px) {
  .intro-grid { grid-template-columns: 1fr; }
  .intro-shell { padding: 22px 20px 18px; }
}

/* ---------- lightbox (video / image / pdf viewer) ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(4, 6, 10, 0.96);
  display: flex;
  flex-direction: column;
  padding: 14px;
}
.lightbox[hidden] { display: none; }
.lb-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}
.lb-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 4px 12px;
  border-bottom: 1px solid var(--line);
  font-family: var(--grid-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--ink);
  flex-shrink: 0;
}
.lb-bar .lb-tag {
  color: var(--accent);
  border: 1px solid var(--accent);
  font-size: 10px;
  letter-spacing: 0.18em;
  padding: 3px 8px;
}
.lb-bar .lb-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 60ch;
}
.lb-bar .lb-meta {
  color: var(--ink-faint);
  font-size: 11px;
  letter-spacing: 0.08em;
}
.lb-bar .lb-newtab {
  margin-left: auto;
  color: var(--accent-2);
  text-decoration: none;
  font-size: 11px;
  letter-spacing: 0.12em;
  border: 1px solid transparent;
  padding: 6px 10px;
  transition: border-color 140ms ease;
}
.lb-bar .lb-newtab:hover { border-color: var(--accent-2); }
.lb-bar .lb-close {
  background: transparent;
  border: 1px solid var(--line-bright);
  color: var(--ink-dim);
  width: 36px; height: 36px;
  font-size: 22px;
  cursor: pointer;
  flex-shrink: 0;
}
.lb-bar .lb-close:hover { color: var(--accent); border-color: var(--accent); }

.lb-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  border: 1px solid var(--line-bright);
  background:
    linear-gradient(135deg, rgba(255, 93, 58, 0.04), rgba(76, 209, 255, 0.04)),
    repeating-linear-gradient(45deg, rgba(255,255,255,0.015) 0 8px, transparent 8px 16px);
  position: relative;
  overflow: hidden;
}
.lb-stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}
.lb-stage video {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  background: #000;
  display: block;
  outline: none;
}
.lb-stage iframe,
.lb-stage embed {
  width: 100%;
  height: 100%;
  border: 0;
  background: #1a1a1a;
}
.lb-stage .lb-fallback {
  font-family: var(--grid-mono);
  font-size: 13px;
  color: var(--ink-dim);
  text-align: center;
  padding: 40px;
  letter-spacing: 0.04em;
  line-height: 1.6;
}
.lb-stage .lb-fallback a { color: var(--accent-2); }

@media (max-width: 760px) {
  .lb-bar .lb-title { max-width: 18ch; }
  .lb-bar .lb-meta { display: none; }
}

/* ---------- footer ---------- */
.foot {
  border-top: 1px solid var(--line);
  padding: 18px 28px 32px;
  font-family: var(--grid-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-dim);
  max-width: 1480px;
  margin: 0 auto;
}
.foot p { margin: 0 0 6px; }
.foot a { color: var(--accent-2); }

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .banner { padding: 12px 16px 16px; }
  .banner-row { grid-template-columns: auto 1fr; }
  .banner-stats { grid-column: 1 / -1; justify-content: flex-start; gap: 18px; }
  .timeline, .filters, .record-grid { padding-left: 16px; padding-right: 16px; }
  .filters { grid-template-columns: 1fr; gap: 12px; }
  .map-overlay-tl { top: 12px; left: 12px; min-width: 160px; padding: 8px 10px; font-size: 10px; }
  .map-overlay-bl { display: none; }
  .off-earth-pill { right: 12px; top: 12px; }
  .detail { width: 100%; }
}
