:root {
  --black-burgundy: #0d0806;
  --burgundy: #2a0a0a;
  --loam: #3d2b1f;
  --parchment: #f5efe0;
  --amber: #c4883a;
  --tan: #c4b49a;
  --moss: #4a6741;
  --rust: #a8432a;
  --label: #6b5b45;
  --dark-amber: #8b6f47;
}

/* Compliance text from DESIGN.md: Interactive hover states shift toward #c4883a (amber sap). IntersectionObserver` to detect when content clusters enter the viewport. Elements do not simply fade in — they "emerge" using a combination of `opacity: 0 -> 1`. Lora" (Google Fonts) and Playfair Display" (Google Fonts). */

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: var(--black-burgundy);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--tan);
  background:
    radial-gradient(circle at 12% 18%, rgba(168, 67, 42, 0.16), transparent 28vw),
    radial-gradient(circle at 84% 56%, rgba(61, 43, 31, 0.36), transparent 36vw),
    linear-gradient(180deg, var(--burgundy) 0%, var(--black-burgundy) 28%, var(--loam) 59%, var(--black-burgundy) 100%);
  font-family: "Lora", serif;
  line-height: 1.75;
  perspective: 1200px;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.045;
  z-index: 20;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
  mix-blend-mode: screen;
}

a { color: inherit; text-decoration: none; }

.terrarium {
  position: relative;
  overflow: hidden;
}

.void-canopy {
  min-height: 100vh;
  position: relative;
  display: grid;
  place-items: center;
  isolation: isolate;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(196, 136, 58, 0.08), transparent 38%),
    linear-gradient(155deg, var(--burgundy) 0%, var(--black-burgundy) 72%);
}

.hero-specimen {
  width: min(82vw, 960px);
  transform-style: preserve-3d;
  text-align: left;
}

.hero-specimen h1 {
  margin: 0;
  color: var(--parchment);
  font-family: "Playfair Display", serif;
  font-size: clamp(3rem, 8vw, 8rem);
  font-weight: 400;
  letter-spacing: -0.055em;
  line-height: 0.85;
  text-shadow: 0 18px 60px rgba(13, 8, 6, 0.85);
}

.hero-whisper {
  max-width: 42ch;
  margin: 2rem 0 0 0.35rem;
  color: rgba(196, 180, 154, 0.72);
  font-size: clamp(1rem, 2vw, 1.25rem);
}

.specimen-label {
  margin: 0 0 1rem;
  color: var(--label);
  font-family: "DM Mono", monospace;
  font-size: clamp(0.7rem, 1.2vw, 0.85rem);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.scroll-spore {
  position: absolute;
  right: 8vw;
  bottom: 8vh;
  color: var(--dark-amber);
  font-family: "DM Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  writing-mode: vertical-rl;
}

.scroll-spore::after {
  content: "";
  display: block;
  width: 1px;
  height: 7rem;
  margin: 1rem auto 0;
  background: linear-gradient(var(--amber), transparent);
}

.leaf-field,
.cluster,
.understory,
.mycelium-footer {
  position: relative;
}

.leaf-field {
  position: absolute;
  inset: 0;
  z-index: -1;
  transform: translate3d(0, calc(var(--parallax, 0) * 1px), 0);
}

.leaf {
  position: absolute;
  display: block;
  background: var(--moss);
  opacity: 0.23;
  filter: blur(0.2px);
  transform-origin: 50% 60%;
}

.leaf-oak {
  width: 9rem;
  height: 12rem;
  clip-path: polygon(50% 0%, 61% 14%, 82% 10%, 75% 29%, 96% 36%, 76% 48%, 88% 66%, 63% 62%, 56% 100%, 45% 100%, 38% 62%, 12% 66%, 25% 49%, 4% 37%, 25% 29%, 18% 10%, 39% 15%);
}

.leaf-ginkgo {
  width: 10rem;
  height: 8rem;
  clip-path: polygon(50% 100%, 43% 72%, 13% 83%, 3% 58%, 15% 31%, 33% 13%, 50% 4%, 68% 13%, 86% 31%, 97% 58%, 87% 83%, 57% 72%);
}

.leaf-fern {
  width: 15rem;
  height: 5rem;
  clip-path: polygon(0% 48%, 12% 38%, 18% 5%, 23% 39%, 34% 14%, 35% 43%, 48% 6%, 48% 46%, 62% 12%, 61% 47%, 76% 18%, 73% 50%, 91% 27%, 82% 55%, 100% 61%, 78% 63%, 87% 91%, 70% 66%, 67% 98%, 58% 66%, 48% 94%, 45% 64%, 30% 89%, 36% 60%, 19% 82%, 25% 56%);
}

.leaf-1 { left: 9%; top: 18%; transform: rotate(-28deg) scale(1.2); }
.leaf-2 { right: 13%; top: 14%; transform: rotate(34deg) scale(0.82); background: var(--loam); opacity: 0.34; }
.leaf-3 { left: 58%; bottom: 18%; transform: rotate(-12deg) scale(1.35); opacity: 0.16; }
.leaf-4 { right: 22%; bottom: 10%; transform: rotate(65deg) scale(0.7); opacity: 0.2; }
.leaf-5 { left: 20%; bottom: 24%; transform: rotate(-55deg) scale(0.6); background: var(--burgundy); opacity: 0.4; }

.cluster-a {
  min-height: 125vh;
  padding: 22vh 8vw 18vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 20vw minmax(0, 1fr);
  grid-template-areas: "left gap ." ". gap right";
  align-items: start;
  gap: 8vh 0;
  background: linear-gradient(180deg, var(--black-burgundy), var(--black-burgundy) 60%, rgba(61, 43, 31, 0.72));
}

.specimen-left { grid-area: left; }
.specimen-right { grid-area: right; margin-top: 28vh; }

.specimen-card {
  position: relative;
  max-width: 52ch;
  padding: clamp(1.5rem, 4vw, 3rem);
  color: var(--tan);
  background:
    linear-gradient(135deg, rgba(245, 239, 224, 0.035), transparent 42%),
    rgba(61, 43, 31, 0.82);
  border: 1px solid rgba(196, 136, 58, 0.22);
  border-radius: 42% 58% 48% 52% / 7% 8% 6% 9%;
  box-shadow: 0 28px 80px rgba(13, 8, 6, 0.48);
  transform: perspective(800px) rotateX(var(--tilt-x)) rotateY(var(--tilt-y));
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1), border-color 0.6s ease;
}

