:root {
  --bg: #070d19;
  --bg-elev: rgba(11, 17, 32, 0.88);
  --bg-card: #0f172a;
  --bg-card-alt: #131f37;
  --border: #1e2d45;
  --border-strong: #2d4365;
  --text: #f1f5f9;
  --text-soft: #cbd5e1;
  --text-muted: #94a3b8;
  --teal: #00a8a6;
  --teal-soft: rgba(0, 168, 166, 0.14);
  --cyan: #38bdf8;
  --cyan-soft: rgba(56, 189, 248, 0.12);
  --emerald: #10b981;
  --emerald-soft: rgba(16, 185, 129, 0.14);
  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.14);
  --slate-pill: rgba(148, 163, 184, 0.14);
  --shadow: 0 18px 42px rgba(2, 6, 23, 0.45);
  --radius: 14px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Georgia, Cambria, serif;
  --font-mono: "SF Mono", "JetBrains Mono", ui-monospace, Menlo, monospace;
}

[data-theme="light"] {
  --bg: #f6f8fb;
  --bg-elev: rgba(255, 255, 255, 0.92);
  --bg-card: #ffffff;
  --bg-card-alt: #f1f5f9;
  --border: #dde5f0;
  --border-strong: #c4d2e4;
  --text: #0b1324;
  --text-soft: #334155;
  --text-muted: #5b6b82;
  --teal: #008987;
  --teal-soft: rgba(0, 137, 135, 0.1);
  --cyan: #0284c7;
  --cyan-soft: rgba(2, 132, 199, 0.1);
  --emerald: #059669;
  --emerald-soft: rgba(5, 150, 105, 0.1);
  --amber: #d97706;
  --amber-soft: rgba(217, 119, 6, 0.11);
  --slate-pill: rgba(100, 116, 139, 0.1);
  --shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(circle at 12% -5%, rgba(0, 168, 166, 0.14), transparent 42%),
    radial-gradient(circle at 88% 4%, rgba(56, 189, 248, 0.11), transparent 38%);
}

a {
  color: inherit;
  text-decoration: none;
}

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-elev);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
  flex-wrap: wrap;
  padding: 10px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
}

.brand-wordmark {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-title {
  font-size: 1.18rem;
  letter-spacing: 0.11em;
}

.brand-title .wm-uro {
  font-weight: 400;
  color: var(--text);
}

.brand-title .wm-corpus {
  font-weight: 800;
  background: linear-gradient(90deg, var(--teal), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.topbar-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.icua-chip {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-soft);
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  transition: border-color 0.2s, color 0.2s;
}

.icua-chip:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.seg-btn {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px;
  background: var(--bg-card);
}

.seg-btn button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
}

.seg-btn button.active {
  background: var(--teal);
  color: #ffffff;
}

.lang-flag {
  display: inline-block;
  width: 16px;
  height: 11px;
  border-radius: 2px;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.24);
}

.seg-btn button.active .lang-flag {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.icon-btn {
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-soft);
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s;
}

.icon-btn:hover {
  border-color: var(--cyan);
}

/* Hero */
.hero {
  padding: 68px 0 44px;
}

.status-banner {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(0, 168, 166, 0.4);
  background: var(--teal-soft);
  color: var(--teal);
  margin-bottom: 22px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.65);
  animation: pulse 2.2s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.65); }
  70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.hero h1 {
  margin: 0 0 18px;
  font-family: var(--font-serif);
  font-size: clamp(2.15rem, 4.4vw, 3.35rem);
  line-height: 1.13;
  letter-spacing: -0.015em;
  max-width: 880px;
}

.hero-lead {
  margin: 0 0 30px;
  max-width: 760px;
  font-size: 1.08rem;
  color: var(--text-soft);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 40px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 22px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--teal), #0284c7);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.94rem;
  box-shadow: 0 10px 24px rgba(0, 168, 166, 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(0, 168, 166, 0.34);
}

.btn-primary-alt {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid rgba(0, 168, 166, 0.55);
  box-shadow: none;
}

.btn-primary-alt:hover {
  border-color: var(--cyan);
  background: var(--bg-card-alt);
  box-shadow: 0 10px 22px rgba(2, 132, 199, 0.16);
}

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .pulse-dot { animation: none; }
  * { transition: none !important; scroll-behavior: auto !important; }
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 20px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text);
  font-weight: 600;
  font-size: 0.94rem;
  transition: border-color 0.2s, background 0.2s;
}

