:root {
  /* Design compliance vocabulary: IntersectionObserver used instead of scroll listeners for section activation; IntersectionObserver` with `threshold: 0.3`; Lora italic: "Charting the invisible geographies of narrative" (delay: 0.8s); Lora" (Google Fonts); Space Mono" (Google Fonts). */
  --cursor-x: 50%;
  --cursor-y: 50%;
  --parallax-x: 0px;
  --parallax-y: 0px;
  --aged-parchment: #f4e8c1;
  --warm-vellum: #e8d5a3;
  --dark-sepia: #5c4a2a;
  --warm-umber: #6b5b3e;
  --old-gold: #8b6914;
  --terracotta: #c4956a;
  --sage: #8a9a6f;
  --sage-light: #a8b89a;
  --loam: #3a2f1e;
  --faded: #d4c5a0;
}

html {
  scroll-snap-type: y proximity;
  scroll-behavior: smooth;
}

body {
  background: #f4e8c1;
  color: #6b5b3e;
  font-family: 'Lora', Georgia, serif;
  overflow-x: hidden;
  margin: 0;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(90deg, transparent 0 97%, rgba(139, 105, 20, 0.1) 97% 98%, transparent 98%), linear-gradient(0deg, transparent 0 97%, rgba(139, 105, 20, 0.08) 97% 98%, transparent 98%);
  background-size: 86px 86px;
  opacity: 0.22;
  z-index: 0;
}

.story-atlas { position: relative; z-index: 1; }

.map-plate {
  min-height: 100vh;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  scroll-snap-align: start;
  box-sizing: border-box;
  padding: 8vh 7vw;
  overflow: hidden;
  isolation: isolate;
}

