:root {
  --peat: #221A14;
  --loam: #5B3A29;
  --moss: #556B3E;
  --clay: #B8793D;
  --sand: #E4D2B0;
  --sage: #A9B7A0;
  --teal: #2F6F68;
  --serif: "Cormorant Garamond", Georgia, serif;
  --book: "EB Garamond", Georgia, serif;
  --pixel: "Press Start 2P", monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--peat);
  color: var(--sand);
  font-family: var(--book);
  overflow-x: hidden;
}

body::selection { background: var(--clay); color: var(--peat); }

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -3;
  overflow: hidden;
  background:
    radial-gradient(circle at 16% 18%, rgba(169, 183, 160, .18), transparent 28%),
    radial-gradient(circle at 80% 11%, rgba(184, 121, 61, .13), transparent 30%),
    radial-gradient(circle at 72% 74%, rgba(47, 111, 104, .20), transparent 34%),
    linear-gradient(180deg, #221A14 0%, #2b2018 48%, #1b1410 100%);
}

.bokeh {
  position: absolute;
  border-radius: 999px;
  filter: blur(34px);
  opacity: .36;
  animation: bokehDrift 28s ease-in-out infinite alternate;
}

.bokeh-one { width: 34vw; height: 34vw; left: -8vw; top: 8vh; background: var(--sage); }
.bokeh-two { width: 26vw; height: 26vw; right: 4vw; top: 36vh; background: var(--teal); animation-duration: 34s; }
.bokeh-three { width: 22vw; height: 22vw; left: 48vw; bottom: -7vw; background: var(--clay); animation-duration: 39s; }

