@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=Libre+Baskerville:wght@400;700&display=swap');

:root {
  --bg: #061814;
  --bg2: #0b241f;
  --paper: #f7f1e6;
  --light: #fff8e8;
  --ink: #10231f;
  --muted: #66736f;
  --accent: #b7d96b;
  --accent2: #78d6bd;
  --radius: 24px;
  --shadow: 0 24px 72px rgba(0,0,0,0.34);
  --max: 1120px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  overflow-x: hidden;
}

.quarto-title-block,
#title-block-header,
.sidebar,
.quarto-sidebar,
.page-columns > .column-page-left,
.page-columns > .column-page-right {
  display: none !important;
}

.navbar {
  display: flex !important;
}

/* story text styling */
.story-page {
  max-width: none !important;
  width: 100% !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow-x: clip !important;
  background: var(--bg);
  color: var(--light);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.story-page h1,
.story-page h2,
.story-page h3,
.story-page p {
  margin-top: 0;
}

.story-page h1,
.story-page h2,
.story-page h3 {
  letter-spacing: -0.055em;
  text-wrap: balance;
}

.story-page h1 {
  font-size: clamp(3.4rem, 8vw, 8rem);
  line-height: 0.88;
  color: #fff7e3;
  margin-bottom: 1.35rem;
}

.story-page h1 span {
  display: block;
}

.story-page h2 {
  font-size: clamp(2.2rem, 4.6vw, 4.8rem);
  line-height: 0.98;
  margin-bottom: 1.1rem;
}

.story-page h3 {
  font-size: clamp(1.28rem, 1.7vw, 1.75rem);
  line-height: 1.12;
  margin-bottom: 0.8rem;
}

.story-page p {
  font-size: clamp(1rem, 1.08vw, 1.12rem);
  line-height: 1.72;
}

.story-page a {
  color: var(--accent);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

/* progress */
.story-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 99999;
  height: 4px;
  width: 100%;
  background: rgba(255,255,255,0.08);
}

.story-progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}

/* hero */
.hero,
.scene {
  min-height: 100svh;
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.hero {
  display: grid;
  align-items: center;
}

.hero-bg {
  position: absolute;
  inset: -4%;
  width: 108%;
  height: 108%;
  object-fit: cover;
  object-position: center;
  z-index: -3;
  transform: scale(1.06);
  animation: drift 24s ease-in-out infinite alternate;
}

.hero-shade {
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(
      90deg,
      rgba(6,24,20,0.82),
      rgba(6,24,20,0.32),
      rgba(6,24,20,0.72)
    ),
    linear-gradient(
      0deg,
      rgba(6,24,20,0.88),
      transparent 42%,
      rgba(0,0,0,0.14)
    );
}

.hero-content,
.map-intro-content {
  width: min(var(--max), calc(100% - 48px));
  margin-inline: auto;
  position: relative;
  z-index: 2;
}

.hero-content {
  padding: 12vh 0 9vh;
}

.deck {
  max-width: 670px;
  color: rgba(255,250,236,0.88);
  font-size: clamp(1.08rem, 1.7vw, 1.5rem) !important;
  line-height: 1.46 !important;
  margin-bottom: 1.2rem;
}

.meta {
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
  color: rgba(255,250,236,0.72);
  font-size: 0.95rem;
  font-weight: 700;
}

.logos {
  display: block;
  max-width: min(360px, 70vw);
  max-height: 120px;
  object-fit: contain;
  margin-top: 1.2rem;
}

.scroll-cue {
  margin-top: 2rem;
  color: var(--accent2);
  font-weight: 700;
}

/* eyebrows */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 1.15rem;
}

.tags span,
.eyebrow {
  display: inline-flex;
  width: fit-content;
  border: 1px solid rgba(255,255,255,0.24);
  border-radius: 999px;
  padding: 0.45rem 0.72rem;
  background: rgba(255,255,255,0.08);
  color: #fff7df;
  font-size: 0.68rem !important;
  line-height: 1 !important;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  font-weight: 900;
  margin-bottom: 1rem;
}

.eyebrow.dark {
  color: var(--ink);
  border-color: rgba(16,35,31,0.18);
  background: rgba(16,35,31,0.06);
}

/* map intro section */
.map-intro {
  display: grid;
  align-items: center;
}

.map-intro-content {
  max-width: 920px;
}

.map-intro-content h2 {
  color: #fff7e3 !important;
}

.map-intro-content p:not(.eyebrow) {
  max-width: 700px;
  color: rgba(255,250,236,0.84);
}

/* leaflet section*/
.map-story {
  position: relative !important;
  min-height: 360vh !important;
  background: var(--bg) !important;
  color: var(--light);
}

.map-stage {
  position: sticky !important;
  top: 0 !important;
  height: 100vh !important;
  min-height: 100vh !important;
  z-index: 1 !important;
  background: #06110f;
  overflow: hidden !important;
}

.map-stage .leaflet,
.map-stage .leaflet-container,
.map-stage .html-widget {
  width: 100% !important;
  height: 100% !important;
  min-height: 100vh !important;
}

.map-stage .leaflet-control-container {
  z-index: 900;
}

