:root {
  --mist-porcelain: #EEE8DD;
  --sage-shadow: #87917A;
  --dried-rose-clay: #B98F87;
  --moon-ink: #2D2E2A;
  --lichen-gold: #C7B36A;
  --pond-blue-gray: #9BAEAD;
  --deep-moss: #4B5A45;
  --display: "Nunito Sans", "Arial Rounded MT Bold", system-ui, sans-serif;
  --secondary: "Quicksand", "Trebuchet MS", system-ui, sans-serif;
  --accent: "Cormorant Garamond", Georgia, serif;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: var(--mist-porcelain);
}

body {
  margin: 0;
  overflow-x: hidden;
  color: var(--moon-ink);
  font-family: var(--secondary);
  background:
    radial-gradient(circle at 85% 12%, rgba(155, 174, 173, .45), transparent 28vw),
    radial-gradient(circle at 12% 88%, rgba(185, 143, 135, .26), transparent 34vw),
    var(--mist-porcelain);
}

.grain-field,
.chapter::before,
.central-figure::after {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 30;
  opacity: .38;
  mix-blend-mode: multiply;
  background-image:
    radial-gradient(circle at 20% 10%, rgba(45, 46, 42, .11) 0 1px, transparent 1px),
    radial-gradient(circle at 70% 35%, rgba(75, 90, 69, .09) 0 1px, transparent 1px),
    radial-gradient(circle at 45% 80%, rgba(185, 143, 135, .12) 0 1px, transparent 1px);
  background-size: 17px 19px, 23px 29px, 11px 13px;
}

.cursor-orb {
  position: fixed;
  width: 18rem;
  height: 18rem;
  left: -9rem;
  top: -9rem;
  z-index: 1;
  border-radius: 47% 53% 58% 42%;
  background: radial-gradient(circle, rgba(199, 179, 106, .22), rgba(155, 174, 173, .09) 48%, transparent 70%);
  filter: blur(6px);
  pointer-events: none;
  transition: border-radius 900ms ease;
}

.garden-quest {
  position: relative;
  z-index: 2;
}

.chapter {
  position: relative;
  min-height: 100vh;
  padding: clamp(1.4rem, 3vw, 3.5rem);
  display: grid;
  grid-template-columns: minmax(1rem, 1fr) minmax(280px, 54vw) minmax(1rem, 1fr);
  grid-template-rows: 24vh 38vh 1fr;
  isolation: isolate;
  overflow: hidden;
}

.chapter::before {
  position: absolute;
  z-index: -1;
  opacity: .22;
  filter: contrast(125%);
}

.chapter::after {
  content: "";
  position: absolute;
  inset: 8vh 6vw;
  z-index: -2;
  border: 1px solid rgba(75, 90, 69, .15);
  border-radius: 46% 54% 51% 49% / 55% 42% 58% 45%;
  background: linear-gradient(118deg, rgba(238, 232, 221, .55), rgba(255,255,255,.08), rgba(155,174,173,.16));
  box-shadow: inset 0 0 60px rgba(238, 232, 221, .36);
  backdrop-filter: blur(1px);
}

