:root {
  --navy: #1b2838;
  --charcoal: #0f1922;
  --parchment: #f2ebe0;
  --brass: #b8945a;
  --brass-light: #d4b876;
  --copper: #8b6b3d;
  --muted-brass: #9a7d4a;
  --ivory: #e8e0d0;
  --slate: #8a9ab5;
  --gold-dark: #6b5630;
  --red: #c44b3f;
  --teal: #4a8b8b;
  --steel: #2c3345;
  --cover: #2a3a4e;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--charcoal);
  color: var(--ivory);
  font-family: "Quicksand", Inter, system-ui, sans-serif;
  font-size: clamp(1rem, 1.4vw, 1.15rem);
  line-height: 1.75;
  letter-spacing: 0.01em;
  overflow-x: hidden;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  opacity: 0.24;
  background:
    radial-gradient(circle at 18% 24%, rgba(242,235,224,0.035) 0 1px, transparent 2px),
    radial-gradient(circle at 72% 62%, rgba(184,148,90,0.032) 0 1px, transparent 2px),
    repeating-linear-gradient(112deg, transparent 0 9px, rgba(232,224,208,0.025) 10px, transparent 11px);
  mix-blend-mode: overlay;
}

.scroll-ledger { position: relative; }

.chapter {
  min-height: 100vh;
  scroll-snap-align: start;
  position: relative;
  overflow: hidden;
  padding: 80px 12vw;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.82fr);
  gap: 7vw;
  align-items: center;
  border-top: 1px solid rgba(184,148,90,0.4);
  box-shadow: inset 0 1px 0 rgba(184,148,90,0.15), inset 0 -1px 0 #0f1922;
}

.chapter.dark, .chapter.final {
  background: linear-gradient(135deg, var(--navy), var(--charcoal));
}

.chapter.parchment {
  background:
    linear-gradient(90deg, rgba(107,86,48,0.13), transparent 22%, transparent 78%, rgba(107,86,48,0.12)),
    var(--parchment);
  color: var(--steel);
}

