/* UFOScans.com — Static Page Stylesheet
   Browser-cached across all 17,000+ document pages.
   Design system mirrors the SPA at index.html.
   ================================================ */

:root {
  --bg-body:    #f1f5f9;
  --bg-white:   #ffffff;
  --bg-header:  #0f172a;
  --text-main:  #1e293b;
  --text-muted: #334155;
  --border:     #cbd5e1;
  --accent:     #1e40af;
  --accent-soft:#eff6ff;
  --font-sans:  'Inter', sans-serif;
  --font-mono:  'JetBrains Mono', monospace;
  --radius:     6px;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg-body);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Header ── */
.site-header {
  background: var(--bg-header);
  color: #fff;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.site-logo {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}

.site-logo:hover { color: #93c5fd; }

.header-search {
  flex: 1;
  max-width: 420px;
}

.header-search input {
  width: 100%;
  padding: 0.4rem 0.875rem;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-size: 0.8125rem;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

.header-search input::placeholder { color: rgba(255,255,255,0.55); }
.header-search input:focus {
  border-color: rgba(255,255,255,0.45);
  background: rgba(255,255,255,0.13);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}
.header-browse-link {
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
}
.header-browse-link:hover { color: #fff; }

/* ── Header stats (homepage only) ── */
.hp-header-stats {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex: 1;
  justify-content: center;
  overflow: hidden;
}
.hp-header-stat {
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
  white-space: nowrap;
}
.hp-header-stat-val {
  font-size: 0.8125rem;
  font-weight: 700;
  color: #fff;
  font-family: var(--font-mono);
}
.hp-header-stat-lbl {
  font-size: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.55);
  font-weight: 600;
}
@media (max-width: 860px) {
  .hp-header-stats { display: none; }
}
@media (max-width: 640px) {
  .hp-header-stats { display: none; }
}

/* ── Breadcrumb ── */
.breadcrumb {
  padding: 0.5rem 1.5rem;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.breadcrumb a {
  color: var(--accent);
  text-decoration: underline;
  font-weight: 500;
}
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb-sep { color: var(--border); font-size: 0.85em; }

/* ── Page layout ── */
.page-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 2rem;
  align-items: start;
}

/* ── Document header card ── */
.doc-header {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  margin-bottom: 1.5rem;
}

.doc-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.doc-title {
  font-size: 1.625rem;
  font-weight: 700;
  color: var(--bg-header);
  line-height: 1.25;
  margin-bottom: 1.25rem;
  word-break: break-word;
}

/* ── Badges ── */
.doc-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.625rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  font-family: var(--font-mono);
  line-height: 1.4;
}
.badge-date     { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.badge-location { background: var(--accent-soft); color: var(--accent); border: 1px solid #bfdbfe; }
.badge-agency   { background: #fef9c3; color: #854d0e; border: 1px solid #fde68a; }
.badge-type     { background: #f5f3ff; color: #6d28d9; border: 1px solid #ddd6fe; }

/* ═══════════════════════════════════════════════════════
   ORIGINAL DOCUMENT SIDEBAR CARD
   ═══════════════════════════════════════════════════════ */

/* Card shell — thumbnail bleeds to edges, body is padded */
.sidebar-card-preview { padding: 0; overflow: hidden; }

.doc-preview-thumb { line-height: 0; }
.doc-preview-img {
  width: 100%;
  height: auto;
  display: block;
  background: var(--bg-body);
}

/* Padded body area below the thumbnail */
.doc-card-body {
  padding: 1rem 1.125rem 1.125rem;
}
.doc-card-body .section-heading { margin-bottom: 0.75rem; }

/* Donate card */
.sidebar-donate-link { display: block; line-height: 0; }
.sidebar-donate-img { width: 100%; height: 160px; object-fit: cover; object-position: center 20%; display: block; transition: opacity 0.15s; }
.sidebar-donate-link:hover .sidebar-donate-img { opacity: 0.88; }
.sidebar-donate-text { font-size: 0.775rem; color: var(--text-muted); line-height: 1.5; margin: 0 0 0.75rem; }

/* ── Segmented control: AI Summary / View Original ── */
.doc-view-toggle {
  display: flex;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-body);
  margin-bottom: 0.75rem;
}
.doc-view-btn {
  flex: 1;
  padding: 0.5rem 0.375rem;
  background: transparent;
  border: none;
  font-size: 0.775rem;
  font-weight: 500;
  font-family: var(--font-sans);
  color: var(--text-muted);
  cursor: pointer;
  text-align: center;
  line-height: 1.3;
  transition: background 0.15s, color 0.15s;
}
.doc-view-btn + .doc-view-btn { border-left: 1.5px solid var(--border); }
.doc-view-btn:hover:not(.doc-view-btn--active) {
  background: var(--accent-soft);
  color: var(--accent);
}
.doc-view-btn--active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

/* ── Download row ── */
.doc-dl-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.575rem 0.75rem;
  background: var(--bg-body);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text-main);
  transition: border-color 0.15s, background 0.15s;
}
.doc-dl-row:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.doc-dl-row svg { flex-shrink: 0; color: var(--text-muted); }
.doc-dl-row:hover svg { color: var(--accent); }
.doc-dl-label {
  flex: 1;
  font-size: 0.8125rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.doc-dl-row:hover .doc-dl-label { color: var(--accent); }
.doc-dl-size {
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--bg-white);
  border: 1px solid var(--border);
  padding: 0.125rem 0.375rem;
  border-radius: 3px;
  font-family: var(--font-mono);
  flex-shrink: 0;
  letter-spacing: 0.01em;
}

/* For the no-preview case (card has its own padding already) */
.sidebar-card .doc-view-toggle { margin-top: 0.5rem; }
.sidebar-card .doc-dl-row      { margin-top: 0; }

/* ── Document view tab bar (above AI summary in article) ── */
.doc-tab-bar {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1rem;
  border-bottom: 2px solid var(--border);
}
.doc-tab {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  padding: 0.55rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: var(--font-sans);
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius) var(--radius) 0 0;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.doc-tab:hover { color: var(--text-main); background: var(--accent-soft); }
.doc-tab--active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

/* ── In-page document viewer panel ── */
.doc-viewer-panel {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1.5rem;
}
.doc-viewer-iframe {
  display: block;
  width: 100%;
  height: 80vh;
  min-height: 500px;
  border: none;
}
.doc-viewer-img-wrap { line-height: 0; background: var(--bg-body); }
.doc-viewer-img { display: block; max-width: 100%; height: auto; margin: 0 auto; }
.doc-viewer-note {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 1rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  background: var(--bg-body);
  border-top: 1px solid var(--border);
  margin: 0;
}
.doc-viewer-dl-link { color: var(--accent); text-decoration: none; font-weight: 500; margin-left: auto; }
.doc-viewer-dl-link:hover { text-decoration: underline; }
.doc-viewer-msg { padding: 2rem 1.5rem; text-align: center; color: var(--text-muted); }
.doc-viewer-msg p { margin-bottom: 1.25rem; max-width: 480px; margin-left: auto; margin-right: auto; line-height: 1.6; }
.doc-viewer-msg-actions { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }

.no-preview-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.file-removed-notice {
  background: #fff7ed;
  border-left: 3px solid #f59e0b;
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
  color: #92400e;
  line-height: 1.55;
}

/* ── Summary card ── */
.doc-summary-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  margin-bottom: 1.5rem;
}

.section-heading {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

/* ── Summary body typography ── */
.summary-body h1,
.summary-body h2,
.summary-body h3 {
  color: var(--bg-header);
  font-weight: 700;
  line-height: 1.3;
  margin: 1.5rem 0 0.75rem;
}
.summary-body h1:first-child,
.summary-body h2:first-child,
.summary-body h3:first-child { margin-top: 0; }
.summary-body h1 { font-size: 1.25rem; }
.summary-body h2 { font-size: 1.05rem; border-bottom: 1px solid var(--border); padding-bottom: 0.3rem; }
.summary-body h3 { font-size: 0.95rem; color: var(--text-muted); }

.summary-body p {
  color: var(--text-main);
  line-height: 1.8;
  margin-bottom: 1rem;
}

.summary-body ul,
.summary-body ol {
  margin: 0.75rem 0 1rem 1.5rem;
  line-height: 1.75;
}
.summary-body li { margin-bottom: 0.4rem; }
.summary-body strong { font-weight: 600; color: var(--bg-header); }
.summary-body em { font-style: italic; color: var(--text-muted); }
.summary-body hr { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }
.summary-body a { color: var(--accent); }

/* ── Share bar ── */
.share-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}
.share-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.075em;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-right: 0.25rem;
}
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-white);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--font-sans);
  transition: all 0.12s;
  white-space: nowrap;
}
button.share-btn {
  cursor: pointer;
}
.share-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

