:root {
  /* Compliance vocabulary from DESIGN.md: (Google IntersectionObserver fallback activate/deactivate off-screen elements. Use custom properties all values enable easy theming. IntersectionObserver` trigger sequences only sections viewport. */
  --deep: #0b1120;
  --surface: #141e33;
  --surface-2: #1c2a45;
  --steel: #3d5a80;
  --gold: #c9a84c;
  --patina: #4a7c6f;
  --white: #e8e4dc;
  --silver: #b0aead;
  --gunmetal: #6b7280;
  --signal: #5d8fba;
  --hex-width: clamp(180px, 18vw, 280px);
  --hex-height: calc(var(--hex-width) * 0.86);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--deep);
  color: var(--silver);
  font-family: "Cormorant Garamond", Georgia, serif;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 25% 20%, rgba(61, 90, 128, 0.18), transparent 32%),
    radial-gradient(circle at 82% 70%, rgba(74, 124, 111, 0.12), transparent 30%);
  mix-blend-mode: screen;
  opacity: 0.65;
  z-index: 0;
}

.chapter {
  position: relative;
  min-height: 100vh;
  isolation: isolate;
  padding: clamp(48px, 6vw, 96px);
}

.top-hex {
  position: fixed;
  top: 22px;
  left: 22px;
  width: 28px;
  height: 28px;
  z-index: 10;
  opacity: 0.78;
  transition: opacity 300ms ease, transform 300ms ease;
}

.top-hex:hover { opacity: 1; transform: rotate(30deg); }
.top-hex path { fill: rgba(20, 30, 51, 0.72); stroke: #8a8e94; stroke-width: 1.2; }

h1, h2 {
  margin: 0;
  color: var(--white);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 0.95;
}

h1 { font-size: clamp(2.8rem, 7vw, 6.5rem); }
h2 { font-size: clamp(2.2rem, 5.6vw, 5.1rem); max-width: 10ch; }

p {
  font-size: clamp(1rem, 1.4vw, 1.2rem);
  line-height: 1.72;
  letter-spacing: 0.01em;
}

.chapter-label, .micro-note, .hex-cell span {
  font-family: "Libre Franklin", Arial, sans-serif;
  font-size: clamp(0.65rem, 0.9vw, 0.8rem);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gunmetal);
}

.archive { display: grid; place-items: center; }
.archive-field { position: relative; width: min(90vw, 1050px); height: min(78vh, 760px); }

.hero-hex, .satellite, .hex-cell, .merge-hex {
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

.hero-hex {
  position: absolute;
  inset: 50% auto auto 50%;
  width: min(70vw, 720px);
  height: min(70vw, 620px);
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 9vw;
  background: radial-gradient(circle at 50% 45%, var(--surface) 0%, #10192b 58%, var(--deep) 100%);
  border: 1px solid var(--steel);
  box-shadow: inset 0 0 0 1px rgba(176, 174, 173, 0.1), 0 0 80px rgba(93, 143, 186, 0.08);
}

.hero-hex .lead { max-width: 38ch; color: var(--silver); margin-top: 22px; }
.crosshair { position: absolute; color: var(--silver); font-family: "IBM Plex Mono", monospace; opacity: 0.6; }
.north { top: 13%; left: 50%; } .east { right: 12%; top: 48%; } .south { bottom: 13%; left: 50%; } .west { left: 12%; top: 48%; }

.satellite {
  position: absolute;
  width: clamp(96px, 12vw, 160px);
  height: clamp(84px, 10.5vw, 140px);
  background: linear-gradient(145deg, rgba(28, 42, 69, 0.72), rgba(11, 17, 32, 0.92));
  border: 1px solid rgba(61, 90, 128, 0.55);
  opacity: 0.45;
  animation: pulse-hex 4s ease-in-out infinite;
  will-change: transform, opacity;
}

.sat-a { left: 5%; top: 10%; animation-delay: 0.2s; }
.sat-b { right: 8%; top: 15%; animation-delay: 0.6s; }
.sat-c { left: 9%; bottom: 18%; animation-delay: 1s; }
.sat-d { right: 14%; bottom: 8%; animation-delay: 1.4s; }
.sat-e { right: 44%; bottom: 0; animation-delay: 1.8s; }

@keyframes pulse-hex {
  0%, 100% { opacity: 0.4; transform: scale(1); filter: drop-shadow(0 0 0 var(--signal)); }
  50% { opacity: 0.8; transform: scale(1.02); filter: drop-shadow(0 0 8px var(--signal)); }
}

.specimens {
  min-height: 150vh;
  padding-top: 12vh;
  background: var(--deep);
}

.halftone {
  position: absolute;
  inset: 0;
  opacity: 0.5;
  background-image: radial-gradient(rgba(232, 228, 220, 0.03) 1px, transparent 1px);
  background-size: 4px 4px;
  z-index: -1;
}

.chapter-copy { max-width: 38ch; position: relative; z-index: 2; }
.copy-left { margin-left: clamp(12px, 8vw, 128px); margin-bottom: 7vh; }

.honeycomb {
  width: min(1120px, 96vw);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 48px;
}

.hex-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, var(--hex-width)));
  gap: 48px;
  justify-content: center;
}

.hex-row.offset { transform: translateX(calc(var(--hex-width) / 4)); }

.hex-cell {
  width: var(--hex-width);
  height: var(--hex-height);
  background: var(--surface-2);
  border: 1px solid var(--steel);
  position: relative;
  display: grid;
  place-items: center;
  opacity: 0.36;
  transform: scale(0.96);
  transition: opacity 700ms ease, transform 700ms ease, filter 700ms ease;
  overflow: hidden;
  will-change: transform, opacity;
}

