:root {
  --abyss-loam: #070A06;
  --wet-basalt: #1B2420;
  --spore-lantern: #B8FF6A;
  --cave-pearl: #E8D8B8;
  --iron-ochre: #B75A2A;
  --mineral-violet: #6D5BD0;
  --blind-river-blue: #2FC7B8;
  --lantern-x: 50vw;
  --lantern-y: 45vh;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--cave-pearl);
  background:
    radial-gradient(circle at 22% 18%, rgba(109, 91, 208, 0.16), transparent 24rem),
    radial-gradient(circle at 80% 72%, rgba(47, 199, 184, 0.11), transparent 26rem),
    linear-gradient(110deg, var(--abyss-loam), #0b1009 42%, #050704);
  font-family: "Atkinson Hyperlegible", Atkinson, Verdana, system-ui, sans-serif;
}

body.awake .specimen-cover { opacity: 0.28; transform: translateY(-13vh) rotate(-1deg) scale(0.92); pointer-events: none; }

.grain,
.caustics,
.lantern {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 20;
}

.grain {
  opacity: 0.28;
  mix-blend-mode: overlay;
  background-image:
    radial-gradient(circle at 15% 20%, rgba(232,216,184,0.18) 0 1px, transparent 1px),
    radial-gradient(circle at 70% 50%, rgba(184,255,106,0.12) 0 1px, transparent 1px),
    linear-gradient(90deg, transparent 49%, rgba(232,216,184,0.035) 50%, transparent 51%);
  background-size: 19px 23px, 31px 29px, 7px 100%;
}

.caustics {
  z-index: 2;
  opacity: 0.25;
  background: repeating-radial-gradient(ellipse at 55% 80%, transparent 0 34px, rgba(47,199,184,0.08) 37px 39px, transparent 43px 72px);
  animation: causticDrift 16s linear infinite;
}

.lantern {
  z-index: 30;
  background: radial-gradient(circle at var(--lantern-x) var(--lantern-y), rgba(232,216,184,0.18) 0 4rem, rgba(184,255,106,0.10) 4rem 11rem, rgba(7,10,6,0.72) 23rem, rgba(7,10,6,0.9) 100%);
  mix-blend-mode: screen;
  opacity: 0.75;
  transition: opacity 500ms ease;
}

.specimen-cover {
  position: fixed;
  z-index: 12;
  left: 50%;
  top: 50%;
  width: min(680px, calc(100vw - 42px));
  padding: 2.6rem 3rem 2.1rem;
  transform: translate(-50%, -50%) rotate(-1.8deg);
  color: var(--abyss-loam);
  background:
    linear-gradient(135deg, rgba(183,90,42,0.14), transparent 38%),
    repeating-linear-gradient(0deg, rgba(7,10,6,0.05) 0 1px, transparent 1px 9px),
    var(--cave-pearl);
  border: 2px solid rgba(183, 90, 42, 0.62);
  border-radius: 6px 20px 10px 18px;
  box-shadow: 0 1rem 4rem rgba(0,0,0,0.75), inset 0 0 0 1px rgba(7,10,6,0.18);
  transition: opacity 900ms ease, transform 900ms cubic-bezier(.2,.7,.1,1);
}

.specimen-cover h1 {
  margin: 0.2rem 0 0.6rem;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(2.7rem, 8vw, 6.4rem);
  line-height: 0.9;
  letter-spacing: -0.08em;
}

.field-code,
.coord {
  margin: 0;
  color: var(--iron-ochre);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  font-weight: 800;
}

.tagline { max-width: 37rem; font-size: 1.08rem; line-height: 1.6; }
.cover-warning,
.margin-note,
.chalk-glyph {
  font-family: "Gochi Hand", "Comic Sans MS", cursive;
  color: var(--iron-ochre);
  font-size: 1.25rem;
}

.pin {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--cave-pearl), var(--iron-ochre) 58%, #4c2414);
  box-shadow: 0 4px 7px rgba(0,0,0,0.35);
}
.pin-a { left: 22px; top: 18px; }
.pin-b { right: 32px; top: 24px; }

.atlas {
  position: relative;
  z-index: 4;
  display: flex;
  width: 500vw;
  min-height: 100vh;
}

.chamber {
  position: relative;
  width: 100vw;
  min-height: 100vh;
  flex: 0 0 100vw;
  overflow: hidden;
  padding: clamp(4rem, 8vw, 7rem);
  background:
    radial-gradient(circle at 25% 22%, rgba(184,255,106,0.07), transparent 19rem),
    radial-gradient(circle at 82% 62%, rgba(183,90,42,0.10), transparent 22rem),
    repeating-linear-gradient(113deg, rgba(232,216,184,0.035) 0 1px, transparent 1px 44px);
}