.dither {
  position: absolute;
  inset: 0;
  opacity: .22;
  background-image:
    linear-gradient(rgba(228, 210, 176, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(228, 210, 176, .04) 1px, transparent 1px),
    radial-gradient(circle, rgba(228,210,176,.16) 1px, transparent 1.4px);
  background-size: 22px 22px, 22px 22px, 6px 6px;
  image-rendering: pixelated;
}

.mote-field {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.mote {
  position: absolute;
  width: var(--size);
  height: var(--size);
  background: var(--color);
  opacity: .78;
  image-rendering: pixelated;
  box-shadow: 0 0 16px rgba(184, 121, 61, .22);
}

.cursor-ring {
  position: fixed;
  width: 112px;
  height: 112px;
  margin: -56px 0 0 -56px;
  border: 1px solid rgba(184, 121, 61, .25);
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  transform: scale(.74);
  transition: opacity .45s ease, transform .45s ease;
  box-shadow: inset 0 0 26px rgba(169, 183, 160, .08), 0 0 40px rgba(184, 121, 61, .10);
  z-index: 5;
}

.cursor-ring.active { opacity: 1; transform: scale(1); }

main { position: relative; }

.scene {
  position: relative;
  min-height: 100vh;
  padding: 8vw;
}

.opening-habitat {
  display: grid;
  place-items: center;
  overflow: hidden;
}

.archive-slip,
.label-strip,
.scene-label {
  font-family: var(--pixel);
  font-size: clamp(8px, .72vw, 11px);
  line-height: 1.8;
  letter-spacing: .02em;
  color: var(--peat);
  background: rgba(228, 210, 176, .86);
  border: 1px solid rgba(91, 58, 41, .55);
  box-shadow: 0 5px 0 rgba(34, 26, 20, .18);
}

.archive-slip {
  position: absolute;
  top: 7vh;
  left: 7vw;
  padding: 12px 16px;
  transform: rotate(-1.5deg);
}

.hero-copy {
  text-align: center;
  max-width: 860px;
  transform: translateY(-5vh);
}

.scene-label {
  display: inline-block;
  padding: 10px 12px;
  margin: 0 0 22px;
  color: var(--loam);
}

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: .95;
  margin: 0;
  letter-spacing: -.035em;
}

h1 {
  font-size: clamp(70px, 16vw, 210px);
  color: var(--sand);
  text-shadow: 0 18px 60px rgba(0,0,0,.38);
}

.thesis {
  font-family: var(--serif);
  font-size: clamp(25px, 4vw, 62px);
  margin: 14px 0 0;
  color: rgba(228, 210, 176, .82);
}

.hero-wave {
  position: absolute;
  inset: 28% 8% auto;
  height: 180px;
  opacity: .38;
}

.hero-wave span {
  position: absolute;
  width: 8px;
  height: 8px;
  background: var(--clay);
  image-rendering: pixelated;
  animation: waveDot 10s ease-in-out infinite;
}
.hero-wave span:nth-child(1) { left: 18%; top: 44%; animation-delay: 0s; }
.hero-wave span:nth-child(2) { left: 28%; top: 36%; animation-delay: -1.2s; background: var(--sage); }
.hero-wave span:nth-child(3) { left: 40%; top: 58%; animation-delay: -2s; }
.hero-wave span:nth-child(4) { left: 56%; top: 32%; animation-delay: -3.1s; background: var(--teal); }
.hero-wave span:nth-child(5) { left: 67%; top: 53%; animation-delay: -4.3s; }
.hero-wave span:nth-child(6) { left: 78%; top: 42%; animation-delay: -5s; background: var(--sage); }

.pixel-horizon {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 28vh;
  height: 20vh;
  opacity: .82;
  background: linear-gradient(to top, rgba(85, 107, 62, .12), transparent);
}

.pixel-horizon i {
  position: absolute;
  bottom: 0;
  width: 3vw;
  min-width: 24px;
  background: var(--moss);
  box-shadow: 0 -12px 0 rgba(169, 183, 160, .16), 22px -24px 0 rgba(184, 121, 61, .10);
  image-rendering: pixelated;
}
.pixel-horizon i:nth-child(1) { left: 2%; height: 12px; }
.pixel-horizon i:nth-child(2) { left: 11%; height: 28px; }
.pixel-horizon i:nth-child(3) { left: 19%; height: 16px; }
.pixel-horizon i:nth-child(4) { left: 27%; height: 42px; }
.pixel-horizon i:nth-child(5) { left: 38%; height: 20px; }
.pixel-horizon i:nth-child(6) { left: 47%; height: 33px; }
.pixel-horizon i:nth-child(7) { left: 55%; height: 14px; }
.pixel-horizon i:nth-child(8) { left: 63%; height: 39px; }
.pixel-horizon i:nth-child(9) { left: 72%; height: 22px; }
.pixel-horizon i:nth-child(10) { left: 80%; height: 50px; }
.pixel-horizon i:nth-child(11) { left: 88%; height: 18px; }
.pixel-horizon i:nth-child(12) { left: 95%; height: 30px; }

.field-journal { padding-top: 10vh; }

.section-note {
  max-width: 620px;
  margin: 0 0 56px 4vw;
}

.section-note h2 {
  font-size: clamp(48px, 8vw, 110px);
  color: var(--sand);
}

.section-note p:not(.scene-label), .specimen p, .final-line {
  font-size: clamp(19px, 1.8vw, 28px);
  line-height: 1.35;
  color: rgba(228, 210, 176, .82);
}

.river {
  position: absolute;
  left: 0;
  right: 0;
  width: 100%;
  height: 180px;
  pointer-events: none;
}
.river-back { top: 42vh; opacity: .55; }
.river path, .panel-svg path, .wave-drawer path, .final-pool path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.river path:first-child { stroke: rgba(169, 183, 160, .45); stroke-width: 3; }
.river .stepped { stroke: rgba(184, 121, 61, .25); stroke-width: 2; }

.masonry-wall {
  position: relative;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-auto-rows: 74px;
  gap: clamp(18px, 2.6vw, 38px);
  max-width: 1280px;
  margin: 0 auto;
  z-index: 1;
}

.specimen {
  position: relative;
  overflow: hidden;
  padding: clamp(20px, 2vw, 30px);
  border: 1px solid rgba(91, 58, 41, .82);
  background:
    linear-gradient(135deg, rgba(228, 210, 176, .15), rgba(34, 26, 20, .28)),
    rgba(34, 26, 20, .60);
  box-shadow: inset 0 0 0 1px rgba(228, 210, 176, .07), 0 28px 70px rgba(0,0,0,.18);
  transition: border-color .5s ease, background .5s ease;
  will-change: transform;
}

.specimen::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(228,210,176,.10) 1px, transparent 1px);
  background-size: 10px 10px;
  opacity: .25;
  pointer-events: none;
}