.map-stage .leaflet-control-layers,
.map-stage .leaflet-control-attribution,
.map-stage .legend {
  font-family: Inter, system-ui, sans-serif !important;
}

/* Scrolly text cards */
.map-steps {
  position: relative !important;
  z-index: 10 !important;
  width: min(420px, calc(100vw - 40px));
  margin-left: 4vw;
  margin-top: -100vh !important;
  padding-top: 36vh !important;
  padding-bottom: 90vh !important;
  display: grid !important;
  gap: 78vh !important;
  pointer-events: none !important;
}

.map-step {
  pointer-events: auto !important;
  background: rgba(255,250,236,0.92);
  color: var(--ink);
  padding: 1.25rem;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.24);
  opacity: 0.82;
  transform: translateY(12px) scale(0.985);
  transition: opacity 420ms ease, transform 420ms ease;
}

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

.map-step p {
  font-size: 0.96rem !important;
  line-height: 1.55 !important;
}

.map-story-ferlo {
  min-height: 500vh !important;
}

.map-story-senegal {
  min-height: 330vh !important;
}

/* story panels */
.story-panel {
  position: relative;
  width: 100%;
  min-height: calc(100svh - var(--nav-h, 0px));
  display: grid;
  grid-template-columns: minmax(340px, 43%) minmax(0, 57%);
  align-items: stretch;
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
}

.story-panel .story-copy {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(3rem, 6vw, 7rem);
  background: var(--paper);
  color: var(--ink);
  order: 1;
}

.story-panel .story-copy::before {
  content: attr(data-kicker);
  width: max-content;
  margin-bottom: 1.35rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--teal-deep, #2f6f66);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  line-height: 1.2;
  text-transform: uppercase;
}

.story-panel .story-copy h2 {
  max-width: 650px;
  margin: 0 0 1.45rem;
  color: var(--ink);
  font-size: clamp(2.45rem, 4.6vw, 4.8rem);
  font-weight: 900;
  letter-spacing: -0.05em;
  line-height: 0.98;
}

.story-panel .story-copy h3 {
  max-width: 650px;
  margin: 0 0 1rem;
  color: var(--ink);
  font-size: clamp(1.9rem, 3vw, 3rem);
  font-weight: 900;
  letter-spacing: -0.035em;
  line-height: 1.02;
}

.story-panel .story-copy p {
  max-width: 60ch;
  margin: 0 0 1.2rem;
  color: var(--ink-soft, #52605c);
  font-size: clamp(1rem, 1.15vw, 1.12rem);
  line-height: 1.72;
}

.story-panel .story-copy .water-opening-deck {
  color: var(--ink);
  font-size: clamp(1.08rem, 1.3vw, 1.25rem);
  line-height: 1.6;
}

.story-panel .story-copy .editorial-number {
  width: max-content;
  margin: 1rem 0 0.8rem !important;
  color: var(--teal-deep, #2f6f66) !important;
  font-size: 0.68rem !important;
  font-weight: 900;
  letter-spacing: 0.16em;
  line-height: 1.2;
}

.story-panel .story-visual {
  width: 100%;
  height: 100%;
  min-height: calc(100svh - var(--nav-h, 0px));
  overflow: hidden;
  background: #e9e4da;
  order: 2;
}

.story-panel .story-visual img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: calc(100svh - var(--nav-h, 0px));
  object-fit: cover;
  border-radius: 0;
  box-shadow: none;
}

.story-panel.image-left .story-copy {
  order: 2;
}

.story-panel.image-left .story-visual {
  order: 1;
}

.water-opening {
  background: var(--paper);
  color: var(--ink);
}

.water-question {
  width: min(820px, calc(100% - 48px));
  margin: 0 auto;
  padding: clamp(6rem, 10vw, 10rem) 0;
  background: var(--paper);
  color: var(--ink);
}

.water-question .eyebrow {
  margin-bottom: 1rem;
}

.water-question h2 {
  max-width: 800px;
  margin: 0 0 1.6rem;
  color: var(--ink);
  font-size: clamp(2.7rem, 5vw, 5rem);
  line-height: 0.98;
  letter-spacing: -0.05em;
}

.water-question p:not(.eyebrow) {
  max-width: 700px;
  margin-bottom: 0;
  color: var(--ink-soft, #52605c);
  font-size: clamp(1.05rem, 1.2vw, 1.2rem);
  line-height: 1.75;
}

/* water-story panels */
.water-story-page .map-note {
  margin-top: 1.25rem;
  padding-top: 0.9rem;
  border-top: 1px solid rgba(16,35,31,0.16);
  font-size: 0.82rem;
  line-height: 1.5;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.water-story-page .closing-content h2 {
  max-width: 900px;
}

/* closing */
.section-light {
  background:
    radial-gradient(
      circle at top left,
      rgba(120,214,189,0.13),
      transparent 32rem
    ),
    var(--paper);
  color: var(--ink);
}

.closing {
  padding: clamp(6rem, 10vw, 10rem) 24px;
}

.closing-content {
  width: min(820px, 100%);
  margin: 0 auto;
  color: var(--ink);
}

.closing-content h2 {
  max-width: 760px;
  font-size: clamp(2.8rem, 5vw, 5rem);
  line-height: 0.95;
  margin-bottom: 2.5rem;
  color: var(--ink);
}

.closing-content p:not(.eyebrow) {
  max-width: 720px;
  font-size: clamp(1.05rem, 1.2vw, 1.25rem);
  line-height: 1.75;
  color: rgba(16,35,31,0.82);
  margin-bottom: 1.6rem;
}

.further-reading {
  padding: clamp(4rem, 8vw, 7rem) 24px;
  background:
    radial-gradient(
      circle at top right,
      rgba(183,217,107,0.13),
      transparent 30rem
    ),
    var(--bg);
}

.further-reading .dark-card {
  width: min(900px, 100%);
  margin: 0 auto;
  padding: 2rem;
  border-radius: 24px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.10);
  backdrop-filter: blur(8px);
  color: var(--light);
}

.further-reading h2,
.further-reading h3 {
  color: var(--light);
  margin-bottom: 1.5rem;
}

.further-reading ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.further-reading li {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0;
  padding: 1rem 0;
  border-top: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,250,236,0.86);
  line-height: 1.5;
}

.further-reading li:first-child {
  border-top: none;
}

.further-reading li::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
  flex-shrink: 0;
}