.chamber::before,
.chamber::after {
  content: "";
  position: absolute;
  inset: auto -6vw -18vh -5vw;
  height: 36vh;
  background: var(--wet-basalt);
  border-radius: 52% 48% 0 0 / 42% 58% 0 0;
  box-shadow: inset 0 2rem 4rem rgba(0,0,0,0.48);
}

.chamber::after {
  inset: -14vh -10vw auto -10vw;
  height: 28vh;
  transform: rotate(2deg);
  opacity: 0.88;
}

.field-note {
  position: absolute;
  z-index: 6;
  max-width: min(470px, 84vw);
  padding: 1.25rem 1.35rem 1.4rem;
  background: rgba(232,216,184,0.93);
  color: var(--abyss-loam);
  border: 1px solid rgba(183,90,42,0.72);
  border-radius: 8px 18px 11px 16px;
  box-shadow: 0 1.2rem 3rem rgba(0,0,0,0.55);
  transform: rotate(-1.2deg) translateY(2rem);
  opacity: 0;
  transition: transform 900ms cubic-bezier(.2,.8,.14,1), opacity 900ms ease;
}

.field-note.visible { opacity: 1; transform: rotate(var(--rot, -1.2deg)) translateY(0); }
.field-note::before { content: ""; position: absolute; left: 50%; top: -10px; width: 16px; height: 16px; border-radius: 50%; background: var(--iron-ochre); box-shadow: 0 0 0 3px rgba(7,10,6,0.18); }
.field-note h2 { margin: 0.25rem 0 0.6rem; font-family: "Fraunces", Georgia, serif; font-size: clamp(2.25rem, 5vw, 5rem); letter-spacing: -0.06em; line-height: 0.92; }
.field-note p { margin: 0; line-height: 1.55; font-size: 1rem; }
.note-large { left: 9vw; top: 18vh; --rot: -2deg; }
.note-right { right: 9vw; top: 14vh; --rot: 1.4deg; }
.note-left-low { left: 8vw; bottom: 14vh; --rot: -0.8deg; }
.note-river { right: 12vw; top: 20vh; --rot: 2deg; }
.note-final { left: 11vw; top: 13vh; --rot: -1.6deg; }

.core-sample {
  position: absolute;
  z-index: 3;
  left: 58vw;
  top: 5vh;
  width: 18vw;
  min-width: 180px;
  height: 90vh;
  border-radius: 46% 54% 42% 58% / 4% 5% 7% 8%;
  background:
    linear-gradient(90deg, transparent 48%, rgba(184,255,106,0.48) 49% 51%, transparent 52%),
    repeating-linear-gradient(177deg, rgba(183,90,42,0.34) 0 5px, rgba(27,36,32,0.95) 7px 31px, rgba(232,216,184,0.10) 32px 34px),
    var(--wet-basalt);
  box-shadow: inset 0 0 2rem rgba(0,0,0,0.7), 0 0 5rem rgba(184,255,106,0.12);
}
.root, .mycelium, .river-thread { position: absolute; display: block; border-radius: 999px; }
.root { top: 0; width: 3px; height: 38%; background: var(--cave-pearl); opacity: 0.58; transform-origin: top; }
.r1 { left: 24%; transform: rotate(8deg); } .r2 { left: 43%; transform: rotate(-11deg); height: 50%; } .r3 { left: 68%; transform: rotate(4deg); height: 43%; }
.mycelium { width: 42%; height: 2px; background: var(--spore-lantern); box-shadow: 0 0 14px var(--spore-lantern); animation: pulseGlow 3.8s ease-in-out infinite; }
.m1 { left: 18%; top: 43%; transform: rotate(18deg); } .m2 { right: 16%; top: 55%; transform: rotate(-24deg); }
.river-thread { left: 38%; bottom: 8%; width: 10px; height: 27%; background: linear-gradient(var(--blind-river-blue), transparent); box-shadow: 0 0 22px var(--blind-river-blue); animation: riverPulse 2.6s ease-in-out infinite; }

