:root {
  /* Compliance phrases: Interaction* Interaction:** IntersectionObserver` (threshold: (Google */
  --parchment: #faf6f0;
  --vellum: #f0e8dc;
  --lavender: #d4b8e3;
  --ice: #b8d4e3;
  --mint: #b8e3c4;
  --rose: #e3b8c4;
  --sepia: #c4b8a6;
  --ruled: #d4c9b8;
  --aged: #e8ddd0;
  --archive: #3a3632;
  --interaction-marker: "Interaction:**";
  --sidebar-width: 280px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 40px;
  background: var(--parchment);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--archive);
  font-family: "Nunito", sans-serif;
  font-size: clamp(1rem, 1.1vw, 1.15rem);
  font-weight: 300;
  line-height: 1.78;
  letter-spacing: 0.01em;
  background: var(--parchment);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -3;
  pointer-events: none;
  background-color: #faf6f0;
  background-image:
    radial-gradient(circle at 12% 18%, rgba(196, 184, 166, 0.05) 0 46px, transparent 92px),
    radial-gradient(circle at 84% 14%, rgba(196, 184, 166, 0.045) 0 38px, transparent 86px),
    radial-gradient(circle at 68% 48%, rgba(196, 184, 166, 0.04) 0 60px, transparent 120px),
    radial-gradient(circle at 22% 72%, rgba(196, 184, 166, 0.055) 0 52px, transparent 112px),
    radial-gradient(circle at 92% 82%, rgba(196, 184, 166, 0.035) 0 42px, transparent 98px),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260' viewBox='0 0 260 260'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='260' height='260' filter='url(%23n)' opacity='0.18'/%3E%3C/svg%3E");
  box-shadow: inset 0 0 150px 50px rgba(58, 54, 50, 0.08);
  opacity: 0;
  animation: textureIn 2.5s ease forwards;
}

.texture-veil {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background: #faf6f0;
  animation: veilLift 2.5s ease forwards;
}

#aurora-lottie,
.aurora-fallback {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: -2;
  pointer-events: none;
}

.aurora-fallback { overflow: hidden; }
.fallback-orb {
  position: absolute;
  display: block;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  filter: blur(42px);
  opacity: 0;
  animation: orbDrift 34s ease-in-out infinite, orbAppear 2s ease forwards;
}
.orb-a { left: 12%; top: 18%; background: radial-gradient(circle, rgba(212,184,227,.46), rgba(184,212,227,.08)); animation-delay: 2.6s, 2.6s; }
.orb-b { right: 8%; top: 28%; background: radial-gradient(circle, rgba(184,227,196,.42), rgba(227,184,196,.08)); animation-delay: 3s, 3s; }
.orb-c { left: 48%; bottom: 8%; background: radial-gradient(circle, rgba(184,212,227,.42), rgba(212,184,227,.08)); animation-delay: 3.4s, 3.4s; }
.orb-d { left: 4%; bottom: 12%; width: 120px; height: 120px; background: radial-gradient(circle, rgba(227,184,196,.38), rgba(184,227,196,.08)); animation-delay: 3.8s, 3.8s; }
.orb-e { right: 28%; top: 4%; width: 140px; height: 140px; background: radial-gradient(circle, rgba(212,184,227,.34), rgba(184,227,196,.07)); animation-delay: 4.2s, 4.2s; }

.archive-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  height: 100vh;
  z-index: 4;
  display: flex;
  flex-direction: column;
  padding: 42px 30px 32px;
  color: var(--archive);
  background-color: #f0e8dc;
  background-image:
    repeating-linear-gradient(0deg, rgba(212, 201, 184, 0.15) 0 1px, transparent 1px 28px),
    radial-gradient(circle at 20% 16%, rgba(196, 184, 166, 0.05) 0 18px, transparent 60px),
    radial-gradient(circle at 74% 44%, rgba(196, 184, 166, 0.04) 0 22px, transparent 70px),
    radial-gradient(circle at 35% 82%, rgba(196, 184, 166, 0.05) 0 26px, transparent 80px),
    linear-gradient(90deg, rgba(250,246,240,.68), rgba(232,221,208,.24));
  border-right: 0.5px solid rgba(196, 184, 166, 0.55);
  box-shadow: 18px 0 60px rgba(58,54,50,.05);
  transform: translateX(-280px);
  animation: sidebarIn 800ms cubic-bezier(0.25, 0.1, 0.25, 1.0) 2.8s forwards;
}

.sidebar-heading strong,
h1,
h2 {
  font-family: "Josefin Sans", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sidebar-heading strong {
  display: block;
  margin-top: 10px;
  font-weight: 300;
  font-size: 1.45rem;
  line-height: 1.1;
}

.archive-kicker,
.chapter-number,
.marginalia,
.sidebar-colophon span,
.chapter-link {
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.archive-kicker,
.chapter-number,
.marginalia { color: var(--sepia); }

.chapter-nav {
  margin-top: 64px;
  display: grid;
  gap: 16px;
}

.chapter-link {
  position: relative;
  display: block;
  padding: 11px 0 11px 18px;
  color: var(--sepia);
  text-decoration: none;
  transition: transform 200ms ease, color 200ms ease;
}

.chapter-link::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 0;
  background: var(--ice);
  border-radius: 10px;
  opacity: .9;
  transition: width 240ms ease;
}

.chapter-link span { margin-right: 8px; color: var(--archive); opacity: .62; }
.chapter-link:hover { transform: translateX(4px); color: #3a3632; }
.chapter-link.active::before { width: 2px; animation: auroraBorder 12s ease-in-out infinite; }
.chapter-link.pulse::before { animation: borderPulse 400ms ease, auroraBorder 12s ease-in-out 400ms infinite; }

.sidebar-colophon {
  margin-top: auto;
  text-align: center;
  color: var(--sepia);
}
.compass { width: 92px; height: 92px; fill: none; stroke: #c4b8a6; stroke-width: 1.5px; opacity: .78; }
.sidebar-colophon span { display: block; margin-top: 10px; font-size: .68rem; }

.drawer-toggle { display: none; }

.codex-main {
  position: relative;
  z-index: 1;
  margin-left: var(--sidebar-width);
  width: calc(100vw - var(--sidebar-width));
  padding: 0 80px;
}

.folio {
  min-height: 100vh;
  max-width: 860px;
  margin: 0 auto;
  padding: 84px 0 120px;
  display: flex;
  align-items: center;
}

.opening { padding-top: 120px; }
.folio-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 24px;
  position: relative;
}
.title-block,
.chapter-copy { grid-column: 3 / 7; }
.marginalia,
.pull-quote { grid-column: 1 / 3; }
.marginalia { align-self: start; margin-top: 24px; }

.title-block {
  opacity: 0;
  transform: translateY(20px);
  animation: titleRise 600ms ease 3.6s forwards;
}

h1 {
  margin: 18px 0 22px;
  font-size: clamp(2.8rem, 6vw, 5.7rem);
  font-weight: 300;
  line-height: .95;
  color: #3a3632;
}

h2 {
  margin: 12px 0 22px;
  font-size: clamp(2.2rem, 4.5vw, 3.8rem);
  font-weight: 300;
  line-height: 1.02;
  color: #3a3632;
}

.lead {
  max-width: 650px;
  color: rgba(58,54,50,.76);
  font-size: clamp(1.22rem, 2vw, 1.55rem);
  line-height: 1.6;
}

.pull-quote {
  position: sticky;
  top: 72px;
  align-self: start;
  margin: 88px 0 0;
  padding: 0 0 0 18px;
  border-left: 1px solid rgba(227, 184, 196, .78);
  color: rgba(58,54,50,.62);
  font-size: clamp(1.3rem, 2vw, 1.7rem);
  font-style: italic;
  font-weight: 400;
  line-height: 1.45;
}
.pull-quote.mint { border-left-color: rgba(184, 227, 196, .9); }
.pull-quote.rose { border-left-color: rgba(212, 184, 227, .9); }
.pull-quote.faded { opacity: .5; }

.chapter-copy p {
  margin: 0 0 22px;
  color: rgba(58,54,50,.78);
  opacity: 0;
  transform: translateY(15px);
  transition: opacity 400ms ease, transform 400ms ease;
}
.folio.in-view .chapter-copy p:nth-of-type(1) { transition-delay: 50ms; }
.folio.in-view .chapter-copy p:nth-of-type(2) { transition-delay: 100ms; }
.folio.in-view .chapter-copy p:nth-of-type(3) { transition-delay: 150ms; }
.folio.in-view .chapter-copy p:nth-of-type(4) { transition-delay: 200ms; }
.folio.in-view .chapter-copy p { opacity: 1; transform: translateY(0); }

.illuminated::first-letter {
  float: left;
  margin: .08em .14em 0 0;
  padding: .08em .12em;
  font-family: "Josefin Sans", sans-serif;
  font-size: 4.6em;
  line-height: .78;
  font-weight: 600;
  color: transparent;
  background: linear-gradient(135deg, #d4b8e3, #b8d4e3, #b8e3c4, #e3b8c4);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 0 22px rgba(212,184,227,.16));
  opacity: 0;
  transform: scale(.8);
  transition: opacity 500ms ease, transform 500ms ease;
}
.folio.in-view .illuminated::first-letter { opacity: 1; transform: scale(1); }

.section-rule {
  position: absolute;
  left: calc(var(--sidebar-width) + 80px);
  right: 80px;
  height: 1px;
  transform: translateY(-54px);
  background: linear-gradient(90deg, transparent, rgba(196,184,166,.82), transparent);
}
.section-rule::after {
  content: "";
  position: absolute;
  left: 0;
  top: -34px;
  width: 74px;
  height: 74px;
  opacity: .2;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 80'%3E%3Cg fill='none' stroke='%23c4b8a6' stroke-width='1'%3E%3Ccircle cx='40' cy='40' r='24'/%3E%3Cpath d='M40 7v66M7 40h66M17 17l46 46M63 17L17 63'/%3E%3C/g%3E%3C/svg%3E") center/contain no-repeat;
}
.topology::after { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 90 90'%3E%3Cg fill='none' stroke='%23c4b8a6' stroke-width='1'%3E%3Cpath d='M10 70 C20 18, 45 80, 82 20'/%3E%3Cpath d='M12 35 C35 8, 50 62, 78 50'/%3E%3Ccircle cx='22' cy='40' r='5'/%3E%3Ccircle cx='55' cy='55' r='5'/%3E%3Ccircle cx='70' cy='28' r='5'/%3E%3C/g%3E%3C/svg%3E"); }

.coalition-diagram {
  position: relative;
  height: 260px;
  margin: 34px 0;
}
.coalition-diagram span {
  position: absolute;
  border-radius: 50%;
  mix-blend-mode: multiply;
  border: 1px solid rgba(196,184,166,.22);
}
.coalition-diagram span:nth-child(1) { width: 190px; height: 190px; left: 10%; top: 22px; background: rgba(212,184,227,.2); }
.coalition-diagram span:nth-child(2) { width: 170px; height: 170px; left: 34%; top: 52px; background: rgba(184,212,227,.2); }
.coalition-diagram span:nth-child(3) { width: 150px; height: 150px; right: 10%; top: 6px; background: rgba(184,227,196,.2); }
.coalition-diagram span:nth-child(4) { width: 135px; height: 135px; left: 46%; bottom: 0; background: rgba(227,184,196,.2); }

.parallel-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin: 26px 0; }
.schisma-grid::after {
  content: "";
  grid-column: 5 / 7;
  grid-row: 1;
  align-self: center;
  height: 360px;
  opacity: .24;
  background: linear-gradient(135deg, transparent 20%, rgba(196,184,166,.4) 21%, transparent 22%), radial-gradient(circle at 30% 25%, rgba(212,184,227,.34), transparent 18%), radial-gradient(circle at 68% 70%, rgba(184,212,227,.32), transparent 20%);
  border: 1px solid rgba(196,184,166,.18);
  border-radius: 50% 42% 48% 44%;
}
.narrow-copy { grid-column: 3 / 5; }
.concordia-section.in-view ~ .aurora-fallback .fallback-orb,
body.concordia-lit .fallback-orb { opacity: .4; }
.vestigium-section { position: relative; }
.vestigium-section::before {
  content: "";
  position: absolute;
  inset: 48px -80px 60px;
  z-index: -1;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(196,184,166,.07) 0 30px, transparent 62px),
    radial-gradient(circle at 70% 36%, rgba(196,184,166,.06) 0 42px, transparent 90px),
    radial-gradient(circle at 40% 80%, rgba(196,184,166,.08) 0 34px, transparent 76px);
}
.vestige-copy p { opacity: .5; }

@keyframes textureIn { to { opacity: 1; } }
@keyframes veilLift { 0%, 70% { opacity: 1; } 100% { opacity: 0; visibility: hidden; } }
@keyframes sidebarIn { to { transform: translateX(0); } }
@keyframes titleRise { to { opacity: 1; transform: translateY(0); } }
@keyframes auroraBorder { 0%,100% { background: #b8d4e3; } 33% { background: #d4b8e3; } 66% { background: #b8e3c4; } }
@keyframes borderPulse { 0%,100% { width: 2px; } 50% { width: 5px; } }
@keyframes orbAppear { to { opacity: .26; } }
@keyframes orbDrift { 0%,100% { transform: translate3d(0,0,0) scale(.94); } 45% { transform: translate3d(42px,-28px,0) scale(1.1); } 75% { transform: translate3d(-22px,36px,0) scale(.98); } }

@media (max-width: 768px) {
  .drawer-toggle {
    display: grid;
    place-items: center;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 7;
    width: 54px;
    height: 46px;
    border: 1px solid rgba(196,184,166,.48);
    background: rgba(250,246,240,.72);
    backdrop-filter: blur(8px);
  }
  .drawer-toggle path { fill: none; stroke: #c4b8a6; stroke-width: 2; stroke-linecap: round; }
  .archive-sidebar {
    width: 100vw;
    height: auto;
    min-height: 72vh;
    padding: 82px 28px 30px;
    transform: translateY(-100%);
    transition: transform 420ms ease;
    animation: none;
    backdrop-filter: blur(8px);
    border-right: 0;
    border-bottom: 1px solid rgba(196,184,166,.5);
  }
  .archive-sidebar.open { transform: translateY(0); }
  .chapter-nav { margin-top: 34px; gap: 8px; }
  .sidebar-colophon { margin-top: 32px; }
  .codex-main { margin-left: 0; width: 100vw; padding: 0 24px; }
  .folio { padding: 86px 0 90px; }
  .folio-grid { grid-template-columns: 1fr; gap: 18px; }
  .title-block, .chapter-copy, .marginalia, .pull-quote, .narrow-copy { grid-column: 1; }
  .pull-quote { position: relative; top: auto; margin: 0; }
  .section-rule { left: 24px; right: 24px; }
  .parallel-columns { grid-template-columns: 1fr; }
  .schisma-grid::after { display: none; }
  .fallback-orb { filter: blur(60px); }
  .orb-d, .orb-e { display: none; }
}
