/* ============================================================
   explore.css — Interactive explorer
   ============================================================ */

html { scroll-behavior: smooth; }

/* ── Tab navigation ──────────────────────────────────────── */
.explore-tab-nav {
  background: #fff;
  border-bottom: 2px solid #e0e0e0;
  overflow-x: auto;
  scrollbar-width: none;
}
.explore-tab-nav::-webkit-scrollbar { display: none; }

.tab-nav-inner {
  display: flex;
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 0 var(--gap);
}

.tab-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 1rem;
  text-decoration: none;
  color: #999;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.tab-item:hover { color: var(--color-foreground); text-decoration: none; }
.tab-item.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }

.tab-num {
  font-family: var(--font-heading);
  font-size: 0.65rem;
  opacity: 0.45;
}
.tab-label { font-size: 0.82rem; }

/* ── Hero — light stat strip ───────────────────────────────── */
.explore-hero {
  /* Break out of content-wrapper padding to go full-width */
  margin: -2rem calc(-1 * var(--gap)) 0;
  padding: 0.85rem var(--gap);
  background: #f0f2f5;
  border-bottom: 1px solid #d8dce3;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.hero-strap {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 0;
}

.hero-eyebrow {
  font-family: var(--font-heading);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-primary);
}

.hero-meta {
  font-size: 0.78rem;
  color: #888;
}

/* 5-country stat row */
.hero-countries {
  display: flex;
  gap: 0;
  flex-wrap: nowrap;
  margin: 0;
}

.hc-card {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 0.3rem;
  padding: 0.25rem 1rem 0.25rem 0;
  margin-right: 1rem;
  border-right: 1px solid #d0d4db;
  cursor: default;
}
.hc-card:last-child { border-right: none; margin-right: 0; }

.hc-flag {
  font-size: 0.95rem;
  line-height: 1;
  align-self: center;
}

.hc-num {
  font-family: var(--font-heading);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--color-primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1;
}

.hc-pct {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1;
}

.hc-name {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1;
  align-self: center;
}

/* ── Figure sections ─────────────────────────────────────── */
.fig-section {
  padding: 1.5rem 0 1rem;
  border-bottom: 2px solid #c0c0c0;
  scroll-margin-top: 100px;
  position: relative;
}
.fig-section:last-of-type { border-bottom: none; }

/* Scroll reveal */
.reveal-section {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.reveal-section.is-visible { opacity: 1; transform: none; }

/* ── Chart figure — remove the global 2.5rem margin ─────── */
.explore-page .chart-figure {
  margin: 0;
}

/* ── Chart title ─────────────────────────────────────────── */
.explore-page .chart-title {
  font-size: 1.05rem;
  margin-bottom: 0.6rem;
  line-height: 1.3;
  border-left: 3px solid var(--color-primary);
  padding-left: 0.75rem;
  position: relative;
  z-index: 1;
}

/* ── Chart containers ────────────────────────────────────── */
.explore-page .chart-container {
  min-height: 280px;
  border: 1.5px solid #bbb;
  border-radius: 2px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.09), 0 6px 20px rgba(0,0,0,0.06);
}

.explore-page .chart-container .axis text { font-size: 14px !important; }
.explore-page .chart-container .grid line { stroke: #ebebeb; }

/* ── Multi-map layout ────────────────────────────────────── */
.multi-map-wrap {
  display: flex;
  gap: 4px;
  height: 440px;
  overflow: hidden;
  border: 1.5px solid #bbb;
  border-radius: 2px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.09), 0 6px 20px rgba(0,0,0,0.06);
}

.cmap-panel {
  flex: 1;
  min-width: 0;
  position: relative;
  cursor: pointer;
  border: 1.5px solid #ddd;
  background: #eef1f6;
  overflow: hidden;
  transition: flex 0.45s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.2s;
}
.cmap-panel:hover { border-color: #aaa; }
.cmap-panel.cmp-active { flex: 4.5; cursor: default; border-color: var(--color-primary); }

.cmp-svg { width: 100%; height: 100%; display: block; }

.cmp-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.3rem 0.2rem 0.4rem;
  background: linear-gradient(transparent, rgba(255,255,255,0.9) 40%);
  pointer-events: none;
  transition: opacity 0.3s;
}
.cmp-active .cmp-overlay { opacity: 0; pointer-events: none; }

