/* ================== GLOBAL ================== */
:root {
  --bg-deep: #050611;
  --bg-panel: #0d101c;
  --bg-card: #101524;
  --bg-card-soft: #151b2a;
  --accent: #ff5a26;
  --accent-soft: rgba(255, 90, 38, 0.18);
  --accent-yellow: #ffd766;
  --text-main: #f5f5f7;
  --text-muted: #b6bccb;
  --border-subtle: rgba(255, 255, 255, 0.06);
  --shadow-soft: 0 18px 50px rgba(0, 0, 0, 0.55);
  --shadow-card: 0 14px 40px rgba(0, 0, 0, 0.45);
}

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

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 10% 0%, rgba(255, 90, 38, 0.18), transparent 60%),
    radial-gradient(circle at 90% 100%, rgba(104, 151, 255, 0.35), transparent 60%),
    radial-gradient(circle at 20% 80%, rgba(255, 182, 80, 0.25), transparent 55%),
    var(--bg-deep);
  color: var(--text-main);
  line-height: 1.6;
}

/* ================== ENHANCED INTRO SECTION ================== */

.intro {
  position: relative;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 48px 24px;
  text-align: center;
  overflow: hidden;
  color: var(--text-main);

  /* Animated wildfire glow */
  background: radial-gradient(circle at 40% 20%, rgba(255,120,60,0.12), transparent 60%),
              radial-gradient(circle at 70% 80%, rgba(255,180,90,0.15), transparent 60%),
              radial-gradient(circle at 20% 90%, rgba(255,90,38,0.12), transparent 65%),
              var(--bg-deep);
  background-size: 180% 180%;
  animation: introGlow 16s ease-in-out infinite alternate;
}

@keyframes introGlow {
  0%   { background-position: 0% 20%; }
  50%  { background-position: 80% 60%; }
  100% { background-position: 0% 20%; }
}

/* Faint world silhouette behind title */
.intro::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("https://raw.githubusercontent.com/datasets/geo-countries/master/img/world-mercator.svg");
  background-size: 95%;
  background-position: center 35%;
  background-repeat: no-repeat;
  opacity: 0.05;
  filter: brightness(0.9);
  z-index: -2;
  pointer-events: none;
}

/* Grid + Ember particles */
.intro::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    /* subtle grid */ 
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px),

    /* floating embers */
    radial-gradient(circle, rgba(255,140,80,0.15) 2px, transparent 3px) 10% 20%,
    radial-gradient(circle, rgba(255,180,100,0.08) 2px, transparent 3px) 70% 60%,
    radial-gradient(circle, rgba(255,120,60,0.08) 3px, transparent 3px) 40% 80%;

  background-size:
    48px 48px, 48px 48px,   /* grid */
    400px 400px, 400px 400px, 400px 400px; /* embers */

  mix-blend-mode: soft-light;
  animation: emberFloat 22s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: -1;
}

@keyframes emberFloat {
  0%   { background-position: 10% 20%, 70% 80%, 40% 85%; }
  50%  { background-position: 8% 30%, 65% 75%, 45% 70%; }
  100% { background-position: 10% 20%, 70% 80%, 40% 85%; }
}

/* HERO TITLE */
.intro h1 {
  font-size: clamp(2.6rem, 4vw, 3.6rem);
  font-weight: 800;
  letter-spacing: 0.045em;
  margin: 0 0 24px;
  text-transform: uppercase;

  /* wildfire gradient */
  background: linear-gradient(120deg, #fff4cc, #ffd766, #ff8a44, #ff5a26);
  -webkit-background-clip: text;
  color: transparent;

  text-shadow: 0 0 8px rgba(255, 150, 80, 0.28);
}

.intro p {
  font-size: clamp(1.05rem, 1.3vw, 1.2rem);
  line-height: 1.7;
  max-width: 760px;
  margin: 0;
  color: var(--text-muted);
}

/* pulsing underline for hook last line */
#hook p:last-of-type {
  position: relative;
  display: inline-block;
  padding-bottom: 4px;
}
#hook p:last-of-type::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-yellow));
  border-radius: 999px;
  opacity: 0.75;
}

/* Animated arrow */
.arrow {
  font-size: 40px;
  color: var(--accent);
  margin-top: 28px;
  animation: arrow-bounce 1.35s ease-in-out infinite alternate;
  text-shadow: 0 0 12px rgba(255, 90, 38, 0.8);
}