.specimen.near {
  border-color: rgba(184, 121, 61, .9);
  background:
    radial-gradient(circle at var(--local-x, 50%) var(--local-y, 50%), rgba(184, 121, 61, .12), transparent 34%),
    linear-gradient(135deg, rgba(228, 210, 176, .18), rgba(34, 26, 20, .30)),
    rgba(34, 26, 20, .64);
}

.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.row-2 { grid-row: span 2; }
.row-3 { grid-row: span 3; }
.row-4 { grid-row: span 4; }

.panel-wave { margin-top: 48px; }
.panel-soil { margin-top: -28px; }
.panel-wind { grid-column: 2 / span 4; }
.panel-map { grid-column: 6 / span 5; margin-top: -18px; }
.panel-note { grid-column: 10 / span 3; margin-top: 36px; background: rgba(228, 210, 176, .18); }

.label-strip {
  display: inline-block;
  padding: 8px 10px;
  margin-bottom: 18px;
}

.specimen h3 {
  font-size: clamp(32px, 3.6vw, 58px);
  color: var(--sand);
  margin-bottom: 16px;
}

.specimen p { margin: 18px 0 0; font-size: clamp(17px, 1.5vw, 23px); }

.cell-grid, .terrain-map, .wind-field {
  display: grid;
  image-rendering: pixelated;
}

.pond-grid {
  grid-template-columns: repeat(14, 1fr);
  gap: 4px;
}
.pond-grid span,
.terrain-map span,
.wind-field span {
  display: block;
  aspect-ratio: 1;
  background: var(--moss);
  opacity: .6;
  transition: background .8s ease, opacity .8s ease, transform .8s ease;
}

.pond-grid span.water { background: var(--teal); opacity: .58; }
.pond-grid span.sand { background: var(--sand); opacity: .46; }
.pond-grid span.clay { background: var(--clay); opacity: .68; }
.pond-grid span.active { opacity: .95; transform: scale(.82); }

.panel-svg { width: 100%; height: 150px; margin-top: 6px; }
.soft-wave { stroke: var(--sage); stroke-width: 4; opacity: .78; }
.pixel-wave { stroke: var(--clay); stroke-width: 3; opacity: .46; }

