:root {
  --licorice: #27304A;
  --mint: #68E6B4;
  --cherry: #FF4B3E;
  --taffy: #FF6FAE;
  --pine: #2FBF71;
  --blueberry: #4D6BFF;
  --lemon: #FFE35B;
  --cream: #FFF4D6;
  --shadow: rgba(39, 48, 74, 0.22);
  --paper: cubic-bezier(.19, 1, .22, 1);
  --font-note-map-label: "Roboto Mono** Medium";
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--licorice);
  background: var(--cream);
  font-family: "Nunito Sans", Inter, system-ui, sans-serif;
  overflow-x: hidden;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  opacity: .13;
  background-image: radial-gradient(var(--licorice) .7px, transparent .7px), radial-gradient(#FFFFFF .8px, transparent .8px);
  background-position: 0 0, 11px 13px;
  background-size: 23px 23px;
  mix-blend-mode: multiply;
}

.map-scroll { width: 100%; }

.chapter {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  display: grid;
  place-items: center;
  padding: clamp(22px, 4vw, 56px);
  border-bottom: 8px solid var(--licorice);
}

.chapter::after {
  content: attr(data-chapter);
  position: absolute;
  right: clamp(22px, 4vw, 54px);
  bottom: clamp(18px, 4vw, 46px);
  font-family: "Roboto Mono", monospace;
  font-weight: 700;
  font-size: .85rem;
  background: var(--lemon);
  border: 4px solid var(--licorice);
  border-radius: 999px;
  padding: 10px 14px;
  box-shadow: 6px 6px 0 var(--shadow);
}

