:root {
  --archive-black: #130E0A;
  --walnut: #2B1A12;
  --oxblood: #5A1F1B;
  --parchment: #D8C09A;
  --brass: #B08A45;
  --sepia: #8A623B;
  --teal: #163C3B;
  --bubble: #DDF3E7;
  --moss: #6E8B4E;
  --display: "Cormorant Garamond", Georgia, serif;
  --folio: "Fraunces", Georgia, serif;
  --body: "Libre Franklin", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--archive-black);
  color: var(--parchment);
  font-family: var(--body);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background:
    radial-gradient(circle at 18% 12%, rgba(221, 243, 231, 0.11), transparent 18rem),
    radial-gradient(circle at 82% 8%, rgba(176, 138, 69, 0.16), transparent 22rem),
    radial-gradient(circle at 48% 84%, rgba(22, 60, 59, 0.45), transparent 30rem),
    repeating-linear-gradient(105deg, rgba(216, 192, 154, 0.035) 0 1px, transparent 1px 18px);
  mix-blend-mode: screen;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  opacity: 0.18;
  background-image:
    linear-gradient(30deg, transparent 45%, rgba(216, 192, 154, 0.12) 46%, transparent 47%),
    linear-gradient(150deg, transparent 45%, rgba(176, 138, 69, 0.1) 46%, transparent 47%);
  background-size: 48px 48px, 64px 64px;
}

.filter-source { position: absolute; width: 0; height: 0; }

.waterfield {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 3;
}

.bubble {
  position: absolute;
  bottom: -12vh;
  border: 1px solid rgba(221, 243, 231, 0.55);
  border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, rgba(221, 243, 231, 0.58), rgba(221, 243, 231, 0.08) 34%, transparent 68%);
  box-shadow: inset 0 0 18px rgba(221, 243, 231, 0.22), 0 0 22px rgba(221, 243, 231, 0.12);
  animation: rise var(--duration, 16s) linear infinite;
}

.bubble-one { width: 34px; height: 34px; left: 7%; --duration: 14s; animation-delay: -4s; }
.bubble-two { width: 72px; height: 72px; left: 24%; --duration: 22s; animation-delay: -12s; }
.bubble-three { width: 44px; height: 44px; left: 48%; --duration: 18s; animation-delay: -7s; }
.bubble-four { width: 110px; height: 110px; left: 67%; --duration: 26s; animation-delay: -16s; }
.bubble-five { width: 26px; height: 26px; left: 83%; --duration: 13s; animation-delay: -3s; }
.bubble-six { width: 58px; height: 58px; left: 91%; --duration: 20s; animation-delay: -10s; }

@keyframes rise {
  0% { transform: translate3d(0, 0, 0) scale(0.82); opacity: 0; }
  12% { opacity: 0.9; }
  50% { transform: translate3d(28px, -58vh, 0) scale(1.05); }
  100% { transform: translate3d(-18px, -116vh, 0) scale(1.24); opacity: 0; }
}

.section-panel {
  position: relative;
  z-index: 4;
  min-height: 100vh;
  padding: clamp(34px, 5vw, 78px);
  border-bottom: 1px solid rgba(176, 138, 69, 0.22);
}

.submerged-door {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  align-items: center;
  gap: clamp(28px, 5vw, 74px);
  background:
    radial-gradient(circle at 58% 44%, rgba(90, 31, 27, 0.55), transparent 32rem),
    radial-gradient(circle at 80% 80%, rgba(22, 60, 59, 0.48), transparent 28rem),
    linear-gradient(135deg, var(--archive-black), var(--walnut) 48%, #0c0907);
  overflow: hidden;
}

.brass-grid {
  position: absolute;
  inset: clamp(18px, 3vw, 46px);
  opacity: 0.56;
  background-image:
    linear-gradient(rgba(176, 138, 69, 0.38) 1px, transparent 1px),
    linear-gradient(90deg, rgba(176, 138, 69, 0.28) 1px, transparent 1px);
  background-size: 20% 18%, 20% 18%;
  border: 1px solid rgba(176, 138, 69, 0.42);
  transform: perspective(900px) rotateX(2deg) rotateY(-2deg);
  animation: drawGrid 1.4s cubic-bezier(.2,1.25,.24,1) both;
}

@keyframes drawGrid {
  from { clip-path: inset(48% 48% 48% 48%); opacity: 0; }
  to { clip-path: inset(0); opacity: 0.56; }
}

.hero-ledger { position: relative; max-width: 920px; }

.eyebrow,
.card-topline,
.scroll-seal,
.annotation-row span {
  font-family: var(--body);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--brass);
}