.btn-secondary:hover {
  border-color: var(--teal);
  background: var(--bg-card-alt);
}

/* KPI Strip */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(195px, 1fr));
  gap: 12px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
}

.kpi-num {
  font-family: var(--font-mono);
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.15;
}

.kpi-num.accent {
  color: var(--teal);
}

.kpi-label {
  margin-top: 5px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Section Headers */
section {
  padding: 36px 0;
}

.sec-kicker {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--teal);
  margin-bottom: 8px;
}

.sec-title {
  margin: 0 0 10px;
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 2.8vw, 2.05rem);
  line-height: 1.2;
}

.sec-desc {
  margin: 0 0 26px;
  max-width: 740px;
  color: var(--text-muted);
  font-size: 0.96rem;
}

/* Volumes Grid */
.volumes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 16px;
}

.vol-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: transform 0.18s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.vol-card.live {
  border-color: rgba(16, 185, 129, 0.55);
  box-shadow: var(--shadow);
  background: linear-gradient(180deg, rgba(0, 168, 166, 0.08), var(--bg-card) 48%);
}

.vol-card.live:hover {
  transform: translateY(-2px);
  border-color: var(--emerald);
}

.vol-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.vol-num {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 999px;
}

.badge-live {
  background: var(--emerald-soft);
  color: var(--emerald);
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.badge-build {
  background: var(--amber-soft);
  color: var(--amber);
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.badge-plan {
  background: var(--slate-pill);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.vol-card h3 {
  margin: 0 0 6px;
  font-size: 1.18rem;
  line-height: 1.25;
}

.vol-sub {
  margin: 0 0 12px;
  font-size: 0.85rem;
  color: var(--cyan);
  font-weight: 600;
}

.vol-desc {
  margin: 0 0 18px;
  font-size: 0.89rem;
  color: var(--text-soft);
}

.vol-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.vol-cta {
  color: var(--emerald);
  font-weight: 700;
}

/* Methodology */
.method-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
  gap: 14px;
}

.method-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}

.method-step {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--teal);
  margin-bottom: 8px;
}

.method-card h4 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.method-card p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* Institutional Governance Card */
.gov-card {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--teal);
  border-radius: var(--radius);
  padding: 28px;
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 28px;
  align-items: center;
}

.gov-card h3 {
  margin: 0 0 10px;
  font-family: var(--font-serif);
  font-size: 1.4rem;
}

.gov-card p {
  margin: 0 0 12px;
  font-size: 0.93rem;
  color: var(--text-soft);
}

.gov-links {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.gov-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card-alt);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text);
  transition: border-color 0.2s, color 0.2s;
}

.gov-link:hover {
  border-color: var(--teal);
  color: var(--teal);
}

/* Footer */
footer {
  margin-top: 32px;
  padding: 28px 0 42px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.82rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-links a:hover {
  color: var(--teal);
}

@media (max-width: 820px) {
  .gov-card {
    grid-template-columns: 1fr;
  }
  .hero {
    padding: 44px 0 28px;
  }
}

/* Global Cross-Volume Search Box */
.global-search-shell {
  margin: 0 0 26px;
  max-width: 820px;
}
.global-search-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1.5px solid var(--border-strong);
  border-radius: 12px;
  padding: 6px 10px 6px 14px;
  box-shadow: var(--shadow);
  transition: border-color 0.16s ease;
}
.global-search-row:focus-within {
  border-color: var(--teal);
}
.global-search-row input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 0.96rem;
  font-family: inherit;
  padding: 7px 4px;
  outline: none;
}
.global-search-row input::placeholder {
  color: var(--text-muted);
}
.global-search-hint {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: 0.76rem;
  color: var(--text-muted);
}
.search-chip {
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-soft);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.74rem;
  cursor: pointer;
  transition: border-color 0.14s ease, color 0.14s ease;
}
.search-chip:hover {
  border-color: var(--teal);
  color: var(--teal);
}
.global-search-results {
  margin-top: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 10px 12px;
  max-height: 430px;
  overflow-y: auto;
  box-shadow: var(--shadow);
}
.global-search-results.hidden { display: none; }
.gs-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.76rem;
  color: var(--text-muted);
  padding: 0 2px 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
  font-family: var(--font-mono);
}
.gs-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 9px;
  border: 1px solid transparent;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.gs-item:hover {
  background: var(--bg-card-alt);
  border-color: var(--border-strong);
}
.gs-main { flex: 1; min-width: 0; }
.gs-badges { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; margin-bottom: 3px; }
.gs-vol-pill {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--teal-soft);
  color: var(--teal);
  border: 1px solid rgba(0, 168, 166, 0.38);
}
.gs-yr-pill {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--slate-pill);
  color: var(--text-soft);
}
.gs-title { font-weight: 650; font-size: 0.88rem; line-height: 1.32; color: var(--text); }
.gs-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }
.gs-pdf-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px 4px 6px;
  border-radius: 6px;
  background: rgba(220, 38, 38, 0.16);
  color: #fca5a5;
  border: 1px solid rgba(248, 113, 113, 0.48);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}