h1, h2, h3, p { margin: 0; }
h1 {
  font-family: "Fredoka", Roboto, system-ui, sans-serif;
  font-size: clamp(3.6rem, 10vw, 10rem);
  line-height: .82;
  letter-spacing: .035em;
}
h2 {
  font-family: "Baloo 2", Roboto, system-ui, sans-serif;
  font-size: clamp(2.3rem, 6vw, 6.6rem);
  line-height: .88;
}
h3 {
  font-family: "Baloo 2", Roboto, system-ui, sans-serif;
  font-size: clamp(2.1rem, 4vw, 4.5rem);
  line-height: .88;
}
p { font-size: clamp(1rem, 1.45vw, 1.3rem); line-height: 1.45; }
.mono, .stamp-label {
  font-family: "Roboto Mono", monospace;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.trail-nav {
  position: fixed;
  z-index: 50;
  top: 50%;
  left: 22px;
  transform: translateY(-50%);
  display: grid;
  gap: 13px;
}
.trail-dot {
  width: 45px;
  height: 45px;
  display: grid;
  place-items: center;
  color: var(--licorice);
  text-decoration: none;
  background: var(--cream);
  border: 4px solid var(--licorice);
  border-radius: 50% 50% 46% 50%;
  box-shadow: 4px 4px 0 var(--shadow);
  transition: transform .35s var(--paper), background .35s var(--paper);
}
.trail-dot span { font-family: "Roboto Mono", monospace; font-size: .68rem; font-weight: 700; }
.trail-dot.active { background: var(--taffy); transform: translateX(7px) rotate(-7deg); }

.chapter-sleeve {
  background: linear-gradient(135deg, var(--cream) 0 52%, #FFEBC4 52% 100%);
}
.map-grid {
  position: relative;
  width: min(1180px, 92vw);
  min-height: min(760px, 84vh);
  display: grid;
  grid-template: repeat(8, 1fr) / repeat(12, 1fr);
}
.sleeve-grid { perspective: 900px; }
.sleeve-panel {
  position: absolute;
  border: 7px solid var(--licorice);
  border-radius: 36px;
  box-shadow: 14px 14px 0 var(--shadow);
  transition: transform 1.35s var(--paper), opacity 1.1s var(--paper);
  z-index: 12;
}
.panel-left { inset: 0 49% 0 0; background: var(--mint); }
.panel-right { inset: 0 0 0 49%; background: var(--taffy); }
.panel-top { inset: 0 10% 58% 10%; background: var(--lemon); z-index: 13; }
.panel-bottom { inset: 58% 15% 0 15%; background: var(--blueberry); z-index: 13; }
.map-open .panel-left { transform: translateX(-112%) rotate(-4deg); opacity: .88; }
.map-open .panel-right { transform: translateX(112%) rotate(4deg); opacity: .88; }
.map-open .panel-top { transform: translateY(-130%) rotate(2deg); opacity: .82; }
.map-open .panel-bottom { transform: translateY(130%) rotate(-2deg); opacity: .82; }

.valley-stage {
  position: absolute;
  inset: 4%;
  border: 7px solid var(--licorice);
  border-radius: 44px;
  background: linear-gradient(#83F0CD 0 52%, var(--cream) 52% 100%);
  overflow: hidden;
  box-shadow: inset 0 0 0 7px rgba(255,255,255,.25), 14px 14px 0 var(--shadow);
}
.wordmark-badge {
  z-index: 20;
  grid-column: 2 / 12;
  grid-row: 3 / 7;
  align-self: center;
  justify-self: center;
  text-align: center;
  width: min(850px, 78vw);
  padding: clamp(24px, 4vw, 50px);
  border: 8px solid var(--licorice);
  border-radius: 48px;
  background: var(--cream);
  box-shadow: 12px 12px 0 var(--cherry), 23px 23px 0 var(--shadow);
  transform: rotate(-1deg);
}
.wordmark-badge .mono { color: var(--blueberry); font-size: .78rem; }
.wordmark-badge p { margin-top: 16px; font-weight: 700; }
.trail-tag, .map-tab {
  border: 5px solid var(--licorice);
  background: var(--lemon);
  color: var(--licorice);
  border-radius: 999px 999px 999px 18px;
  padding: 15px 24px;
  font-family: "Baloo 2", Roboto, system-ui, sans-serif;
  font-weight: 700;
  font-size: 1.08rem;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 7px 7px 0 var(--shadow);
  transition: transform .35s var(--paper);
}
.trail-tag { position: absolute; z-index: 25; right: 7%; bottom: 7%; }
.trail-tag:hover, .map-tab:hover { transform: translateY(-5px) rotate(-2deg); }

.sun, .summit-sun {
  position: absolute;
  width: clamp(80px, 12vw, 150px);
  height: clamp(80px, 12vw, 150px);
  border: 6px solid var(--licorice);
  border-radius: 50%;
  background: var(--cherry);
  box-shadow: 8px 8px 0 var(--taffy);
  animation: sunDrift 7s ease-in-out infinite alternate;
}
.sun-opening { top: 10%; left: 11%; }
.cloud {
  position: absolute;
  width: 155px;
  height: 55px;
  background: white;
  border: 5px solid var(--licorice);
  border-radius: 999px;
  box-shadow: 6px 6px 0 var(--shadow);
  animation: cloudFloat 12s ease-in-out infinite alternate;
}
.cloud::before, .cloud::after {
  content: "";
  position: absolute;
  background: white;
  border: 5px solid var(--licorice);
  border-bottom: 0;
  border-radius: 50% 50% 0 0;
}
.cloud::before { width: 62px; height: 50px; left: 21px; top: -30px; }
.cloud::after { width: 70px; height: 58px; right: 19px; top: -39px; }
.cloud-a { top: 14%; right: 17%; }
.cloud-b { top: 27%; left: 38%; transform: scale(.74); animation-delay: -3s; }
.mountain {
  position: absolute;
  bottom: -7%;
  width: 70%;
  height: 48%;
  border: 6px solid var(--licorice);
  border-radius: 48% 52% 13% 14%;
  clip-path: polygon(0 100%, 20% 42%, 36% 58%, 55% 15%, 77% 54%, 100% 25%, 100% 100%);
  box-shadow: 8px 8px 0 var(--shadow);
}
.mountain span {
  position: absolute;
  left: 48%;
  top: 13%;
  width: 15%;
  height: 30%;
  background: white;
  border-radius: 0 0 24px 24px;
}
.layer-back { left: -9%; background: var(--blueberry); opacity: .9; }
.layer-mid { right: -10%; background: var(--mint); transform: scale(.88); bottom: 6%; }
.layer-front { left: 18%; background: var(--pine); transform: scale(.84); bottom: -1%; }
.river {
  position: absolute;
  left: 42%;
  bottom: -8%;
  width: 17%;
  height: 45%;
  border: 6px solid var(--licorice);
  border-radius: 999px 999px 0 0;
  background: repeating-linear-gradient(90deg, var(--blueberry) 0 18px, #80C6FF 18px 34px);
  transform: rotate(8deg);
  animation: riverShimmer 1.8s linear infinite;
}
.pine {
  position: absolute;
  width: 0;
  height: 0;
  border-left: 33px solid transparent;
  border-right: 33px solid transparent;
  border-bottom: 90px solid var(--pine);
  filter: drop-shadow(5px 5px 0 var(--shadow));
  animation: pineWobble 5s ease-in-out infinite alternate;
}
.pine::after {
  content: "";
  position: absolute;
  left: -8px;
  top: 75px;
  width: 16px;
  height: 35px;
  background: var(--licorice);
  border-radius: 8px;
}
.pine-one { left: 18%; bottom: 10%; }
.pine-two { left: 73%; bottom: 13%; transform: scale(.8); animation-delay: -1s; }
.pine-three { left: 81%; bottom: 22%; transform: scale(.56); animation-delay: -2s; }
.cabin {
  position: absolute;
  width: 120px;
  height: 82px;
  right: 24%;
  bottom: 17%;
  background: var(--lemon);
  border: 6px solid var(--licorice);
  border-radius: 18px;
  box-shadow: 8px 8px 0 var(--shadow);
}
.cabin b {
  position: absolute;
  left: -15px;
  right: -15px;
  top: -38px;
  height: 45px;
  background: var(--taffy);
  border: 6px solid var(--licorice);
  border-radius: 30px 30px 8px 8px;
}
.cabin i {
  position: absolute;
  width: 26px;
  height: 42px;
  left: 47px;
  bottom: 0;
  background: var(--cherry);
  border-left: 5px solid var(--licorice);
  border-right: 5px solid var(--licorice);
}

.chapter-valley {
  background: radial-gradient(circle at 88% 18%, #FFFFFF 0 9%, transparent 9.5%), linear-gradient(160deg, var(--mint) 0 34%, var(--cream) 34% 100%);
  grid-template-columns: minmax(0, 1fr);
}
.title-plaque {
  position: absolute;
  z-index: 8;
  top: 8%;
  left: 9%;
  width: min(560px, 78vw);
  background: var(--cream);
  padding: 25px 30px;
}
.map-tile {
  border: 7px solid var(--licorice);
  border-radius: 34px;
  box-shadow: 12px 12px 0 var(--shadow);
}
.title-plaque .mono { color: var(--cherry); font-size: .75rem; }
.stage-set { position: relative; width: min(1120px, 90vw); min-height: 72vh; }
.horizon-slab {
  position: absolute;
  left: 10%;
  right: 3%;
  height: 30%;
  border: 7px solid var(--licorice);
  border-radius: 42px;
  box-shadow: 12px 12px 0 var(--shadow);
}
.slab-blue { bottom: 25%; background: var(--blueberry); transform: rotate(-2deg); }
.slab-mint { bottom: 5%; left: 3%; right: 15%; background: var(--pine); transform: rotate(2deg); }
.sticker {
  position: absolute;
  display: grid;
  place-items: center;
  text-align: center;
  font-family: "Baloo 2", Roboto, system-ui, sans-serif;
  font-weight: 700;
  line-height: .82;
  color: var(--licorice);
  border: 6px solid var(--licorice);
  box-shadow: 8px 8px 0 var(--shadow);
}
.sticker-sun {
  right: 11%;
  top: 8%;
  width: 148px;
  height: 148px;
  background: var(--lemon);
  border-radius: 50%;
  transform: rotate(9deg);
}
.cabin-card {
  position: absolute;
  left: 9%;
  bottom: 10%;
  width: min(390px, 75vw);
  min-height: 285px;
  padding: 28px;
  background: var(--taffy);
}
.big-cabin { position: relative; right: auto; bottom: auto; transform: scale(1.1); margin: 56px auto 25px; }
.trail-ribbon {
  position: absolute;
  right: 6%;
  bottom: 24%;
  max-width: 500px;
  padding: 20px 28px;
  background: var(--lemon);
  border: 6px solid var(--licorice);
  border-radius: 999px;
  box-shadow: 9px 9px 0 var(--shadow);
  font-family: "Baloo 2", Roboto, system-ui, sans-serif;
  font-size: clamp(1.35rem, 3vw, 2.35rem);
  font-weight: 700;
}
.cloud-c { right: 25%; top: 23%; transform: scale(.72); }
.cloud-d { left: 54%; top: 48%; transform: scale(.55); animation-delay: -5s; }

.topo-lines {
  position: absolute;
  inset: 0;
  opacity: .22;
  pointer-events: none;
  background: repeating-radial-gradient(ellipse at 20% 30%, transparent 0 22px, var(--licorice) 23px 26px, transparent 27px 48px);
}
.valley-topo { inset: auto 0 0 auto; width: 52%; height: 72%; }

.chapter-switchback {
  background: linear-gradient(90deg, var(--cream) 0 21%, #FEECC8 21% 23%, var(--cream) 23% 100%);
}
.vertical-post {
  position: absolute;
  left: 8%;
  top: 10%;
  bottom: 10%;
  width: min(285px, 25vw);
  padding: 28px;
  background: var(--mint);
  border: 7px solid var(--licorice);
  border-radius: 38px;
  box-shadow: 12px 12px 0 var(--shadow);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}
.switchback-grid {
  width: min(900px, 70vw);
  margin-left: clamp(120px, 18vw, 260px);
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(5, minmax(75px, 1fr));
  gap: 18px;
}
.turn { padding: 25px; background: var(--cream); position: relative; }
.turn-one { grid-column: 1 / 4; grid-row: 1 / 3; background: var(--blueberry); color: white; }
.turn-two { grid-column: 3 / 7; grid-row: 3 / 5; background: var(--lemon); }
.turn-three { grid-column: 1 / 5; grid-row: 5 / 7; background: var(--taffy); }
.stamp-label {
  position: absolute;
  right: 18px;
  top: 18px;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  background: var(--cream);
  color: var(--licorice);
  border: 4px solid var(--licorice);
  border-radius: 16px;
}
.stitched-path {
  position: absolute;
  right: 12%;
  top: 20%;
  bottom: 15%;
  width: 10px;
  display: grid;
  align-content: space-between;
}
.stitched-path span {
  display: block;
  width: 18px;
  height: 18px;
  background: var(--cherry);
  border: 4px solid var(--licorice);
  border-radius: 50%;
  opacity: .45;
  transition: opacity .45s var(--paper), transform .45s var(--paper);
}
.stitched-path span.lit { opacity: 1; transform: scale(1.25); background: var(--lemon); }
.grove-a { right: 18%; bottom: 12%; }
.grove-b { right: 25%; bottom: 8%; transform: scale(.76); }
.grove-c { right: 9%; bottom: 21%; transform: scale(.55); }

.chapter-summit {
  background: linear-gradient(180deg, #B4F8DF 0 46%, var(--cream) 46% 100%);
}
.summit-map {
  position: relative;
  width: min(1120px, 90vw);
  min-height: 78vh;
  border: 8px solid var(--licorice);
  border-radius: 50px;
  background: var(--cream);
  overflow: hidden;
  box-shadow: 18px 18px 0 var(--shadow);
}
.summit-sun { right: 10%; top: 8%; background: var(--lemon); }
.summit-back { left: -6%; bottom: 0; background: var(--blueberry); width: 80%; height: 55%; }
.summit-front { right: -4%; bottom: -8%; background: var(--pine); width: 82%; height: 60%; transform: scale(.9); }
.final-note {
  position: absolute;
  z-index: 8;
  left: 8%;
  top: 13%;
  width: min(570px, 78vw);
  padding: clamp(26px, 4vw, 46px);
  background: var(--cream);
}
.final-note .mono { color: var(--blueberry); font-size: .74rem; }
.final-note p { margin: 18px 0 24px; max-width: 38ch; }
.compass-sticker {
  right: 13%;
  bottom: 17%;
  width: 160px;
  height: 160px;
  border-radius: 38px;
  background: var(--taffy);
  transform: rotate(8deg);
}
.compass-sticker span {
  width: 36px;
  height: 58px;
  background: var(--cherry);
  border: 5px solid var(--licorice);
  border-radius: 50% 50% 12px 12px;
  transform: rotate(24deg);
}
.checker-strip {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 46px;
  background: linear-gradient(45deg, var(--cherry) 25%, transparent 25% 75%, var(--cherry) 75%), linear-gradient(45deg, var(--cherry) 25%, var(--cream) 25% 75%, var(--cherry) 75%);
  background-position: 0 0, 23px 23px;
  background-size: 46px 46px;
  border-top: 6px solid var(--licorice);
}
.cloud-e { right: 25%; top: 25%; transform: scale(.8); }

.reveal-item {
  opacity: 0;
  transform: translateY(44px) translateX(-18px) rotate(-1deg);
  transition: opacity .9s var(--paper), transform 1s var(--paper);
}
.chapter.in-view .reveal-item {
  opacity: 1;
  transform: translateY(0) translateX(0) rotate(0deg);
}
.chapter.in-view .reveal-item:nth-of-type(2) { transition-delay: .12s; }
.chapter.in-view .reveal-item:nth-of-type(3) { transition-delay: .22s; }
.chapter.in-view .reveal-item:nth-of-type(4) { transition-delay: .32s; }

@keyframes sunDrift { from { transform: translate(0, 0) rotate(-2deg); } to { transform: translate(9px, -7px) rotate(3deg); } }
@keyframes cloudFloat { from { margin-left: -8px; } to { margin-left: 16px; } }
@keyframes riverShimmer { to { background-position: 34px 0; } }
@keyframes pineWobble { from { filter: drop-shadow(5px 5px 0 var(--shadow)); } to { filter: drop-shadow(8px 5px 0 var(--shadow)); } }

@media (max-width: 760px) {
  .trail-nav { left: auto; right: 14px; top: 18px; transform: none; grid-auto-flow: column; }
  .trail-dot { width: 38px; height: 38px; border-width: 3px; }
  .chapter { padding: 18px; }
  .map-grid { min-height: 82vh; }
  .wordmark-badge { width: 84vw; padding: 22px; }
  .trail-tag { right: 8%; bottom: 5%; }
  .title-plaque { top: 10%; left: 6%; }
  .cabin-card { left: 5%; bottom: 7%; }
  .trail-ribbon { right: 3%; left: 8%; bottom: 38%; }
  .vertical-post { writing-mode: horizontal-tb; transform: none; top: 8%; left: 5%; right: 5%; bottom: auto; width: auto; }
  .switchback-grid { width: 92vw; margin-left: 0; margin-top: 150px; grid-template-columns: 1fr; grid-template-rows: none; }
  .turn-one, .turn-two, .turn-three { grid-column: auto; grid-row: auto; }
  .stitched-path { display: none; }
  .final-note { left: 5%; top: 11%; }
  .compass-sticker { transform: scale(.75) rotate(8deg); right: 4%; bottom: 12%; }
}
