:root {
  --night: #06101c;
  --night-deep: #03070d;
  --ivory: #f2eadf;
  --ivory-dim: #b9b1a6;
  --gold: #bb946b;
  --gold-hot: #ddb88f;
  --blue: #2f6f9f;
  --serif: "Songti SC", "STSong", "SimSun", "Times New Roman", serif;
  --sans: "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--night-deep); scroll-behavior: auto; }
body {
  background: var(--night-deep);
  color: var(--ivory);
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

#loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  background: var(--night-deep);
  transition: opacity .8s ease, visibility .8s ease;
}
#loader.gone { opacity: 0; visibility: hidden; pointer-events: none; }
#loader p {
  font-family: var(--sans);
  color: var(--ivory-dim);
  font-size: 11px;
  letter-spacing: .48em;
  text-indent: .48em;
}
#loader strong { color: var(--gold-hot); font: 300 24px/1 var(--serif); letter-spacing: .08em; }
#loader small { font-size: 10px; margin-left: 4px; }
.loader-orbit { width: 62px; height: 62px; position: relative; animation: orbit 5s linear infinite; }
.loader-orbit i { position: absolute; inset: 0; border: 1px solid rgba(221,184,143,.22); border-radius: 50%; }
.loader-orbit i:nth-child(2) { inset: 10px; border-color: rgba(221,184,143,.48); }
.loader-orbit i:nth-child(3) { inset: 25px; background: var(--gold-hot); border: 0; }
@keyframes orbit { to { rotate: 360deg; } }

.chrome {
  position: fixed;
  z-index: 30;
  inset: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 26px 34px;
  pointer-events: none;
}
.brand, .chapters a {
  color: var(--ivory);
  text-decoration: none;
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: .28em;
  text-shadow: 0 2px 16px rgba(0,0,0,.65);
}
.brand { pointer-events: auto; }
.brand i { display: inline-block; width: 22px; height: 1px; margin: 0 9px 3px 6px; background: var(--gold); }
.chapters { pointer-events: auto; display: flex; gap: 28px; }
.chapters a { color: rgba(242,234,223,.67); transition: color .25s ease; }
.chapters a:hover { color: var(--gold-hot); }

#global-progress {
  position: fixed;
  z-index: 32;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gold-hot);
  transform: scaleX(0);
  transform-origin: left center;
}

.telemetry {
  position: fixed;
  z-index: 28;
  right: 34px;
  bottom: 28px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--sans);
  text-shadow: 0 2px 16px rgba(0,0,0,.8);
}
.telemetry span {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  border: 1px solid rgba(221,184,143,.72);
  color: var(--gold-hot);
  font-family: var(--serif);
  font-size: 18px;
}
.telemetry b { color: rgba(242,234,223,.62); font-size: 10px; font-weight: 400; letter-spacing: .18em; }

.cinematic { position: relative; height: 900vh; }
.sticky { position: sticky; top: 0; height: 100vh; overflow: hidden; background: var(--night); }
.sticky canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(3,7,13,.62) 0%, rgba(3,7,13,.16) 36%, transparent 60%),
    linear-gradient(180deg, rgba(3,7,13,.18), transparent 22%, transparent 76%, rgba(3,7,13,.32));
}
.grain {
  position: absolute;
  inset: -20%;
  pointer-events: none;
  opacity: .055;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.65'/%3E%3C/svg%3E");
}

.chapter-block {
  position: absolute;
  z-index: 6;
  left: 7vw;
  top: 28vh;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  opacity: 0;
  color: var(--ivory);
  will-change: opacity, transform;
  text-shadow: 0 2px 26px rgba(0,0,0,.78);
}
.chapter-block.hero { top: 21vh; }
.eyebrow, .chapter-no {
  margin-bottom: 18px;
  color: var(--gold-hot);
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: .5em;
}
.hero h1 {
  font-size: clamp(94px, 13vw, 188px);
  font-weight: 400;
  line-height: .9;
  letter-spacing: -.05em;
}
.hero h1 span { color: var(--gold-hot); }
.hero p { margin-top: 28px; font-size: clamp(17px, 1.6vw, 23px); letter-spacing: .2em; }
.hero em {
  margin-top: 28px;
  color: rgba(242,234,223,.62);
  font-family: var(--sans);
  font-size: 10px;
  font-style: normal;
  letter-spacing: .36em;
}
.chapter-block h2 { font-size: clamp(92px, 12vw, 164px); font-weight: 400; line-height: .88; color: var(--gold-hot); }
.chapter-block p { margin-top: 24px; font-size: clamp(15px, 1.45vw, 21px); line-height: 1.8; letter-spacing: .16em; }
.chapter-block.right { left: auto; right: 7vw; top: 22vh; align-items: flex-end; text-align: right; }
.chapter-block.low { top: auto; bottom: 14vh; }
.chapter-block.core { top: 17vh; }

.scroll-hint {
  position: absolute;
  z-index: 7;
  left: 7vw;
  bottom: 34px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(242,234,223,.48);
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: .34em;
  transition: opacity .5s ease;
}
.scroll-hint span { width: 32px; height: 1px; background: var(--gold); animation: breathe 2s ease-in-out infinite; }
@keyframes breathe { 50% { width: 55px; opacity: .35; } }

.outro {
  min-height: 88vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 80px 24px;
  text-align: center;
  background:
    radial-gradient(circle at 50% 35%, rgba(66,45,29,.25), transparent 28%),
    var(--night-deep);
}
.outro-mark {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border: 1px solid var(--gold);
  color: var(--gold-hot);
  font-size: 34px;
}
.outro-title { font-size: clamp(20px, 2.6vw, 34px); letter-spacing: .22em; text-indent: .22em; }
.colophon, .disclaimer { max-width: 780px; color: rgba(242,234,223,.45); font-family: var(--sans); font-size: 10px; line-height: 2; letter-spacing: .17em; }
.disclaimer { margin-top: -16px; color: rgba(242,234,223,.28); }
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 1s ease, transform 1s ease; }
.reveal.in { opacity: 1; transform: none; }

@media (max-width: 700px) {
  .chrome { padding: 20px; }
  .chapters { gap: 17px; }
  .chapters a { font-size: 10px; }
  .telemetry { right: 20px; bottom: 18px; }
  .chapter-block, .chapter-block.hero, .chapter-block.core { left: 8vw; top: 20vh; }
  .chapter-block.right { left: auto; right: 8vw; top: 18vh; }
  .chapter-block.low { top: auto; bottom: 18vh; }
  .hero h1 { font-size: 92px; }
  .chapter-block h2 { font-size: 88px; }
  .scroll-hint { left: 8vw; }
  .shade { background: linear-gradient(180deg, rgba(3,7,13,.40), transparent 34%, transparent 70%, rgba(3,7,13,.38)); }
}

@media (prefers-reduced-motion: reduce) {
  .loader-orbit, .scroll-hint span { animation: none; }
}