.sample-honeycomb {
  position: absolute;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(2, 120px);
  gap: 0.85rem;
  transform: rotate(var(--hrot, 3deg));
}
.honey-a { right: 9vw; bottom: 14vh; --hrot: 4deg; }
.honey-b { left: 10vw; bottom: 11vh; --hrot: -5deg; }
.honey-c { right: 11vw; top: 14vh; --hrot: 6deg; }
.honey-d { left: 13vw; top: 16vh; --hrot: -3deg; }
.honey-e { right: 10vw; bottom: 13vh; --hrot: 2deg; }
.cell {
  width: 120px;
  min-height: 104px;
  padding: 1.05rem 0.75rem;
  color: var(--cave-pearl);
  background: rgba(27,36,32,0.88);
  clip-path: polygon(25% 4%, 76% 0, 100% 50%, 75% 96%, 24% 100%, 0 50%);
  filter: drop-shadow(0 0.7rem 1rem rgba(0,0,0,0.48));
  transform: rotate(var(--cellrot, -2deg));
  transition: transform 400ms ease, filter 400ms ease;
}
.cell:hover { transform: rotate(1deg) scale(1.08); filter: drop-shadow(0 0 1.2rem rgba(184,255,106,0.36)); }
.cell b { display: block; font-family: "Fraunces", Georgia, serif; font-size: 1rem; color: var(--spore-lantern); }
.cell span { display: block; margin-top: 0.25rem; font-size: 0.77rem; line-height: 1.25; }
.cell.glow { border: 1px solid var(--spore-lantern); }
.cell.ochre { border: 1px solid var(--iron-ochre); }
.cell.blue { border: 1px solid var(--blind-river-blue); }
.cell.violet { border: 1px solid var(--mineral-violet); }
.cell.pearl { border: 1px solid var(--cave-pearl); }
.cell.cracked { background: linear-gradient(135deg, rgba(232,216,184,0.12), rgba(27,36,32,0.92)); }

.margin-note { position: absolute; z-index: 7; max-width: 15rem; transform: rotate(-8deg); left: 39vw; bottom: 12vh; color: var(--spore-lantern); text-shadow: 0 0 12px rgba(184,255,106,0.5); }
.note-fungal { left: auto; right: 31vw; bottom: 9vh; color: var(--cave-pearl); }
.chalk-glyph { position: absolute; left: 43vw; top: 45vh; color: rgba(232,216,184,0.68); transform: rotate(9deg); }

.survey-cord {
  position: fixed;
  z-index: 40;
  left: 7vw;
  right: 7vw;
  bottom: 1.45rem;
  height: 42px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.survey-cord::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 4px; background: linear-gradient(90deg, var(--iron-ochre), var(--cave-pearl), var(--iron-ochre)); border-radius: 999px; transform: skewY(-1.5deg); box-shadow: 0 0 18px rgba(183,90,42,0.36); }
