/* For Angelina — refined midnight experience */

:root {
  --bg: #05070f;
  --gold: #e0c9a0;
  --gold-soft: #f0dcc0;
  --rose: #c9949c;
  --text: #f4ebe3;
  --muted: #a89890;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: 'Cormorant Garamond', Georgia, serif;
  -webkit-font-smoothing: antialiased;
}

#stars-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.scene {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 1.15s ease, visibility 1.15s;
  z-index: 10;
}
.scene.active {
  opacity: 1;
  visibility: visible;
}

/* Loading */
#loading {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: opacity 0.9s ease;
}
#loading.hidden { opacity: 0; pointer-events: none; }
.loader {
  width: 32px;
  height: 32px;
  border: 1.5px solid rgba(224,201,160,0.2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
.loading-text {
  margin-top: 1.1rem;
  font-size: 1rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  font-weight: 300;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Opening */
#scene-opening {
  background: radial-gradient(ellipse at 50% 40%, #12101c 0%, var(--bg) 70%);
}
.opening-content { text-align: center; }
.opening-name {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(3.1rem, 13vw, 4.8rem);
  font-weight: 400;
  letter-spacing: 0.14em;
  color: var(--gold-soft);
  margin-bottom: 1.5rem;
  opacity: 0;
  animation: rise 2.2s ease forwards 0.5s;
  text-shadow: 0 0 60px rgba(224,201,160,0.25);
}
.opening-subtitle {
  font-size: clamp(1.1rem, 4.4vw, 1.35rem);
  font-weight: 300;
  line-height: 1.6;
  color: var(--text);
  max-width: 17rem;
  margin: 0 auto 3.2rem;
  opacity: 0;
  animation: rise 2s ease forwards 1.7s;
  letter-spacing: 0.02em;
}
.btn-open {
  padding: 0.95rem 2.8rem;
  background: transparent;
  border: 1px solid rgba(224,201,160,0.55);
  color: var(--gold);
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.15rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  border-radius: 999px;
  cursor: pointer;
  opacity: 0;
  animation: rise 1.6s ease forwards 2.9s;
  transition: all 0.4s ease;
  text-transform: uppercase;
}
.btn-open:active {
  background: rgba(224,201,160,0.1);
  transform: scale(0.97);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Intro — pure black + words */
#scene-intro {
  background: #000;
  padding: 2rem;
}
.intro-words {
  text-align: center;
  max-width: 19rem;
  min-height: 6rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.intro-line {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(1.35rem, 5.5vw, 1.7rem);
  font-weight: 300;
  line-height: 1.55;
  color: var(--text);
  opacity: 0;
  transform: translateY(14px);
  margin-bottom: 0.35rem;
  letter-spacing: 0.01em;
}
.intro-line.visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 1.1s ease, transform 1.1s ease;
}
.intro-line.gold {
  color: var(--gold-soft);
  font-style: italic;
  font-size: clamp(1.25rem, 5vw, 1.55rem);
}
.intro-line.emphasis {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.5rem, 6.2vw, 1.9rem);
  color: var(--gold);
  letter-spacing: 0.04em;
  margin-top: 0.6rem;
}

/* Book */
#scene-book {
  background: linear-gradient(180deg, #05070f 0%, #0e0a12 55%, #080a12 100%);
  padding: 1rem 1rem 5.8rem;
  justify-content: flex-start;
  padding-top: 5vh;
}
.book {
  width: 100%;
  max-width: 22rem;
  perspective: 1400px;
}
.book-page {
  position: relative;
  width: 100%;
  aspect-ratio: 3/4.5;
  border-radius: 4px 14px 14px 4px;
  overflow: hidden;
  box-shadow:
    0 16px 50px rgba(0,0,0,0.65),
    6px 0 20px rgba(0,0,0,0.35);
  background: #0a0a0c;
  transform-origin: left center;
  transition: transform 0.55s cubic-bezier(0.4,0,0.2,1), opacity 0.4s ease;
}
.book-page.turning {
  transform: rotateY(-13deg) scale(0.97);
  opacity: 0.85;
}
.page-media {
  position: absolute;
  inset: 0;
}
.page-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
}
.page-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0,0,0,0.2) 0%,
    transparent 25%,
    transparent 40%,
    rgba(0,0,0,0.85) 100%
  );
  pointer-events: none;
}
.page-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1.7rem 1.35rem 1.9rem;
  z-index: 5;
}
.page-number {
  font-size: 0.68rem;
  letter-spacing: 0.28em;
  color: var(--gold);
  margin-bottom: 0.7rem;
  text-transform: uppercase;
  opacity: 0.85;
  font-family: 'Cormorant Garamond', serif;
}
.page-text {
  font-size: clamp(1.08rem, 4.3vw, 1.25rem);
  line-height: 1.58;
  color: var(--text);
  text-shadow: 0 1px 12px rgba(0,0,0,0.8);
  min-height: 5.4em;
  font-weight: 300;
}
.page-text.typing::after {
  content: '│';
  animation: blink 0.7s step-end infinite;
  color: var(--gold);
  margin-left: 1px;
  font-weight: 300;
}
@keyframes blink { 50% { opacity: 0; } }

.book-nav {
  position: fixed;
  bottom: 1.6rem;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 1.1rem;
  z-index: 30;
}
.nav-btn {
  min-width: 7.4rem;
  padding: 0.85rem 1.4rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(224,201,160,0.35);
  color: var(--gold);
  font-family: 'Cormorant Garamond', serif;
  font-size: 1rem;
  letter-spacing: 0.1em;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.3s ease;
}
.nav-btn:disabled {
  opacity: 0.25;
  pointer-events: none;
}
.nav-btn:active:not(:disabled) {
  background: rgba(224,201,160,0.12);
  transform: scale(0.96);
}

/* Final question — elegant reveal */
#scene-final {
  background: radial-gradient(ellipse at 50% 45%, #12101c 0%, var(--bg) 70%);
}
.final-content {
  text-align: center;
  max-width: 20rem;
}
.final-line {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300;
  color: var(--text);
  opacity: 0;
  transform: translateY(18px);
  margin-bottom: 0.35rem;
}
.final-line.visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 1.3s ease, transform 1.3s ease;
}
#final-line-1 {
  font-size: clamp(1.4rem, 5.5vw, 1.7rem);
  letter-spacing: 0.06em;
  color: var(--gold-soft);
}
#final-line-2 {
  font-size: clamp(1.35rem, 5.2vw, 1.65rem);
  letter-spacing: 0.03em;
}
#final-line-3 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2rem, 8vw, 2.6rem);
  color: var(--gold);
  letter-spacing: 0.08em;
  margin-top: 0.5rem;
  text-shadow: 0 0 40px rgba(224,201,160,0.2);
}

/* Soft grain */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
  opacity: 0.5;
  pointer-events: none;
  z-index: 50;
  mix-blend-mode: overlay;
}
