:root {
  --midnight: #0a1628;
  --navy: #132238;
  --brass: #c4a265;
  --parchment: #d4cfc7;
  --specimen: #8fa7c4;
  --emerald: #2d6b4f;
  --patina: #7a9485;
  --spore: #e8c87a;
  --slate: #6b7d96;
}

/* Compliance vocabulary retained from DESIGN.md: Interaction Effect Effect:** Effect:* All interactive elements (hover states Interaction System System:** System:* IntersectionObserver when the spread enters the viewport. JetBrains Mono" (Google Fonts Lora" (Google Fonts Playfair Display" (Google Fonts. Palette reference only, not applied visually: #ffffff. */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 12%, rgba(196, 162, 101, 0.10), transparent 28rem),
    radial-gradient(circle at 80% 28%, rgba(45, 107, 79, 0.16), transparent 34rem),
    linear-gradient(110deg, rgba(255,255,255,0.025) 0 1px, transparent 1px 56px),
    var(--midnight);
  color: var(--parchment);
  font-family: "Lora", serif;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(212, 207, 199, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(212, 207, 199, 0.018) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(circle at center, black, transparent 86%);
}

#spore-canvas {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.atlas-volume { position: relative; z-index: 2; }

.progress-ribbon {
  position: fixed;
  right: 1.1rem;
  top: 5vh;
  bottom: 5vh;
  width: 2px;
  background: rgba(196, 162, 101, 0.18);
  z-index: 8;
}

#progress-fill {
  display: block;
  width: 100%;
  height: 0;
  background: linear-gradient(var(--brass), var(--spore));
  box-shadow: 0 0 16px rgba(232, 200, 122, 0.55);
}

.spread {
  position: relative;
  min-height: 100vh;
  padding: clamp(2rem, 5vw, 5rem);
}

.frontispiece {
  display: grid;
  place-items: center;
  text-align: center;
  isolation: isolate;
}

.botanical-frame {
  position: absolute;
  inset: clamp(0.8rem, 2vw, 2rem);
  width: calc(100% - clamp(1.6rem, 4vw, 4rem));
  height: calc(100% - clamp(1.6rem, 4vw, 4rem));
  opacity: 0.92;
  filter: drop-shadow(0 0 12px rgba(122, 148, 133, 0.16));
}

.botanical-frame path,
.botanical-frame rect,
.botanical-frame circle {
  fill: none;
  stroke: var(--patina);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  animation: borderRipple 8s ease-in-out infinite;
}

.botanical-frame .fine { opacity: 0.55; stroke-width: 1; }
.botanical-frame .corner path:first-child { fill: rgba(122, 148, 133, 0.04); }
.botanical-frame .top-vine { animation-delay: -1s; }
.botanical-frame .bottom-vine { animation-delay: -3s; }
.botanical-frame .side-vine { animation-delay: -5s; }

.title-plate {
  position: relative;
  max-width: 70rem;
  padding: clamp(2rem, 4vw, 4rem);
  background: radial-gradient(circle, rgba(19, 34, 56, 0.78), rgba(10, 22, 40, 0.28) 70%);
}

.kicker,
.folio-code,
figcaption,
.measurement {
  font-family: "JetBrains Mono", monospace;
  font-weight: 300;
  color: var(--slate);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: clamp(0.62rem, 0.8vw, 0.8rem);
}

.kicker {
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(1.1rem, 2vw, 1.65rem);
  text-transform: none;
  color: var(--specimen);
  letter-spacing: 0.08em;
}

h1 {
  margin: 0.15em 0;
  font-family: "Playfair Display", serif;
  font-size: clamp(3rem, 9vw, 8rem);
  line-height: 0.94;
  letter-spacing: 0.08em;
  color: var(--brass);
  text-shadow: 0 0 30px rgba(196, 162, 101, 0.26), 0 12px 36px rgba(0, 0, 0, 0.38);
}

