/* ConspiracyExplorer V2 — Academic edition (matching V1 aesthetic) */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500;700;900&family=Crimson+Pro:ital,wght@0,400;0,500;0,600;0,700;1,400;1,600&family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@300;400;500;700&family=Special+Elite&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

.construction-banner {
  text-align: center;
  padding: 6px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  font-size: 24px;
  color: var(--text-3);
}

:root {
  /* Surfaces */
  --bg: #ffffff;
  --bg-2: #f7f5f0;
  --bg-3: #efece4;
  --surface: #ffffff;
  --surface-2: #f7f5f0;

  /* Borders */
  --border: #d8d3c8;
  --border-strong: #a39b8a;

  /* Text */
  --text: #1a1a1a;
  --text-2: #4a4742;
  --text-3: #87827b;

  /* Accents */
  --accent: #8b1538;
  --accent-2: #a83a5c;
  --accent-deep: #5d0e25;
  --link: #1e4080;
  --verified: #2d6a3e;
  --disputed: #b8442b;

  /* Type */
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --serif: 'Crimson Pro', Georgia, "Times New Roman", serif;
  --display: 'Playfair Display', Georgia, "Times New Roman", serif;
  --mono: 'JetBrains Mono', ui-monospace, "SF Mono", Menlo, monospace;

  --r-sm: 3px;
  --r-md: 4px;
  --r-lg: 6px;

  --shadow-soft: 0 1px 2px rgba(20, 18, 14, 0.05), 0 2px 6px rgba(20, 18, 14, 0.06);
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

body {
  background-image:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(139, 21, 56, 0.025), transparent 70%);
  background-attachment: fixed;
}

a {
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}
a:hover { border-bottom-color: currentColor; }

::selection { background: #fbe4d3; color: var(--accent-deep); }

/* ── Header (journal masthead) ─────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.site-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: 22px;
  color: var(--text);
  letter-spacing: -0.005em;
}

.back-link {
  color: var(--text-2);
  text-decoration: none;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: all 0.18s;
}
.back-link:hover {
  background: var(--bg-2);
  border-color: var(--border-strong);
  color: var(--text);
}

/* ── Home page ─────────────────────────────── */
.home-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 28px;
  text-align: center;
  min-height: calc(100vh - 90px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0;
  overflow: hidden;
}

.home-main::before {
  content: "PUBLIC INVESTIGATIVE ARCHIVE";
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.25em;
  margin-bottom: 24px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 6px 12px;
}

.home-main h2 {
  font-family: var(--display);
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin-bottom: 16px;
  color: var(--text);
  font-weight: 700;
}

.home-search-wrap {
  position: relative;
  margin: 20px 0 20px;
}

.global-search {
  width: 100%;
  padding: 14px 22px 14px 44px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  outline: none;
  box-shadow: var(--shadow-soft);
  transition: border-color 0.18s, box-shadow 0.18s;
}
.global-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(139, 21, 56, 0.10);
}
.home-search-wrap::before {
  content: "⌕";
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  font-size: 18px;
  pointer-events: none;
}

.select-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.select-wrap label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-1);
  text-transform: uppercase;
  letter-spacing: 0.2em;
}

#conspiracySelect {
  width: 100%;
  max-width: 420px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  cursor: pointer;
}
#conspiracySelect:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(139, 21, 56, 0.10);
}

/* ── Buttons ───────────────────────────────── */
button {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  padding: 8px 16px;
  border-radius: var(--r-md);
  transition: all 0.18s ease;
  letter-spacing: 0.01em;
}
button:hover { background: var(--bg-2); border-color: var(--text-2); }

.btn-primary {
  background: var(--accent);
  color: #fafaf7;
  border: 1px solid var(--accent);
  padding: 12px 26px;
  border-radius: var(--r-md);
  font-family: var(--sans);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.18s;
}
.btn-primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); }

.btn-small {
  font-family: var(--sans);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  padding: 7px 14px;
  border-radius: var(--r-md);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s;
}
.btn-small:hover { background: var(--bg-2); }

.btn-ghost {
  font-family: var(--sans);
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
  padding: 7px 14px;
  border-radius: var(--r-md);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.18s;
}
.btn-ghost:hover { background: var(--bg-2); color: var(--text); }