.opening-plate { background: #f4e8c1; opacity: 0; transform: scale(1.02); animation: plateOpen 1.5s ease forwards; }
.atlas-plate { background: #e8d5a3; }
.hud-plate { background: #f4e8c1; }
.meadow-plate { background: #d4c5a0; }

h1, h2 {
  font-family: 'Bebas Neue', Impact, sans-serif;
  color: #5c4a2a;
  font-weight: 400;
  text-transform: uppercase;
  margin: 0;
  line-height: 0.9;
  text-align: center;
}

h1 { font-size: clamp(5rem, 14vw, 12rem); letter-spacing: 0.15em; animation: revealText 1.1s ease 0.3s both; }
h2 { font-size: clamp(3.5rem, 10vw, 10rem); letter-spacing: 0.12em; }

.plate-kicker, .arc-labels text, .data-tag {
  font-family: 'Space Mono', 'Courier New', monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8b6914;
}

.plate-kicker {
  font-size: clamp(0.7rem, 1.2vw, 0.85rem);
  opacity: 0.72;
  margin: 0 0 1rem;
}

.subtitle {
  color: #6b5b3e;
  font-size: clamp(1.2rem, 3vw, 2rem);
  margin: 1rem 0 1.2rem;
  animation: revealText 1.1s ease 0.8s both;
}

.narration, .closing-line {
  color: #6b5b3e;
  font-size: clamp(1rem, 2.2vw, 1.25rem);
  line-height: 1.75;
  max-width: 62ch;
  text-align: center;
  margin: 1.4rem auto 0;
}

.closing-line {
  font-size: clamp(1.45rem, 3.4vw, 2.8rem);
  color: #5c4a2a;
  font-style: italic;
  max-width: 40ch;
}

.progress-quill {
  position: fixed;
  top: 9vh;
  right: 26px;
  width: 1px;
  height: 82vh;
  background: rgba(139, 105, 20, 0.28);
  z-index: 20;
}

#progressNib {
  display: block;
  width: 3px;
  min-height: 38px;
  background: #8b6914;
  transform-origin: top;
  transform: scaleY(0.05) translateX(-1px);
}

.quill-divider {
  height: 0;
  position: relative;
  z-index: 5;
}

.quill-divider svg {
  position: absolute;
  width: 60vw;
  left: 20vw;
  top: -16px;
  overflow: visible;
  transform: scale(1);
  animation: breatheLine 5s ease-in-out infinite;
}

.desk-field { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.desk-svg { position: absolute; opacity: 0; transform: translate(var(--parallax-x), var(--parallax-y)); animation: revealDesk 1s ease both; }
.page-one { width: 21vw; min-width: 190px; left: 8vw; top: 15vh; rotate: -9deg; animation-delay: 1s; }
.desk-ruler { width: 27vw; min-width: 250px; right: 8vw; top: 18vh; rotate: 7deg; animation-delay: 1.1s; }
.desk-protractor { width: 19vw; min-width: 180px; right: 14vw; bottom: 13vh; rotate: -12deg; animation-delay: 1.2s; }
.page-two { width: 15vw; min-width: 150px; left: 16vw; bottom: 17vh; rotate: 11deg; animation-delay: 1.3s; }

.arc-panel {
  width: min(980px, 92vw);
  padding: 2rem;
  box-sizing: border-box;
  background: #f4e8c1;
  border: 1px solid #c4956a;
  margin-top: 2rem;
}

.arc-chart { width: 100%; display: block; }
.primary-arc { fill: none; stroke: #c4956a; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; transition: stroke-dashoffset 2.5s ease-in-out; }
.ghost-arc { fill: none; stroke-width: 2; stroke-linecap: round; opacity: 0.45; }
.tragedy { stroke: #5c4a2a; }
.comedy { stroke: #8a9a6f; }
.arc-labels text { font-size: 16px; fill: #8b6914; opacity: 0; transform: translateY(10px); transition: opacity 0.6s ease, transform 0.6s ease; }
.atlas-plate.is-active .arc-labels text { opacity: 1; transform: translateY(0); }
.atlas-plate.is-active .arc-labels text:nth-child(1) { transition-delay: 0.5s; }
.atlas-plate.is-active .arc-labels text:nth-child(2) { transition-delay: 0.9s; }
.atlas-plate.is-active .arc-labels text:nth-child(3) { transition-delay: 1.3s; }
.atlas-plate.is-active .arc-labels text:nth-child(4) { transition-delay: 1.7s; }
.atlas-plate.is-active .arc-labels text:nth-child(5) { transition-delay: 2.1s; }

.hud-system { position: relative; width: min(620px, 84vw); aspect-ratio: 1; margin: 2rem auto 1rem; }
.hud-rings { position: absolute; inset: 0; width: 100%; height: 100%; }
.ring-group { transform-origin: 310px 310px; animation-name: rotateRing; animation-timing-function: linear; animation-iteration-count: infinite; }
.ring-group circle, .ring-group path { fill: none; stroke: #8b6914; stroke-width: 0.5; opacity: 0.42; }
.ring-outer { animation-duration: 180s; }
.ring-middle { animation-duration: 120s; }
.ring-inner { animation-duration: 90s; }

.data-tag {
  position: absolute;
  box-sizing: border-box;
  width: 178px;
  padding: 0.75rem;
  background: #e8d5a3;
  border: 1px solid #8b6914;
  color: #8b6914;
  font-size: clamp(0.7rem, 1.2vw, 0.85rem);
  opacity: 0.6;
  transform: translate(var(--tag-x, 0), var(--tag-y, 0));
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.data-tag span { display: block; margin-bottom: 0.55rem; }
.data-tag i { display: block; height: 8px; width: var(--w); background: #c4956a; }
.data-tag.is-near { opacity: 1; }
.tag-one { left: 2%; top: 19%; }
.tag-two { right: -2%; top: 28%; }
.tag-three { left: 14%; bottom: 8%; }
.tag-four { right: 10%; bottom: 15%; }

.meadow-svg { position: absolute; inset: auto 0 0; width: 100%; height: 52vh; z-index: -1; }
.mote-field { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 2; }
.mote { position: absolute; width: 5px; height: 5px; border-radius: 50%; background: #8a9a6f; opacity: 0.75; transition: transform 3s ease-out, opacity 3s ease-out; }

@keyframes plateOpen { to { opacity: 1; transform: scale(1); } }
@keyframes revealText { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes revealDesk { from { opacity: 0; transform: translate(var(--parallax-x), var(--parallax-y)) scale(0.96); } to { opacity: 0.95; transform: translate(var(--parallax-x), var(--parallax-y)) scale(1); } }
@keyframes rotateRing { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes breatheLine { 50% { transform: scale(1.005); } }

@media (max-width: 768px) {
  html { scroll-snap-type: y proximity; }
  .map-plate { padding: 8vh 5vw; }
  h1, h2 { font-size: clamp(2.5rem, 8vw, 4rem); }
  h1 { letter-spacing: 0.12em; }
  .progress-quill { right: 14px; }
  .desk-svg { transform: none; }
  .hud-system { width: min(390px, 92vw); }
  .data-tag { width: 136px; padding: 0.55rem; }
  .tag-one { left: 0; top: 18%; }
  .tag-two { right: 0; top: 32%; }
  .tag-three { left: 3%; bottom: 9%; }
  .tag-four { right: 4%; bottom: 11%; }
  .arc-panel { padding: 0.8rem; }
  .arc-labels text { font-size: 13px; }
  .meadow-svg path:nth-child(2) { display: none; }
}