.soil-core {
  height: 310px;
  border: 1px solid rgba(228, 210, 176, .20);
  display: flex;
  flex-direction: column;
}
.soil-core span { flex: 1; image-rendering: pixelated; }
.soil-core span:nth-child(1) { background: repeating-linear-gradient(90deg, var(--moss) 0 12px, #465833 12px 24px); }
.soil-core span:nth-child(2) { background: repeating-linear-gradient(90deg, var(--sand) 0 18px, #c9b68f 18px 30px); }
.soil-core span:nth-child(3) { background: repeating-linear-gradient(90deg, var(--loam) 0 16px, #4b2f22 16px 28px); }
.soil-core span:nth-child(4) { background: repeating-linear-gradient(90deg, var(--teal) 0 10px, #285f59 10px 20px); }
.soil-core span:nth-child(5) { background: repeating-linear-gradient(90deg, var(--peat) 0 14px, #302219 14px 26px); }

.wind-field {
  grid-template-columns: repeat(12, 1fr);
  gap: 8px;
  min-height: 120px;
}
.wind-field span {
  height: 3px;
  aspect-ratio: auto;
  background: var(--sage);
  transform: rotate(var(--angle));
  transform-origin: left center;
}

.terrain-map {
  grid-template-columns: repeat(18, 1fr);
  gap: 3px;
}
.terrain-map span.moss { background: var(--moss); }
.terrain-map span.sand { background: var(--sand); opacity: .72; }
.terrain-map span.water { background: var(--teal); }
.terrain-map span.loam { background: var(--loam); }
.terrain-map span.clay { background: var(--clay); }

.large-note { font-family: var(--serif); font-size: clamp(26px, 3vw, 42px) !important; color: var(--sand) !important; }

.emergence {
  display: grid;
  align-content: center;
  gap: 58px;
}
.section-note.narrow { margin-left: auto; margin-right: 9vw; max-width: 700px; }
.basin-shelf {
  display: grid;
  grid-template-columns: minmax(260px, 420px) minmax(360px, 1fr);
  gap: clamp(22px, 4vw, 64px);
  align-items: stretch;
}
.magnetic-drawer { min-height: 440px; }
.wave-drawer { min-height: 360px; margin-top: 72px; }
.ring-lab {
  position: absolute;
  inset: 88px 32px 32px;
  display: grid;
  place-items: center;
}
.ring-lab span {
  position: absolute;
  border: 1px solid rgba(169, 183, 160, .28);
  border-radius: 50%;
  animation: ringBreathe 8s ease-in-out infinite alternate;
}
.ring-lab span:nth-child(1) { width: 70%; aspect-ratio: 1; }
.ring-lab span:nth-child(2) { width: 48%; aspect-ratio: 1; animation-delay: -2s; border-color: rgba(184,121,61,.30); }
.ring-lab span:nth-child(3) { width: 26%; aspect-ratio: 1; animation-delay: -4s; border-color: rgba(47,111,104,.46); }
.ring-lab b { width: 10px; height: 10px; background: var(--clay); image-rendering: pixelated; box-shadow: 32px -22px 0 var(--sage), -38px 28px 0 var(--moss), 18px 44px 0 var(--teal); }
.wave-drawer svg { position: absolute; inset: 35% 0 0; width: 100%; height: 52%; }
.wave-drawer path:first-child { stroke: var(--sage); stroke-width: 5; opacity: .72; }
.under-wave { stroke: var(--clay); stroke-width: 2; opacity: .42; }

.ending-basin {
  display: grid;
  place-items: center;
  text-align: center;
  overflow: hidden;
}
.final-pool {
  position: relative;
  width: min(76vw, 820px);
  height: 230px;
  border-bottom: 2px solid rgba(169, 183, 160, .34);
}
.pool-cells {
  position: absolute;
  inset: auto 7% 34px;
  height: 70px;
  background:
    linear-gradient(90deg, transparent 0 5%, rgba(47,111,104,.45) 5% 10%, transparent 10% 16%, rgba(85,107,62,.45) 16% 22%, transparent 22% 31%, rgba(184,121,61,.35) 31% 36%, transparent 36%),
    repeating-linear-gradient(90deg, rgba(169,183,160,.18) 0 10px, transparent 10px 22px);
  image-rendering: pixelated;
}
.final-pool svg { position: absolute; left: 0; right: 0; bottom: 54px; width: 100%; height: 120px; }
.final-pool path { stroke: rgba(169, 183, 160, .72); stroke-width: 3; }
.final-line {
  position: absolute;
  bottom: 15vh;
  max-width: 760px;
  font-family: var(--serif);
  font-size: clamp(34px, 5vw, 76px);
  color: var(--sand);
}

.reveal-ink {
  opacity: 0;
  clip-path: inset(0 0 100% 0);
  transform: translateY(22px);
  transition: opacity 1.2s ease, clip-path 1.4s ease, transform 1.2s ease;
}
.reveal-ink.visible {
  opacity: 1;
  clip-path: inset(0 0 0 0);
  transform: translateY(0);
}

@keyframes bokehDrift {
  from { transform: translate3d(0,0,0) scale(1); }
  to { transform: translate3d(4vw,-3vh,0) scale(1.08); }
}
@keyframes waveDot {
  0%, 100% { transform: translateY(0); opacity: .35; }
  50% { transform: translateY(38px); opacity: .9; }
}
@keyframes ringBreathe {
  from { transform: scale(.94); opacity: .38; }
  to { transform: scale(1.08); opacity: .72; }
}

@media (max-width: 900px) {
  .scene { padding: 26px; }
  .archive-slip { left: 24px; right: 24px; top: 26px; }
  .masonry-wall { grid-template-columns: repeat(6, 1fr); grid-auto-rows: 82px; }
  .span-3, .span-4, .span-5, .panel-wind, .panel-map, .panel-note { grid-column: span 6; margin-top: 0; }
  .basin-shelf { grid-template-columns: 1fr; }
  .wave-drawer { margin-top: 0; }
  .section-note, .section-note.narrow { margin-left: 0; margin-right: 0; }
}

@media (max-width: 560px) {
  h1 { font-size: 21vw; }
  .pond-grid { gap: 3px; }
  .masonry-wall { display: block; }
  .specimen { min-height: 300px; margin: 22px 0; }
  .panel-soil { min-height: 520px; }
  .final-line { bottom: 10vh; }
}