.hex-cell::before {
  content: "";
  position: absolute;
  inset: 1px;
  clip-path: inherit;
  background: linear-gradient(135deg, rgba(201, 168, 76, 0.05), transparent 45%, rgba(74, 124, 111, 0.12));
}

.hex-cell.is-lit, .hex-cell.active-seed {
  opacity: 0.92;
  transform: scale(1);
  filter: drop-shadow(0 0 10px rgba(93, 143, 186, 0.42));
  animation: pulse-once 2s ease-out 1;
}

@keyframes pulse-once {
  0% { filter: drop-shadow(0 0 0 var(--signal)); }
  45% { filter: drop-shadow(0 0 14px var(--signal)); }
  100% { filter: drop-shadow(0 0 10px rgba(93, 143, 186, 0.42)); }
}

.hex-cell span { position: absolute; bottom: 23%; z-index: 3; color: rgba(176, 174, 173, 0.7); }
.artifact svg { width: 70%; height: 70%; z-index: 2; overflow: visible; }
.artifact path { fill: none; stroke: var(--gold); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; opacity: 0.8; }
.artifact circle { fill: var(--gold); opacity: 0.65; }
.gear path { stroke: var(--patina); stroke-width: 3; opacity: 0.62; }
.wave path { stroke: var(--white); opacity: 0.15; stroke-width: 3; }

.punch-matrix {
  width: 86px;
  height: 58px;
  z-index: 2;
  background-image: radial-gradient(circle, var(--steel) 1.8px, transparent 2.2px);
  background-size: 10px 9px;
  opacity: 0.72;
  transform: rotate(-4deg);
}
.punch.alt .punch-matrix { background-image: radial-gradient(circle, rgba(201, 168, 76, 0.75) 1.6px, transparent 2.2px); transform: rotate(5deg); }
.micro-note { margin: 8vh 8vw 0 auto; max-width: 340px; }

.process {
  min-height: 120vh;
  background: linear-gradient(180deg, var(--deep) 0%, #121f38 100%);
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 5vw;
}

.kintsugi { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }
.gold-line {
  fill: none;
  stroke: var(--gold);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-dasharray: 1200;
  stroke-dashoffset: 1200;
  filter: drop-shadow(0 0 5px rgba(201, 168, 76, 0.35));
}
.process.in-view .gold-line { animation: draw-line 2.2s ease-out forwards; }
.process.in-view .gold-line:nth-child(2) { animation-delay: 0.35s; }
.process.in-view .gold-line:nth-child(3) { animation-delay: 0.7s; }
@keyframes draw-line { to { stroke-dashoffset: 0; } }

.merged-cluster { position: relative; height: 560px; z-index: 2; }
.merge-hex {
  position: absolute;
  width: clamp(210px, 24vw, 340px);
  height: clamp(180px, 21vw, 294px);
  background: rgba(28, 42, 69, 0.75);
  border: 1px solid rgba(61, 90, 128, 0.8);
  animation: pulse-hex 5s ease-in-out infinite;
}
.mh-one { left: 7%; top: 8%; }
.mh-two { left: 34%; top: 25%; animation-delay: 0.5s; background: rgba(20, 30, 51, 0.86); }
.mh-three { left: 15%; top: 48%; animation-delay: 1s; background: rgba(74, 124, 111, 0.22); }
.mh-four { left: 48%; top: 55%; animation-delay: 1.5s; }
.process-copy { z-index: 3; max-width: 42ch; justify-self: start; }
.notation code { font-family: "IBM Plex Mono", monospace; font-size: 0.9em; background: rgba(26, 37, 61, 0.4); padding: 0.15em 0.4em; border-radius: 2px; color: var(--gold); }

.signal {
  display: grid;
  place-items: center;
  text-align: left;
}
.divider-hexes { position: absolute; top: 12vh; left: 12vw; display: flex; gap: 10px; }
.divider-hexes span {
  width: 8px; height: 8px;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  background: var(--steel);
}
.divider-hexes span:nth-child(2) { background: #314969; }
.divider-hexes span:nth-child(3) { background: #283b58; }
.divider-hexes span:nth-child(4) { background: #20304a; }
.divider-hexes span:nth-child(5) { background: var(--surface-2); }
.signal-point {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 0 0 rgba(93, 143, 186, 0.55), 0 0 60px rgba(93, 143, 186, 0.8);
  animation: signal-breathe 3s ease-in-out infinite;
}
@keyframes signal-breathe {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(93, 143, 186, 0.3), 0 0 40px rgba(93, 143, 186, 0.6); }
  50% { transform: scale(1.6); box-shadow: 0 0 0 64px rgba(93, 143, 186, 0), 0 0 90px rgba(93, 143, 186, 0.95); }
}
.final-copy { position: relative; z-index: 2; max-width: 620px; margin-left: 28vw; margin-top: 28vh; }
.final-copy h2 { max-width: 12ch; }

@media (max-width: 820px) {
  .chapter { padding: 72px 22px; }
  .hero-hex { width: 88vw; height: 76vw; padding: 16vw 13vw; }
  .satellite { opacity: 0.25; }
  .hex-row, .hex-row.offset { transform: none; grid-template-columns: repeat(2, minmax(130px, 1fr)); gap: 26px; }
  .hex-cell { width: 100%; height: 42vw; min-height: 142px; }
  .process { grid-template-columns: 1fr; }
  .merged-cluster { height: 360px; }
  .final-copy { margin: 32vh 0 0 0; }
}