/* ── Conspiracy page ───────────────────────── */
.conspiracy-page {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 57px);
  padding-bottom: 300px;
}

.top-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px 28px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.conspiracy-title {
  font-family: var(--display);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.005em;
  color: var(--text);
  white-space: nowrap;
}
.conspiracy-title::before {
  content: "CASE FILE · ";
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent);
  letter-spacing: 0.25em;
  font-weight: 400;
  display: block;
  margin-bottom: 4px;
}

.conspiracy-search {
  flex: 1;
  max-width: 440px;
  padding: 9px 16px 9px 38px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  outline: none;
  position: relative;
}
.conspiracy-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(139, 21, 56, 0.10);
}

/* ── Controls bar (filters + dates + view, all one line) ── */
.controls-bar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 5px;
  padding: 7px 14px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
}

.ctrl-divider {
  width: 1px;
  height: 16px;
  background: var(--border-strong);
  flex-shrink: 0;
  margin: 0 3px;
  opacity: 0.5;
}

.ctrl-sep {
  color: var(--text-3);
  font-size: 12px;
  flex-shrink: 0;
  padding: 0 1px;
}

.filter-label {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text-3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  flex-shrink: 0;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  user-select: none;
  transition: all 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.filter-chip:hover {
  border-color: var(--border-strong);
  background: var(--bg-3);
}
.filter-chip input { accent-color: var(--accent); cursor: pointer; }

/* ── Date range slider ──────────────────────────── */
.date-slider-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}
.date-slider-text {
  width: 72px;
  padding: 3px 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-2);
  text-align: center;
  cursor: default;
  outline: none;
}
.date-slider-track {
  position: relative;
  width: 160px;
  height: 4px;
  background: var(--bg-3);
  border-radius: 99px;
  flex-shrink: 0;
}
.date-slider-fill {
  position: absolute;
  top: 0; height: 100%;
  background: var(--accent);
  border-radius: 99px;
  pointer-events: none;
}
.date-slider-thumb {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 13px; height: 13px;
  background: var(--surface);
  border: 2px solid var(--accent);
  border-radius: 50%;
  cursor: ew-resize;
  z-index: 2;
  transition: box-shadow 0.12s;
}
.date-slider-thumb:hover,
.date-slider-thumb:active { box-shadow: 0 0 0 4px rgba(139,21,56,0.15); }

.controls-bar .btn-small,
.controls-bar .btn-ghost {
  padding: 4px 10px;
  font-size: 11px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── View mode pill ─────────────────────────────── */
.view-pill {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  flex-shrink: 0;
}
.view-pill-btn {
  padding: 3px 10px;
  background: var(--surface);
  border: none;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}
.view-pill-btn + .view-pill-btn { border-left: 1px solid var(--border); }
.view-pill-btn:hover { background: var(--bg-3); }
.view-pill-btn.active { background: var(--accent); color: #fff; }

/* ── Content area ──────────────────────────── */
.content-area {
  display: flex;
  flex: none;
  height: 306px;
  overflow: hidden;
  background: var(--bg);
  transition: height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.content-area.expanded { height: 420px; }

@keyframes track-stretch {
  0%   { opacity: 1;    filter: blur(0); }
  50%  { opacity: 0.75; filter: blur(0.4px); }
  100% { opacity: 1;    filter: blur(0); }
}
.timeline-track.expanding {
  animation: track-stretch 0.36s ease-out;
}

/* ── File explorer ─────────────────────────── */
.file-explorer {
  width: 240px;
  min-width: 200px;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  gap: 14px;
  overflow-y: auto;
}

.file-explorer::before {
  content: "EVIDENCE";
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  padding: 0 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pane-search {
  width: 100%;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  font-family: var(--sans);
  font-size: 12px;
  outline: none;
}
.pane-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(139, 21, 56, 0.10);
}

.file-tree {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.file-cat {
  padding: 10px 12px;
  border-radius: var(--r-md);
  cursor: pointer;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  border-left: 2px solid transparent;
  transition: all 0.15s;
}
.file-cat:hover {
  background: var(--surface);
  color: var(--text);
}
.file-cat.active {
  background: rgba(139, 21, 56, 0.07);
  border-left-color: var(--accent);
  color: var(--accent);
}

/* ── Timeline ──────────────────────────────── */
.zoom-controls {
  display: flex;
  gap: 2px;
  margin-left: 4px;
}
.zoom-btn {
  width: 30px;
  padding: 5px 0;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
}

.timeline-wrap {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(var(--bg), var(--bg)),
    repeating-linear-gradient(0deg, transparent 0, transparent 39px, var(--border) 39px, var(--border) 40px);
  background-blend-mode: normal;
}

.timeline-container {
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  position: relative;
  cursor: grab;
  background:
    repeating-linear-gradient(0deg, rgba(216, 211, 200, 0.18) 0px, rgba(216, 211, 200, 0.18) 1px, transparent 1px, transparent 28px);
}

.timeline-container.vertical {
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--bg);
}

.timeline-container:active { cursor: grabbing; }

.timeline-track {
  position: relative;
  height: 100%;
  min-width: 100%;
  padding-right: 120px;
  will-change: transform;
}

/* Timeline axis — editorial ledger line */
.timeline-axis {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--text);
  z-index: 0;
}
.timeline-axis::before,
.timeline-axis::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--text-3);
}
.timeline-axis::before { top: -3px; }
.timeline-axis::after  { top: 3px; }