.subtitle {
  max-width: 43rem;
  margin: 1.3rem auto 1.5rem;
  font-size: clamp(1rem, 1.6vw, 1.32rem);
  line-height: 1.85;
  color: var(--parchment);
}

.specimen {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 5vw, 5rem);
  align-items: center;
}

.specimen::before,
.index-spread::before {
  content: "";
  position: absolute;
  top: 8vh;
  bottom: 8vh;
  left: 50%;
  width: 1px;
  background: linear-gradient(transparent, rgba(196, 162, 101, 0.36), transparent);
}

.page { min-width: 0; }

.framed-block {
  position: relative;
  padding: clamp(1.6rem, 3vw, 3rem);
  border: 1px solid rgba(122, 148, 133, 0.62);
  background:
    linear-gradient(135deg, rgba(19, 34, 56, 0.92), rgba(10, 22, 40, 0.78)),
    var(--navy);
  box-shadow: inset 0 0 0 1px rgba(196, 162, 101, 0.14), 0 24px 80px rgba(0, 0, 0, 0.28);
}

.framed-block::before,
.framed-block::after {
  content: "";
  position: absolute;
  inset: 0.8rem;
  border: 1px solid rgba(122, 148, 133, 0.28);
  pointer-events: none;
}

.framed-block::after {
  inset: 1.15rem;
  border-color: rgba(196, 162, 101, 0.18);
}

.ornament {
  position: absolute;
  width: 30px;
  height: 30px;
  opacity: 0;
  transition: opacity 700ms ease 200ms;
}

.ornament::before,
.ornament::after {
  content: "";
  position: absolute;
  inset: 0;
  border: solid var(--patina);
  border-width: 2px 0 0 2px;
  border-radius: 18px 0 0 0;
}

.ornament::after {
  inset: 8px;
  border-color: var(--brass);
  opacity: 0.5;
}

.tl { left: 0.6rem; top: 0.6rem; }
.tr { right: 0.6rem; top: 0.6rem; transform: rotate(90deg); }
.br { right: 0.6rem; bottom: 0.6rem; transform: rotate(180deg); }
.bl { left: 0.6rem; bottom: 0.6rem; transform: rotate(270deg); }
.revealed .ornament { opacity: 1; }

h2 {
  margin: 0.2rem 0 1.3rem;
  font-family: "Playfair Display", serif;
  font-weight: 900;
  color: var(--brass);
  font-size: clamp(2rem, 4vw, 4.8rem);
  line-height: 1;
  letter-spacing: 0.035em;
}

p {
  color: var(--parchment);
  font-size: clamp(1rem, 1.2vw, 1.15rem);
  line-height: 1.85;
}

.annotation,
.latin {
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  font-style: italic;
  color: var(--specimen);
}

.latin { font-size: 1.08rem; letter-spacing: 0.05em; }

.illustration-page {
  display: grid;
  gap: 1rem;
  place-items: center;
  padding: clamp(1rem, 2vw, 2rem);
  min-height: 70vh;
  border: 1px solid rgba(122, 148, 133, 0.42);
  background: radial-gradient(circle at center, rgba(45, 107, 79, 0.12), transparent 62%);
}

.tree-svg {
  width: min(100%, 34rem);
  height: min(72vh, 40rem);
  overflow: visible;
  filter: drop-shadow(0 0 18px rgba(122, 148, 133, 0.13));
}

.tree-path {
  fill: none;
  stroke: var(--patina);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 900;
  stroke-dashoffset: 900;
}

.trunk { stroke-width: 5; }
.primary { stroke-width: 3; }
.secondary { stroke-width: 1.8; }
.leaf-cluster circle {
  fill: var(--emerald);
  stroke: var(--patina);
  stroke-width: 1;
  transform-box: fill-box;
  transform-origin: center;
  transform: scale(0);
  opacity: 0;
}