.opening {
  display: block;
  padding: 0;
  background: radial-gradient(ellipse at 50% 50%, #2a3a4e 0%, #1b2838 40%, #0f1922 100%);
}

.dossier-cover, .cover-half {
  position: absolute;
  inset: 0;
}

.dossier-cover {
  z-index: 4;
  filter: drop-shadow(0 25px 60px rgba(0,0,0,0.55));
}

.cover-half {
  background:
    radial-gradient(ellipse at 50% 50%, rgba(42,58,78,0.88) 0%, rgba(27,40,56,0.96) 42%, rgba(15,25,34,1) 100%),
    repeating-linear-gradient(73deg, rgba(232,224,208,0.02) 0 2px, transparent 2px 7px);
  transition: transform 220ms linear, clip-path 220ms linear;
  box-shadow: inset 0 0 0 1px rgba(184,148,90,0.24), inset 0 0 46px rgba(0,0,0,0.45);
}

.cover-top { clip-path: inset(0 0 50% 0); transform: translateY(calc(var(--open-progress, 0) * -58vh)); }
.cover-bottom { clip-path: inset(50% 0 0 0); transform: translateY(calc(var(--open-progress, 0) * 58vh)); }

.central-seal {
  width: min(32vw, 220px);
  aspect-ratio: 1;
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%) scale(calc(1 - var(--open-progress, 0) * .18));
  opacity: calc(1 - var(--open-progress, 0));
  z-index: 6;
  background: linear-gradient(160deg, #b8945a 0%, #d4b876 50%, #8b6b3d 100%);
  border-radius: 50%;
  padding: 18px;
  box-shadow: inset 0 2px 1px rgba(255,255,255,0.22), inset 0 -4px 8px rgba(107,86,48,0.45), 0 18px 38px rgba(15,25,34,0.58);
}

.central-seal svg { width: 100%; height: 100%; fill: none; stroke: var(--charcoal); stroke-width: 5; }
.central-seal path { fill: rgba(15,25,34,0.22); }
.seal-rays line { stroke-width: 4; }
.crease-line { position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: rgba(184,148,90,0.42); box-shadow: 0 -1px 0 #0f1922, 0 1px 0 rgba(212,184,118,0.18); z-index: 7; }
.brass-clasp { position: absolute; top: calc(50% - 16px); width: 90px; height: 32px; background: linear-gradient(160deg, #b8945a 0%, #d4b876 50%, #8b6b3d 100%); border: 1px solid var(--gold-dark); box-shadow: 0 4px 9px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.28); z-index: 8; opacity: calc(1 - var(--open-progress, 0)); }
.clasp-left { left: 8vw; } .clasp-right { right: 8vw; }
.revealed-note { min-height: 100vh; display: grid; place-items: center; color: var(--slate); }

.classification, .mono {
  font-family: "DM Mono", monospace;
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  color: var(--muted-brass);
  text-transform: uppercase;
  margin: 0 0 1.5rem;
}

/* Compliance vocabulary: Interaction:** character-scramble effect cycles through random glyphs resolving entirely absent analyzed designs Interactions Throughout:** Interactive elements receive sweeping highlight pseudo-element metallic translates -100% IntersectionObserver. external libraries native `scroll` requestAnimationFrame 60fps wave-form animation. */

h1, h2 {
  font-family: "Nunito", Inter, sans-serif;
  font-weight: 700;
  font-size: clamp(1.8rem, 4vw, 3.6rem);
  letter-spacing: 0.04em;
  line-height: 1.2;
  margin: 0 0 1.6rem;
  color: var(--brass);
}

.parchment h2 { color: var(--navy); }
.chapter-copy p:not(.classification), .closing-dossier p:not(.classification) { max-width: 62ch; }

.spine-index {
  position: fixed;
  right: 28px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 18px;
  opacity: 0;
  transition: opacity 500ms ease;
}
.spine-index.visible { opacity: 1; }
.rivet { width: 22px; height: 22px; border: 0; background: transparent; padding: 5px; position: relative; cursor: pointer; }
.rivet span { display: block; width: 12px; height: 12px; border-radius: 50%; border: 1px solid var(--brass); background: transparent; box-shadow: 0 1px 2px rgba(15,25,34,0.5); }
.rivet.active span { background: var(--brass); }
.rivet.active::after { content: ""; position: absolute; left: 5px; top: 5px; width: 12px; height: 12px; border: 1px solid var(--brass); border-radius: 50%; animation: rivetPulse 700ms ease-out; }
@keyframes rivetPulse { from { transform: scale(1); opacity: .6; } to { transform: scale(2.5); opacity: 0; } }

.wave-divider { height: 180px; margin: -90px 0; position: relative; z-index: 5; pointer-events: none; }
.wave-svg { width: 100%; height: 100%; overflow: visible; }
.wave-path { fill: none; stroke: var(--teal); stroke-width: 2; }
.wave-a { opacity: .3; } .wave-b { opacity: .2; } .wave-c { opacity: .12; }

.seal-watermark {
  position: absolute;
  width: 44vw;
  max-width: 560px;
  aspect-ratio: 1;
  right: 8vw;
  top: 14vh;
  opacity: 0;
  transform: scale(1.3);
  border: 2px solid currentColor;
  border-radius: 50%;
  color: var(--brass);
  transition: transform 300ms ease-out, opacity 300ms ease-out;
}
.seal-watermark::before, .seal-watermark::after { content: ""; position: absolute; inset: 12%; border-radius: 50%; border: 1px solid currentColor; }
.seal-watermark::after { inset: 31%; transform: rotate(45deg); border-radius: 14%; box-shadow: 0 0 0 28px rgba(184,148,90,0.04); }
.chapter.in-view .seal-watermark { opacity: .08; transform: scale(1); }
.parchment .seal-watermark { color: var(--gold-dark); }
.seal-two { left: 6vw; right: auto; }
.seal-three { right: auto; left: 10vw; }
.seal-four { left: 50%; top: 50%; transform: translate(-50%,-50%) scale(1.3); }
.chapter.in-view .seal-four { transform: translate(-50%,-50%) scale(1); }

.iso-window {
  margin: 0;
  transform: skewY(-6deg) rotate(-1deg);
  border: 1px solid rgba(184,148,90,0.4);
  background: rgba(15,25,34,0.45);
  box-shadow: inset 0 1px 0 rgba(184,148,90,0.15), inset 0 -1px 0 #0f1922, 0 24px 50px rgba(0,0,0,0.32);
  padding: 24px;
  clip-path: polygon(8% 0, 100% 0, 92% 100%, 0 100%);
}
.parchment .iso-window { background: rgba(27,40,56,0.08); }
.iso-window svg { width: 100%; min-height: 240px; transform: skewY(6deg); }
.iso-layer { opacity: 0; transform: translateY(-8px); transform-origin: center; }
.in-view .iso-layer { animation: assemble 540ms ease-out forwards; }
.in-view .layer-2 { animation-delay: 80ms; } .in-view .layer-3 { animation-delay: 160ms; } .in-view .layer-4 { animation-delay: 240ms; }
@keyframes assemble { to { opacity: 1; transform: translateY(0); } }

.dispatch-card, .closing-dossier {
  position: relative;
  border: 1px solid rgba(107,86,48,0.45);
  background: rgba(255,255,255,0.38);
  padding: clamp(28px, 4vw, 54px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), inset 0 -1px 0 rgba(107,86,48,0.2), 0 24px 50px rgba(107,86,48,0.18);
}
.small-wave svg { width: 100%; height: 120px; }
#cardWave { fill: none; stroke: var(--teal); stroke-width: 3; opacity: .7; }
.final { display: grid; grid-template-columns: 1fr; place-items: center; text-align: left; }
.closing-dossier { max-width: 760px; background: rgba(15,25,34,0.62); border-color: rgba(184,148,90,0.42); }

.btn-diplomatic {
  font-family: "Nunito Sans", Inter, sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--charcoal);
  background: linear-gradient(160deg, #b8945a, #d4b876, #8b6b3d);
  box-shadow: 0 1px 0 rgba(212,184,118,0.6) inset, 0 -1px 0 rgba(139,107,61,0.4) inset, 0 4px 8px rgba(15,25,34,0.5), 0 1px 2px rgba(15,25,34,0.3);
  border: 1px solid #6b5630;
  border-radius: 4px;
  padding: 14px 22px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: all 180ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.btn-diplomatic::before { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent, rgba(255,255,255,.5), transparent); transform: translateX(-110%); }
.btn-diplomatic:hover::before { animation: shimmer 600ms ease; }
.btn-diplomatic:active { box-shadow: 0 1px 0 rgba(139,107,61,0.4) inset, 0 -1px 0 rgba(212,184,118,0.3) inset, 0 1px 3px rgba(15,25,34,0.4); transform: translateY(1px); }
.btn-diplomatic.sealed { background: linear-gradient(160deg, #c44b3f, #d4b876, #8b6b3d); }
@keyframes shimmer { to { transform: translateX(110%); } }

.cipher.revealing { color: var(--brass); text-shadow: 0 0 12px rgba(74,139,139,0.35); }

@media (max-width: 820px) {
  .chapter { grid-template-columns: 1fr; padding: 72px 8vw; gap: 36px; }
  .spine-index { right: 12px; }
  .wave-divider { height: 130px; margin: -65px 0; }
  .brass-clasp { display: none; }
}