/* ── Lang switcher ── */
.lang-switcher-wrap {
  margin-bottom: 1.5rem;
}
.lang-switcher-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.075em;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.lang-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}
.lang-btn {
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-white);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.7rem;
  font-weight: 700;
  font-family: var(--font-mono);
  transition: all 0.1s;
}
.lang-btn:hover,
.lang-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

/* ── Sidebar ── */
.doc-sidebar { position: sticky; top: 68px; }

.sidebar-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

/* ── Key facts table ── */
.facts-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}
.facts-table tr:not(:last-child) .facts-label,
.facts-table tr:not(:last-child) .facts-value {
  padding-bottom: 0.7rem;
}
.facts-label {
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.075em;
  color: var(--text-muted);
  font-weight: 700;
  padding-right: 0.875rem;
  vertical-align: top;
  white-space: nowrap;
  width: 35%;
}
.facts-value {
  color: var(--text-main);
  font-size: 0.8rem;
  line-height: 1.5;
  word-break: break-word;
  font-family: var(--font-mono);
}

/* ── Download button ── */
.btn-download {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-header);
  color: #fff;
  text-align: center;
  text-decoration: none;
  border-radius: 5px;
  font-weight: 600;
  font-size: 0.875rem;
  margin-top: 1.25rem;
  transition: background 0.2s;
  letter-spacing: 0.01em;
}
.btn-download:hover { background: var(--accent); }

/* ── Related docs ── */
.related-list { list-style: none; }
.related-item {
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--border);
}
.related-item:last-child { border-bottom: none; }
.related-item a {
  color: var(--text-main);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 500;
  display: block;
  line-height: 1.4;
  transition: color 0.1s;
}
.related-item a:hover { color: var(--accent); }
.related-meta {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 0.2rem;
}

/* ── Archive stat ── */
.archive-stat {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.6;
}
.archive-stat strong { color: var(--text-main); font-weight: 600; }

/* ── Footer ── */
.site-footer {
  background: var(--bg-header);
  color: rgba(255,255,255,0.55);
  padding: 2rem 1.5rem;
  text-align: center;
  font-size: 0.75rem;
}
.footer-inner { max-width: 800px; margin: 0 auto; }
.footer-inner p { margin-bottom: 0.5rem; }
.footer-links { display: flex; justify-content: center; gap: 0.75rem; flex-wrap: wrap; }
.site-footer a { color: rgba(255,255,255,0.7); text-decoration: none; }
.site-footer a:hover { color: #fff; }
.footer-inner p a { text-decoration: underline; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }

/* ── Category pages ── */
.cat-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.375rem 1.5rem 3.5rem;
}