.cmp-flag  { font-size: 1rem; line-height: 1; margin-bottom: 0.05rem; }
.cmp-cname {
  font-family: var(--font-heading);
  font-size: 0.6rem;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  padding: 0 2px;
}
.cmp-pct {
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-primary);
}

/* Legend */
.cmp-legend-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.35rem 0 0.2rem;
  font-family: var(--font-heading);
  font-size: 0.72rem;
  color: var(--color-secondary);
}
.cmp-legend-bar {
  flex: 1;
  max-width: 200px;
  height: 7px;
  background: linear-gradient(to right, #fff5f0, #fdc9b4, #fc8d59, #d7301f, #7f0000);
  border: 1px solid #e0e0e0;
  border-radius: 2px;
}

/* ── Toolbar ─────────────────────────────────────────────── */
.chart-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}
.chart-search {
  padding: 0.28rem 0.75rem;
  border: 1.5px solid var(--color-border);
  font-family: var(--font-body);
  font-size: 0.82rem;
  color: var(--color-foreground);
  background: #fff;
  width: 210px;
  transition: border-color 0.15s;
  -webkit-appearance: none;
  appearance: none;
}
.chart-search:focus { outline: none; border-color: var(--color-primary); }
.chart-search::placeholder { color: #bbb; }

/* ── End labels / skeleton ───────────────────────────────── */
.end-label {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  pointer-events: none;
}
.chart-skeleton {
  width: 100%; height: 100%;
  background: linear-gradient(90deg, #f4f4f4 25%, #e8e8e8 50%, #f4f4f4 75%);
  background-size: 200% 100%;
  animation: skeleton-sweep 1.5s ease-in-out infinite;
  min-height: 280px;
}
@keyframes skeleton-sweep {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Map controls ────────────────────────────────────────── */
.map-controls {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  margin-top: 0.4rem;
  font-size: 0.82rem;
  color: var(--color-secondary);
}
.map-slider-label { white-space: nowrap; min-width: 120px; }
.map-slider {
  flex: 1;
  max-width: 480px;
  accent-color: var(--color-primary);
  cursor: pointer;
}

/* ── Alternating section backgrounds ─────────────────────── */
#fig2, #fig4 {
  background: #f7f8fa;
}
/* ── Wider side padding on explore page (makes content skinnier) ── */
@media (min-width: 700px) {
  .content-wrapper.explore-page {
    /* Override --gap so the dark hero's negative-margin breakout auto-adjusts */
    --gap: clamp(2.5rem, 5vw, 4.5rem);
  }
}

/* ── Fixed side navigation arrows ────────────────────────── */
.fig-side-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 250;
}
.fig-side-left  { left: 1.25rem; }
.fig-side-right { right: 1.25rem; }

.fig-side-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #ccc;
  color: #444;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, color 0.2s, box-shadow 0.2s, opacity 0.2s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  padding: 0;
  user-select: none;
}
.fig-side-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  box-shadow: 0 4px 14px rgba(219,0,66,0.2);
}
.fig-side-btn:disabled {
  opacity: 0.18;
  pointer-events: none;
  box-shadow: none;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .fig-side-nav { display: none; }

  .hc-card { padding: 0.2rem 0.75rem 0.2rem 0; }
  .hc-num  { font-size: 1.2rem; }
  .multi-map-wrap { height: 320px; }
}

@media (max-width: 600px) {
  .explore-hero { gap: 0.25rem; }
  .hero-countries { flex-wrap: wrap; gap: 0.1rem 0; }
  .hc-card { border-right: none; padding-right: 0.75rem; margin-right: 0.75rem; }
  .tab-item { padding: 0.4rem 0.7rem; }
  .tab-num { display: none; }
  .explore-page .chart-container { min-height: 280px; }
  .map-controls { flex-direction: column; align-items: flex-start; }
  .multi-map-wrap { height: 220px; gap: 3px; }
  .cmp-cname { display: none; }
  .cmp-pct { font-size: 0.65rem; }
  .hc-name { display: none; }
}