@keyframes arrow-bounce {
  from {
    transform: translateY(0);
    opacity: 0.6;
  }
  to {
    transform: translateY(12px);
    opacity: 1;
  }
}

/* ================== SCROLLY LAYOUT ================== */

#map,
#dots {
  display: none;
}

#scrolly {
  position: relative;
}

#dots {
  display: none;
}

/* Sticky map */
#scrolly.active #map {
  display: block;
  position: sticky;
  top: 0;
  left: 0;
  width: 64vw;
  height: 100vh;
  z-index: 1;
  filter: drop-shadow(0 20px 60px rgba(0, 0, 0, 0.9));
}

/* Dots overlay */
#dots {
  position: fixed;
  top: 0;
  left: 0;
  width: 64vw;
  height: 100vh;
  z-index: 2;
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: 0;
  transition: opacity 0.5s ease;
}

#dots.is-visible {
  display: block;
  opacity: 1;
}

#scrolly.active #dots {
  display: block;
  position: sticky;
  top: 0;
  left: 0;
  width: 64vw;
  height: 100vh;
  z-index: 2;
}

#scrolly.activate #dots.is-visible {
  opacity: 1;
}

/* Text column */
#scrolly.active #sections {
  margin-left: 64vw;
  margin-top: 4vw;
}

#sections {
  max-width: 720px;
  padding: 40px 28px 100px;
  width: 35%;
  flex-grow: 1;
}

/* ================== SECTION CARDS ================== */

#sections section {
  margin: 0 auto 80px;
  padding: 32px 30px 34px;
  border-radius: 22px;
  border: 1px solid var(--border-subtle);
  background: radial-gradient(circle at top, rgba(255, 255, 255, 0.04), transparent 60%),
    var(--bg-card);
  box-shadow: var(--shadow-card);
  transition:
    border-color 0.28s ease,
    box-shadow 0.28s ease,
    transform 0.28s ease,
    background 0.28s ease,
    opacity 0.3s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
  opacity: 0.45;
}

/* subtle glow edge */
#sections section::before {
  content: "";
  position: absolute;
  inset: -40%;
  background: radial-gradient(circle at 0 0, rgba(255, 90, 38, 0.12), transparent 60%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

/* chapter pill */
#sections section::after {
  content: attr(data-chapter);
  position: absolute;
  left: 16px;
  top: 16px;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

/* active card */
#sections section.is-active {
  border-color: var(--accent-soft);
  box-shadow: 0 26px 60px rgba(0, 0, 0, 0.8);
  transform: translateY(-4px);
  background:
    radial-gradient(circle at top, rgba(255, 213, 130, 0.18), transparent 68%),
    var(--bg-card-soft);
  opacity: 1;
}
#sections section.is-active::before {
  opacity: 1;
}

/* Typography */
#sections h2 {
  font-size: 1.6rem;
  font-weight: 650;
  margin: 0 0 14px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #ffffff;
}

#sections h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 10px 0 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-yellow);
}

#sections p {
  font-size: 1rem;
  line-height: 1.8;
  margin: 0 0 16px;
  color: var(--text-muted);
}

/* conclusion special glow */
section[data-chapter="conclusion"].is-active {
  background:
    radial-gradient(circle at bottom, rgba(94, 196, 255, 0.18), transparent 72%),
    var(--bg-card-soft);
}

/* ================== CHART CONTAINERS ================== */

.chart-container {
  width: 100%;
  max-width: 520px;
  margin: 22px auto 6px;
  padding: 16px 18px 18px;
  border-radius: 18px;
  background: rgba(3, 7, 18, 0.75);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(14px);
}

/* Let axes + labels breathe */
.chart-container svg {
  overflow: visible;
}

.chart-container svg .axis path {
  stroke-width: 0; /* Makes the axis line invisible */
}

/* ================== TOOLTIP ================== */

.fire-tooltip {
  backdrop-filter: blur(14px);
  border-radius: 10px !important;
}

/* ================== FRP TOGGLE BUTTON ================== */

#frp-region-toggle {
  font-family: inherit;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#frp-region-toggle::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: inherit;
  background: radial-gradient(circle, rgba(255, 90, 38, 0.45), transparent 70%);
  opacity: 0;
  z-index: -1;
  transition: opacity 0.3s ease;
}
#frp-region-toggle:hover::before {
  opacity: 1;
}