/* Header + pagination form one connected block above the doc list */
.cat-header {
  margin-bottom: 0.625rem;
}
.cat-header-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 0.375rem;
}
.cat-header-title {
  font-size: clamp(1.375rem, 3vw, 1.875rem);
  font-weight: 700;
  color: var(--bg-header);
  line-height: 1.2;
  margin-bottom: 0.5rem;
}
.cat-header-meta { display: flex; gap: 0.375rem; align-items: center; flex-wrap: wrap; }
.cat-count-badge,
.cat-date-badge {
  font-size: 0.6875rem;
  font-weight: 600;
  font-family: var(--font-mono);
  padding: 0.175rem 0.5rem;
  border-radius: 4px;
}
.cat-count-badge { background: var(--accent-soft); color: var(--accent); border: 1px solid #bfdbfe; }
.cat-date-badge  { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }

/* ═══════════════════════════════════════════════════════
   SHARED PAGINATOR  (.pager)
   One component used everywhere: category pages use static
   <a> links; the search page uses JS <button> elements.
   Same classes, identical appearance.
   ═══════════════════════════════════════════════════════ */
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

/* Shared reset + base for both <a> and <button> */
.pager-btn,
.pager-num {
  font-family: var(--font-sans);
  background: var(--bg-white);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 4px;
  text-decoration: none;
  color: var(--text-main);
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.pager-btn {
  padding: 0.35rem 0.875rem;
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
}
.pager-btn:not(.pager-btn--disabled):hover,
.pager-num:not(.pager-num--active):hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.pager-btn--disabled {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}
.pager-nums {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}
.pager-num {
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.375rem;
  font-size: 0.8rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}
.pager-num--active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 600;
  cursor: default;
  pointer-events: none;
}
.pager-ellipsis {
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 0 0.2rem;
  user-select: none;
}

/* Context: category pages — pager between header and doc list */
.cat-container .pager {
  padding: 0.5rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 2px solid var(--border);
}

/* Context: category pages — bottom pager after doc list */
.cat-docs + .pager {
  padding: 0.75rem 0 0.25rem;
  border-top: 2px solid var(--border);
  border-bottom: none;
  margin-top: 0;
}

.cat-docs { border-top: none; }
.cat-doc  { border-bottom: 1px solid var(--border); }
.cat-doc-link {
  display: block;
  padding: 1rem 0.5rem;
  text-decoration: none;
  color: inherit;
  transition: background 0.1s, padding-left 0.1s;
}
.cat-doc-link:hover { background: var(--accent-soft); padding-left: 0.875rem; }
.cat-doc-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.35;
  margin-bottom: 0.3rem;
}
.cat-doc-link:hover .cat-doc-title { color: var(--accent); }
.cat-doc-meta {
  display: flex; flex-wrap: wrap; gap: 0.2rem 0.75rem;
  margin-bottom: 0.35rem;
}
.cat-doc-meta span { font-size: 0.65rem; font-family: var(--font-mono); color: var(--text-muted); }
.cat-doc-agency {
  background: var(--bg-body); border: 1px solid var(--border);
  padding: 0.1rem 0.4rem; border-radius: 3px;
}
.cat-doc-snippet {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
}

/* ── Shared document card grid (homepage featured + category pages) ── */
.feat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
}
.feat-card {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 0.5rem; padding: 1rem 1rem 1rem 1.125rem;
  background: #fff; text-decoration: none; color: inherit;
  transition: background 0.12s;
}
.feat-card:hover { background: var(--accent-soft); }
.feat-card-inner { flex: 1; min-width: 0; }
.feat-card-head { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.35rem; min-height: 1.4rem; }
.feat-card-type {
  font-size: 0.55rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; font-family: var(--font-mono);
  color: var(--accent); background: var(--accent-soft);
  padding: 0.15rem 0.45rem; border-radius: 3px;
}
.feat-card-title {
  font-size: 0.9rem; font-weight: 700; color: var(--text-main);
  line-height: 1.35; margin: 0 0 0.4rem;
}
.feat-card:hover .feat-card-title { color: var(--accent); }
.feat-card-meta {
  display: flex; flex-wrap: wrap; gap: 0.25rem 0.5rem;
  margin-bottom: 0.5rem;
}
.feat-card-meta span { font-size: 0.65rem; font-family: var(--font-mono); color: var(--text-muted); }
.feat-card-date::before { content: "📅 "; }
.feat-card-loc::before  { content: "📍 "; }
.feat-card-agency {
  background: var(--bg-body); border: 1px solid var(--border);
  padding: 0.1rem 0.4rem; border-radius: 3px;
}
.feat-card-snippet {
  font-size: 0.75rem; color: var(--text-muted); line-height: 1.55; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
.feat-card-arrow {
  font-size: 0.9rem; color: var(--border); flex-shrink: 0;
  align-self: center; transition: color 0.12s, transform 0.12s;
}
.feat-card:hover .feat-card-arrow { color: var(--accent); transform: translateX(3px); }

@media (max-width: 640px) {
  .cat-container { padding: 1rem 1rem 2rem; }
  .cat-doc-snippet { display: none; }
  .pager-nums { display: none; }
  .feat-grid { grid-template-columns: 1fr; }
  .feat-card-snippet { -webkit-line-clamp: 2; }
}

/* ── Rotating spotlight banner ── */
#spotlight {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
}
/* Wrapper used on homepage/category pages where the spotlight sits in the
   wide hp-main column rather than inside a narrower article column */