.watery-title {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(6rem, 18vw, 18rem);
  line-height: 0.75;
  letter-spacing: -0.075em;
  color: var(--bubble);
  filter: url(#liquid-displacement);
  text-shadow: 0 0 18px rgba(221, 243, 231, 0.18), 0 22px 60px rgba(0,0,0,0.72);
  animation: titleSurface 1.25s cubic-bezier(.15,1.35,.26,1) both;
}

@keyframes titleSurface {
  from { transform: translateY(36px) scaleY(0.9); opacity: 0; letter-spacing: -0.12em; }
  to { transform: translateY(0) scaleY(1); opacity: 1; letter-spacing: -0.075em; }
}

.hero-thesis,
.chapter-copy p,
.artifact-card p,
.ledger-strip p {
  color: rgba(216, 192, 154, 0.82);
  line-height: 1.65;
}

.hero-thesis {
  max-width: 680px;
  margin: 30px 0 0;
  font-size: clamp(1.05rem, 1.7vw, 1.4rem);
}

.artifact-card {
  position: relative;
  padding: 22px;
  min-height: 260px;
  border: 1px solid rgba(176, 138, 69, 0.55);
  background:
    linear-gradient(145deg, rgba(43, 26, 18, 0.92), rgba(19, 14, 10, 0.76)),
    radial-gradient(circle at 28% 16%, rgba(221, 243, 231, 0.12), transparent 8rem);
  box-shadow: 0 26px 70px rgba(0,0,0,0.44), inset 0 0 0 1px rgba(216, 192, 154, 0.08);
  transform-style: preserve-3d;
  transition: transform 560ms cubic-bezier(.18,1.55,.28,1), border-color 360ms ease, box-shadow 360ms ease;
  overflow: hidden;
}

.artifact-card::before,
.artifact-card::after {
  content: "";
  position: absolute;
  width: 32px;
  height: 32px;
  border-color: rgba(176, 138, 69, 0.65);
  pointer-events: none;
}

.artifact-card::before { top: 10px; left: 10px; border-top: 1px solid; border-left: 1px solid; }
.artifact-card::after { right: 10px; bottom: 10px; border-right: 1px solid; border-bottom: 1px solid; }

.artifact-card:hover,
.artifact-card.is-open {
  transform: translateY(-14px) scale(1.025) rotate(var(--r, -0.6deg));
  border-color: var(--bubble);
  box-shadow: 0 36px 100px rgba(0,0,0,0.58), 0 0 34px rgba(221, 243, 231, 0.12);
}

.card-pane {
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 16%, rgba(221, 243, 231, 0.12) 42%, transparent 52%);
  transform: translateX(-120%) skewX(-12deg);
  transition: transform 720ms cubic-bezier(.16,1.45,.28,1);
}

.artifact-card:hover .card-pane,
.artifact-card.is-open .card-pane { transform: translateX(120%) skewX(-12deg); }

.card-topline { display: flex; justify-content: space-between; gap: 12px; color: rgba(176, 138, 69, 0.9); }

.artifact-card h2,
.artifact-card h3 {
  position: relative;
  margin: 48px 0 14px;
  font-family: var(--folio);
  font-weight: 700;
  color: var(--parchment);
  line-height: 0.95;
}

.artifact-card h2 { font-size: clamp(2.3rem, 4vw, 4.2rem); }
.artifact-card h3 { font-size: clamp(1.55rem, 2.4vw, 2.45rem); }

.emblem {
  position: absolute;
  right: 20px;
  bottom: 18px;
  width: 72px;
  height: 72px;
  border: 1px solid rgba(221, 243, 231, 0.38);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--bubble);
  font-family: var(--display);
  font-size: 2.1rem;
  background: radial-gradient(circle, rgba(221, 243, 231, 0.13), transparent 68%);
  transition: transform 560ms cubic-bezier(.16,1.65,.28,1);
}

.artifact-card:hover .emblem,
.artifact-card.is-open .emblem { transform: translateY(-12px) scale(1.18); }

.marginal-note {
  position: relative;
  margin-top: 20px;
  max-height: 0;
  overflow: hidden;
  color: var(--bubble);
  font-family: var(--body);
  font-size: 0.82rem;
  line-height: 1.55;
  transition: max-height 540ms cubic-bezier(.18,1.4,.24,1), opacity 320ms ease;
  opacity: 0;
}

.artifact-card:hover .marginal-note,
.artifact-card.is-open .marginal-note { max-height: 110px; opacity: 1; }

.hero-drawer { align-self: end; transform: rotate(1.5deg); }
.scroll-seal { position: absolute; left: clamp(34px, 5vw, 78px); bottom: 30px; color: rgba(216, 192, 154, 0.68); }

