:root {

  /* Neutrals */
  --bg: #FAF9F6;
  --bg-alt: #F1EEE8;
  --card-bg: #FFFFFF;
  --card-border: #E2DFD7;

  --text: #3A3A3A;
  --text-muted: #7A7A7A;

  /* Brand Colors */
  --mx-pink: #E4007C;
  --primary: #1F4E79;
  --primary-dark: #0D3B66;
  --accent: #2A9D8F;
  --accent-dark: #264653;
  --highlight: #E9C46A;

  --div-neg: #2A9D8F;
  --div-mid: #EAF2F8;
  --div-pos: #1B3B5F;

  /* Sequential blues */
  --seq-1: #E9EEF4;
  --seq-2: #AFC6DD;
  --seq-3: #3E6FA8;
  --seq-4: #1F4E79;
  --seq-5: #0D3B66;

  /* Layout tokens */
  --border-radius-lg: 18px;
  --border-radius-md: 12px;
  --shadow-soft: 0 6px 16px rgba(0,0,0,0.06);
  --shadow-card: 0 10px 25px rgba(0,0,0,0.08);
  --container-width: 1120px;
}

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

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Inter", system-ui, sans-serif;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
}

.global-nav {
  position: sticky;
  top: 0;
  z-index: 9999;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--card-border);
}

.nav-inner {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0.9rem 1.4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-logo {
  color: var(--primary-dark);
  font-size: 1.28rem;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 600;
}

.nav-links a:hover {
  color: var(--mx-pink);
  transition: 0.2s ease;
}


.wrapper {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 40px 2rem 100px;
}

.header h1 {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--primary-dark);
  margin-bottom: 0.3rem;
}

.header-sub {
  max-width: 640px;
  font-size: 1.05rem;
  color: var(--text-muted);
}

.search-container {
  margin-top: 22px;
  position: relative;
  max-width: 360px;
}

#country-search {
  width: 100%;
  background: var(--card-bg);
  border-radius: var(--border-radius-md);
  border: 1.5px solid var(--card-border);
  padding: 12px 14px;
  font-size: 0.95rem;
}

#country-search:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(31,78,121,0.18);
}

.autocomplete-items {
  position: absolute;
  background: var(--card-bg);
  width: 100%;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--card-border);
  margin-top: 6px;
  max-height: 260px;
  overflow-y: auto;
  z-index: 9999;
  box-shadow: var(--shadow-card);
}

.autocomplete-item {
  padding: 10px 12px;
  cursor: pointer;
  font-size: 0.95rem;
}

.autocomplete-item:hover {
  background: var(--bg-alt);
}


.graphic {
  position: sticky;
  top: 80px;
  background: var(--card-bg);
  border-radius: var(--border-radius-lg);
  padding: 34px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.graphic-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.line-main,
.map-main,
.top5-main {
  color: var(--primary-dark);
  font-size: 1.85rem;
  font-weight: 800;
}

.line-note,
.map-note,
.top5-note {
  color: var(--text-muted);
  font-size: 1rem;
}

.steps {
  display: flex;
  flex-direction: column;
  gap: 20vh;
  padding-bottom: 30vh;
}

.step {
  background: transparent;
  padding: 28px 26px;
  height: 50vh;
  opacity: 0.4;
  transform: translateY(12px);
  transition: 0.25s ease;
}

.step.is-active {
  opacity: 1;
  transform: translateY(0);
}


.line-layout {
  display: flex;
  gap: 40px;
}

.line-text {
  flex: 0 0 40%;
}

.line-chart-wrapper {
  flex: 1;
  background: var(--card-bg);
  border-radius: var(--border-radius-md);
  padding: 12px;
  box-shadow: var(--shadow-soft);
}

#chart-line {
  width: 100%;
  height: 320px;
}


.top5-wrapper {
  display: flex;
  gap: 28px;
}

.top5-chart {
  background: var(--card-bg);
  padding: 20px;
  flex: 1;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-card);
  min-height: 280px;
}


.static-section {
  margin-top: 120px;
  margin-bottom: 120px;
}

.spots-text-box h2 {
  color: var(--primary-dark);
  font-size: 1.7rem;
  font-weight: 800;
}

.spots-text-box p {
  color: var(--text-muted);
  font-size: 1.05rem;
}

.flowmap-hero {
  width: 100%;
  height: 420px;
  background: var(--card-bg);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  position: relative;
}

