/* ============================================================
   codex.css
   The Codex Aion — twelve declarations, inscribed in the form
   of an ancient royal text. Long-form reading. Quiet. Slow.
   ============================================================ */

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

html, body {
  width: 100%;
  background: var(--void);
  color: var(--bone);
  font-family: var(--font-display);
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
  scroll-behavior: smooth;
}

a { color: inherit; text-decoration: none; }

/* ── Atmospheric backdrop ─────────────────────────────── */

.codex-atmosphere {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 10%,
      rgba(60, 36, 18, 0.20) 0%,
      transparent 60%),
    radial-gradient(ellipse at 50% 90%,
      rgba(20, 12, 30, 0.30) 0%,
      transparent 65%),
    var(--void);
}

/* Subtle grain over the whole document */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.04;
  mix-blend-mode: screen;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.92' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ── Header ──────────────────────────────────────────── */

.codex-header {
  position: relative;
  z-index: 2;
  padding: 60px 24px 40px;
  text-align: center;
}

.codex-back {
  display: inline-block;
  margin-bottom: 80px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 200;
  letter-spacing: 0.32em;
  color: var(--bone-faint);
  transition: color 0.4s ease, letter-spacing 0.4s ease;
}
.codex-back:hover { color: var(--bone); letter-spacing: 0.40em; }

.codex-title h1 {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(36px, 6vw, 56px);
  letter-spacing: 0.6em;
  padding-left: 0.6em;
  color: var(--bone);
  margin-bottom: 18px;
}

.codex-subtitle {
  font-family: var(--font-cuneiform);
  font-size: clamp(14px, 1.6vw, 18px);
  letter-spacing: 0.2em;
  color: var(--gold-soft);
  margin-bottom: 14px;
}

.codex-meta {
  font-family: var(--font-mono);
  font-weight: 200;
  font-size: 10px;
  letter-spacing: 0.36em;
  color: var(--bone-faint);
  text-transform: uppercase;
}

/* ── The scroll · twelve stanzas ──────────────────────── */

.codex-scroll {
  position: relative;
  z-index: 2;
  max-width: 720px;
  margin: 0 auto;
  padding: 80px 32px 120px;
}

.codex-stanza {
  margin-bottom: 80px;
  position: relative;
  padding-left: 80px;
}
.codex-stanza:last-child { margin-bottom: 0; }

.codex-numeral {
  position: absolute;
  left: 0;
  top: 4px;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: 28px;
  letter-spacing: 0.06em;
  color: var(--gold);
  text-shadow: 0 0 12px var(--gold-soft);
  width: 60px;
  text-align: right;
}

.codex-stanza-title {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: 22px;
  letter-spacing: 0.10em;
  color: var(--bone);
  margin-bottom: 10px;
}

.codex-cu {
  font-family: var(--font-cuneiform);
  font-weight: 400;
  font-size: 17px;
  letter-spacing: 0.18em;
  color: var(--gold-soft);
  margin-bottom: 16px;
}

.codex-text {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: 17px;
  letter-spacing: 0.02em;
  line-height: 1.85;
  color: rgba(237, 232, 216, 0.84);
}
.codex-text em       { font-style: italic; color: var(--bone); }
.codex-text strong   { font-weight: 500; color: var(--bone); }
.codex-text code     { font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.04em; color: var(--gold); padding: 2px 6px; background: var(--gold-trace); border: 1px solid var(--gold-soft); word-break: break-all; }
.codex-mute          { color: var(--bone-faint); font-size: 0.86em; }
.codex-const         { font-family: var(--font-display); font-style: italic; color: var(--gold); font-weight: 400; }

.codex-invitation {
  font-style: italic;
  font-size: 19px;
  color: var(--bone);
  border-left: 1px solid var(--gold-soft);
  padding-left: 24px;
  margin-top: 8px;
}

/* ── Footer ──────────────────────────────────────────── */

.codex-footer {
  position: relative;
  z-index: 2;
  padding: 60px 24px 80px;
  text-align: center;
  border-top: 1px solid var(--bone-trace);
  margin-top: 40px;
}

.codex-footer-mark {
  display: grid;
  place-items: center;
  margin: 0 auto 24px;
  width: 64px;
  height: 64px;
  opacity: 0.7;
}
.codex-footer-mark .tomb-mark {
  width: 100%;
  height: 100%;
}

.codex-footer-text {
  font-family: var(--font-mono);
  font-weight: 200;
  font-size: 10px;
  letter-spacing: 0.30em;
  text-transform: uppercase;
  color: var(--bone-dim);
  line-height: 2.0;
}

/* ── Responsive ──────────────────────────────────────── */

@media (max-width: 720px) {
  .codex-header { padding: 40px 20px 30px; }
  .codex-back { margin-bottom: 50px; }
  .codex-title h1 { font-size: 32px; letter-spacing: 0.4em; padding-left: 0.4em; }
  .codex-scroll { padding: 50px 22px 80px; }
  .codex-stanza { padding-left: 0; margin-bottom: 60px; }
  .codex-numeral {
    position: relative;
    width: auto;
    text-align: left;
    margin-bottom: 8px;
    font-size: 22px;
  }
  .codex-stanza-title { font-size: 18px; }
  .codex-text { font-size: 15px; line-height: 1.8; }
  .codex-cu { font-size: 14px; }
  .codex-invitation { font-size: 16px; padding-left: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
