:root {
  --bg: #000000;
  --card: rgba(8, 12, 17, 0.7);
  --accent: #a855f7;
  --accent-soft: rgba(168, 85, 247, 0.12);
  --text: #e2e8f0;
  --muted: #94a3b8;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-height: 100vh;
  background:
    radial-gradient(circle at 0% 35%, #073052 0%, rgba(0,0,0,0) 33%),
    radial-gradient(circle at 110% 25%, #550023 0%, rgba(0,0,0,0) 33%),
    #000;
  background-attachment: fixed;
  color: var(--text);
}

/* =================== TOP BAR =================== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(6px);
  padding: 8px 18px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  position: sticky;
  top: 0;
  z-index: 1200;
}

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

.logo {
  height: 30px;
  width: auto;
}

.brand {
  font-weight: 600;
  font-size: 15px;
  color: #fff;
}

/* ==== MOBILE-FIRST NAV ==== */
/* default: mobile */
.menu-toggle {
  display: flex;
  border: none;
  background: rgba(148, 163, 184, 0.08);
  color: #fff;
  border-radius: 10px;
  font-size: 20px;
  width: 38px;
  height: 32px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.topnav {
  display: none;
  flex-direction: column;
  position: absolute;
  right: 12px;
  top: 58px;
  background: rgba(0,0,0,0.95);
  border: 1px solid rgba(148,163,184,0.08);
  border-radius: 14px;
  padding: 6px;
  width: 170px;
  z-index: 1600;
}

.topnav.open {
  display: flex;
}

.nav-link {
  border: none;
  background: transparent;
  padding: 4px 12px 5px;
  border-radius: 999px;
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}
.nav-link:hover {
  background: rgba(148, 163, 184, 0.08);
  color: #fff;
}
.nav-link.active {
  background: rgba(168, 85, 247, 0.16);
  color: #fff;
}

/* desktop / tablet */
@media (min-width: 769px) {
  .menu-toggle {
    display: none;
  }
  .topnav {
    display: flex;
    position: static;
    flex-direction: row;
    gap: 8px;
    background: transparent;
    border: none;
    width: auto;
    padding: 0;
  }
}

/* =================== VIEWS =================== */
.view {
  display: none;
  padding: 24px 16px 90px;
  max-width: 1180px;
  margin: 0 auto;
  min-height: calc(100vh - 58px);
  position: relative;
}
.view.active {
  display: block;
}

/* =================== HEADINGS =================== */
.page-title,
.view > h2 {
  font-size: 24px;
  font-weight: 600;
  background: linear-gradient(90deg, #a855f7 0%, #ff5770 50%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 6px;
}

.page-subtitle,
.section-intro {
  color: var(--muted);
  font-size: 17px;
  max-width: 720px;
}

/* =================== MAP BLOCK =================== */
.map-info-text {
  font-size: 15px;
  font-style: italic;
  color: #caaaef;
  text-align: center;
  margin-bottom: 6px;
}
.hero-map-card--full {
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(148, 163, 184, 0.08);
  border-radius: 16px;
  padding: 10px;
  margin-top: 15px;
  position: relative;
  z-index: 10;
}

.map-wrapper {
  width: 100%;
  height: 370px;
  position: relative;
  border-radius: 12px;
  overflow: hidden;
}

.leaflet-map,
.leaflet-container {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  background: #000;
}

.leaflet-pane,
.leaflet-top,
.leaflet-bottom {
  z-index: 400;
}

/* legend */
.map-legend {
  margin-top: 10px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}
.legend-title {
  font-weight: 500;
  color: #fff;
}
.legend-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.legend-box {
  width: 14px;
  height: 14px;
  border-radius: 4px;
}

/* match map colors (6 buckets) */
.legend-high {      /* ≥10% */
  background: #6d28d9;
}
.legend-mid {       /* 5–<10% */
  background: #7c3aed;
}
.legend-low {       /* 3.5–<5% */
  background: #a855f7;
}
.legend-verylow {   /* 2–<3.5% */
  background: #c084fc;
}
.legend-verylow2 {  /* 1–<2% */
  background: #ddc8ff;
}
.legend-verylow3 {  /* <1% */
  background: #f0e7ff;
  border: 1px solid rgba(109, 40, 217, 0.15);
}
.legend-nodata {
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.1);
}

/* map no-data polygons */
.leaflet-overlay-pane svg .country-nodata {
  fill: url(#nodataPattern);
  stroke: #000;
  stroke-width: 0.35;
}

.legend-nodata {
  background: repeating-linear-gradient(
    135deg,
    #f4f4f5 0,
    #f4f4f5 10px,   /* big gap */
    #000 10px,
    #000 11px
  );
  border: 1px solid rgba(0, 0, 0, 0.05);
}


/* remove click/focus outline on countries */
.leaflet-container .leaflet-interactive:focus {
  outline: none;
  outline-offset: 0;
  box-shadow: none;
}
.leaflet-container .leaflet-interactive:active {
  outline: none;
  box-shadow: none;
}



/* =================== SECTION CARDS =================== */
.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-top: 22px;
}

.section-card {
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(148, 163, 184, 0.04);
  border-radius: 16px;
  padding: 14px;
  cursor: pointer;
  transition: transform 0.1s ease-out, border 0.1s ease-out;
}
.section-card:hover {
  transform: translateY(-2px);
  border: 1px solid rgba(168, 85, 247, 0.5);
}

/* =================== PAPERS (landing list) =================== */
.papers-block {
  margin-top: 26px;
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(148,163,184,0.04);
  border-radius: 16px;
  padding: 18px 16px 14px;
}
.papers-block h2 {
  font-size: 16px;
  margin-bottom: 8px;
  color: #fff;
}
.papers-block p {
  margin: 0 0 10px;
  color: var(--muted);
}
.papers-block h2.working-paper-title {
  background: linear-gradient(90deg, #a855f7 0%, #ff5770 25%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.paper-links {
  list-style: none;
  padding-left: 0;
  display: grid;
  gap: 0.5rem;
}

.paper-link-btn {
    background: none;
  border: none;
  color: var(--link, #8c40c1);
  text-decoration: none;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  padding: 0;
  font-size: 14px;
  margin-top: 8px;  
}
.paper-link-btn:hover {
  text-decoration: underline;
}

/* =================== ACCORDION =================== */
.accordion {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 18px;
}

.accordion-item {
  background: rgba(0,0,0,0.28);
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.04);
}

.accordion-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  cursor: pointer;
}

.accordion-header h3 {
  margin: 0;
  font-size: 15px;
  color: #fff;
}

.accordion-body {
  display: none;
  padding: 0 14px 14px 14px;
}

.accordion-item.open .accordion-body {
  display: block;
}

/* =================== CHARTS =================== */
.chart-container {
  max-width: 640px;
  background: transparent;
  padding: 10px 0 0 0;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.chart-title-sm {
  font-weight: 600;
  font-size: 12px;
  color: #fff;
}

.chart-toggle {
  display: flex;
  gap: 4px;
}

.chart-toggle button {
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(0,0,0,0.15);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11px;
  cursor: pointer;
  color: #e2e8f0;
}
.chart-toggle button.active {
  border-color: rgba(168, 85, 247, 0.9);
  background: rgba(168, 85, 247, 0.15);
}

canvas {
  display: block;
  width: 100% !important;
  height: auto !important;
  min-height: 190px;
}

/* ---- chart height management for horizontal bars ---- */
canvas.h-fixed {
  height: var(--canvas-h, 260px) !important; /* explicitly sized canvas */
}


/* =================== FIXED BOTTOM NAV =================== */
.section-nav.sticky-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: min(1180px, 100%);
  background: rgba(0,0,0,0.55);
  padding: 9px 14px 10px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  backdrop-filter: blur(4px);
  border-top: 1px solid rgba(148, 163, 184, 0.05);
  z-index: 1100;
}

.primary {
  background: linear-gradient(90deg, #a855f7 0%, #ff5770 100%);
  color: #fff;
  border: none;
  padding: 7px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
}
.secondary {
  background: rgba(0,0,0,0.25);
  color: #e2e8f0;
  border: 1px solid rgba(148, 163, 184, 0.25);
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
}

/* =================== PAPER VIEWS =================== */
.inline-note {
  font-size: 0.7rem;
  color: var(--muted);
  margin-left: 0.25rem;
}

.paper-actions {
  margin: 16px 0 26px;
}

.primary-btn {
  display: inline-block;
  background: linear-gradient(90deg, #a855f7 0%, #ff5770 100%);
  color: #fff;
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
}

.paper-view {
  display: none;
  max-width: 880px;
  margin: 0 auto;
  padding: 28px 16px 90px;
}

.paper-view.active {
  display: block;
}

.paper-header h2 {
  font-size: 22px;
  margin-bottom: 6px;
  background: linear-gradient(90deg, #a855f7 0%, #ff5770 35%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.paper-meta {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 16px;
}

/* ===== small tweaks for phones ===== */
@media (max-width: 768px) {
  #landing {
    padding-top: 18px;
  }

  .map-wrapper {
    height: 300px;
  }

  .section-nav.sticky-nav {
    justify-content: space-between;
    gap: 6px;
  }

  .section-nav.sticky-nav .primary,
  .section-nav.sticky-nav .secondary {
    font-size: 12.5px;
    padding: 6px 10px;
  }

  .paper-view {
    max-width: 100%;
  }
}