.year-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  flex-wrap: wrap;
}

#year-play {
  background: var(--primary);
  color: white;
  padding: 6px 12px;
  border-radius: var(--border-radius-md);
  border: none;
  cursor: pointer;
}
#year-play:hover {
  background: var(--primary-dark);
}

.tooltip,
#line-tooltip,
#map-tooltip,
#spots-tooltip,
#top5-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(255,255,255,0.95);
  padding: 12px 14px;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-card);
  font-size: 13px;
  opacity: 0;
  max-width: 260px;
  z-index: 999999;
  transition: opacity 0.15s ease;
}


.chor-map {
  width: 100%;
  height: min(60vh, 700px);
  background: var(--card-bg);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.metric-buttons {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.metric-btn {
  background: var(--bg);
  border: 1px solid var(--card-border);
  padding: 8px 14px;
  font-size: 14px;
  border-radius: var(--border-radius-md);
  cursor: pointer;
  font-weight: 600;
}

.metric-btn:hover {
  background: var(--bg-alt);
}

.metric-btn.active {
  background: var(--primary);
  color: white;
}

@media (max-width: 1024px) {
  .wrapper {
    padding: 32px 1.4rem 80px;
  }

  .graphic {
    position: static;
    top: auto;
  }

  .line-layout {
    flex-direction: column;
  }

  .line-text {
    flex: 1 1 100%;
  }

  #chart-line {
    height: 280px;
  }

  .top5-wrapper {
    flex-direction: column;
  }

  .flowmap-hero,
  .chor-map {
    height: 360px;
  }
}

@media (max-width: 720px) {
  .nav-inner {
    gap: 10px;
  }

  .nav-logo {
    width: 100%;
    font-size: 1.1rem;
  }

  .nav-links {
    width: 100%;
    gap: 0.9rem;
    font-size: 0.95rem;
  }

  .wrapper {
    padding: 26px 1rem 70px;
  }

  .header h1 {
    font-size: 1.9rem;
  }

  .graphic {
    padding: 26px;
  }

  .static-section {
    margin: 90px 0;
  }

  .flowmap-hero,
  .chor-map {
    height: 300px;
  }

  .year-controls {
    gap: 8px;
  }

  .line-text {
    font-size: 0.96rem;
  }

  .steps {
    gap: 8vh;
    padding-bottom: 12vh;
  }

  .step {
    height: auto;
    min-height: 200px;
  }

  .flow-legend {
    top: 12px !important;
    right: 12px !important;
    bottom: auto !important;
    left: auto !important;
    font-size: 12px !important;
    padding: 8px 10px !important;
    max-width: 220px;
    pointer-events: none;
  }
  .flow-legend * { pointer-events: none; }

  .graphic-title {
    font-size: 0.8rem;
  }

  .line-main,
  .map-main,
  .top5-main {
    font-size: 1.4rem;
    line-height: 1.3;
  }

  .line-note,
  .map-note,
  .top5-note {
    font-size: 0.95rem;
  }
}
/* Legend */
.chor-legend-gradient {
  width: 180px;
  height: 14px;
  border-radius: 5px;
  border: 1px solid var(--card-border);
  background: linear-gradient(
    to right,
    var(--div-neg),
    var(--div-mid),
    var(--div-pos)
  );
}

.chor-legend-labels {
  width: 180px;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

.selected-country {
  stroke: var(--primary-dark) !important;
  stroke-width: 1.5 !important;
}


.footer {
  width: 100%;
  background: var(--primary-dark);
  color: #FFFFFF;
  padding: 40px 0;
  margin-top: 80px;
}

.footer-inner {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
}

.footer-left {
  font-size: 0.95rem;
  line-height: 1.5;
}

.footer-left strong {
  color: #FFFFFF;
}

.footer-right {
  display: flex;
  flex-direction: column;
  font-size: 0.95rem;
  gap: 6px;
}

.footer-right a {
  color: #FFFFFF;
  text-decoration: none;
  font-weight: 600;
}

.footer-right a:hover {
  text-decoration: underline;
}



.chor-legend {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-muted);
}

.chor-legend-blocks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 4px;
}

.chor-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.chor-legend-swatch {
  width: 18px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid var(--card-border);
  flex-shrink: 0;
}

.limit-btn {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--border-radius-md);
  padding: 6px 14px;
  font-size: 14px;
  cursor: pointer;
}

.limit-btn:hover {
  background: var(--primary-dark);
}