.sl-hp-wrap { max-width: 940px; }
/* Ali slide: absolute overlay sized to the container */
.spotlight-slide {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  background: var(--bg-white);
}
/* Game: in-flow so its content sets the container height */
#spotlight-game {
  position: relative;
  height: auto;
  width: 100%;
  opacity: 1;
  z-index: 1;
  pointer-events: auto;
  background: #0f172a;
  border-top: 2px solid var(--accent);
  padding: 0;
}
#spotlight-game::after {
  content: '● ON AIR';
  position: absolute;
  top: 0.55rem;
  right: 0.8rem;
  font-size: 0.57rem;
  font-weight: 700;
  color: #ef4444;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  pointer-events: none;
}
/* AliExpress banner slide: fades over the game slide — 30s cycle (15s each) */
#spotlight-ali {
  opacity: 0; z-index: 2; pointer-events: none;
  will-change: opacity;
  animation: aliShow 30s linear infinite;
  justify-content: center;
}
/* 30s cycle: game 0-15s · ali 15-30s (1s crossfades) */
@keyframes aliShow {
  0%       { opacity: 0; pointer-events: none; }
  46.7%    { opacity: 0; pointer-events: none; animation-timing-function: ease-in-out; }
  50%      { opacity: 1; pointer-events: auto; }
  96.7%    { opacity: 1; pointer-events: auto; animation-timing-function: ease-in-out; }
  100%     { opacity: 0; pointer-events: none; }
}

/* — Game slide — */
.sl-game-card {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  width: 100%;
  padding: 1.25rem 1.5rem;
}
.sl-screenshot-frame {
  flex: 0 0 auto;
  background: #1e293b;
  border-radius: 6px;
  overflow: hidden;
  padding: 5px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  align-self: center;
}
.sl-screenshot {
  width: 148px;
  height: 100px;
  object-fit: cover;
  object-position: center;
  border-radius: 3px;
  display: block;
}
.sl-game-body { flex: 1; min-width: 0; }
.sl-game-hook {
  font-size: 0.9375rem;
  font-weight: 700;
  color: #f1f5f9;
  margin: 0 0 0.2rem;
  line-height: 1.3;
}
.sl-game-name {
  font-size: 0.65rem;
  font-weight: 700;
  color: #60a5fa;
  margin: 0 0 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.sl-game-meta {
  font-weight: 400;
  color: #475569;
  text-transform: none;
  letter-spacing: 0;
}
.sl-game-desc {
  font-size: 0.775rem;
  color: #94a3b8;
  line-height: 1.5;
  margin: 0 0 0.5rem;
}
.sl-game-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 0 0 0.6rem;
}
.sl-topic {
  font-size: 0.62rem;
  font-weight: 600;
  color: #64748b;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 3px;
  padding: 0.1rem 0.45rem;
  white-space: nowrap;
}
/* — Game CTA button — */
.sl-game-btn {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  text-decoration: none;
  padding: 0.4rem 1rem;
  border-radius: var(--radius);
  transition: background 0.15s, box-shadow 0.15s;
  letter-spacing: 0.01em;
  box-shadow: 0 1px 4px rgba(30,64,175,0.4);
}
.sl-game-btn:hover {
  background: #1d4ed8;
  text-decoration: none;
  color: #fff;
  box-shadow: 0 2px 8px rgba(30,64,175,0.5);
}
/* Hide screenshot at narrower widths to prevent cramping */
@media (max-width: 580px) {
  .sl-screenshot-frame { display: none; }
  .sl-game-card { gap: 0; padding: 1rem 1.125rem; }
}

/* — AliExpress banner slide — */
.sl-ali-link {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  text-decoration: none;
}
.sl-ali-img {
  max-width: 100%;
  max-height: 168px;
  width: auto;
  height: auto;
  display: block;
  border-radius: 4px;
  transition: opacity 0.15s, transform 0.15s;
}
.sl-ali-img:hover { opacity: 0.9; transform: scale(1.02); }

/* Mobile: stack slides as static blocks */
@media (max-width: 700px) {
  #spotlight { overflow: visible; }
  #spotlight-game { border-bottom: 1px solid #1e293b; }
  #spotlight-ali {
    position: static;
    width: 100%;
    height: auto;
    opacity: 1 !important;
    pointer-events: auto !important;
    animation: none !important;
  }
  .sl-ali-img { max-height: 120px; }
}

/* ── Override centering inside portal right column ── */
/* page-container and cat-container both have max-width + margin:0 auto which
   creates a gap between the sidebar and the content on wide screens. Remove that. */
.hp-main .page-container {
  max-width: none;
  margin: 0;
}
.hp-main .cat-container {
  max-width: none;
  margin: 0;
}

/* ── Portal 2-column layout ── */
.hp-portal {
  display: grid;
  grid-template-columns: 260px 1fr;
  align-items: start;
}
.hp-main { min-width: 0; }

