:root {
  --burgundy-black: #17070D;
  --oxblood-lacquer: #4A0F1F;
  --velvet-wine: #751D35;
  --antique-gold: #D6A84F;
  --mist-parchment: #F1E4CF;
  --alpine-mauve: #9B7AA0;
  --cold-summit-blue: #B8D5E8;
  --display: "Bebas Neue", "Arial Narrow", sans-serif;
  --serif: "Cormorant Garamond", Georgia, serif;
  --mono: "IBM Plex Mono", "Space Mono", monospace;
  --space: "Space Grotesk", "Inter", sans-serif;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: #17070D;
}

body {
  margin: 0;
  color: #F1E4CF;
  background:
    radial-gradient(circle at 72% 12%, rgba(184, 213, 232, 0.13), transparent 24rem),
    radial-gradient(circle at 18% 28%, rgba(155, 122, 160, 0.22), transparent 32rem),
    linear-gradient(180deg, #17070D 0%, #4A0F1F 48%, #17070D 100%);
  font-family: var(--serif);
  overflow-x: hidden;
}

.leather-field,
.leather-field::before,
.leather-field::after {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.leather-field {
  z-index: -4;
  background:
    radial-gradient(circle at 20% 30%, rgba(241, 228, 207, 0.045) 0 1px, transparent 2px 7px),
    radial-gradient(circle at 70% 50%, rgba(214, 168, 79, 0.04) 0 1px, transparent 2px 9px),
    repeating-linear-gradient(112deg, rgba(241, 228, 207, 0.026) 0 1px, transparent 1px 8px),
    linear-gradient(135deg, #17070D, #4A0F1F 44%, #751D35 70%, #17070D);
}

.leather-field::before {
  content: "";
  opacity: 0.44;
  mix-blend-mode: overlay;
  background:
    repeating-linear-gradient(23deg, transparent 0 22px, rgba(0,0,0,0.32) 23px, transparent 25px),
    repeating-linear-gradient(157deg, transparent 0 36px, rgba(241,228,207,0.04) 37px, transparent 39px);
}

.leather-field::after {
  content: "";
  border-left: 1px solid rgba(214, 168, 79, 0.18);
  border-right: 1px solid rgba(214, 168, 79, 0.18);
  box-shadow: inset 0 0 80px rgba(0,0,0,0.62), inset 50vw 0 90px -88px rgba(214,168,79,0.35);
}

.fog {
  position: fixed;
  inset: auto -20vw 6vh -20vw;
  height: 42vh;
  pointer-events: none;
  z-index: 8;
  opacity: 0.22;
  filter: blur(18px);
  background: linear-gradient(90deg, transparent, rgba(155, 122, 160, 0.55), rgba(184, 213, 232, 0.22), transparent);
  animation: driftFog 24s linear infinite alternate;
}

.fog-two {
  top: 8vh;
  bottom: auto;
  opacity: 0.15;
  animation-duration: 31s;
  animation-direction: alternate-reverse;
}

.cursor-glint {
  position: fixed;
  width: 18rem;
  height: 18rem;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 7;
  opacity: 0.24;
  background: radial-gradient(circle, rgba(214,168,79,0.18), transparent 63%);
}

.folio-header {
  position: fixed;
  z-index: 20;
  top: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: 5rem 1fr auto;
  gap: 1.4rem;
  align-items: center;
  padding: 1.1rem 2rem;
  font-family: var(--mono);
  color: rgba(241, 228, 207, 0.78);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.68rem;
}

.header-mark {
  font-family: var(--display);
  font-size: 1.75rem;
  color: #D6A84F;
  letter-spacing: 0.04em;
}

.header-rule {
  height: 1px;
  background: linear-gradient(90deg, rgba(214,168,79,0.9), transparent);
}

.spread {
  position: relative;
  min-height: 100vh;
  display: grid;
  grid-template-columns: repeat(14, minmax(0, 1fr));
  grid-template-rows: minmax(5rem, 13vh) 1fr minmax(6rem, 15vh);
  column-gap: 1.15vw;
  padding: 6.8rem clamp(1.25rem, 4vw, 4.5rem) 4.5rem;
  isolation: isolate;
  overflow: hidden;
}

.spread::before {
  content: "";
  position: absolute;
  inset: 5.7rem clamp(0.8rem, 2.3vw, 2.6rem) 2rem;
  z-index: -2;
  background:
    linear-gradient(90deg, rgba(23,7,13,0.2), rgba(241,228,207,0.04) 49.8%, rgba(0,0,0,0.42) 50%, rgba(74,15,31,0.22)),
    radial-gradient(circle at 50% 50%, rgba(214,168,79,0.08), transparent 26rem);
  border: 1px solid rgba(214, 168, 79, 0.16);
  box-shadow: 0 2rem 7rem rgba(0,0,0,0.38), inset 0 0 4rem rgba(0,0,0,0.36);
}

.spread::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgba(214,168,79,0.07), transparent 18rem);
  opacity: 0.88;
}

.chapter-number {
  grid-column: 1 / 3;
  grid-row: 1;
  align-self: end;
  font-family: var(--display);
  font-size: clamp(5rem, 12vw, 12rem);
  line-height: 0.75;
  color: rgba(214, 168, 79, 0.18);
  text-shadow: 0 0 24px rgba(214,168,79,0.11);
}

.rotated-title {
  position: absolute;
  left: 1.1rem;
  top: 50%;
  margin: 0;
  transform: translateY(-50%) rotate(-90deg);
  transform-origin: left center;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.42em;
  color: rgba(214, 168, 79, 0.66);
  text-transform: uppercase;
}

.title-plate {
  grid-column: 2 / 9;
  grid-row: 2;
  align-self: center;
  transform: translateX(-6vw);
  opacity: 0;
  transition: transform 1.35s cubic-bezier(.19,1,.22,1), opacity 1.2s ease;
}

.spread.active .title-plate { transform: translateX(0); opacity: 1; }

.plate-right {
  grid-column: 7 / 14;
  text-align: right;
  transform: translateX(6vw);
}

.kicker,
.caption,
.annotation,
.code-fragment,
.marginal-note {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.kicker {
  display: inline-block;
  color: #D6A84F;
  font-size: clamp(0.68rem, 1vw, 0.86rem);
  margin-bottom: 0.6rem;
}

h1, h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  color: #F1E4CF;
  font-size: clamp(6.6rem, 18vw, 18rem);
  line-height: 0.78;
  letter-spacing: -0.035em;
  text-shadow: 0 1.2rem 3rem rgba(0,0,0,0.45), 0 0 1px #D6A84F;
}

.essay-column {
  grid-column: 10 / 14;
  grid-row: 2;
  align-self: center;
  max-width: 29rem;
  padding: 1.8rem 0 1.8rem 1.4rem;
  border-left: 1px solid rgba(214, 168, 79, 0.45);
  color: rgba(241, 228, 207, 0.86);
  font-size: clamp(1.15rem, 1.7vw, 1.58rem);
  line-height: 1.45;
  opacity: 0;
  transform: translateY(2rem);
  transition: transform 1.35s ease 0.22s, opacity 1.35s ease 0.22s;
}

.spread.active .essay-column { opacity: 1; transform: translateY(0); }

.column-left {
  grid-column: 2 / 6;
  border-left: 0;
  border-right: 1px solid rgba(214, 168, 79, 0.45);
  padding-left: 0;
  padding-right: 1.4rem;
}

.essay-drop {
  font-size: clamp(1.65rem, 2.6vw, 2.55rem);
  line-height: 1.05;
  color: #F1E4CF;
  margin-top: 0;
}

.caption,
.annotation,
.code-fragment {
  font-size: 0.72rem;
  line-height: 1.65;
  color: rgba(184, 213, 232, 0.78);
}

.note-hover,
.marginal-note {
  color: #D6A84F;
  cursor: pointer;
}

.marginal-note {
  border: 1px solid rgba(214,168,79,0.38);
  background: rgba(23,7,13,0.22);
  padding: 0.7rem 0.9rem;
  font-size: 0.68rem;
}

.sigil-wrap {
  grid-column: 8 / 12;
  grid-row: 2;
  align-self: start;
  justify-self: center;
  width: min(28vw, 18rem);
  opacity: 0.86;
}

.summit-sigil { overflow: visible; filter: drop-shadow(0 0 18px rgba(214,168,79,0.22)); }
.sigil-line, .sigil-dot {
  fill: none;
  stroke: #D6A84F;
  stroke-width: 1.2;
  stroke-dasharray: 620;
  stroke-dashoffset: 620;
  animation: drawSigil 5.5s ease-in-out infinite;
}
.sigil-dot { fill: #D6A84F; stroke-width: 0; animation: pulseDot 5.5s ease-in-out infinite; }

.mountain {
  position: absolute;
  left: -4vw;
  right: -4vw;
  bottom: -4rem;
  width: 108vw;
  height: 45vh;
  z-index: -1;
  fill: rgba(23, 7, 13, 0.82);
  stroke: rgba(214,168,79,0.2);
  stroke-width: 1;
  transform: translateY(var(--parallax, 0));
  transition: transform 0.2s linear;
}

.mountain-b { fill: rgba(74, 15, 31, 0.76); bottom: -2rem; }
.mountain-c { fill: rgba(23, 7, 13, 0.88); height: 52vh; }
.snow { fill: rgba(184, 213, 232, 0.34); stroke: rgba(184,213,232,0.4); }

.route-line {
  position: absolute;
  top: 43%;
  left: 28%;
  width: 36vw;
  height: 1px;
  background: linear-gradient(90deg, transparent, #D6A84F, transparent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.9s ease;
}
.route-line.lit { transform: scaleX(1); }

.map-panel {
  grid-column: 6 / 12;
  grid-row: 2;
  align-self: center;
  position: relative;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(155,122,160,0.12), transparent 68%);
}

.topography {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: rgba(214, 168, 79, 0.44);
  stroke-width: 1.1;
}

.compass-arc {
  position: absolute;
  inset: 10%;
  border: 1px solid rgba(184,213,232,0.2);
  border-left-color: transparent;
  border-bottom-color: transparent;
  border-radius: 50%;
  animation: compassTurn 18s linear infinite;
}

.tick { position: absolute; width: 5rem; height: 1px; background: #D6A84F; opacity: 0.46; transform-origin: center; }
.tick-one { top: 21%; left: 8%; transform: rotate(18deg); }
.tick-two { right: 10%; top: 42%; transform: rotate(-32deg); }
.tick-three { bottom: 24%; left: 33%; transform: rotate(61deg); }

.stitch-line {
  position: absolute;
  left: 33vw;
  right: 20vw;
  top: 58%;
  display: flex;
  justify-content: space-between;
  opacity: 0.28;
  transition: opacity 0.8s ease, filter 0.8s ease;
}
.stitch-line span { width: 9%; height: 2px; background: #D6A84F; transform: rotate(-8deg); }
.stitch-line.lit { opacity: 1; filter: drop-shadow(0 0 9px #D6A84F); }

.ember-panel {
  grid-column: 8 / 13;
  grid-row: 2;
  position: relative;
  align-self: center;
  min-height: 55vh;
  border: 1px solid rgba(214,168,79,0.2);
  background: radial-gradient(circle at 50% 68%, rgba(214,168,79,0.27), rgba(117,29,53,0.24) 28%, transparent 62%);
  box-shadow: inset 0 0 4rem rgba(0,0,0,0.36);
}
.ember { position: absolute; bottom: 18%; width: 0.35rem; height: 0.35rem; border-radius: 50%; background: #D6A84F; animation: emberRise 7s ease-in infinite; }
.ember:nth-child(1) { left: 36%; animation-delay: 0s; }
.ember:nth-child(2) { left: 48%; animation-delay: 1.6s; }
.ember:nth-child(3) { left: 61%; animation-delay: 3.3s; }
.ember:nth-child(4) { left: 55%; animation-delay: 4.8s; }

.fold-shadow {
  position: absolute;
  top: 10vh;
  bottom: 8vh;
  left: 50%;
  width: 1px;
  background: linear-gradient(180deg, transparent, rgba(214,168,79,0.35), transparent);
  box-shadow: 0 0 4rem 1rem rgba(0,0,0,0.38);
}

.signal-orbit {
  grid-column: 7 / 12;
  grid-row: 2;
  align-self: center;
  justify-self: center;
  position: relative;
  width: min(38vw, 32rem);
  aspect-ratio: 1;
}
.orbit-ring { position: absolute; inset: 10%; border: 1px solid rgba(184,213,232,0.3); border-radius: 50%; box-shadow: 0 0 35px rgba(184,213,232,0.12); }
.lantern { position: absolute; width: 0.7rem; height: 0.7rem; border-radius: 50%; background: #B8D5E8; box-shadow: 0 0 24px #B8D5E8; animation: lanternBlink 4.8s ease-in-out infinite; }
.lantern-one { top: 18%; left: 47%; }
.lantern-two { top: 56%; right: 17%; animation-delay: 1.3s; }
.lantern-three { bottom: 14%; left: 28%; animation-delay: 2.7s; }

.closing-plate { grid-column: 2 / 10; }
.closing-column { grid-column: 9 / 14; }
.closing-glyphs {
  grid-column: 2 / 14;
  grid-row: 3;
  align-self: center;
  display: flex;
  justify-content: space-around;
  font-family: var(--space);
  font-size: clamp(2rem, 5vw, 5rem);
  color: rgba(214,168,79,0.34);
}

.chapter-nav {
  position: fixed;
  right: 1.4rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 25;
  display: grid;
  gap: 0.7rem;
}
.chapter-nav button {
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid rgba(214,168,79,0.35);
  background: rgba(23,7,13,0.45);
  color: rgba(241,228,207,0.66);
  font-family: var(--mono);
  cursor: pointer;
}
.chapter-nav button.active,
.chapter-nav button:hover { color: #17070D; background: #D6A84F; }

@keyframes drawSigil { 0% { stroke-dashoffset: 620; opacity: 0; } 25%, 65% { stroke-dashoffset: 0; opacity: 1; } 100% { stroke-dashoffset: -620; opacity: 0; } }
@keyframes pulseDot { 0%, 100% { opacity: 0; transform: scale(0.6); transform-origin: center; } 42%, 66% { opacity: 1; transform: scale(1.3); transform-origin: center; } }
@keyframes driftFog { from { transform: translateX(-7vw); } to { transform: translateX(7vw); } }
@keyframes compassTurn { to { transform: rotate(360deg); } }
@keyframes emberRise { 0% { transform: translateY(0) scale(0.7); opacity: 0; } 18% { opacity: 1; } 100% { transform: translateY(-34vh) scale(0.12); opacity: 0; } }
@keyframes lanternBlink { 0%, 100% { opacity: 0.38; transform: scale(0.8); } 45% { opacity: 1; transform: scale(1.2); } }

@media (max-width: 860px) {
  .folio-header { grid-template-columns: auto 1fr; padding: 0.9rem 1rem; }
  .header-coordinates { display: none; }
  .spread { grid-template-columns: repeat(6, 1fr); padding: 5.5rem 1.1rem 3rem; }
  .chapter-number { grid-column: 1 / 3; font-size: 5rem; }
  .title-plate, .plate-right, .closing-plate { grid-column: 1 / 7; grid-row: 2; text-align: left; }
  h1, h2 { font-size: clamp(5.4rem, 27vw, 9rem); }
  .essay-column, .column-left, .closing-column { grid-column: 1 / 7; grid-row: 3; border-left: 1px solid rgba(214,168,79,0.45); border-right: 0; padding-left: 1rem; padding-right: 0; align-self: start; }
  .sigil-wrap, .map-panel, .signal-orbit, .ember-panel { grid-column: 2 / 6; grid-row: 2; opacity: 0.42; }
  .chapter-nav { right: 0.5rem; }
  .rotated-title { display: none; }
}
