/* ═══════════════════════════════════════════════════════════
   MONOLITH — a museum of impossible objects
   void / bone / iridescence
   ═══════════════════════════════════════════════════════════ */

:root {
  --void: #050508;
  --bone: #E8E4DA;
  --bone-dim: rgba(232, 228, 218, 0.55);
  --iris: #9FB8FF;
  --display: "Italiana", serif;
  --body-f: "Spectral", serif;
  --mono-f: "IBM Plex Mono", monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

html, body { overflow-x: clip; }
body {
  background: var(--void);
  color: var(--bone);
  font-family: var(--body-f);
}

::selection { background: var(--iris); color: var(--void); }

:focus-visible {
  outline: 1px solid var(--bone);
  outline-offset: 4px;
}

.mono {
  font-family: var(--mono-f);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--bone-dim);
}

/* ── canvas & veil ─────────────────────────── */
#gl {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  display: block;
  z-index: 0;
}
.veil {
  position: fixed; inset: 0;
  background: var(--void);
  z-index: 5;
  pointer-events: none;
  transition: opacity 2.2s ease 0.3s;
}
body.ready .veil { opacity: 0; }

/* grain */
body::after {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 6;
  opacity: 0.5;
  background: url("noise.png");
  background-size: 128px 128px;
  mix-blend-mode: overlay;
}

/* ── chrome ────────────────────────────────── */
.chrome {
  position: fixed; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px clamp(20px, 4vw, 48px);
  z-index: 10;
  pointer-events: none;
}
.chrome--top { top: 0; }
.chrome--bottom { bottom: 0; gap: 24px; }

.wordmark {
  font-family: var(--display);
  font-size: 19px;
  letter-spacing: 0.42em;
  color: var(--bone);
}

.progress {
  flex: 1;
  height: 1px;
  background: rgba(232, 228, 218, 0.18);
  position: relative;
}
.progress__fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 0%;
  background: var(--bone);
  box-shadow: 0 0 8px rgba(232, 228, 218, 0.8);
}
#chapterNum { min-width: 3ch; text-align: right; }
#chapterLabel { min-width: 18ch; }
@media (max-width: 720px) {
  #chapterLabel { min-width: 0; }
  .chrome__cat { display: none; }
}

/* ── chapters ──────────────────────────────── */
main { position: relative; z-index: 2; }

.ch {
  min-height: 130vh;
  display: flex;
  align-items: center;
  padding: 0 clamp(20px, 6vw, 90px);
}
.ch--intro, .ch--outro { min-height: 100vh; }

.ch__inner {
  max-width: 480px;
  opacity: 0;
  transform: translateY(50px);
  transition: opacity 1.4s cubic-bezier(0.2, 0.6, 0.2, 1), transform 1.4s cubic-bezier(0.2, 0.6, 0.2, 1);
  position: relative;
  padding: 34px 0;
}
/* soft scrim so type stays legible over bright surfaces */
.ch__inner::before {
  content: "";
  position: absolute;
  inset: -8% -14%;
  background: radial-gradient(ellipse at 50% 50%, rgba(5, 5, 8, 0.62), rgba(5, 5, 8, 0.30) 55%, transparent 75%);
  z-index: -1;
  filter: blur(2px);
}
.ch.in-view .ch__inner { opacity: 1; transform: translateY(0); }
.ch__inner--right { margin-left: auto; }
.ch__inner--center { margin: 0 auto; text-align: center; }

.kicker { margin-bottom: 26px; }

.title {
  font-family: var(--display);
  font-size: clamp(3rem, 7.5vw, 6.2rem);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: 0.02em;
  margin-bottom: 34px;
}
.title__em { font-style: italic; font-family: var(--body-f); font-weight: 200; letter-spacing: 0; }

.body {
  font-size: clamp(1rem, 1.35vw, 1.18rem);
  font-weight: 300;
  line-height: 1.85;
  color: var(--bone-dim);
  max-width: 44ch;
}
.body em { color: var(--bone); font-style: italic; }
.ch__inner--center .body { margin: 0 auto; }
.body--outro { font-size: clamp(1.1rem, 1.6vw, 1.4rem); }

.ch__roman {
  display: block;
  font-family: var(--display);
  font-size: clamp(6rem, 14vw, 12rem);
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1px rgba(232, 228, 218, 0.35);
  margin-bottom: 8px;
}

.ch__name {
  font-family: var(--display);
  font-size: clamp(2.2rem, 4.5vw, 3.6rem);
  font-weight: 400;
  letter-spacing: 0.06em;
  margin-bottom: 26px;
}

.spec {
  margin-top: 30px;
  padding-top: 14px;
  border-top: 1px solid rgba(232, 228, 218, 0.15);
  width: fit-content;
}
.ch__inner--center .spec { margin-inline: auto; }

/* ── scroll cue ────────────────────────────── */
.scrollcue {
  margin-top: 64px;
  display: flex; flex-direction: column; gap: 14px;
  align-items: flex-start;
}
.scrollcue__line {
  width: 1px; height: 56px;
  background: linear-gradient(var(--bone), transparent);
  animation: cue 2.2s ease-in-out infinite;
  transform-origin: top;
}
@keyframes cue {
  0% { transform: scaleY(0); opacity: 0; }
  40% { transform: scaleY(1); opacity: 1; }
  100% { transform: scaleY(1) translateY(24px); opacity: 0; }
}

/* ── colophon ──────────────────────────────── */
.colophon {
  margin-top: 70px;
  display: flex; flex-direction: column; gap: 12px;
  line-height: 1.8;
}

/* ── fallback ──────────────────────────────── */
.nogl[hidden] { display: none; }
.nogl {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  background: radial-gradient(ellipse at 50% 40%, #14141f, var(--void));
  z-index: 4;
  font-style: italic;
  color: var(--bone-dim);
  padding: 24px; text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .ch__inner { transition-duration: 0.01ms; }
  .scrollcue__line { animation: none; }
  .veil { transition-duration: 0.4s; }
}
