:root {
  --abyss: #0B0F12;
  --slate: #1C252B;
  --mineral: #6F7D86;
  --paper: #D7DEE2;
  --ice: #9FB7C6;
  --lichen: #C7E6D2;
  --gold: #D8C678;
  --gothic: "Zen Kaku Gothic New", Inter, system-ui, sans-serif;
  --serif: "Noto Serif JP", Georgia, serif;
  --mincho: "Shippori Mincho", "Noto Serif JP", serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  color: var(--paper);
  background: var(--abyss);
  font-family: var(--gothic);
  overflow-x: hidden;
}

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

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  opacity: .18;
  mix-blend-mode: screen;
  background-image:
    radial-gradient(circle at 12% 18%, rgba(215,222,226,.35) 0 1px, transparent 1.6px),
    radial-gradient(circle at 74% 63%, rgba(199,230,210,.22) 0 1px, transparent 1.8px),
    linear-gradient(115deg, transparent 0 48%, rgba(215,222,226,.05) 49% 51%, transparent 52%);
  background-size: 53px 47px, 79px 71px, 170px 170px;
}

.fixed-map {
  position: fixed;
  top: 0;
  left: 58%;
  width: 120px;
  height: 100vh;
  z-index: 15;
  pointer-events: none;
}

.depth-line {
  position: absolute;
  top: 0;
  left: 42px;
  width: 1px;
  height: 100%;
  background: linear-gradient(var(--paper), var(--mineral), var(--gold));
  opacity: .55;
}

.line-glow {
  display: block;
  width: 7px;
  height: 7px;
  margin-left: -3px;
  border-radius: 50%;
  background: var(--lichen);
  box-shadow: 0 0 18px var(--lichen);
  transform: translateY(var(--line-y, 10vh));
}

.depth-readout {
  position: absolute;
  top: 18px;
  left: 58px;
  color: var(--ice);
  font-size: 11px;
  letter-spacing: .24em;
  writing-mode: vertical-rl;
}

.core-silhouette {
  position: absolute;
  bottom: 9vh;
  left: 34px;
  width: 17px;
  height: 142px;
  border: 1px solid rgba(215,222,226,.22);
  background: linear-gradient(to bottom, rgba(199,230,210,.2), rgba(111,125,134,.18), rgba(216,198,120,.18));
  clip-path: polygon(18% 0, 100% 5%, 82% 100%, 0 94%);
}

.depth-index {
  position: fixed;
  z-index: 20;
  right: 32px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  gap: 15px;
  color: rgba(215,222,226,.54);
  font: 500 11px/1 var(--gothic);
  letter-spacing: .16em;
  text-transform: uppercase;
}

.depth-index a {
  position: relative;
  padding-right: 28px;
  transition: color .45s ease, transform .45s ease;
}

.depth-index a::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 0;
  width: 16px;
  height: 1px;
  background: currentColor;
}

.depth-index a.active { color: var(--gold); transform: translateX(-5px); }

.chapter {
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  display: grid;
  align-items: center;
  padding: 11vh 9vw;
  isolation: isolate;
  background:
    linear-gradient(90deg, rgba(215,222,226,.035) 0 1px, transparent 1px),
    radial-gradient(circle at 15% 20%, rgba(159,183,198,.10), transparent 28%),
    linear-gradient(180deg, var(--abyss), var(--slate));
  background-size: 84px 100%, auto, auto;
}

.chapter::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(174deg, transparent 0 18%, rgba(111,125,134,.16) 18.4% 19.2%, transparent 19.6% 100%),
    linear-gradient(3deg, transparent 0 70%, rgba(215,222,226,.05) 70.3% 70.8%, transparent 71.1%);
}

.parallax { will-change: transform; }

.measurement-column {
  position: absolute;
  left: calc(58% - 52px);
  top: 13vh;
  height: 74vh;
  width: 80px;
  border-left: 1px solid rgba(215,222,226,.18);
}

.tick {
  position: absolute;
  left: -1px;
  width: 42px;
  height: 1px;
  background: rgba(215,222,226,.45);
}