.survey-cord a { position: relative; width: 32px; height: 32px; border-radius: 50%; background: var(--iron-ochre); border: 3px solid #5a2a17; box-shadow: 0 0 0 4px rgba(232,216,184,0.12); }
.survey-cord a.active { background: var(--spore-lantern); box-shadow: 0 0 22px rgba(184,255,106,0.72); }
.survey-cord a::after { content: attr(data-chamber); position: absolute; left: 50%; bottom: 120%; transform: translateX(-50%) rotate(-3deg); white-space: nowrap; padding: 0.25rem 0.45rem; color: var(--abyss-loam); background: var(--cave-pearl); border-radius: 4px; font-size: 0.7rem; opacity: 0; transition: opacity 250ms ease; }
.survey-cord a:hover::after, .survey-cord a.active::after { opacity: 1; }

.stalactites { position: absolute; inset: 0; z-index: 3; background: linear-gradient(172deg, var(--wet-basalt) 0 14%, transparent 14% 100%); clip-path: polygon(0 0,100% 0,100% 12%,88% 9%,82% 31%,76% 11%,66% 15%,61% 42%,55% 13%,47% 17%,42% 28%,35% 12%,27% 38%,21% 10%,13% 17%,7% 32%,0 13%); }
.root-curtain { position: absolute; left: 12vw; top: 0; width: 42vw; height: 76vh; z-index: 4; }
.root-curtain i { position: relative; display: inline-block; width: 2px; height: var(--h, 62vh); margin: 0 4.2%; background: linear-gradient(var(--cave-pearl), rgba(232,216,184,0)); border-radius: 999px; transform: rotate(var(--rr, 4deg)); opacity: 0.58; animation: rootSway 7s ease-in-out infinite alternate; }
.root-curtain i:nth-child(2n) { --h: 50vh; --rr: -6deg; animation-delay: -2s; }
.root-curtain i:nth-child(3n) { --h: 70vh; --rr: 9deg; }

.fungi-field { position: absolute; z-index: 4; inset: 13vh 8vw 0 35vw; }
.cap { position: absolute; display: block; bottom: var(--bottom, 12vh); left: var(--left, 10%); width: var(--w, 130px); height: calc(var(--w, 130px) * 0.55); border-radius: 60% 60% 18% 18%; background: radial-gradient(circle at 45% 15%, var(--spore-lantern), #618f39 36%, var(--wet-basalt) 76%); box-shadow: 0 0 35px rgba(184,255,106,0.42); }
.cap::after { content: ""; position: absolute; left: 45%; top: 70%; width: 12%; height: 95%; background: linear-gradient(var(--cave-pearl), rgba(232,216,184,0.22)); border-radius: 999px; }
.cap-b { --left: 35%; --bottom: 20vh; --w: 96px; filter: hue-rotate(80deg); }
.cap-c { --left: 62%; --bottom: 9vh; --w: 160px; filter: hue-rotate(140deg); }
.cap-d { --left: 78%; --bottom: 27vh; --w: 74px; }
.spore-cloud { position: absolute; inset: 0; z-index: 5; background-image: radial-gradient(circle, rgba(184,255,106,0.78) 0 2px, transparent 3px), radial-gradient(circle, rgba(109,91,208,0.65) 0 1px, transparent 2px); background-size: 97px 83px, 131px 107px; animation: spores 18s linear infinite; }

.river { position: absolute; z-index: 3; left: -10vw; right: -10vw; bottom: 8vh; height: 34vh; background: linear-gradient(180deg, transparent, rgba(47,199,184,0.10) 22%, rgba(47,199,184,0.45), rgba(7,10,6,0.8)), repeating-radial-gradient(ellipse at 50% 30%, rgba(232,216,184,0.2) 0 2px, transparent 3px 44px); clip-path: polygon(0 50%, 9% 38%, 20% 60%, 31% 43%, 44% 54%, 57% 34%, 70% 48%, 83% 30%, 100% 46%, 100% 100%, 0 100%); box-shadow: 0 0 48px rgba(47,199,184,0.36); animation: waterShimmer 5s ease-in-out infinite; }
.creatures i { position: absolute; z-index: 5; display: block; background: rgba(47,199,184,0.74); box-shadow: 0 0 16px var(--blind-river-blue); }
.fish { width: 70px; height: 22px; right: 32vw; bottom: 22vh; border-radius: 50%; clip-path: polygon(0 50%, 20% 8%, 80% 12%, 100% 50%, 80% 88%, 20% 92%); animation: swim 9s ease-in-out infinite; }
.shrimp { width: 36px; height: 14px; border-radius: 60% 40% 60% 40%; bottom: 17vh; left: 27vw; animation: swim 7s ease-in-out infinite reverse; }
.s2 { left: 55vw; bottom: 27vh; animation-duration: 11s; }

.mineral-sky { position: absolute; inset: 0; z-index: 3; background-image: radial-gradient(circle at 18% 30%, var(--mineral-violet) 0 2px, transparent 3px), radial-gradient(circle at 62% 24%, var(--spore-lantern) 0 2px, transparent 4px), radial-gradient(circle at 78% 58%, var(--blind-river-blue) 0 1px, transparent 3px), linear-gradient(132deg, transparent 43%, rgba(109,91,208,0.35) 44%, transparent 46%); background-size: 180px 130px, 240px 170px, 210px 190px, 100% 100%; animation: crystalBlink 4s steps(2,end) infinite; }
.closing-label { position: absolute; z-index: 6; left: 34vw; bottom: 19vh; padding: 0.65rem 0.9rem; color: var(--abyss-loam); background: var(--cave-pearl); border: 1px solid var(--iron-ochre); transform: rotate(3deg); font-family: "Gochi Hand", "Comic Sans MS", cursive; font-size: 1.28rem; }

@keyframes causticDrift { to { transform: translate3d(-4vw, 3vh, 0) rotate(2deg); } }
@keyframes pulseGlow { 50% { opacity: 0.4; box-shadow: 0 0 30px var(--spore-lantern); } }
@keyframes riverPulse { 50% { transform: translateX(9px); opacity: 0.62; } }
@keyframes rootSway { to { transform: rotate(calc(var(--rr, 4deg) * -1)); } }
@keyframes spores { to { background-position: 120px -220px, -150px -180px; } }
@keyframes waterShimmer { 50% { filter: brightness(1.25) saturate(1.2); transform: translateX(2vw); } }
@keyframes swim { 50% { transform: translateX(-16vw) translateY(3vh) rotate(-4deg); } }
@keyframes crystalBlink { 50% { opacity: 0.65; } }

@media (max-width: 760px) {
  .atlas { display: block; width: 100%; }
  .chamber { width: 100%; min-height: 112vh; padding: 5rem 1.2rem; }
  .field-note { position: relative; left: auto; right: auto; top: auto; bottom: auto; margin: 10vh auto 0; }
  .sample-honeycomb { position: relative; left: auto; right: auto; top: auto; bottom: auto; margin: 3rem auto; grid-template-columns: repeat(2, 112px); width: 238px; }
  .cell { width: 112px; }
  .core-sample { left: 10vw; opacity: 0.55; }
  .survey-cord { left: 1rem; right: 1rem; }
  .survey-cord a::after { display: none; }
  .margin-note, .chalk-glyph, .closing-label { left: 1.2rem; right: auto; }
}