/* Year tick badges — sit well below axis & event date pills */
.tl-axis-label {
  position: absolute;
  top: calc(50% + 50px);
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text);
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
  background: var(--bg-2);
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 2px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.tl-axis-label::before {
  content: '';
  position: absolute;
  left: 50%;
  top: -46px;
  width: 1px;
  height: 44px;
  background: var(--border);
  transform: translateX(-50%);
  z-index: -1;
}

/* Event node */
.tl-event {
  position: absolute;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  max-width: 130px;
  text-align: center;
  z-index: 5;
}

/* Above-axis events: flip so label/date go up, dot stays closest to axis */
.tl-event.above { flex-direction: column-reverse; }

.tl-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: var(--bg);
  margin-bottom: 12px;
  transition: all 0.15s;
  box-shadow: 0 0 0 4px var(--bg);
}
.tl-event:hover .tl-dot {
  transform: scale(1.4);
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--bg), 0 0 12px rgba(139, 21, 56, 0.4);
}

/* Thumbnail square — replaces dot on individual events */
.tl-thumb {
  width: 44px;
  height: 44px;
  border-radius: 4px;
  border: 2px solid var(--accent);
  background: var(--bg-2);
  overflow: hidden;
  flex-shrink: 0;
  margin-bottom: 12px;
  box-shadow: 0 0 0 3px var(--bg);
  transition: all 0.15s;
}
.tl-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.tl-thumb--icon {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
}
.tl-event:hover .tl-thumb {
  transform: scale(1.15);
  box-shadow: 0 0 0 3px var(--bg), 0 0 12px rgba(139, 21, 56, 0.4);
}
.timeline-container.vertical .tl-thumb {
  margin-bottom: 0;
  flex-shrink: 0;
  margin-top: 2px;
}

.tl-label {
  font-family: var(--serif);
  font-size: 12px;
  color: var(--text);
  font-weight: 500;
  line-height: 1.3;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  white-space: normal;
  background: var(--bg);
  padding: 2px 4px;
}

.tl-date {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent);
  margin-top: 6px;
  margin-bottom: 14px;
  letter-spacing: 0.04em;
  background: var(--bg);
  padding: 1px 6px;
  border-radius: 2px;
}

