/* ---------- design tokens (default = chapter i) ---------- */
:root {
  --bg: #0a0d14;
  --accent: #7a8fa6;
  --text: #f0e6d2;
  --muted: #5a6470;
  --serif: 'Spectral', 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --transition-tint: 1500ms;
  --transition-line: 600ms;
}

/* ---------- reset ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100vh; min-height: 100dvh; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.7;
  letter-spacing: 0.2px;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  transition: background var(--transition-tint) ease;
}

/* ---------- atmospheric layer ---------- */
body::before {
  /* vignette */
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.4) 100%);
  z-index: 1;
}

body::after {
  /* breathing glow — slow brightness oscillation */
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: rgba(255, 250, 235, 0.015);
  animation: breath 8s ease-in-out infinite;
  z-index: 1;
}

@keyframes breath {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}

/* drifting motes are JS-injected divs; their style: */
.mote {
  position: fixed;
  width: 1px;
  height: 1px;
  background: var(--text);
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
  opacity: 0.1;
  will-change: transform, opacity;
}

/* tap glow */
.tap-glow {
  position: fixed;
  width: 30px;
  height: 30px;
  margin-left: -15px;
  margin-top: -15px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
  pointer-events: none;
  opacity: 0.6;
  z-index: 2;
  animation: tap-fade 800ms ease-out forwards;
}

@keyframes tap-fade {
  to { opacity: 0; transform: scale(2.5); }
}

/* ---------- stage layout ---------- */
#stage {
  position: relative;
  z-index: 5;
  max-width: 640px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

/* ---------- screens (centered, full viewport) ---------- */
.screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
}

.screen-body { max-width: 480px; }

/* ---------- typography ---------- */
.chapter-label {
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--accent);
  font-style: italic;
  font-weight: 400;
  margin: 0 0 24px;
  opacity: 0.85;
  transition: color var(--transition-tint) ease;
}

.chapter-title {
  font-family: var(--serif);
  font-size: 26px;
  line-height: 1.3;
  font-weight: 400;
  letter-spacing: 0.5px;
  color: var(--text);
  margin: 0 0 48px;
}

.section-marker {
  font-size: 11px;
  letter-spacing: 2px;
  font-style: italic;
  color: var(--accent);
  opacity: 0.7;
  margin: 32px 0 16px;
  transition: color var(--transition-tint) ease;
}

p.line {
  margin: 0 0 1.2em;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity var(--transition-line) ease, transform var(--transition-line) ease;
}

p.line.in {
  opacity: 1;
  transform: none;
}

p.thesis {
  font-style: italic;
  color: var(--accent);
  margin-top: 1.6em;
}

p.line.italic-line {
  font-style: italic;
  color: var(--accent);
  opacity: 0.95;
}

/* ---------- chapter page transitions ---------- */
.chapter-page {
  opacity: 0;
  transition: opacity 800ms ease;
}
.chapter-page.in {
  opacity: 1;
}
.chapter-page.out {
  opacity: 0;
  transition: opacity 600ms ease;
}

/* ---------- continue button ---------- */
.continue-wrap {
  text-align: center;
  margin: 60px 0 40px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 1000ms ease, transform 1000ms ease;
}
.continue-wrap.in {
  opacity: 1;
  transform: none;
}
.continue-btn {
  padding: 14px 32px;
  background: transparent;
  border: 1px solid var(--accent);
  border-radius: 28px;
  color: var(--accent);
  font-family: inherit;
  font-size: 14px;
  font-style: italic;
  letter-spacing: 1px;
  cursor: pointer;
  transition: background 300ms ease, color 300ms ease;
}
.continue-btn:hover, .continue-btn:active {
  background: var(--accent);
  color: var(--bg);
}

.back-btn {
  padding: 12px 22px;
  margin-right: 14px;
  background: transparent;
  border: 0;
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  font-style: italic;
  letter-spacing: 1px;
  cursor: pointer;
  transition: color 300ms ease;
}
.back-btn:hover, .back-btn:active {
  color: var(--accent);
}

.gift-image {
  margin: 1.6em 0;
  text-align: center;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity var(--transition-line) ease, transform var(--transition-line) ease;
}
.gift-image.in {
  opacity: 1;
  transform: none;
}
.gift-image img {
  max-width: 100%;
  border-radius: 8px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.5);
}

.gift-link {
  margin: 1.6em 0;
  text-align: center;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity var(--transition-line) ease, transform var(--transition-line) ease;
}
.gift-link.in {
  opacity: 1;
  transform: none;
}
.gift-link a {
  display: inline-block;
  padding: 14px 28px;
  border: 1px solid var(--accent);
  border-radius: 28px;
  color: var(--accent);
  text-decoration: none;
  font-style: italic;
  font-size: 15px;
  letter-spacing: 0.5px;
  transition: background 300ms ease, color 300ms ease;
}
.gift-link a:hover, .gift-link a:active {
  background: var(--accent);
  color: var(--bg);
}

/* ---------- ritual ---------- */
.ritual-trail .ritual-q {
  margin-bottom: 18px;
  opacity: 0.3;
}

.ritual-active .ritual-q-text {
  font-size: 18px;
  font-style: italic;
  margin-bottom: 18px;
  color: var(--text);
}

.ritual-input {
  display: block;
  width: 60%;
  max-width: 280px;
  margin: 0 auto;
  padding: 6px 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--muted);
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
  text-align: center;
  outline: none;
}

.ritual-input:focus { border-color: var(--accent); }

.ritual-counter {
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 32px;
}

.ritual-error {
  margin-top: 24px;
  font-style: italic;
  color: #c47a85;
  font-size: 14px;
}

/* ---------- locked card (chapter xv) ---------- */
.locked-card {
  margin-top: 60px;
  padding: 32px 24px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  text-align: center;
  opacity: 0.85;
}

.locked-card .label {
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

.locked-card .countdown {
  font-family: var(--serif);
  font-size: 22px;
  font-style: italic;
  color: var(--text);
}

/* ---------- accessibility ---------- */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
  body::after { display: none; }
  .mote { display: none; }
  p.line { opacity: 1; transform: none; }
}
