:root {
  --page: #efe6d5;
  --panel: rgba(247, 243, 233, 0.92);
  --card: rgba(255, 252, 247, 0.88);
  --ink: #122221;
  --muted: #556b67;
  --stroke: rgba(18, 34, 33, 0.12);
  --accent: #187f77;
  --accent-soft: #8ed1c8;
  --alert: #d9633f;
  --alert-soft: rgba(217, 99, 63, 0.18);
  --shadow: 0 18px 60px rgba(35, 43, 43, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Avenir Next", "Trebuchet MS", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(24, 127, 119, 0.12), transparent 32%),
    radial-gradient(circle at bottom right, rgba(217, 99, 63, 0.18), transparent 28%),
    linear-gradient(135deg, #efe6d5 0%, #f7f4ec 45%, #e6efe9 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(18, 34, 33, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(18, 34, 33, 0.035) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), transparent 85%);
}

.shell {
  display: grid;
  grid-template-columns: minmax(320px, 380px) 1fr;
  min-height: 100vh;
}

.panel {
  padding: 24px;
  backdrop-filter: blur(16px);
  background: var(--panel);
  border-right: 1px solid var(--stroke);
  overflow-y: auto;
}

.hero,
.card {
  margin-bottom: 18px;
}

.hero h1,
.map-header h2,
.card h2 {
  margin: 0;
  font-family: "Baskerville", "Times New Roman", serif;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.hero h1 {
  font-size: clamp(2.6rem, 4vw, 3.4rem);
  line-height: 0.92;
  margin-top: 8px;
}

.intro,
.note,
.map-caption,
.map-subtitle,
.slider-meta,
.stat-label,
.eyebrow {
  color: var(--muted);
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
}

.intro {
  margin: 14px 0 0;
  line-height: 1.55;
}

.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.status-pill {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  background: rgba(24, 127, 119, 0.1);
  color: var(--accent);
  border: 1px solid rgba(24, 127, 119, 0.14);
}

.status-pill-warn {
  background: var(--alert-soft);
  color: var(--alert);
  border-color: rgba(217, 99, 63, 0.18);
}

.card {
  padding: 18px;
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.button {
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 700;
  color: #f4fbfa;
  background: linear-gradient(135deg, #16625e, #1b8e85);
  cursor: pointer;
}

.month-label {
  margin: 0 0 14px;
  font-size: 1.45rem;
  font-family: "Baskerville", "Times New Roman", serif;
}

.slider {
  width: 100%;
  accent-color: var(--accent);
}

.slider-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  font-size: 0.84rem;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-weight: 600;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.stat-label {
  margin: 0 0 4px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat-value {
  margin: 0;
  font-size: 2rem;
  font-family: "Baskerville", "Times New Roman", serif;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.legend-swatch {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid rgba(18, 34, 33, 0.12);
}

.legend-swatch-migration {
  background: linear-gradient(135deg, #f4dd8f, #8d4e0f);
}

.legend-swatch-outbreak {
  background: linear-gradient(135deg, #f6b89d, #d9633f);
}

.source-list {
  margin: 12px 0 0;
  padding-left: 20px;
}

.source-list li + li {
  margin-top: 8px;
}

.source-list a {
  color: var(--ink);
}

.map-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-bottom: 24px;
}

.map-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
  padding: 24px 24px 0;
}

.map-caption {
  max-width: 340px;
  margin: 0;
  line-height: 1.5;
}

.map-subtitle {
  margin: 8px 0 0;
  max-width: 520px;
  line-height: 1.5;
}

.map-frame {
  position: relative;
  flex: 1;
  margin: 24px;
  min-height: 520px;
}

#map {
  height: 100%;
  min-height: 520px;
  border-radius: 30px;
  overflow: hidden;
  border: 1px solid rgba(18, 34, 33, 0.1);
  box-shadow: var(--shadow);
}

.map-legend {
  position: absolute;
  left: 20px;
  top: 20px;
  width: min(300px, calc(100% - 40px));
  max-width: calc(100% - 40px);
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid rgba(18, 34, 33, 0.12);
  background: rgba(255, 252, 247, 0.92);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}

.map-legend-title,
.map-legend-label {
  margin: 0;
  font-weight: 700;
}

.map-legend-copy {
  margin: 8px 0 14px;
  line-height: 1.45;
  color: var(--muted);
}

.map-legend-note {
  margin: 0 0 14px;
  line-height: 1.45;
  color: var(--alert);
}

.map-legend-section + .map-legend-section {
  margin-top: 14px;
}

.legend-ramp {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.legend-ramp-stop {
  height: 16px;
  border-radius: 999px;
}

.legend-ramp-low {
  background: #f7e8b3;
}

.legend-ramp-mid {
  background: #d59a3a;
}

.legend-ramp-high {
  background: #8d4e0f;
}

.legend-ramp-values {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--muted);
}

.outbreak-scale {
  display: flex;
  align-items: end;
  gap: 18px;
  margin-top: 10px;
  min-height: 24px;
}

.outbreak-scale-dot {
  display: inline-block;
  border-radius: 999px;
  background: #d9633f;
  border: 2px solid #fff0eb;
}

.outbreak-scale-small {
  width: 10px;
  height: 10px;
}

.outbreak-scale-medium {
  width: 16px;
  height: 16px;
}

.outbreak-scale-large {
  width: 24px;
  height: 24px;
}

.popup {
  min-width: 180px;
}

.popup h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.popup p {
  margin: 0 0 6px;
  line-height: 1.45;
}

.popup strong {
  color: var(--ink);
}

.maplibregl-popup-content {
  padding: 14px 16px;
  border-radius: 16px;
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .panel {
    border-right: 0;
    border-bottom: 1px solid var(--stroke);
  }

  .map-header {
    flex-direction: column;
    align-items: start;
  }

  .map-frame {
    margin-top: 16px;
    min-height: 60vh;
  }

  .map-legend {
    left: 16px;
    top: 16px;
    width: calc(100% - 32px);
    max-width: calc(100% - 32px);
  }
}