/* ── Cluster node — collapsed bundle of events ── */
.tl-cluster .tl-dot.tl-cluster-dot {
  width: 22px;
  height: 22px;
  border-width: 2px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.tl-cluster-badge {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0;
}

.tl-cluster .tl-label {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-weight: 600;
}

.tl-cluster:hover .tl-cluster-dot {
  transform: scale(1.2);
  box-shadow: 0 0 0 3px var(--bg), 0 0 14px rgba(139, 21, 56, 0.5);
}

/* Floating drop-down menu when cluster clicked */
.tl-cluster-menu {
  position: fixed;
  min-width: 320px;
  max-width: 420px;
  max-height: 360px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  box-shadow: 0 8px 24px rgba(20, 18, 14, 0.18), 0 2px 6px rgba(20, 18, 14, 0.08);
  z-index: 1000;
  pointer-events: auto;
  animation: tl-cluster-menu-in 0.15s ease-out;
}

@keyframes tl-cluster-menu-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.tl-cluster-head {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

.tl-cluster-list {
  padding: 4px 0;
}

.tl-cluster-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  text-align: left;
  border-bottom: 1px solid var(--bg-2);
  transition: background 0.12s;
}
.tl-cluster-item:last-child { border-bottom: none; }
.tl-cluster-item:hover { background: var(--bg-2); }

.tl-cluster-item-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}

.tl-cluster-item-text {
  flex: 1;
  min-width: 0;
}

.tl-cluster-item-title {
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.35;
  margin-bottom: 2px;
}

.tl-cluster-item-meta {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* Connector — faint ruling line back to axis */
.tl-event.above::after,
.tl-event.below::after {
  content: '';
  position: absolute;
  left: 50%;
  width: 1px;
  background: var(--border);
  pointer-events: none;
  z-index: -1;
}
.tl-event.above::after { top: 100%; height: 300px; }
.tl-event.below::after { bottom: 100%; height: 300px; }

/* Right boundary wall */
.tl-end-wall {
  position: absolute;
  top: 15%;
  height: 70%;
  width: 2px;
  background: var(--border-strong);
  transform: translateX(-50%);
  pointer-events: none;
}
.tl-end-wall::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 0;
  height: 100%;
  width: 1px;
  background: var(--border);
}
.tl-end-wall::after {
  content: 'END OF RECORD';
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text-3);
  letter-spacing: 0.18em;
  white-space: nowrap;
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

/* ── Proper vertical timeline ───────────────── */
.timeline-container.vertical {
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--bg);
  cursor: default;
}
.timeline-container.vertical .timeline-track {
  position: relative !important;
  height: auto;
  width: 100% !important;
  min-height: 100%;
  padding: 0 !important;
}
.vert-axis {
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  background: var(--border-strong);
  z-index: 0;
}
.vert-tick-dot {
  position: absolute;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 2px solid var(--bg);
  z-index: 4;
  pointer-events: none;
}
.timeline-container.vertical .tl-event {
  position: absolute !important;
  transform: translateY(-50%) !important;
  flex-direction: column !important;
  align-items: flex-start;
  left: auto; right: auto;
  max-width: 260px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-soft);
  gap: 4px;
  text-align: left;
  z-index: 3;
}
.timeline-container.vertical .tl-event.vert-right {
  left: calc(50% + 28px);
}
.timeline-container.vertical .tl-event.vert-left {
  right: calc(50% + 28px);
  text-align: right;
  align-items: flex-end;
}
.timeline-container.vertical .tl-event::after {
  content: '';
  position: absolute;
  top: 50%;
  height: 1px;
  background: var(--border);
  width: 28px;
}
.timeline-container.vertical .tl-event.vert-right::after { left: -28px; }
.timeline-container.vertical .tl-event.vert-left::after  { right: -28px; }
.timeline-container.vertical .tl-dot { display: none; }
.timeline-container.vertical .tl-thumb {
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  margin-bottom: 6px;
}
.timeline-container.vertical .tl-label {
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 600;
  white-space: normal;
  max-width: none;
  display: block;
  -webkit-line-clamp: unset;
}
.timeline-container.vertical .tl-date {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-3);
  margin-top: 2px;
  margin-left: 0;
}
.timeline-container.vertical .tl-axis-label { display: none; }
.timeline-container.vertical .timeline-axis  { display: none; }