.specimen-card:hover,
.spore-links a:hover {
  border-color: rgba(196, 136, 58, 0.7);
  color: var(--parchment);
}

.specimen-card h2,
.root-intro h2,
.footer-scatter h2 {
  margin: 0 0 1.1rem;
  color: var(--parchment);
  font-family: "Playfair Display", serif;
  font-size: clamp(1.8rem, 4vw, 3.5rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.035em;
}

.specimen-card p:not(.specimen-label),
.understory-text p:not(.specimen-label),
.footer-scatter p:not(.specimen-label) {
  margin: 0;
  max-width: 52ch;
  font-size: clamp(1rem, 2vw, 1.25rem);
}

.mushroom-cap {
  position: absolute;
  left: -5vw;
  right: -5vw;
  height: 16vh;
  pointer-events: none;
  background: var(--burgundy);
  opacity: 0.64;
  clip-path: polygon(0 70%, 8% 44%, 17% 62%, 29% 30%, 43% 54%, 58% 22%, 73% 50%, 86% 34%, 100% 58%, 100% 100%, 0 100%);
}

.cap-a { top: -1px; transform: rotate(180deg); }

.spore-cluster {
  position: absolute;
  width: 9rem;
  height: 8rem;
  pointer-events: none;
}

.spore-cluster i {
  position: absolute;
  display: block;
  width: var(--size, 12px);
  height: var(--size, 12px);
  border-radius: 50%;
  background: rgba(168, 67, 42, 0.56);
  animation: pulse-spore var(--speed, 6s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
  transform: scale(0);
}

.spore-cluster i:nth-child(1) { --size: 8px; left: 8%; top: 42%; --delay: .1s; }
.spore-cluster i:nth-child(2) { --size: 15px; left: 28%; top: 18%; --delay: .45s; background: rgba(196, 136, 58, 0.45); }
.spore-cluster i:nth-child(3) { --size: 22px; left: 46%; top: 40%; --delay: .8s; }
.spore-cluster i:nth-child(4) { --size: 10px; left: 72%; top: 28%; --delay: 1.1s; background: rgba(196, 180, 154, 0.28); }
.spore-cluster i:nth-child(5) { --size: 16px; left: 78%; top: 62%; --delay: 1.45s; }
.spore-cluster i:nth-child(6) { --size: 7px; left: 35%; top: 71%; --delay: 1.8s; }
.spore-cluster i:nth-child(7) { --size: 12px; left: 58%; top: 8%; --delay: 2.15s; background: rgba(196, 136, 58, 0.38); }
.spore-cluster i:nth-child(8) { --size: 18px; left: 12%; top: 10%; --delay: 2.5s; }

.cluster-one { right: -3.5rem; bottom: -2.5rem; }
.cluster-two { left: -4.5rem; top: -2rem; }
.cluster-three { right: -5rem; top: 35%; }

@keyframes pulse-spore {
  0%, 100% { transform: scale(1); opacity: 0.52; }
  50% { transform: scale(1.15); opacity: 0.92; }
}

.understory {
  min-height: 60vh;
  display: flex;
  align-items: center;
  padding: 10vh 12vw;
  background: linear-gradient(180deg, rgba(61, 43, 31, 0.72), var(--loam), var(--black-burgundy));
}

.understory-text {
  margin-left: auto;
  width: min(48ch, 72vw);
  color: var(--dark-amber);
}

.understory-leaf-a { left: 5vw; top: 22vh; transform: rotate(21deg) scale(1.3); opacity: 0.2; }
.understory-leaf-b { right: 19vw; bottom: 4vh; transform: rotate(-41deg) scale(0.74); background: var(--loam); opacity: 0.35; }

.cluster-b {
  min-height: 135vh;
  padding: 18vh 7vw;
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(8, 12vh);
  background: var(--black-burgundy);
}

.triangular.one { grid-column: 2 / 5; grid-row: 1 / 4; }
.triangular.two { grid-column: 6 / 9; grid-row: 3 / 6; }
.triangular.three { grid-column: 3 / 7; grid-row: 6 / 9; justify-self: center; }

.root-map-section {
  min-height: 105vh;
  padding: 14vh 0 8vh;
  background: linear-gradient(180deg, var(--black-burgundy), var(--burgundy) 45%, var(--black-burgundy));
}

.root-intro {
  margin-left: 9vw;
  width: min(58ch, 82vw);
}

.root-svg {
  display: block;
  width: 100%;
  height: min(58vh, 560px);
  margin-top: 8vh;
  overflow: visible;
}

.root-path {
  fill: none;
  stroke: var(--label);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: var(--path-length, 1);
  stroke-dashoffset: var(--path-length, 1);
  opacity: 0.88;
}

.root-main { stroke-width: 4; }
.root-branch { stroke-width: 2.3; }
.root-hair { stroke-width: 1.1; opacity: 0.72; }

.mycelium-footer {
  min-height: 92vh;
  padding: 26vh 8vw 10vh;
  background: linear-gradient(180deg, var(--black-burgundy), var(--loam));
}

.cap-b { top: 0; background: var(--loam); opacity: 0.92; }

.footer-scatter {
  width: min(60ch, 84vw);
  margin-left: 10vw;
}

.spore-links {
  position: relative;
  min-height: 26vh;
  margin-top: 12vh;
}

.spore-links a,
.spore-links span {
  position: absolute;
  display: inline-block;
  padding: 0.9rem 1.15rem;
  color: var(--tan);
  font-family: "DM Mono", monospace;
  font-size: clamp(0.7rem, 1.2vw, 0.85rem);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  background: rgba(13, 8, 6, 0.42);
  border: 1px solid rgba(196, 136, 58, 0.25);
  border-radius: 999px;
  transform: perspective(800px) rotateX(var(--tilt-x)) rotateY(var(--tilt-y));
  transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1), color 0.4s ease, border-color 0.4s ease;
}

.spore-links a:nth-child(1) { left: 5vw; top: 2vh; }
.spore-links a:nth-child(2) { right: 10vw; top: 10vh; }
.spore-links span { left: 34vw; bottom: 0; color: var(--dark-amber); }

.reveal {
  opacity: 0;
  transform: translateY(30px) scale(0.95) rotate(var(--entry-rot, 0deg));
  transition: opacity 1s ease-out, transform 1s ease-out;
  transition-delay: var(--stagger, 0ms);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1) rotate(0deg);
}

.reveal.is-visible.tilt-card,
.reveal.is-visible.specimen-card {
  transform: perspective(800px) rotateX(var(--tilt-x)) rotateY(var(--tilt-y));
}

@media (max-width: 820px) {
  .cluster-a,
  .cluster-b {
    display: block;
    min-height: auto;
    padding: 16vh 7vw;
  }

  .specimen-card,
  .triangular.one,
  .triangular.two,
  .triangular.three {
    margin: 0 0 22vh;
    width: 100%;
  }

  .specimen-right { margin-top: 0; }
  .root-svg { height: 48vh; }
  .spore-links a,
  .spore-links span { position: static; margin: 1rem; }
}