.hp-sidebar {
  position: sticky;
  top: 44px;
  height: calc(100vh - 44px);
  overflow-y: auto;
  overflow-x: hidden;
  background: #fff;
  border-right: 1px solid var(--border);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.hp-sidebar::-webkit-scrollbar { width: 4px; }
.hp-sidebar::-webkit-scrollbar-track { background: transparent; }
.hp-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.sidebar-heading {
  padding: 0.875rem 1rem 0.5rem;
  font-size: 0.55rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.25rem;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}
.sidebar-col-link {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  font-size: 0.8rem;
  color: var(--text-main);
  text-decoration: none;
  transition: background 0.1s, color 0.1s;
  line-height: 1.3;
}
.sidebar-col-link:hover,
.sidebar-col-link.active {
  background: var(--accent-soft);
  color: var(--accent);
}
.sidebar-col-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-col-count {
  font-size: 0.6rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

@media (max-width: 860px) {
  .hp-portal { grid-template-columns: 1fr; }
  .hp-sidebar {
    position: static;
    height: auto;
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 0 0.5rem;
    scrollbar-width: none;
    gap: 0;
  }
  .hp-sidebar::-webkit-scrollbar { display: none; }
  .sidebar-heading { display: none; }
  .sidebar-col-link {
    flex: 0 0 auto;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
  }
  .sidebar-col-link:hover,
  .sidebar-col-link.active {
    border-bottom-color: var(--accent);
    background: transparent;
  }
  .sidebar-col-count { display: none; }
}

/* ── RTL support ── */
[dir="rtl"] .breadcrumb { flex-direction: row-reverse; }
[dir="rtl"] .facts-label { padding-right: 0; padding-left: 0.875rem; }
[dir="rtl"] .summary-body ul,
[dir="rtl"] .summary-body ol { margin-left: 0; margin-right: 1.5rem; }

/* ── Mobile ── */
@media (max-width: 900px) {
  .page-container {
    grid-template-columns: 1fr;
    padding: 1rem 1rem 2rem;
    gap: 1rem;
  }
  .doc-sidebar { position: static; }
  .doc-title { font-size: 1.25rem; }
  .doc-header { padding: 1.25rem; }
  .doc-summary-card { padding: 1.25rem; }
  .sidebar-card { padding: 1.25rem; }
  .header-browse-link { display: none; }
  .header-search { max-width: none; }
}

@media (max-width: 480px) {
  .site-header { flex-wrap: wrap; padding: 0.625rem 1rem; }
  .header-search { width: 100%; order: 3; max-width: 100%; }
  .breadcrumb { padding: 0.4rem 1rem; }
  .doc-badges { gap: 0.375rem; }
  .badge { font-size: 0.65rem; }
  .share-bar { flex-direction: column; align-items: flex-start; }
}

/* ─────────────────────────────────────────────────────────────────────────────
   COMPREHENSIVE MOBILE RESPONSIVENESS
   Senior-developer quality: every touch target ≥44px, no horizontal overflow,
   readable font sizes at 375px viewport, iOS Safari safe.
   ───────────────────────────────────────────────────────────────────────────── */

/* Prevent horizontal scroll bleed without creating a new scroll container
   (overflow-x:hidden would make body a scroll container, breaking sticky headers) */
body { overflow-x: clip; }

/* Images in the summary body should never overflow their container */
.summary-body img { max-width: 100%; height: auto; display: block; }

/* iOS Safari: prevent auto-zoom on input focus (requires font-size ≥ 16px) */
.search-input { font-size: 16px; }

/* Touch targets: ensure minimum 44px on mobile (applied in mobile breakpoints below) */

/* Footer dev links: centered, wraps on narrow screens */
.footer-dev {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem 0.75rem;
  margin-top: 0.5rem;
}
.footer-dev a { font-size: 0.75rem; white-space: nowrap; padding: 0.5rem 0.25rem; }

/* ── 768px: Tablet tweaks ── */
@media (max-width: 768px) {
  .doc-header { padding: 1rem; }
  .doc-summary-card { padding: 1rem; }
  .sidebar-card { padding: 1rem; }
  .share-bar { flex-wrap: wrap; gap: 0.375rem; }
  /* Larger touch targets on touch devices */
  .share-btn { min-height: 44px; padding: 0 0.875rem; }
  .sidebar-col-link { min-height: 44px; }
  .pager-btn { min-height: 44px; }
}

/* ── 640px: Compact layout ── */
@media (max-width: 640px) {
  /* Search bar full-width, slightly taller hit target */
  .search-wrap { padding: 0.375rem; }
  .search-input { padding: 0.75rem 2.4rem 0.75rem 2.5rem; }

  /* Breadcrumb condensed */
  .breadcrumb { font-size: 0.7rem; padding: 0.375rem 0.75rem; gap: 0.25rem; }

  /* Doc header */
  .doc-title { font-size: 1.15rem; }
  .doc-label { font-size: 0.65rem; }

  /* Doc tags wrap tighter */
  .doc-tags { gap: 0.2rem; margin-top: 0.625rem; }

  /* Key facts table: smaller text */
  .facts-table { font-size: 0.8rem; }
  .facts-label, .facts-value { padding: 0.375rem 0; }

  /* Share bar: smaller buttons, wrap */
  .share-bar { gap: 0.3rem; }
  .share-label { font-size: 0.7rem; }

  /* Footer */
  .footer-inner { padding: 1.25rem 1rem; gap: 0.75rem; }
  .footer-links { gap: 0.75rem; }
}

/* ── 480px: Phone landscape and smaller ── */
@media (max-width: 480px) {
  /* Header: logo + nav on one row, search below if present */
  .site-logo { font-size: 0.75rem; }

  /* Related docs: stack */
  .related-item { flex-direction: column; gap: 0.25rem; }

  /* Archive stat block */
  .archive-stat { font-size: 0.8rem; }

  /* Conclusion card */
  .doc-conclusion { padding: 1rem; }
  .doc-conclusion-text, .doc-conclusion-findings { font-size: 0.825rem; }

  /* TL;DR */
  .doc-tldr { padding: 0.75rem 0.875rem; }
  .doc-tldr p { font-size: 0.825rem; }

  /* Notable quote */
  .doc-notable-quote { font-size: 0.825rem; }

  /* Summary body text */
  .summary-body { font-size: 0.875rem; }
  .summary-body h1, .summary-body h2 { font-size: 1rem; }
  .summary-body h3 { font-size: 0.9rem; }
}

/* ── 375px: iPhone SE / smallest common phones ── */
@media (max-width: 375px) {
  .site-header { padding: 0.5rem 0.75rem; }
  .doc-title { font-size: 1.05rem; }
  .doc-badges { flex-wrap: wrap; }
  .badge { font-size: 0.6rem; padding: 0.2rem 0.45rem; }
  .search-input::placeholder { font-size: 0.75rem; }
  .btn-donate-cool { padding: 0.5rem 1.25rem; font-size: 0.75rem; }
  .sl-donate-label { font-size: 0.8rem; }
}

/* ── v2 enhanced: document tags ── */
.doc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.875rem;
}
.doc-tag {
  padding: 0.175rem 0.5rem;
  border-radius: 3px;
  background: var(--bg-body);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.6rem;
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* ── v2 enhanced: TL;DR synopsis box ── */
.doc-tldr {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 0.875rem 1.125rem;
  margin-bottom: 1.25rem;
}
.doc-tldr-label {
  font-size: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.35rem;
}
.doc-tldr p {
  font-size: 0.875rem;
  color: var(--text-main);
  line-height: 1.65;
  margin: 0;
}

/* ── v2 enhanced: notable quote ── */
.doc-notable-quote {
  border-left: 3px solid var(--border);
  padding: 0.75rem 1rem;
  margin: 1.25rem 0 0;
  background: var(--bg-body);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.65;
}

/* ── v2 enhanced: official conclusion card ── */
.doc-conclusion {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  margin-bottom: 1.5rem;
}
.doc-conclusion-category {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-family: var(--font-mono);
  padding: 0.2rem 0.6rem;
  border-radius: 3px;
  margin-bottom: 0.875rem;
}
.doc-conclusion-category.explained {
  background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0;
}
.doc-conclusion-category.unknown,
.doc-conclusion-category.unexplained {
  background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa;
}
.doc-conclusion-category.insufficient-data {
  background: #f5f3ff; color: #6d28d9; border: 1px solid #ddd6fe;
}
.doc-conclusion-category.not-stated {
  background: var(--bg-body); color: var(--text-muted); border: 1px solid var(--border);
}
.doc-conclusion-text {
  font-size: 0.875rem;
  color: var(--text-main);
  line-height: 1.72;
  font-style: italic;
  margin-bottom: 0;
}
.doc-conclusion-findings {
  font-size: 0.875rem;
  color: var(--text-main);
  line-height: 1.72;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
@media (max-width: 900px) {
  .doc-conclusion { padding: 1.25rem; }
}

/* ── v2 enhanced: linked tags (doc-tag is now an <a>) ── */
a.doc-tag {
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
a.doc-tag:hover,
a.doc-tag:focus-visible {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}

/* ── v2 enhanced: notable quote speaker attribution ── */
.doc-notable-quote p { margin: 0; }
.quote-attribution {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  font-style: normal;
  color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════════════════════
   ENTITY HUB
   Displays witnesses, key persons, organizations, and military units
   as a 2-column auto-fit grid. Falls back to single column on narrow screens.
   ═══════════════════════════════════════════════════════════════════════════ */

.doc-entity-hub {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  margin-bottom: 1.5rem;
  display: grid;
  /* auto-fit collapses empty tracks — single section takes full width */
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem 2.5rem;
}

.entity-section { min-width: 0; }

.entity-section-heading {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  color: var(--text-muted);
  margin: 0 0 0.625rem;
  padding-bottom: 0.375rem;
  border-bottom: 1px solid var(--border);
}

/* ── Structured entity list (witnesses, key persons) ── */
.entity-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.entity-item {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
}
.entity-item:last-child { border-bottom: none; }

.entity-name {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  line-height: 1.4;
}
.entity-name:hover,
.entity-name:focus-visible {
  text-decoration: underline;
  outline: none;
}
.entity-role {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  line-height: 1.4;
}
.entity-affil {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.4;
}
.entity-more {
  font-size: 0.7rem;
  color: var(--text-muted);
  padding-top: 0.375rem;
  font-style: italic;
}

/* ── Tag-pill entity list (organizations, military units) ── */
.entity-list--tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.entity-list--tags li { display: contents; }

.entity-tag {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 3px;
  background: var(--bg-body);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  font-family: var(--font-mono);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.entity-tag:hover,
.entity-tag:focus-visible {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}

@media (max-width: 900px) {
  /* On single-column layouts, dissolve the outer card and make each section
     its own card — matching the visual style of sidebar-card elements */
  .doc-entity-hub {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }
  .entity-section {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
  }
  .entity-section-heading {
    font-size: 0.65rem;
    margin-bottom: 1rem;
  }
}
@media (max-width: 768px) {
  .entity-section { padding: 1rem; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   AI TRANSPARENCY SIDEBAR CARD
   ═══════════════════════════════════════════════════════════════════════════ */

.ai-disclosure {
  margin-top: 0.875rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.55;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FILE PROVENANCE ACCORDION
   Collapsed <details> sidebar card for SHA-256, file size, PDF metadata.
   ═══════════════════════════════════════════════════════════════════════════ */

.sidebar-card--provenance details { margin: -0.25rem 0; }

/* Remove browser-default triangle marker across all engines */
.provenance-summary { list-style: none; }
.provenance-summary::-webkit-details-marker { display: none; }

.provenance-summary {
  cursor: pointer;
  user-select: none;
  margin: 0;
  padding: 0.125rem 0;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}
.provenance-summary::after {
  content: '▾';
  font-size: 0.7em;
  color: var(--text-muted);
  margin-left: auto;
  transition: transform 0.15s;
}
details[open] .provenance-summary::after {
  transform: rotate(180deg);
}
.provenance-table { margin-top: 0.875rem; }

/* SHA-256 hash — monospace, no overflow */
.prov-hash {
  font-size: 0.65rem !important;
  letter-spacing: 0 !important;
  word-break: break-all;
  line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MAIN-COLUMN SEARCH BAR
   Sits above the spotlight banner in the right (hp-main) column.
   Results drop as an absolute overlay so the page content below isn't pushed.
   ═══════════════════════════════════════════════════════════════════════════ */

.search-wrap {
  background: var(--bg-white);
  padding: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.search-input-row {
  position: relative;             /* anchor for absolute children */
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 0.8rem;
  color: #94a3b8;
  pointer-events: none;
  flex-shrink: 0;
  transition: color 0.15s;
}
.search-input-row:focus-within .search-icon { color: var(--accent); }

.search-input {
  width: 100%;
  padding: 0.6rem 2.4rem 0.6rem 2.5rem;
  background: var(--bg-body);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}
.search-input:focus {
  background: var(--bg-white);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
  color: var(--text-main);
}
.search-input::placeholder { color: #94a3b8; }
.search-input::-webkit-search-cancel-button,
.search-input::-webkit-search-decoration { display: none; }

.search-clear {
  position: absolute;
  right: 0.5rem;
  background: none;
  border: none;
  cursor: pointer;
  color: #94a3b8;
  padding: 0.25rem;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.12s;
}
.search-clear:hover { color: var(--text-main); }

/* Results panel: absolute overlay, drops below the input row */
.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
  overflow-y: auto;
  max-height: 72vh;
  z-index: 200;
}

/* sr- = search result component prefix */
.sr-count {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 0.4rem 0.75rem 0.3rem;
  margin: 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg-body);
}

.sr-item {
  display: block;
  padding: 0.5rem 0.75rem;
  text-decoration: none;
  color: var(--text-main);
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.08s;
}
.sr-item:last-child { border-bottom: none; }
.sr-item:hover,
.sr-item:focus {
  background: var(--accent-soft);
  outline: none;
}

.sr-title {
  display: block;
  font-size: 0.775rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text-main);
}
.sr-title mark {
  background: #fef08a;
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

.sr-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.1rem 0;
  margin-top: 0.2rem;
  font-size: 0.67rem;
  color: var(--text-muted);
}
.sr-meta span + span::before {
  content: '·';
  margin: 0 0.25rem;
  color: #cbd5e1;
}
.sr-meta mark {
  background: #fef08a;
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

.sr-empty {
  font-size: 0.775rem;
  color: var(--text-muted);
  padding: 1.25rem 0.75rem;
  margin: 0;
  text-align: center;
  line-height: 1.5;
}

.sr-badge {
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  background: #e2e8f0;
  color: #475569;
  white-space: nowrap;
  margin-left: 0.3rem;
  flex-shrink: 0;
}
.sr-badge--explained       { background: #dcfce7; color: #166534; }
.sr-badge--unexplained,
.sr-badge--unknown         { background: #fff7ed; color: #9a3412; }
.sr-badge--insufficient_data { background: #f3e8ff; color: #6b21a8; }

/* "See all results →" link pinned to the bottom of the dropdown */
.sr-footer {
  display: block;
  padding: 0.45rem 0.75rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  border-top: 1px solid var(--border);
  background: var(--bg-body);
  border-radius: 0 0 var(--radius) var(--radius);
  transition: background 0.08s;
}
.sr-footer:hover,
.sr-footer:focus {
  background: var(--accent-soft);
  outline: none;
}
.sr-footer em {
  font-style: normal;
  font-weight: 700;
}

/* Entity hint: shown when a result matched on person name / org (not title) */
.sr-entity-hint {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.65rem;
  font-style: italic;
  color: var(--text-muted);
  line-height: 1.3;
}
.sr-entity-hint mark {
  background: #fef08a;
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
  font-style: normal;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FULL SEARCH RESULTS PAGE  (/search/)
   A dedicated page with a large search form and full result cards.
   ═══════════════════════════════════════════════════════════════════════════ */

.sp-wrap {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 44px);
}

/* ── Search form header ── */
.sp-search-header {
  background: var(--bg-white);
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 44px;
  z-index: 10;
}

.sp-form { width: 100%; }

.sp-input-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.sp-icon {
  position: absolute;
  left: 0.875rem;
  color: #94a3b8;
  pointer-events: none;
  flex-shrink: 0;
  transition: color 0.15s;
}
.sp-input-row:focus-within .sp-icon { color: var(--accent); }

.sp-input {
  flex: 1;
  padding: 0.7rem 1rem 0.7rem 2.75rem;
  background: var(--bg-body);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 16px; /* prevents iOS Safari auto-zoom */
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.sp-input:focus {
  background: var(--bg-white);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}
.sp-input::placeholder { color: #94a3b8; }
.sp-input::-webkit-search-cancel-button,
.sp-input::-webkit-search-decoration { display: none; }

.sp-submit-btn {
  flex-shrink: 0;
  padding: 0.7rem 1.375rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.sp-submit-btn:hover { background: #1d4ed8; }

/* ── Results area ── */
.sp-results {
  padding: 1.5rem;
  flex: 1;
}

.sp-count {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-weight: 500;
  margin: 0 0 1.25rem;
  padding-bottom: 0.875rem;
  border-bottom: 1px solid var(--border);
}
.sp-count em {
  color: var(--text-main);
  font-style: normal;
  font-weight: 600;
}

.sp-empty, .sp-loading, .sp-hint {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
  padding: 3rem 0;
  text-align: center;
  margin: 0;
}
.sp-loading { font-style: italic; }

/* ── Result cards ── */
.sp-result {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.625rem;
  transition: border-color 0.1s, box-shadow 0.1s;
}
.sp-result:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 10px rgba(30, 64, 175, 0.09);
}

.sp-result-link {
  display: block;
  padding: 1rem 1.25rem;
  text-decoration: none;
  color: inherit;
}

.sp-result-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 0.3rem;
  line-height: 1.35;
}
.sp-result-title mark {
  background: #fef08a;
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

.sp-result-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}
.sp-result-meta span + span::before {
  content: '·';
  margin: 0 0.3rem;
  color: #cbd5e1;
}
.sp-result-meta mark {
  background: #fef08a;
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

.sp-result-snippet {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0.2rem 0 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sp-result-snippet mark {
  background: #fef08a;
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

/* Conclusion badge inside result cards */
.sp-badge {
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  background: #e2e8f0;
  color: #475569;
  white-space: nowrap;
  margin-left: 0.3rem;
  flex-shrink: 0;
}
.sp-badge--explained        { background: #dcfce7; color: #166534; }
.sp-badge--unexplained,
.sp-badge--unknown          { background: #fff7ed; color: #9a3412; }
.sp-badge--insufficient_data { background: #f3e8ff; color: #6b21a8; }

/* Entity row: person names / orgs / ref numbers matched in result cards */
.sp-result-entities {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.15rem 0.4rem;
  margin-top: 0.35rem;
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.sp-entity-label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  white-space: nowrap;
}
.sp-entity-sep {
  color: #cbd5e1;
  font-size: 0.7rem;
  flex-shrink: 0;
}
.sp-result-entities mark {
  background: #fef08a;
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

/* Context: search page — pager below the result cards */
.sp-results .pager {
  padding: 1.25rem 0 0.25rem;
  margin-top: 0.75rem;
  border-top: 1px solid var(--border);
}

/* ── Mobile ── */
@media (max-width: 768px) {
  .sp-search-header { padding: 0.875rem 1rem; top: 40px; }
  .sp-results { padding: 1rem; }
}
@media (max-width: 640px) {
  .sp-submit-btn { padding: 0.7rem 0.875rem; font-size: 0.8125rem; }
  .sp-result-link { padding: 0.875rem 1rem; }
  .sp-result-title { font-size: 0.875rem; }
}
@media (max-width: 480px) {
  .sp-input-row { gap: 0.375rem; }
  .sp-submit-btn { padding: 0.7rem 0.625rem; font-size: 0.75rem; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   HOMEPAGE — section bar
   Defined here (not only in homepage inline <style>) so it renders correctly
   when arriving via client-side navigation (nav.js swaps #page-content only).
   ═══════════════════════════════════════════════════════════════════════════ */

.hp-section-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.5rem 0.875rem;
  border-bottom: 1px solid var(--border);
  background: #fff;
}
.hp-section-bar-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}
.hp-section-bar-count {
  font-size: 0.6rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: var(--bg-body);
  padding: 0.1rem 0.45rem;
  border-radius: 3px;
  border: 1px solid var(--border);
}

/* ═══════════════════════════════════════════════════════════════════════════
   ABOUT PAGE  (/about.html)
   Defined here so styles apply when arriving via client-side navigation.
   ═══════════════════════════════════════════════════════════════════════════ */

.about-container { max-width: 740px; margin: 0 auto; padding: 3rem 1.5rem 5rem; }
.about-label { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.16em; font-weight: 700; color: var(--accent); margin-bottom: 0.5rem; }
.about-title { font-size: clamp(1.5rem, 3vw, 2.25rem); font-weight: 700; color: var(--bg-header); margin-bottom: 2rem; line-height: 1.2; }
.about-body h2 { font-size: 1rem; font-weight: 700; color: var(--bg-header); margin: 2rem 0 0.75rem; padding-bottom: 0.375rem; border-bottom: 1px solid var(--border); }
.about-body p { color: var(--text-main); line-height: 1.8; margin-bottom: 1rem; font-size: 0.9375rem; }
.about-body ul { margin: 0.5rem 0 1rem 1.5rem; }
.about-body li { line-height: 1.75; margin-bottom: 0.3rem; color: var(--text-main); font-size: 0.9375rem; }
.about-body strong { font-weight: 600; color: var(--bg-header); }
.about-stat-row { display: flex; gap: 1.5rem; flex-wrap: wrap; margin: 1.5rem 0; }
.about-stat { background: var(--bg-body); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; }
.about-stat-val { display: block; font-size: 1.5rem; font-weight: 700; font-family: var(--font-mono); color: var(--bg-header); }
.about-stat-lbl { display: block; font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); font-weight: 700; margin-top: 0.2rem; }
.about-api-grid { display: flex; flex-direction: column; gap: 0.5rem; margin: 1rem 0 1.5rem; }
.about-api-card { display: flex; align-items: baseline; gap: 1rem; padding: 0.75rem 1rem; background: var(--bg-body); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; transition: border-color 0.12s, background 0.12s; }
.about-api-card:hover { border-color: var(--accent); background: var(--accent-soft); }
.about-api-file { font-family: var(--font-mono); font-size: 0.8rem; font-weight: 700; color: var(--accent); flex-shrink: 0; min-width: 140px; }
.about-api-desc { font-size: 0.8125rem; color: var(--text-muted); line-height: 1.5; }
@media (max-width: 480px) {
  .about-container { padding: 1.5rem 1rem 3rem; }
  .about-api-card { flex-direction: column; gap: 0.25rem; }
  .about-api-file { min-width: unset; }
}