/* ================== RESPONSIVE ================== */

@media (max-width: 1024px) {
  #scrolly.active #map {
    width: 100vw;
    height: 55vh;
    position: sticky;
  }

  #dots,
  #dots.is-visible {
    position: fixed;
    width: 100vw;
    height: 55vh;
  }

  #scrolly.active #sections {
    margin-left: 0;
    margin-top: 0;
  }

  #sections {
    width: 100%;
    max-width: 700px;
    padding-top: 32px;
  }

  #sections section {
    min-height: auto;
    margin-bottom: 56px;
  }
}

@media (max-width: 640px) {
  .intro {
    padding-inline: 18px;
  }

  #sections section {
    padding-inline: 20px;
  }

  #sections h2 {
    font-size: 1.35rem;
  }

  #sections p {
    font-size: 0.96rem;
  }
}

/* ================== POPUP ================== */

.popup-hint {
  position: fixed;
  bottom: 50px; 
  left: 50%;
  right: auto; 
  transform: translateX(-50%); 
  top: auto;
  background: rgba(43, 8, 5, 0.95); /* Dark Red/Black */
  border: 1px solid #ff5722; /* Vibrant Orange/Red */
  padding: 18px 24px;
  border-radius: 10px;
  color: white;
  font-size: 16px;
  z-index: 999999;
  box-shadow: 
    0 0 10px rgba(255, 87, 34, 0.8), /* Inner glow */
    0 14px 35px rgba(0, 0, 0, 0.6); /* Standard shadow */
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.popup-hint.show {
  opacity: 1;
  pointer-events: auto;
}

/* ================== SLIDER ================== */
#month-slider-container {
  position: absolute;
  bottom: 20px;
  left: 20px;
  background: var(--bg-card-soft);
  padding: 10px 15px;
  border-radius: 10px;
  box-shadow: var(--shadow-card);
  text-align: center;
  z-index: 15;
  font-family: system-ui, sans-serif;
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 90, 38, 0.15);
  width: 300px;
}

#month-label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text-main);
  text-shadow: 0 0 4px rgba(0,0,0,0.4);
}

/* Slider track */
#month-slider {
  width: 100%;  /* fills the container width */
  height: 5px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 90, 38, 0.12);
  border-radius: 5px;
  outline: none;
  transition: background 0.3s;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.4);
}

#month-slider:hover {
  background: rgba(255, 90, 38, 0.22);
}

/* Slider thumb */
#month-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 6px rgba(255,90,38,0.7), 0 2px 4px rgba(0,0,0,0.4);
  transition: all 0.2s ease;
  border: 1px solid rgba(255, 90, 38, 0.6);
}

#month-slider::-webkit-slider-thumb:hover {
  box-shadow: 0 0 10px rgba(255,90,38,0.85), 0 3px 6px rgba(0,0,0,0.5);
  transform: scale(1.1);
}

#month-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 6px rgba(255,90,38,0.7), 0 2px 4px rgba(0,0,0,0.4);
  border: 1px solid rgba(255, 90, 38, 0.6);
  transition: all 0.2s ease;
}

#month-slider::-moz-range-thumb:hover {
  box-shadow: 0 0 10px rgba(255,90,38,0.85), 0 3px 6px rgba(0,0,0,0.5);
  transform: scale(1.1);
}

/* Controls container - minimal */
#slider-controls {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 6px;
}

/* Sleek buttons */
#play-btn,
#reset-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  background: var(--bg-card);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

#play-btn:hover,
#reset-btn:hover {
  box-shadow: 0 0 10px rgba(255,90,38,0.7);
  transform: scale(1.05);
}

#play-btn {
  border: 1px solid rgba(255,90,38,0.4);
}

#reset-btn {
  border: 1px solid rgba(255,90,38,0.2);
}

#month-banner {
  position: fixed;
  top: 20px;
  left: 6%;
  transform: translate(-50%, -4px);
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(43, 8, 5, 0.95); /* Dark Red/Black */
  border: 1px solid #ff5722; /* Vibrant Orange/Red */
  box-shadow: 
    0 14px 35px rgba(0, 0, 0, 0.6); /* Standard shadow */
  color: #f9fafb;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  backdrop-filter: blur(12px);
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* visible state */
#month-banner.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}