[data-theme="light"] .gs-pdf-btn { background: #fef2f2; color: #b91c1c; border-color: #f87171; }
.gs-pdf-btn:hover { background: #dc2626; color: #ffffff; border-color: #dc2626; }

/* OWID-style Cross-Procedural Synthesis Panel & Weekly Feed */
.owid-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.owid-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}
.owid-bars {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.owid-row {
  display: grid;
  grid-template-columns: minmax(180px, 240px) 1fr 125px;
  gap: 14px;
  align-items: center;
}
@media (max-width: 720px) {
  .owid-row { grid-template-columns: 1fr; gap: 6px; }
}
.owid-vol-lbl { font-weight: 700; font-size: 0.88rem; }
.owid-vol-sub { font-size: 0.74rem; color: var(--text-muted); font-family: var(--font-mono); }
.owid-bar-group { display: flex; flex-direction: column; gap: 5px; }
.owid-track {
  height: 12px;
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.owid-fill-rct { height: 100%; background: #10b981; border-radius: 999px; }
.owid-fill-srma { height: 100%; background: #a855f7; border-radius: 999px; }
.owid-fill-oa { height: 100%; background: linear-gradient(90deg, #dc2626, #f87171); border-radius: 999px; }
.owid-fill-edg { height: 100%; background: linear-gradient(90deg, var(--teal), var(--cyan)); border-radius: 999px; }
.owid-stat {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text);
}
.owid-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.owid-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 5px; }

.feed-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
  gap: 11px;
}
.feed-card {
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 13px 15px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.14s ease, transform 0.12s ease;
}
.feed-card:hover {
  border-color: var(--teal);
  transform: translateY(-1px);
}
.feed-card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Volume Card Section Editors Mini-Strip */
.vol-editors {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: 13px;
  padding-top: 11px;
  border-top: 1px dashed var(--border);
}
.vol-ed-avatars {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.vol-ed-avatars img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 15%;
  border: 2px solid var(--bg-card);
  box-shadow: 0 0 0 1.5px rgba(0, 168, 166, 0.65);
  margin-left: -9px;
  background: var(--bg-card-alt);
}
.vol-ed-avatars img:first-child { margin-left: 0; }
.vol-ed-names {
  font-size: 0.8rem;
  line-height: 1.32;
  color: var(--text-muted);
}
.vol-ed-names strong {
  color: var(--text);
  font-weight: 700;
}

/* Editorial Board Grid */
.board-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(310px, 100%), 1fr));
  gap: 14px;
}
.board-card {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 13px 15px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.16s ease, transform 0.14s ease, box-shadow 0.16s ease;
}
.board-card:hover {
  border-color: var(--teal);
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(0, 168, 166, 0.15);
}
.board-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 15%;
  border: 2.5px solid var(--teal);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.24);
  flex-shrink: 0;
  background: var(--bg-card-alt);
}
.board-info { min-width: 0; }
.board-name {
  font-size: 0.97rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.22;
}
.board-card:hover .board-name { color: var(--teal); }
.board-city {
  font-size: 0.8rem;
  color: var(--teal);
  font-weight: 700;
  margin-top: 3px;
}
.board-vols {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-soft);
  margin-top: 4px;
}