.chapter-threshold { background: linear-gradient(145deg, #EEE8DD 0%, rgba(135,145,122,.28) 100%); }
.chapter-pond { background: linear-gradient(32deg, rgba(155,174,173,.58), #EEE8DD 55%, rgba(185,143,135,.14)); }
.chapter-archive { background: linear-gradient(144deg, #EEE8DD, rgba(199,179,106,.27) 48%, rgba(185,143,135,.22)); }
.chapter-grove { background: linear-gradient(38deg, rgba(75,90,69,.8), rgba(135,145,122,.54) 45%, #EEE8DD); color: #EEE8DD; }
.chapter-clearing { background: radial-gradient(circle at 72% 20%, rgba(199,179,106,.38), transparent 19rem), linear-gradient(145deg, #4B5A45, #2D2E2A); color: #EEE8DD; }

.chapter-inscription {
  grid-column: 1 / 3;
  grid-row: 1;
  align-self: start;
  display: flex;
  gap: 1.2rem;
  align-items: baseline;
  flex-wrap: wrap;
  z-index: 4;
}

.domain-label {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: .03em;
  font-size: clamp(1.15rem, 2.1vw, 2rem);
}

.pressed-label,
.chapter-number {
  font-family: var(--accent);
  font-size: clamp(1rem, 1.4vw, 1.4rem);
  color: var(--deep-moss);
  opacity: .82;
}

.chapter-grove .pressed-label,
.chapter-grove .chapter-number,
.chapter-clearing .pressed-label,
.chapter-clearing .chapter-number { color: var(--mist-porcelain); }

.botanical-apparition {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  align-self: start;
  position: relative;
  width: clamp(7rem, 16vw, 13rem);
  height: clamp(7rem, 16vw, 13rem);
  display: grid;
  place-items: center;
  font-family: var(--accent);
  font-style: italic;
  font-size: clamp(1.1rem, 2vw, 2rem);
  color: var(--moon-ink);
  animation: drift 9s ease-in-out infinite;
}

.botanical-apparition::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(238,232,221,.48);
  border: 1px solid rgba(75,90,69,.18);
  box-shadow: 0 24px 60px rgba(45,46,42,.12), inset 0 0 32px rgba(255,255,255,.28);
  clip-path: ellipse(44% 50% at 50% 50%);
}

.botanical-apparition span { position: relative; z-index: 1; transform: rotate(-8deg); }
.mirror-pod::before { background: rgba(155,174,173,.54); clip-path: ellipse(36% 50% at 50% 50%); }
.seed-moon::before { background: rgba(199,179,106,.36); border-radius: 50% 46% 55% 45%; clip-path: none; }
.root-question::before { background: rgba(135,145,122,.36); clip-path: polygon(48% 0, 67% 27%, 100% 38%, 72% 58%, 66% 100%, 43% 70%, 0 76%, 29% 45%, 16% 12%); }
.clearing-moon::before { background: rgba(238,232,221,.24); box-shadow: 0 0 80px rgba(199,179,106,.28); }

.diagonal-path {
  position: absolute;
  inset: 16vh -8vw auto -8vw;
  height: 72vh;
  z-index: -1;
  background: linear-gradient(116deg, transparent 0 35%, rgba(238,232,221,.58) 36% 39%, rgba(199,179,106,.34) 40%, transparent 43% 100%);
  mask-image: linear-gradient(90deg, transparent, #000 16%, #000 84%, transparent);
}

.diagonal-path.reverse { transform: scaleX(-1); }

.central-figure {
  grid-column: 2;
  grid-row: 1 / 4;
  align-self: center;
  justify-self: center;
  position: relative;
  width: clamp(16rem, 34vw, 34rem);
  height: clamp(22rem, 55vh, 40rem);
  display: grid;
  place-items: center;
  animation: breathe 7s ease-in-out infinite;
}

.central-figure::after {
  position: absolute;
  inset: 12%;
  border-radius: 50%;
  z-index: 4;
  opacity: .34;
  background-size: 8px 10px, 13px 17px, 6px 7px;
  mix-blend-mode: overlay;
}

.figure-halo {
  position: absolute;
  inset: 2%;
  border-radius: 50% 44% 55% 45%;
  background: radial-gradient(circle, rgba(238,232,221,.34), rgba(155,174,173,.18) 58%, transparent 70%);
  filter: blur(8px);
  transform: rotate(-12deg);
}

.figure-core {
  position: relative;
  width: 66%;
  height: 75%;
  background: linear-gradient(145deg, var(--dried-rose-clay), rgba(135,145,122,.72));
  box-shadow: inset -28px 8px 0 rgba(45,46,42,.15), 0 36px 90px rgba(45,46,42,.16);
  transition: clip-path 900ms ease, border-radius 900ms ease, background 900ms ease;
}

.figure-face .figure-core {
  clip-path: path("M172 24 C96 29 48 91 50 181 C51 254 89 306 130 330 C149 341 129 382 175 391 C240 404 295 338 302 262 C310 174 258 18 172 24 Z");
}

.figure-leaf .figure-core {
  background: linear-gradient(145deg, var(--sage-shadow), rgba(155,174,173,.8));
  clip-path: ellipse(36% 49% at 51% 50%);
  border-radius: 100% 0 100% 0;
  transform: rotate(11deg);
}

.figure-seed .figure-core {
  background: linear-gradient(145deg, rgba(199,179,106,.88), rgba(185,143,135,.65));
  clip-path: ellipse(38% 46% at 50% 50%);
  border-radius: 54% 46% 47% 53%;
}

.figure-root .figure-core {
  background: linear-gradient(150deg, rgba(75,90,69,.72), rgba(185,143,135,.46));
  clip-path: polygon(50% 0, 61% 27%, 53% 52%, 71% 100%, 48% 78%, 28% 100%, 43% 54%, 35% 27%);
}

.figure-moon .figure-core {
  background: radial-gradient(circle at 38% 34%, #EEE8DD, rgba(199,179,106,.72) 52%, rgba(155,174,173,.18));
  clip-path: circle(42% at 50% 50%);
  box-shadow: 0 0 90px rgba(199,179,106,.38), inset -42px 0 0 rgba(45,46,42,.12);
}

.vine-line,
.leaf-veins,
.root-lines,
.seed-glow {
  position: absolute;
  z-index: 5;
  inset: 20% 28%;
  border: solid var(--deep-moss);
  border-width: 0 0 2px 2px;
  border-radius: 0 0 0 70%;
  opacity: .58;
}

.vine-a { transform: rotate(28deg); }
.vine-b { transform: rotate(-12deg) scale(.72); inset: 34% 20% 30% 44%; }
.leaf-veins { border-color: rgba(238,232,221,.72); transform: rotate(48deg); }
.root-lines { border-color: rgba(238,232,221,.64); inset: 42% 26% 12%; border-radius: 0 0 45% 55%; }
.seed-glow { border: 0; border-radius: 50%; background: radial-gradient(circle, rgba(238,232,221,.42), transparent 62%); }

.dream-statement {
  grid-column: 1 / 3;
  grid-row: 2;
  align-self: end;
  max-width: min(48rem, 72vw);
  margin: 0;
  z-index: 6;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.15rem, 6.2vw, 7.4rem);
  line-height: .98;
  letter-spacing: -.055em;
}

.story-fragment {
  grid-column: 2 / 4;
  grid-row: 3;
  justify-self: end;
  align-self: center;
  max-width: 34rem;
  margin: 0;
  z-index: 6;
  font-size: clamp(1rem, 1.5vw, 1.45rem);
  line-height: 1.6;
  color: currentColor;
}

.story-fragment em {
  font-family: var(--accent);
  font-size: 1.2em;
  color: var(--dried-rose-clay);
}

.chapter-clearing .story-fragment em,
.chapter-grove .story-fragment em { color: var(--lichen-gold); }

.pollen-map {
  position: absolute;
  right: clamp(1.2rem, 4vw, 4rem);
  bottom: clamp(1.2rem, 4vw, 4rem);
  display: flex;
  gap: .7rem;
}

.pollen-map i {
  width: .52rem;
  height: .52rem;
  border-radius: 50%;
  background: var(--lichen-gold);
  box-shadow: 0 0 16px rgba(199,179,106,.42);
  animation: pollen 3.7s ease-in-out infinite;
}

.pollen-map i:nth-child(2) { animation-delay: .35s; background: var(--dried-rose-clay); }
.pollen-map i:nth-child(3) { animation-delay: .8s; background: var(--pond-blue-gray); }
.pollen-map i:nth-child(4) { animation-delay: 1.1s; background: var(--sage-shadow); }

.pond-oval {
  position: absolute;
  left: 6vw;
  bottom: 11vh;
  width: 31vw;
  height: 17vw;
  min-width: 15rem;
  min-height: 8rem;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 42%, rgba(238,232,221,.68), rgba(155,174,173,.36) 61%, transparent 67%);
  border: 1px solid rgba(75,90,69,.18);
}

.seed-shelf {
  position: absolute;
  left: 10vw;
  bottom: 17vh;
  display: flex;
  gap: 1rem;
  transform: rotate(-9deg);
}

.seed-shelf b {
  width: 4.4rem;
  height: 5.8rem;
  display: grid;
  place-items: center;
  border-radius: 55% 45% 50% 50%;
  font-family: var(--accent);
  font-size: 3rem;
  color: var(--deep-moss);
  background: rgba(238,232,221,.58);
  box-shadow: inset 0 0 20px rgba(199,179,106,.24);
}

.garden-map {
  position: absolute;
  inset: 30vh 8vw 10vh;
  border-radius: 48% 52% 38% 62%;
  background: rgba(238,232,221,.08);
  border: 1px solid rgba(238,232,221,.16);
  overflow: hidden;
}

.garden-map svg { width: 100%; height: 100%; }
.map-root { fill: none; stroke: var(--lichen-gold); stroke-width: 8; stroke-linecap: round; opacity: .68; }
.map-root.thin { stroke-width: 3; opacity: .42; }
.garden-map strong {
  position: absolute;
  left: 10%;
  bottom: 12%;
  font-family: var(--display);
  font-size: clamp(2rem, 7vw, 7rem);
  letter-spacing: -.05em;
  color: rgba(238,232,221,.72);
}

.chapter-dots {
  position: fixed;
  right: 1.4rem;
  top: 50%;
  z-index: 35;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: .85rem;
}

.chapter-dots button {
  width: .8rem;
  height: .8rem;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(45,46,42,.24);
  border-radius: 999px;
  color: transparent;
  background: rgba(238,232,221,.64);
  cursor: pointer;
  transition: transform 300ms ease, background 300ms ease, height 300ms ease;
}

.chapter-dots button.active {
  height: 2.4rem;
  background: var(--lichen-gold);
  transform: translateX(-.2rem);
}

.is-near .figure-core { filter: saturate(1.08) brightness(1.04); }
.is-near::before { opacity: .36; }

@keyframes breathe {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-1.3vh) scale(1.025); }
}

@keyframes drift {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  50% { transform: translate(-1.2vw, 1.5vh) rotate(4deg); }
}

@keyframes pollen {
  0%, 100% { transform: translateY(0) scale(1); opacity: .55; }
  50% { transform: translateY(-.55rem) scale(1.25); opacity: 1; }
}

@media (max-width: 760px) {
  .chapter {
    grid-template-columns: 1fr;
    grid-template-rows: 18vh 38vh 1fr;
    padding: 1.25rem;
  }

  .chapter-inscription,
  .dream-statement,
  .story-fragment,
  .botanical-apparition,
  .central-figure {
    grid-column: 1;
  }

  .botanical-apparition { width: 6.5rem; height: 6.5rem; }
  .central-figure { width: 76vw; height: 48vh; opacity: .82; }
  .dream-statement { max-width: 92vw; }
  .story-fragment { justify-self: start; align-self: end; max-width: 84vw; }
  .chapter-dots { right: .65rem; }
}