.further-reading a {
  color: rgba(255,248,232,0.92);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.25s ease;
}

.further-reading a:hover {
  color: var(--accent);
}

.further-reading a::after {
  content: " ↗";
  opacity: 0.6;
}

.stories-related-panel {
  clear: both;
  position: relative;
  z-index: 20;
  background: #fff;
  color: #111;
}

.back-to-top,
#quarto-back-to-top {
  z-index: 9999;
}

/* map legends */
.water-map-legends {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 8px;
  margin-right: 8px;
  width: 330px;
}

.water-gradient-legend {
  width: 330px;
  box-sizing: border-box;
  font-family: Lato, "Helvetica Neue", Arial, sans-serif;
  color: #1f2d24;
  pointer-events: none;
}

.water-gradient-legend .gradient-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 7px;
  color: #1f2d24;
}

.water-gradient-legend .gradient-bar {
  width: 100%;
  height: 15px;
  border-radius: 5px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}

.water-gradient-legend .rainfall-gradient {
  background: linear-gradient(
    to right,
    #f7fcfd 0%,
    #e0ecf4 4%,
    #bfd3e6 19%,
    #9ebcda 25%,
    #8c96c6 39%,
    #8c6bb1 52%,
    #88419d 65%,
    #6e016b 100%
  );
}

.water-gradient-legend .intensity-gradient {
  background: linear-gradient(
    to right,
    #1b7837 0%,
    #5aae61 29%,
    #a6dba0 43%,
    #f7f7f7 50%,
    #d9f0d3 57%,
    #9970ab 71%,
    #762a83 100%
  );
}

.water-gradient-legend .gradient-labels {
  position: relative;
  display: flex;
  justify-content: space-between;
  margin-top: 5px;
  font-size: 11px;
  line-height: 1;
  color: #1f2d24;
  white-space: nowrap;
}

.water-gradient-legend .gradient-unit {
  text-align: right;
  margin-top: 5px;
  font-size: 12px;
  color: #1f2d24;
  font-weight: 400;
}

.leaflet-control-water-map-legends,
.water-map-legends.leaflet-control {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}


@media (max-width: 900px) {
  .story-page h1 {
    font-size: clamp(2.8rem, 14vw, 5rem);
  }

  .story-panel {
    min-height: auto;
    grid-template-columns: 1fr;
  }

  .story-panel .story-copy,
  .story-panel.image-left .story-copy {
    padding:
      clamp(4rem, 10vw, 6rem)
      max(24px, 7vw);
    order: 1;
  }

  .story-panel .story-visual,
  .story-panel.image-left .story-visual {
    min-height: auto;
    order: 2;
  }

  .story-panel .story-visual img {
    min-height: 0;
    height: auto;
    aspect-ratio: 16 / 10;
  }

  .scrolly-steps {
    width: min(540px, calc(100vw - 32px));
    margin-inline: auto;
  }

  .map-steps {
    width: min(540px, calc(100vw - 32px));
    margin-left: auto !important;
    margin-right: auto !important;
  }

  .water-question {
    width: min(680px, calc(100% - 48px));
    padding: 5rem 0 6rem;
  }
}

@media (max-width: 700px) {
  .water-map-legends {
    width: 260px;
  }

  .water-gradient-legend {
    width: 260px;
  }

  .water-gradient-legend .gradient-title {
    font-size: 13px;
  }

  .water-gradient-legend .gradient-labels {
    font-size: 9px;
  }

  .water-gradient-legend .gradient-unit {
    font-size: 10px;
  }
}


@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .hero-bg {
    animation: none;
  }

  .map-step {
    transition: none;
  }
}


@keyframes drift {
  from {
    transform: scale(1.06) translate3d(-0.5%, -0.3%, 0);
  }

  to {
    transform: scale(1.1) translate3d(0.5%, 0.4%, 0);
  }
}