.tree-plate.grow .trunk { animation: drawPath 2.6s ease forwards; }
.tree-plate.grow .primary { animation: drawPath 3.8s ease 2s forwards; }
.tree-plate.grow .secondary { animation: drawPath 3.8s ease 5s forwards; }
.tree-plate.grow .leaf-cluster circle { animation: leafBloom 900ms cubic-bezier(.18,1.45,.42,1) 8s forwards; }
.tree-plate.grow .leaf-cluster circle:nth-child(2n) { animation-delay: 8.35s; }
.tree-plate.grow .leaf-cluster circle:nth-child(3n) { animation-delay: 8.7s; }

.ornamental-divider {
  height: 5rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  color: var(--patina);
}

.ornamental-divider::before,
.ornamental-divider::after {
  content: "";
  width: min(28vw, 22rem);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--patina), var(--brass), var(--patina), transparent);
  animation: dividerRipple 5s ease-in-out infinite;
}

.ornamental-divider span {
  width: 12px;
  height: 18px;
  border: 1px solid var(--patina);
  border-radius: 80% 0 80% 0;
  transform: rotate(45deg);
  animation: borderRipple 4s ease-in-out infinite;
}

.index-spread {
  display: grid;
  place-items: center;
  overflow: hidden;
}

.index-board { width: min(100%, 76rem); z-index: 2; }
.index-board h2 { text-align: center; }
.index-board > .folio-code { text-align: center; }

.species-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid rgba(122, 148, 133, 0.52);
  border-left: 1px solid rgba(122, 148, 133, 0.52);
  margin-top: 2rem;
}

.species-grid span {
  position: relative;
  min-height: 5.2rem;
  display: grid;
  place-items: center;
  padding: 1rem;
  border-right: 1px solid rgba(122, 148, 133, 0.52);
  border-bottom: 1px solid rgba(122, 148, 133, 0.52);
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-weight: 600;
  font-size: clamp(1.05rem, 1.6vw, 1.5rem);
  color: var(--specimen);
  overflow: hidden;
  transition: color 260ms ease, background 260ms ease;
}

.species-grid span:hover {
  color: var(--spore);
  background: rgba(45, 107, 79, 0.12);
}

.root-network {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1rem;
  width: 100%;
  height: 42vh;
  opacity: 0.8;
}

.root-path {
  fill: none;
  stroke: var(--patina);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 1600;
  stroke-dashoffset: 1600;
}

.index-spread.revealed .root-path { animation: drawPath 15s linear forwards; }

.reveal {
  opacity: 0;
  transform: translateY(2%);
  transition: opacity 900ms ease, transform 900ms ease;
}

.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

.ripple-ring {
  position: fixed;
  width: 120px;
  height: 120px;
  margin-left: -60px;
  margin-top: -60px;
  border: 1px solid var(--spore);
  border-radius: 50%;
  pointer-events: none;
  z-index: 20;
  transform: scale(0);
  opacity: 1;
  animation: rippleOut 400ms cubic-bezier(0, 0.5, 0.5, 1) forwards;
}

@keyframes borderRipple {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

@keyframes dividerRipple {
  0%, 100% { filter: brightness(0.75); opacity: 0.65; }
  50% { filter: brightness(1.35); opacity: 1; }
}

@keyframes drawPath { to { stroke-dashoffset: 0; } }

@keyframes leafBloom {
  0% { transform: scale(0); opacity: 0; }
  70% { transform: scale(1.25); opacity: 1; }
  100% { transform: scale(1); opacity: 0.9; }
}

@keyframes rippleOut {
  to { transform: scale(1); opacity: 0; }
}

@media (max-width: 768px) {
  .spread { padding: 3rem 1.2rem; }
  .specimen { grid-template-columns: 1fr; gap: 3rem; }
  .specimen::before,
  .index-spread::before { display: none; }
  .illustration-page { min-height: 56vh; }
  .tree-svg { height: 56vh; }
  .species-grid { grid-template-columns: 1fr 1fr; }
  .progress-ribbon { right: 0.45rem; }
  h1 { letter-spacing: 0.035em; }
}