/* ── Branching view ────────────────────────── */
.timeline-container.branching {
  overflow-x: auto;
  overflow-y: auto;
  cursor: default;
}
.timeline-container.branching .timeline-track {
  display: flex;
  flex-direction: column;
  padding: 16px 0 32px;
  min-height: unset;
}
.branch-row {
  position: relative;
  height: 90px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.branch-row:last-of-type { border-bottom: none; }
.branch-row-label {
  width: 130px;
  flex-shrink: 0;
  font-size: 10px;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: .06em;
  text-align: right;
  padding-right: 14px;
  line-height: 1.3;
}
.branch-row-label.official { color: var(--accent); }
.branch-row-label.revealed { color: var(--teal, #2a9d8f); }
.branch-row-label.dissent  { color: var(--gold, #d4a853); }
.branch-row-line {
  position: relative;
  flex: 1;
  height: 2px;
  flex-shrink: 0;
}
.branch-row.official .branch-row-line { background: var(--accent); }
.branch-row.revealed .branch-row-line { background: var(--teal, #2a9d8f); }
.branch-row.dissent  .branch-row-line { background: var(--gold, #d4a853); }
.branch-axis-label {
  position: absolute;
  bottom: 6px;
  font-size: 9px;
  font-family: var(--mono);
  color: var(--text-muted, #8a8580);
  transform: translateX(-50%);
  white-space: nowrap;
  pointer-events: none;
}
/* events on branching track: override horizontal stagger positioning */
.branch-row-line .tl-event {
  position: absolute;
  top: 50% !important;
  transform: translate(-50%, -50%) !important;
  flex-direction: column-reverse;
}
.branch-row-line .tl-event .tl-label,
.branch-row-line .tl-event .tl-date {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  max-width: 110px;
  white-space: normal;
  text-align: center;
}
.branch-row-line .tl-event .tl-date { bottom: calc(100% + 22px); }
.branch-row-line .tl-event::after { display: none; }

/* ── Narrative lens select ─────────────────── */
.narrative-lens {
  background: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 11px;
  font-family: inherit;
  padding: 3px 8px;
  cursor: pointer;
  max-width: 190px;
}
.narrative-lens:focus {
  outline: none;
  border-color: var(--accent);
}
.narrative-lens option {
  background: var(--bg-2);
  color: var(--text);
}

/* ── Media viewer ──────────────────────────── */
.media-viewer {
  border-top: 1px solid var(--border);
  background: var(--bg-2);
  max-height: 42vh;
  overflow-y: auto;
  padding: 20px 28px;
  box-shadow: 0 -2px 12px rgba(20, 18, 14, 0.04);
}

.viewer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.viewer-header span:first-child {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

#viewerContent p {
  font-family: var(--serif);
  font-size: 16px;
  color: var(--text);
  line-height: 1.65;
}
.viewer-row {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}
.viewer-thumb {
  flex-shrink: 0;
  width: 96px;
  height: 96px;
  border-radius: 4px;
  overflow: hidden;
  border: 2px solid var(--border);
}
.viewer-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.viewer-body { flex: 1; min-width: 0; }
.viewer-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.viewer-chip {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.05em;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-3);
  color: var(--text-2);
  text-transform: uppercase;
}
.viewer-chip--type { color: var(--accent); }
.viewer-summary {
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 14px;
}
.viewer-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.viewer-link { text-decoration: none; display: inline-flex; align-items: center; }

/* ── Map view ──────────────────────────────────── */
.map-open-btn {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text-2);
  font-family: var(--mono);
  font-size: 11px;
  text-align: left;
  cursor: pointer;
  letter-spacing: .04em;
  transition: border-color 0.15s, color 0.15s;
  margin-top: auto;
}
.map-open-btn:hover { border-color: var(--accent); color: var(--accent); }

.map-overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.map-overlay.hidden { display: none; }

.map-close-btn {
  position: absolute;
  top: 10px;
  right: 14px;
  z-index: 51;
  padding: 5px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
  cursor: pointer;
}
.map-close-btn:hover { border-color: var(--accent); color: var(--accent); }

.leaflet-map-el { width: 100%; height: 100%; }

.map-no-data {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 13px;
}

/* Custom map pins */
.map-pin {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid;
  box-shadow: 0 0 6px rgba(0,0,0,0.5);
  cursor: pointer;
  transition: transform 0.15s;
}
.map-pin:hover { transform: scale(1.4); }

/* Leaflet popup override */
.map-popup-wrap .leaflet-popup-content-wrapper {
  background: var(--bg-2, #1a1a1a);
  border: 1px solid var(--border, #333);
  border-radius: 6px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  padding: 0;
  overflow: hidden;
}
.map-popup-wrap .leaflet-popup-tip { background: var(--bg-2, #1a1a1a); }
.map-popup-wrap .leaflet-popup-content { margin: 0; }

.map-popup { display: flex; gap: 0; }
.map-popup-track { width: 4px; flex-shrink: 0; }
.map-popup-body { padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.map-popup-title { font-family: var(--serif, serif); font-size: 13px; font-weight: 600; color: var(--text, #eee); line-height: 1.3; }
.map-popup-date { font-family: var(--mono, monospace); font-size: 10px; color: var(--text-3, #888); }
.map-popup-summary { font-size: 11px; color: var(--text-2, #bbb); line-height: 1.5; margin-top: 2px; }
.map-popup-dive {
  margin-top: 8px;
  padding: 5px 10px;
  background: var(--accent, #c85370);
  border: none;
  border-radius: 4px;
  color: #fff;
  font-size: 11px;
  font-family: var(--mono, monospace);
  cursor: pointer;
  align-self: flex-start;
}
.map-popup-dive:hover { opacity: 0.85; }

/* Court documents section in viewer */
.viewer-docs { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.viewer-docs-label { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin-bottom: 2px; }
.viewer-doc-link { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 4px; color: var(--accent); font-size: 12px; text-decoration: none; font-family: var(--mono); gap: 8px; }
.viewer-doc-link:hover { border-color: var(--accent); background: var(--bg-3); }
.doc-source { font-size: 10px; color: var(--text-muted); flex-shrink: 0; }

/* ── Search results dropdown ───────────────── */
.search-results {
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-top: 6px;
  z-index: 100;
  max-height: 360px;
  overflow-y: auto;
  box-shadow: var(--shadow-soft);
}

.search-result-item {
  padding: 11px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  font-family: var(--serif);
  font-size: 14px;
  color: var(--text);
  transition: background 0.15s;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--bg-2); }
.search-result-item strong { font-weight: 600; }
.search-result-item .result-type {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: block;
  margin-top: 3px;
}

.hidden { display: none !important; }

/* ── Dark mode toggle button ───────────────── */
.dark-toggle {
  margin-left: auto;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.18s;
}
.dark-toggle:hover { background: var(--bg-2); color: var(--text); border-color: var(--border-strong); }

/* ── Dark mode ─────────────────────────────── */
body.dark {
  --bg: #0f0e0c;
  --bg-2: #161410;
  --bg-3: #1d1b17;
  --surface: #161410;
  --surface-2: #1d1b17;
  --border: #302d27;
  --border-strong: #4e4940;
  --text: #e8e4dc;
  --text-2: #a89f94;
  --text-3: #6e6860;
  --accent: #c85070;
  --accent-2: #d87090;
  --accent-deep: #f09090;
  --link: #7aabde;
  --verified: #5aad72;
  --disputed: #e0604a;
  --shadow-soft: 0 1px 2px rgba(0,0,0,0.4), 0 2px 6px rgba(0,0,0,0.3);
}
body.dark {
  background-image:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(200, 80, 112, 0.06), transparent 70%);
}
body.dark .site-header {
  background: rgba(15, 14, 12, 0.94);
}
body.dark .timeline-wrap {
  background:
    linear-gradient(var(--bg), var(--bg)),
    repeating-linear-gradient(0deg, transparent 0, transparent 39px, var(--border) 39px, var(--border) 40px);
}
body.dark .timeline-container {
  background:
    repeating-linear-gradient(0deg, rgba(48, 45, 39, 0.4) 0px, rgba(48, 45, 39, 0.4) 1px, transparent 1px, transparent 28px);
}
body.dark ::selection { background: rgba(200, 80, 112, 0.28); color: var(--text); }

/* ── Footer ────────────────────────────────── */
.site-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 20px 28px;
  border-top: 1px solid var(--border);
  background: var(--bg-2);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.06em;
  flex-wrap: wrap;
}

.footer-copy { flex-shrink: 0; }

/* ── Globe ──────────────────────────────────────── */
.globe-btn {
  margin-top: 16px;
  padding: 10px 28px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s;
  display: block;
  margin-left: auto;
  margin-right: auto;
}
.globe-btn:hover { border-color: var(--accent); color: var(--accent); }

.globe-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #0a0a0f;
  display: flex;
  flex-direction: column;
}
.globe-overlay.hidden { display: none; }

.globe-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}
.globe-title {
  font-family: var(--display);
  font-size: 16px;
  color: #fff;
  letter-spacing: 0.05em;
}
.globe-header .btn-ghost {
  color: rgba(255,255,255,0.6);
  border-color: rgba(255,255,255,0.2);
}
.globe-header .btn-ghost:hover { color: #fff; border-color: rgba(255,255,255,0.5); }

.globe-header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
.globe-ctrl-btn {
  font-size: 13px;
}

.globe-container {
  flex: 1;
  width: 100%;
  position: relative;
}

.globe-preview {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20,10,20,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(200,83,112,0.4);
  border-radius: 10px;
  padding: 18px 22px;
  max-width: 340px;
  width: 90%;
  z-index: 10;
  color: #fff;
}
.globe-preview.hidden { display: none; }

.globe-preview-close {
  position: absolute;
  top: 10px; right: 12px;
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  font-size: 14px;
  cursor: pointer;
}
.globe-preview h3 {
  font-family: var(--display);
  font-size: 17px;
  margin-bottom: 8px;
  color: #fff;
}
.globe-preview p {
  font-size: 13px;
  color: rgba(255,255,255,0.7);
  margin-bottom: 14px;
  line-height: 1.5;
}
.globe-deep-dive {
  display: inline-block;
  padding: 8px 20px;
  background: var(--accent);
  color: #fff !important;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
}

.footer-contact-btn {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  transition: all 0.18s;
}
.footer-contact-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.footer-email {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-2);
  padding: 4px 12px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  letter-spacing: 0.02em;
  animation: fade-in 0.18s ease;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Contested tag & panel ─────────────────── */
.contested-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  font-family: var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #f59e0b;
  background: rgba(245,158,11,0.12);
  border: 1px solid rgba(245,158,11,0.35);
  border-radius: 4px;
  padding: 2px 7px;
  margin-top: 6px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  user-select: none;
}
.contested-tag:hover {
  background: rgba(245,158,11,0.22);
  border-color: rgba(245,158,11,0.6);
}

.contested-panel {
  position: fixed;
  z-index: 9999;
  width: 320px;
  max-width: calc(100vw - 32px);
  background: var(--bg-2, #1a1a2e);
  border: 1px solid rgba(245,158,11,0.45);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.45);
  padding: 16px 18px 18px;
  animation: fade-in 0.15s ease;
}
.contested-panel-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: transparent;
  border: none;
  font-size: 14px;
  color: var(--text-2, #aaa);
  cursor: pointer;
  line-height: 1;
  padding: 2px 4px;
}
.contested-panel-close:hover { color: var(--text-1, #fff); }
.contested-panel-title {
  font-size: 13px;
  font-weight: 700;
  color: #f59e0b;
  margin: 0 0 8px;
  padding-right: 24px;
}
.contested-panel-summary {
  font-size: 12px;
  color: var(--text-2, #ccc);
  line-height: 1.55;
  margin: 0 0 10px;
}
.contested-evidence-head {
  font-size: 10px;
  font-weight: 700;
  font-family: var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3, #888);
  margin-bottom: 6px;
}
.contested-evidence-item {
  font-size: 11px;
  color: var(--text-2, #ccc);
  line-height: 1.5;
  padding: 4px 0;
  border-top: 1px solid var(--border, rgba(255,255,255,0.08));
}
.contested-evidence-item:first-child { border-top: none; }

/* ── Map overlay controls ──────────────────── */
.map-overlay-controls {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1000;
  display: flex;
  gap: 8px;
  align-items: center;
}
.map-theme-btn {
  font-size: 14px;
  min-width: 34px;
}

/* ── Leaflet permanent pin labels ─────────── */
.map-label {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--mono, monospace);
  color: var(--text-1, #eee);
  white-space: nowrap;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8), 0 0 6px rgba(0,0,0,0.6);
}
.map-label::before { display: none !important; }

/* ── Scrollbars ────────────────────────────── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-2); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 5px; border: 2px solid var(--bg-2); }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }
