:root {
  --night-moss: #132017;
  --foxglove: #7C4D8B;
  --lantern: #F2B84B;
  --parchment: #E9D8A6;
  --clay: #A86A43;
  --mushroom: #C94F4F;
  --dew: #9FE3C0;
  --bark: #241A16;
  --paper-shadow: rgba(36, 26, 22, .42);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 18% 10%, rgba(159, 227, 192, .14), transparent 28rem),
    radial-gradient(circle at 86% 42%, rgba(124, 77, 139, .22), transparent 34rem),
    linear-gradient(135deg, #132017 0%, #241A16 58%, #132017 100%);
  color: var(--parchment);
  font-family: "Nunito Sans", sans-serif;
  overflow-x: hidden;
}

body.map-awake .trail-map #trailPath,
body.map-awake .trail-map .trail-fork { filter: drop-shadow(0 0 11px rgba(242, 184, 75, .85)); }

.moss-frame {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  box-shadow: inset 0 0 0 18px #132017, inset 0 0 44px 24px rgba(19, 32, 23, .88), inset 0 0 120px rgba(36, 26, 22, .9);
}

.moss-frame::before, .moss-frame::after {
  content: "";
  position: absolute;
  inset: 10px;
  opacity: .34;
  background-image:
    radial-gradient(circle, rgba(159, 227, 192, .45) 0 1px, transparent 2px),
    radial-gradient(circle, rgba(233, 216, 166, .18) 0 1px, transparent 2px);
  background-size: 37px 31px, 53px 47px;
  mask-image: linear-gradient(90deg, #000 0 8%, transparent 16% 84%, #000 92% 100%);
}

.mist {
  position: fixed;
  width: 46vw;
  height: 46vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(159, 227, 192, .12), transparent 67%);
  filter: blur(10px);
  pointer-events: none;
  z-index: 2;
  animation: drift 18s ease-in-out infinite alternate;
}

.mist-one { left: -10vw; top: 18vh; }
.mist-two { right: -14vw; top: 54vh; animation-duration: 23s; }

.map-tabs {
  position: fixed;
  z-index: 60;
  top: 24px;
  left: 32px;
  display: flex;
  gap: 10px;
  transform: rotate(-2deg);
}

.map-tabs a {
  display: block;
  padding: 8px 12px;
  color: var(--bark);
  background: var(--parchment);
  border: 1px dashed rgba(36, 26, 22, .45);
  text-decoration: none;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  box-shadow: 0 6px 0 rgba(36, 26, 22, .22);
}

.quest-log {
  position: fixed;
  z-index: 55;
  right: 28px;
  top: 22px;
  width: 190px;
  padding: 18px 18px 18px 22px;
  color: var(--bark);
  background:
    radial-gradient(circle at 20% 30%, rgba(168, 106, 67, .18), transparent 9rem),
    linear-gradient(120deg, #E9D8A6, #d9c48b);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .35);
  clip-path: polygon(0 4%, 94% 0, 100% 88%, 78% 100%, 4% 96%);
  transform: rotate(2deg);
}

.quest-log h2 {
  margin: 3px 0 9px;
  font-family: "Fraunces", serif;
  font-size: 20px;
}

.quest-log ul { margin: 0; padding: 0; list-style: none; }
.quest-log li { margin: 6px 0; opacity: .42; transition: opacity .45s, transform .45s; }
.quest-log li.found { opacity: 1; transform: translateX(4px); color: var(--foxglove); }

.log-seal {
  position: absolute;
  width: 34px;
  height: 34px;
  right: 14px;
  top: -9px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #e07777, #C94F4F 62%, #8a3030);
  box-shadow: 0 5px 0 rgba(36, 26, 22, .25);
}

.mono { font-family: "IBM Plex Mono", monospace; }
.ibm-plex-mono-only-for-inventory-counts { font-family: "IBM Plex Mono", monospace; }

.threshold-trail { position: relative; isolation: isolate; }

.trail-map {
  position: absolute;
  z-index: 4;
  inset: 0 auto auto 0;
  width: 100%;
  height: 700vh;
  pointer-events: none;
}

.trail-map path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#trailPath {
  stroke: var(--lantern);
  stroke-width: 8;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  opacity: .96;
}

.trail-fork {
  stroke: rgba(159, 227, 192, .78);
  stroke-width: 4;
  stroke-dasharray: 12 18;
  opacity: .68;
}

.chapter {
  position: relative;
  min-height: 100vh;
  padding: clamp(86px, 10vw, 150px) clamp(28px, 8vw, 132px);
  display: grid;
  align-items: center;
  z-index: 5;
}

.parchment {
  margin: 0 auto;
  width: min(1120px, calc(100vw - 48px));
  color: var(--bark);
  background:
    radial-gradient(circle at 24% 28%, rgba(242, 184, 75, .22), transparent 15rem),
    radial-gradient(circle at 78% 70%, rgba(159, 227, 192, .13), transparent 17rem),
    linear-gradient(130deg, #E9D8A6 0%, #dec88e 100%);
  box-shadow: 0 28px 80px rgba(0,0,0,.44);
  clip-path: polygon(2% 4%, 96% 0, 100% 18%, 97% 96%, 73% 99%, 49% 96%, 22% 100%, 0 93%, 3% 66%, 0 38%);
}

.parchment::before, .story-scrap::before, .bark-riddle::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(36, 26, 22, .16) 0 1px, transparent 1.5px),
    linear-gradient(87deg, transparent 0 47%, rgba(36, 26, 22, .06) 48% 52%, transparent 53%);
  background-size: 19px 23px, 67px 100%;
  mix-blend-mode: multiply;
  opacity: .46;
}

.hero { min-height: calc(100vh - 34px); text-align: center; }

.chapter-kicker {
  margin: 0 0 14px;
  color: var(--foxglove);
  font-family: "Fraunces", serif;
  font-weight: 700;
  letter-spacing: .05em;
}

h1, .finale h2 {
  margin: 0;
  font-family: "Uncial Antiqua", cursive;
  font-size: clamp(64px, 14vw, 174px);
  font-weight: 400;
  line-height: .85;
  color: var(--bark);
  text-shadow: 0 3px 0 rgba(242, 184, 75, .45);
}

h2 {
  margin: 0 0 16px;
  font-family: "Uncial Antiqua", cursive;
  font-size: clamp(42px, 7vw, 96px);
  line-height: .9;
  font-weight: 400;
}

.lead {
  max-width: 670px;
  margin: 26px auto;
  font-size: clamp(19px, 2.2vw, 27px);
  line-height: 1.45;
}

.object-button {
  border: 0;
  color: var(--bark);
  background: radial-gradient(circle at 45% 20%, #ffe08a, #F2B84B 65%, #A86A43);
  font-family: "Fraunces", serif;
  font-weight: 700;
  font-size: 18px;
  padding: 16px 26px;
  border-radius: 999px 999px 999px 24px;
  box-shadow: 0 12px 0 rgba(168, 106, 67, .55), 0 0 34px rgba(242, 184, 75, .44);
  cursor: pointer;
  transform: rotate(-1deg);
}

.lantern-dot {
  position: absolute;
  left: 50%;
  bottom: 8vh;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--lantern);
  box-shadow: 0 0 0 14px rgba(242, 184, 75, .15), 0 0 46px var(--lantern);
  animation: pulse 1.9s ease-in-out infinite;
}

.bootprint {
  position: absolute;
  left: 28%;
  bottom: 17vh;
  width: 42px;
  height: 68px;
  border-radius: 50% 48% 46% 42%;
  background: rgba(168, 106, 67, .55);
  transform: rotate(-28deg);
  opacity: 0;
  animation: printIn 1.4s .55s forwards;
}

.topographic-rings {
  position: absolute;
  right: 8%;
  top: 18%;
  width: 240px;
  height: 180px;
  opacity: .24;
  border: 2px solid var(--clay);
  border-radius: 48% 42% 55% 43%;
  box-shadow: inset 0 0 0 18px transparent, 0 0 0 18px transparent, 0 0 0 21px var(--clay), 0 0 0 44px transparent, 0 0 0 47px var(--clay);
}

.paper-corner {
  position: absolute;
  right: 2%;
  bottom: 4%;
  width: 96px;
  height: 96px;
  background: linear-gradient(135deg, transparent 49%, rgba(36, 26, 22, .15) 51%), #d5bb76;
  clip-path: polygon(100% 0, 0 100%, 100% 100%);
  animation: cornerLift 4s ease-in-out infinite;
}

.root-door { grid-template-columns: 1fr 1fr; gap: 7vw; }
.hill-door { position: relative; width: min(430px, 80vw); height: 440px; margin: auto; border-radius: 52% 48% 16% 16%; background: radial-gradient(circle at 45% 40%, #2b5134, #132017 68%); box-shadow: inset 0 -30px 0 rgba(36, 26, 22, .55), 0 30px 80px rgba(0,0,0,.5); }
.door-plank { position: absolute; left: 28%; bottom: 0; width: 44%; height: 70%; border-radius: 52% 52% 8px 8px; background: repeating-linear-gradient(90deg, #A86A43 0 23px, #855332 24px 26px); box-shadow: inset 0 0 30px rgba(36,26,22,.48); }
.door-knob { position: absolute; right: 32%; bottom: 30%; width: 24px; height: 24px; background: var(--lantern); border-radius: 50%; box-shadow: 0 0 18px var(--lantern); }
.root { position: absolute; height: 22px; background: #241A16; border-radius: 999px; transform-origin: left; }
.root-a { width: 360px; left: 10px; top: 82px; transform: rotate(18deg); }
.root-b { width: 280px; right: -45px; top: 152px; transform: rotate(142deg); }
.root-c { width: 250px; left: 60px; bottom: 120px; transform: rotate(-28deg); }

.story-scrap, .bark-riddle {
  position: relative;
  padding: clamp(26px, 4vw, 54px);
  color: var(--bark);
  background: linear-gradient(125deg, #E9D8A6, #d8c083);
  box-shadow: 0 26px 66px var(--paper-shadow);
  clip-path: polygon(0 7%, 92% 0, 100% 80%, 88% 100%, 4% 94%);
}

.story-scrap p, .bark-riddle p { font-size: 19px; line-height: 1.65; }
.torn-left { clip-path: polygon(4% 0, 100% 7%, 96% 96%, 9% 100%, 0 55%); transform: rotate(-2deg); }

.pebble-field { grid-template-columns: .9fr 1.1fr; gap: 6vw; }
.pebbles { display: flex; gap: clamp(16px, 3vw, 34px); align-items: center; justify-content: center; flex-wrap: wrap; }
.pebble { width: 156px; height: 128px; border: 0; border-radius: 53% 47% 49% 51%; background: radial-gradient(circle at 35% 28%, #E9D8A6, #A86A43 72%); color: var(--bark); box-shadow: inset -14px -18px 20px rgba(36,26,22,.26), 0 18px 28px rgba(0,0,0,.32); cursor: pointer; font-family: "Fraunces", serif; font-weight: 700; transform: rotate(var(--turn, -4deg)); transition: transform .35s, box-shadow .35s; }
.pebble:nth-child(2) { --turn: 3deg; background: radial-gradient(circle at 40% 30%, #9FE3C0, #7C4D8B 76%); }
.pebble:nth-child(3) { --turn: -1deg; background: radial-gradient(circle at 35% 28%, #E9D8A6, #C94F4F 76%); }
.pebble.selected { transform: translateY(-16px) rotate(var(--turn, -4deg)); box-shadow: inset -14px -18px 20px rgba(36,26,22,.18), 0 0 0 5px rgba(242,184,75,.85), 0 24px 34px rgba(0,0,0,.38); }
.choice-note { position: absolute; right: 9vw; bottom: 14vh; color: var(--dew); }

.inventory { grid-template-columns: 1.05fr .95fr; gap: 7vw; }
.pouch { position: relative; width: min(430px, 80vw); height: 500px; margin: auto; border-radius: 20% 20% 42% 44%; background: linear-gradient(150deg, #A86A43, #6b3d26); box-shadow: inset 0 -24px 38px rgba(36,26,22,.48), 0 28px 60px rgba(0,0,0,.45); }
.pouch-mouth { position: absolute; left: 11%; top: 12%; width: 78%; height: 70px; border: 12px solid #241A16; border-bottom: 0; border-radius: 50% 50% 0 0; }
.inventory-item { position: absolute; left: 50%; padding: 12px 16px; color: var(--bark); background: var(--parchment); border: 2px dashed rgba(36,26,22,.42); font-family: "IBM Plex Mono", monospace; font-size: 13px; opacity: 0; transform: translate(-50%, -30px); transition: opacity .7s, transform .7s; }
.chapter.in-view .inventory-item { opacity: 1; transform: translate(-50%, 0); }
.key { top: 140px; transition-delay: .1s; }
.acorn { top: 230px; transition-delay: .35s; }
.wax { top: 320px; transition-delay: .6s; }
.small-scrap { transform: rotate(2deg); }

.marker { grid-template-columns: .8fr 1.2fr; gap: 8vw; }
.mushroom-marker { position: relative; height: 440px; }
.mushroom-marker span { position: absolute; bottom: 0; width: 120px; height: 170px; background: #E9D8A6; border-radius: 45% 45% 18% 18%; box-shadow: inset -12px 0 rgba(168,106,67,.25); }
.mushroom-marker span::before { content: ""; position: absolute; left: -50px; top: -72px; width: 220px; height: 112px; border-radius: 55% 55% 48% 48%; background: radial-gradient(circle at 35% 35%, #f08a85 0 10px, transparent 11px), radial-gradient(circle at 62% 45%, #E9D8A6 0 9px, transparent 10px), #C94F4F; box-shadow: 0 18px 0 rgba(36,26,22,.2); }
.mushroom-marker span:nth-child(2) { left: 155px; transform: scale(.72); bottom: 24px; }
.mushroom-marker span:nth-child(3) { left: 285px; transform: scale(.5); bottom: 12px; }
.bark-riddle { background: linear-gradient(110deg, #4c2d20, #241A16); color: var(--parchment); clip-path: polygon(2% 0, 96% 4%, 100% 96%, 9% 100%, 0 46%); }
.bark-riddle .chapter-kicker { color: var(--dew); }
.fireflies { position: relative; height: 80px; }
.fireflies i { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--dew); box-shadow: 0 0 16px var(--dew); animation: blink 2.2s infinite ease-in-out; }
.fireflies i:nth-child(1) { left: 8%; top: 35%; animation-delay: .1s; }
.fireflies i:nth-child(2) { left: 22%; top: 55%; animation-delay: .5s; }
.fireflies i:nth-child(3) { left: 41%; top: 18%; animation-delay: .9s; }
.fireflies i:nth-child(4) { left: 58%; top: 62%; animation-delay: .2s; }
.fireflies i:nth-child(5) { left: 72%; top: 30%; animation-delay: 1.2s; }
.fireflies i:nth-child(6) { left: 87%; top: 48%; animation-delay: .7s; }

.one-step { align-content: center; }
.wide-scrap { max-width: 760px; margin-left: auto; transform: rotate(1.5deg); }
.footprints { position: absolute; left: 13vw; top: 18vh; width: 420px; height: 520px; }
.footprints span { position: absolute; width: 46px; height: 78px; border-radius: 50% 45% 48% 44%; background: rgba(168, 106, 67, .62); opacity: 0; transform: rotate(-24deg); transition: opacity .4s, transform .5s; }
.footprints span:nth-child(1) { left: 30px; top: 390px; }
.footprints span:nth-child(2) { left: 110px; top: 300px; transform: rotate(20deg); }
.footprints span:nth-child(3) { left: 175px; top: 210px; }
.footprints span:nth-child(4) { left: 260px; top: 128px; transform: rotate(20deg); }
.footprints span:nth-child(5) { left: 325px; top: 40px; }
.chapter.in-view .footprints span { opacity: 1; transform: translateY(-8px) rotate(-24deg); }
.chapter.in-view .footprints span:nth-child(2), .chapter.in-view .footprints span:nth-child(4) { transform: translateY(-8px) rotate(20deg); }
.chapter.in-view .footprints span:nth-child(1) { transition-delay: .05s; }
.chapter.in-view .footprints span:nth-child(2) { transition-delay: .25s; }
.chapter.in-view .footprints span:nth-child(3) { transition-delay: .45s; }
.chapter.in-view .footprints span:nth-child(4) { transition-delay: .65s; }
.chapter.in-view .footprints span:nth-child(5) { transition-delay: .85s; }
.companion-shadow { position: absolute; right: 12vw; bottom: 14vh; width: 150px; height: 260px; border-radius: 50% 50% 20% 20%; background: linear-gradient(180deg, rgba(124,77,139,.38), transparent); filter: blur(2px); opacity: .55; }

.finale { text-align: center; margin-bottom: 48px; }
.moon-clasp { width: 96px; height: 96px; margin: 0 auto 24px; border-radius: 50%; background: radial-gradient(circle at 30% 35%, transparent 0 34px, #F2B84B 35px); filter: drop-shadow(0 0 24px rgba(242,184,75,.5)); }
.continuing-path { width: 4px; height: 180px; margin: 24px auto -70px; background: linear-gradient(#F2B84B, transparent); box-shadow: 0 0 18px var(--lantern); }

@keyframes pulse { 0%,100% { transform: scale(.9); opacity: .78; } 50% { transform: scale(1.18); opacity: 1; } }
@keyframes printIn { to { opacity: 1; transform: translateY(-10px) rotate(-28deg); } }
@keyframes cornerLift { 0%,100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-6px) rotate(3deg); } }
@keyframes drift { from { transform: translate3d(0,0,0) scale(1); } to { transform: translate3d(8vw,-5vh,0) scale(1.18); } }
@keyframes blink { 0%,100% { opacity: .18; transform: scale(.7); } 45% { opacity: 1; transform: scale(1.3); } }

@media (max-width: 860px) {
  .map-tabs, .quest-log { position: absolute; transform: none; }
  .quest-log { top: 76px; right: 16px; width: 160px; }
  .map-tabs { left: 16px; flex-wrap: wrap; max-width: 52vw; }
  .root-door, .pebble-field, .inventory, .marker { grid-template-columns: 1fr; }
  .footprints { opacity: .45; left: 2vw; }
  .chapter { padding-inline: 24px; }
}