.chamber {
  background:
    linear-gradient(180deg, rgba(19, 14, 10, 0.82), rgba(43, 26, 18, 0.95)),
    radial-gradient(circle at var(--mx, 50%) var(--my, 20%), rgba(221, 243, 231, 0.09), transparent 22rem);
}

.chapter-copy { max-width: 680px; margin-bottom: 44px; }
.right-copy { margin-left: auto; text-align: right; }
.centered-copy { margin-inline: auto; text-align: center; }

.chapter-copy h2,
.ledger-strip h2,
.final-seal span {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(4rem, 9vw, 9rem);
  line-height: 0.82;
  letter-spacing: -0.055em;
  color: var(--parchment);
}

.folio-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 18px;
  align-items: end;
}

.folio { min-height: 390px; }
.folio.tall { min-height: 520px; }
.folio:nth-child(2n) { margin-bottom: 54px; --r: 0.8deg; }
.folio:nth-child(3n) { --r: -1.1deg; }

.specimen-index { background-color: var(--walnut); }

.slide-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: clamp(18px, 3vw, 34px);
  padding: 3vw 0;
}

.slide { aspect-ratio: 1 / 1; min-height: 300px; }
.slide.offset { transform: translateY(54px); }
.slide.offset:hover,
.slide.offset.is-open { transform: translateY(34px) scale(1.025) rotate(0.9deg); }
.ring { color: var(--brass); }

.errata-springs {
  display: grid;
  place-items: center;
  background:
    linear-gradient(120deg, rgba(90, 31, 27, 0.52), rgba(19, 14, 10, 0.9)),
    repeating-linear-gradient(-12deg, transparent 0 38px, rgba(176, 138, 69, 0.12) 39px 40px);
}

.ledger-strip {
  width: min(1040px, 100%);
  padding: clamp(28px, 6vw, 70px);
  border-left: 2px solid var(--brass);
  border-right: 2px solid rgba(176, 138, 69, 0.46);
  background: rgba(19, 14, 10, 0.55);
  box-shadow: 0 30px 80px rgba(0,0,0,0.42);
  transform: rotate(-2deg);
}

.pullquote {
  font-family: var(--folio);
  font-size: clamp(1.6rem, 3vw, 3rem);
  color: var(--bubble) !important;
}

.annotation-row {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 20px;
  border-top: 1px solid rgba(176, 138, 69, 0.3);
  transform-origin: left center;
  transition: transform 520ms cubic-bezier(.18,1.6,.28,1);
}

.annotation-row:hover { transform: translateX(22px) scaleX(1.02); }

.last-pocket { overflow: hidden; min-height: 120vh; }

.constellation {
  position: relative;
  min-height: 760px;
  max-width: 1180px;
  margin: 0 auto;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(221, 243, 231, 0.08), transparent 62%);
}

.orbit { position: absolute; width: min(310px, 42vw); min-height: 280px; }
.orbit-one { left: 4%; top: 18%; transform: rotate(-7deg); }
.orbit-two { right: 1%; top: 28%; transform: rotate(6deg); }
.orbit-three { left: 37%; bottom: 4%; transform: rotate(-2deg); }

.final-seal {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  width: min(540px, 82vw);
  aspect-ratio: 1;
  border: 2px solid var(--brass);
  border-radius: 50%;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  padding: 44px;
  background: radial-gradient(circle, rgba(90, 31, 27, 0.62), rgba(19, 14, 10, 0.82) 65%);
  box-shadow: inset 0 0 0 14px rgba(176, 138, 69, 0.08), 0 0 80px rgba(22, 60, 59, 0.38);
  filter: url(#liquid-displacement);
}

.final-seal strong {
  display: block;
  margin-top: 20px;
  color: var(--brass);
  font-family: var(--body);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.reveal { opacity: 0; transform: translateY(42px) scale(0.98); transition: opacity 720ms ease, transform 820ms cubic-bezier(.18,1.4,.24,1); }
.reveal.is-visible { opacity: 1; transform: translateY(0) scale(1); }

@media (max-width: 980px) {
  .submerged-door { grid-template-columns: 1fr; }
  .folio-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .slide-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .right-copy { margin-left: 0; text-align: left; }
}

@media (max-width: 640px) {
  .section-panel { padding: 28px 18px; }
  .folio-grid,
  .slide-grid { grid-template-columns: 1fr; }
  .folio,
  .folio.tall,
  .slide { min-height: 320px; margin-bottom: 0; }
  .slide.offset { transform: none; }
  .orbit { position: relative; width: 100%; inset: auto; margin: 18px 0; transform: none; }
  .constellation { min-height: auto; padding-bottom: 420px; }
  .final-seal { top: auto; bottom: 0; }
}