.tick-a { top: 11%; } .tick-b { top: 42%; width: 24px; } .tick-c { top: 79%; }

.title-block {
  width: min(720px, 74vw);
  transform: translateY(34px);
  opacity: 0;
}

.chapter-number {
  margin: 0 0 22px;
  color: var(--gold);
  font: 500 clamp(36px, 7vw, 92px)/.8 var(--mincho);
  letter-spacing: .18em;
  opacity: .8;
}

h1, h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: .03em;
}

h1 { font-size: clamp(46px, 9vw, 126px); line-height: .95; }
h2 { font-size: clamp(34px, 5.6vw, 76px); line-height: 1.03; }

.accession-label, .paper-note, .stamp-mark, .masked-window p, .specimen-envelope p, .final-label span {
  font-family: var(--mincho);
  letter-spacing: .08em;
}

.accession-label {
  display: inline-block;
  margin-top: 28px;
  padding: 12px 18px;
  color: var(--abyss);
  background: linear-gradient(120deg, var(--paper), #eef2f0 58%, var(--ice));
  clip-path: polygon(2% 7%, 96% 0, 100% 88%, 6% 100%);
  box-shadow: 18px 20px 60px rgba(0,0,0,.42);
}

.plane-surface {
  position: absolute;
  inset: -18vh -10vw auto;
  height: 38vh;
  background:
    radial-gradient(ellipse at 20% 100%, rgba(199,230,210,.22), transparent 48%),
    linear-gradient(180deg, rgba(199,230,210,.18), rgba(11,15,18,.05));
  clip-path: polygon(0 0, 100% 0, 100% 68%, 72% 77%, 43% 62%, 0 78%);
}

.moss-collage { position: absolute; inset: 7vh auto auto 8vw; width: 310px; height: 190px; opacity: .5; }
.moss-collage span { position: absolute; background: rgba(199,230,210,.16); border: 1px solid rgba(199,230,210,.18); clip-path: polygon(10% 0, 100% 18%, 87% 91%, 0 100%); }
.moss-collage span:nth-child(1) { width: 130px; height: 82px; left: 20px; top: 18px; }
.moss-collage span:nth-child(2) { width: 170px; height: 58px; left: 108px; top: 78px; transform: rotate(-8deg); }
.moss-collage span:nth-child(3) { width: 70px; height: 130px; left: 214px; top: 12px; transform: rotate(11deg); }

.paper-note {
  position: absolute;
  right: 12vw;
  bottom: 14vh;
  color: rgba(215,222,226,.78);
  border-top: 1px solid rgba(215,222,226,.25);
  padding-top: 13px;
  font-size: 13px;
}

.specimen-card {
  width: min(560px, 72vw);
  margin-left: 9vw;
  padding: 30px 0 30px 34px;
  border-left: 1px solid rgba(215,222,226,.28);
  transform: translateY(44px);
  opacity: 0;
}

.specimen-card p:not(.chapter-number) {
  color: rgba(215,222,226,.76);
  font-size: clamp(16px, 1.4vw, 20px);
  line-height: 1.8;
}

.stamp-mark {
  display: inline-block;
  margin-top: 18px;
  padding: 8px 13px;
  border: 1px solid rgba(216,198,120,.42);
  color: var(--gold);
  font-size: 12px;
}

.root-zone { background: linear-gradient(180deg, #10161a, var(--slate) 55%, #12191d); }
.root-diagram {
  position: absolute;
  inset: -10vh auto auto 48vw;
  width: 42vw;
  height: 118vh;
  opacity: .46;
  background:
    repeating-radial-gradient(ellipse at 40% 0%, transparent 0 20px, rgba(199,230,210,.28) 21px 22px, transparent 23px 42px),
    linear-gradient(95deg, transparent 49%, rgba(199,230,210,.34) 50%, transparent 51%);
  clip-path: polygon(30% 0, 76% 0, 100% 100%, 7% 100%);
}
.root-paper {
  position: absolute;
  right: 12vw;
  top: 18vh;
  width: 230px;
  height: 280px;
  background: rgba(215,222,226,.08);
  border: 1px solid rgba(215,222,226,.14);
  clip-path: polygon(5% 4%, 100% 0, 92% 100%, 0 91%);
}
.aperture-one { position: absolute; right: 18vw; bottom: 15vh; width: 190px; height: 190px; border: 1px solid rgba(159,183,198,.42); overflow: hidden; }
.mycelium { height: 100%; background: repeating-linear-gradient(35deg, transparent 0 12px, rgba(199,230,210,.28) 13px 14px), radial-gradient(circle, rgba(199,230,210,.2), transparent 60%); }

.mineral-vein { background: linear-gradient(180deg, #12191d, #182228 43%, #101417); }
.sediment { position: absolute; left: -5vw; width: 110vw; height: 22vh; opacity: .48; mix-blend-mode: screen; }
.sediment-a { top: 16vh; background: linear-gradient(178deg, transparent 25%, rgba(111,125,134,.55) 26% 34%, transparent 35%); }
.sediment-b { bottom: 22vh; background: linear-gradient(2deg, transparent 10%, rgba(159,183,198,.32) 11% 20%, transparent 21%); }
.mineral-card { margin-left: 22vw; }
.masked-window {
  position: absolute;
  left: 8vw;
  bottom: 13vh;
  width: 260px;
  height: 330px;
  padding: 18px;
  background: rgba(215,222,226,.08);
  border: 1px solid rgba(215,222,226,.14);
  clip-path: polygon(0 8%, 91% 0, 100% 92%, 9% 100%);
}
.rubbing { height: 235px; background: repeating-linear-gradient(14deg, rgba(111,125,134,.18) 0 5px, rgba(215,222,226,.18) 6px 7px), radial-gradient(circle at 70% 30%, rgba(216,198,120,.25), transparent 30%); }
.masked-window p { color: rgba(215,222,226,.7); font-size: 12px; }

.biota { background: radial-gradient(circle at 76% 45%, rgba(199,230,210,.12), transparent 24%), linear-gradient(180deg, #0f1518, #182229 52%, #0b0f12); }
.cave-cross { position: absolute; right: 7vw; top: 12vh; width: 38vw; height: 64vh; border: 1px solid rgba(215,222,226,.12); background: linear-gradient(150deg, transparent 32%, rgba(215,222,226,.12) 33% 36%, transparent 37%), radial-gradient(ellipse at center, rgba(111,125,134,.24), transparent 62%); clip-path: polygon(8% 12%, 82% 0, 100% 70%, 42% 100%, 0 72%); }
.fern-shadow { position: absolute; left: 7vw; top: 7vh; width: 240px; height: 560px; opacity: .24; background: repeating-linear-gradient(102deg, transparent 0 18px, rgba(199,230,210,.36) 19px 21px, transparent 22px 34px); clip-path: polygon(48% 0, 62% 100%, 41% 100%, 38% 0); }
.specimen-envelope { position: absolute; right: 15vw; bottom: 13vh; width: 300px; height: 205px; padding: 24px; background: rgba(215,222,226,.12); border: 1px solid rgba(215,222,226,.18); clip-path: polygon(0 0, 100% 8%, 94% 100%, 5% 91%); }
.specimen-envelope i { display: inline-block; width: 42px; height: 90px; margin-right: 11px; background: linear-gradient(90deg, transparent, rgba(159,183,198,.35), transparent); border-radius: 50%; transform: rotate(18deg); }
.specimen-envelope p { color: rgba(215,222,226,.74); font-size: 13px; }

.still-water { background: linear-gradient(180deg, #0b0f12 0%, #111a20 58%, #071014 100%); }
.water-plane { position: absolute; left: 0; right: 0; bottom: 0; height: 38vh; background: radial-gradient(ellipse at 50% 0, rgba(159,183,198,.30), transparent 48%), linear-gradient(180deg, transparent, rgba(159,183,198,.12)); }
.drip-lines { position: absolute; inset: 0; }
.drip-lines span { position: absolute; top: 0; width: 1px; height: 45vh; background: linear-gradient(var(--ice), transparent); opacity: .42; }
.drip-lines span:nth-child(1) { left: 18%; } .drip-lines span:nth-child(2) { left: 36%; height: 30vh; } .drip-lines span:nth-child(3) { left: 71%; height: 52vh; } .drip-lines span:nth-child(4) { left: 83%; height: 26vh; }
.water-card { margin-left: 15vw; }
.water-trace { position: absolute; right: 23vw; top: 9vh; height: 76vh; width: 250px; fill: none; stroke: var(--gold); stroke-width: 1.4; opacity: .82; filter: drop-shadow(0 0 8px rgba(216,198,120,.25)); }

.living-dot { position: absolute; width: 9px; height: 9px; border-radius: 50%; background: var(--lichen); box-shadow: 0 0 20px rgba(199,230,210,.8); opacity: .95; }
.spore-dot { right: 28vw; bottom: 32vh; }
.insect-dot { left: 28vw; top: 38vh; width: 12px; height: 7px; border-radius: 60% 40% 50% 50%; background: var(--gold); }
.droplet-dot { right: 32vw; top: 39vh; background: var(--ice); }
.living-dot.bounced { animation: organicBounce .9s cubic-bezier(.2, .9, .25, 1.15) both; }

.specimen-table { background: linear-gradient(180deg, #11181c, #0b0f12); justify-items: center; grid-template-columns: 1fr 1fr; gap: 8vw; }
.table-surface { position: absolute; inset: 16vh 8vw; border: 1px solid rgba(215,222,226,.14); background: linear-gradient(115deg, rgba(215,222,226,.04), transparent 45%), repeating-linear-gradient(90deg, transparent 0 70px, rgba(215,222,226,.035) 71px); }
.aligned-core { position: relative; z-index: 1; width: 92px; height: 70vh; border: 1px solid rgba(215,222,226,.32); opacity: 0; transform: translateY(38px); }
.core-layer { width: 100%; }
.l1 { height: 16%; background: rgba(199,230,210,.24); } .l2 { height: 20%; background: rgba(111,125,134,.42); } .l3 { height: 24%; background: rgba(159,183,198,.22); } .l4 { height: 18%; background: rgba(28,37,43,.88); border-top: 1px solid rgba(216,198,120,.45); } .l5 { height: 22%; background: rgba(159,183,198,.16); }
.final-label { position: relative; z-index: 1; width: min(480px, 80vw); padding: 28px; background: rgba(215,222,226,.92); color: var(--abyss); clip-path: polygon(3% 0, 100% 4%, 94% 100%, 0 91%); opacity: 0; transform: translateY(38px); }
.final-label h2 { font-size: clamp(32px, 5vw, 64px); }
.final-label p:not(.chapter-number) { line-height: 1.7; color: var(--slate); }
.final-label .chapter-number { color: var(--mineral); }
.final-label span { font-size: 12px; color: var(--mineral); }

.kinetic.in-view { animation: settleText 1.05s cubic-bezier(.2, .8, .16, 1) forwards; }

@keyframes settleText {
  0% { opacity: 0; transform: translateY(46px); letter-spacing: .18em; filter: blur(4px); }
  62% { opacity: 1; transform: translateY(-4px); letter-spacing: .055em; filter: blur(0); }
  100% { opacity: 1; transform: translateY(0); letter-spacing: .03em; filter: blur(0); }
}

@keyframes organicBounce {
  0% { transform: translateY(-32px) scale(.72); opacity: 0; }
  58% { transform: translateY(4px) scale(1.08); opacity: 1; }
  78% { transform: translateY(-7px) scale(.96); }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

@media (max-width: 820px) {
  .depth-index { display: none; }
  .fixed-map { left: auto; right: 18px; width: 70px; }
  .chapter { padding: 10vh 7vw; }
  .specimen-card, .mineral-card, .water-card { margin-left: 0; width: min(620px, 84vw); }
  .root-diagram, .cave-cross { width: 70vw; right: -12vw; left: auto; }
  .masked-window, .specimen-envelope, .paper-note { opacity: .65; transform: scale(.82); transform-origin: right bottom; }
  .specimen-table { grid-template-columns: 1fr; }
  .aligned-core { height: 46vh; }
}
