/* LIGHT AFTER TIME · Cinematic Experience Layer
   Cold open: black, faint rain, an inhale, a reflection, a phrase, an off-screen ignition.
   No room shown. No furniture. Only memory and atmosphere.
   12 chapters, one continuous film. */

/* ============================================================
   COLD OPEN · The Reflection Ritual (index only)
   Pitch black -> reflection on marble fades up -> serif phrase fades in ->
   off-screen candle catches and warm light blooms across the environment ->
   the visitor steps inside.
   ============================================================ */

.cold-open {
  position: fixed; inset: 0; z-index: 9000;
  background: #000;
  display: grid; place-items: center;
  overflow: hidden;
  cursor: default;
  transition: opacity 2400ms cubic-bezier(0.22, 0.61, 0.36, 1), visibility 0s linear 2400ms;
}
.cold-open.dismissed {
  opacity: 0; visibility: hidden;
}

/* Layer 1 · pure black plate, always there */
.cold-open .black {
  position: absolute; inset: 0;
  background: #000;
}

/* Layer 2 · the marble reflection, faintly fades up under everything else
   Starts invisible. Slowly emerges over ~6s. Texture visible but moody. */
.cold-open .reflection {
  position: absolute; inset: 0;
  background-image: url("../assets/coldopen-marble.png");
  background-size: cover;
  background-position: 70% center;  /* keep the gold streak on the right side */
  opacity: 0;
  filter: brightness(0.45) saturate(0.95) contrast(1.05);
  transform: scale(1.08);
  transition: opacity 6500ms ease-out,
              filter 14000ms ease-out,
              transform 22000ms ease-out;
  will-change: opacity, filter, transform;
}
.cold-open.lit .reflection {
  opacity: 1;
  filter: brightness(0.85) saturate(1.0) contrast(1.05);
  transform: scale(1.02);
}

/* Layer 3 · the ignition bloom — warm wash sweeps in from off-screen right.
   Sits on TOP of the marble but uses screen blend so the texture below stays
   visible. Concentrated near the right edge, fading across the surface. */
.cold-open .ignition {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 55% 75% at 92% 22%, rgba(255, 192, 118, 0.35) 0%, rgba(255, 160, 80, 0.10) 35%, transparent 65%),
    radial-gradient(ellipse 35% 55% at 98% 32%, rgba(255, 215, 155, 0.22) 0%, transparent 60%);
  mix-blend-mode: screen;
  opacity: 0;
  transition: opacity 3200ms cubic-bezier(0.22, 0.61, 0.36, 1);
  pointer-events: none;
}
.cold-open.ignited .ignition { opacity: 1; }

/* Layer 4 · subtle vignette to focus the eye toward center / warm side */
.cold-open .vignette {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 90% 85% at 55% 55%, transparent 0%, transparent 45%, rgba(0,0,0,0.35) 78%, rgba(0,0,0,0.65) 100%);
  pointer-events: none;
}

/* Layer 5 · grain (no AI flatness) */
.cold-open .grain {
  position: absolute; inset: -10%;
  pointer-events: none;
  opacity: 0.06;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' seed='3'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.35 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  mix-blend-mode: overlay;
  animation: grain 1600ms steps(3) infinite;
}
@keyframes grain {
  0%   { transform: translate3d(0,0,0); }
  33%  { transform: translate3d(-2%, 1%, 0); }
  66%  { transform: translate3d(1%, -2%, 0); }
  100% { transform: translate3d(0,0,0); }
}

/* Layer 6 · the serif phrase, very slowly fades in well after the reflection */
.cold-open .phrase {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  text-align: center;
  width: min(900px, 92vw);
  padding: 0 1.5rem;
  pointer-events: none;
}
.cold-open .phrase .line {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 300;
  font-style: italic;
  font-size: clamp(2rem, 1rem + 3.6vw, 4.2rem);
  letter-spacing: 0.045em;
  line-height: 1.22;
  color: #F4E9DA;
  opacity: 0;
  filter: blur(10px);
  transform: translateY(10px);
  transition: opacity 3800ms ease-out, filter 3800ms ease-out, transform 3800ms ease-out, color 1600ms;
  text-shadow:
    0 0 1px rgba(0,0,0,0.95),
    0 2px 18px rgba(0,0,0,0.85),
    0 0 60px rgba(0,0,0,0.6);
  text-wrap: balance;
  padding: 0 2rem;
}
.cold-open.spoken .phrase .line { opacity: 1; filter: blur(0); transform: translateY(0); }
.cold-open.ignited .phrase .line {
  color: #FBF1DC;
  text-shadow:
    0 0 1px rgba(0,0,0,0.95),
    0 2px 18px rgba(0,0,0,0.85),
    0 0 40px rgba(255,210,140,0.18);
}

/* Enter cue — appears only after the ignition. Quiet. No button language. */
.cold-open .enter {
  position: absolute; left: 50%; bottom: 8.5vh;
  transform: translateX(-50%);
  z-index: 4;
  font-family: 'Manrope', sans-serif;
  font-size: 0.62rem;
  letter-spacing: 0.55em;
  text-transform: uppercase;
  color: rgba(244, 233, 218, 0.7);
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 0.7rem 1.2rem;
  opacity: 0;
  transition: opacity 2400ms ease-out, color 800ms;
  text-shadow: 0 0 24px rgba(0,0,0,0.9);
}
.cold-open.ignited .enter { opacity: 0.85; }
.cold-open .enter:hover { color: #F4E9DA; }
.cold-open .enter::after {
  content: "";
  display: block;
  width: 22px; height: 1px;
  margin: 0.7rem auto 0;
  background: linear-gradient(90deg, transparent, rgba(198,164,108,0.9), transparent);
}

/* The whole stage gently breathes once ignited */
.cold-open.ignited .reflection {
  animation: breathe 9s ease-in-out infinite alternate;
}
@keyframes breathe {
  from { filter: brightness(0.85) saturate(1.0)  contrast(1.05); }
  to   { filter: brightness(0.98) saturate(1.08) contrast(1.08); }
}

/* ============================================================
   CINEMATIC PAGE TRANSITION · fade to black between chapters
   ============================================================ */

.curtain {
  position: fixed; inset: 0; z-index: 8000;
  background: radial-gradient(ellipse at 50% 45%, #1a0f25 0%, #000 70%);
  opacity: 0; visibility: hidden;
  transition: opacity 900ms cubic-bezier(0.22, 0.61, 0.36, 1), visibility 0s linear 900ms;
  pointer-events: none;
}
.curtain.closing {
  opacity: 1; visibility: visible;
  transition: opacity 700ms ease-in;
}
.curtain.opening {
  opacity: 0; visibility: visible;
  transition: opacity 1400ms ease-out;
}
.curtain .glow {
  position: absolute; inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(198,164,108,0.18) 0%, transparent 45%);
  opacity: 0;
  transition: opacity 700ms ease-out;
}
.curtain.closing .glow { opacity: 1; }

/* Note: this animation deliberately uses opacity ONLY because transform OR filter
   (including blur(0)) on body creates a containing block for position:fixed
   descendants, breaking the cold-open overlay positioning. */
.page-enter { opacity: 0; animation: page-fade-up 1400ms 100ms ease-out forwards; }
@keyframes page-fade-up {
  0%   { opacity: 0; }
  100% { opacity: 1; }
}

/* Audio UI removed by founder request, May 29 2026.
   Light After Time is silent by design. */

/* ============================================================
   CUSTOM CURSOR GLOW · soft candlelight follows the pointer
   (only on non-touch devices)
   ============================================================ */
@media (hover: hover) and (pointer: fine) {
  .cursor-glow {
    position: fixed; top: 0; left: 0; z-index: 6000;
    width: 320px; height: 320px;
    pointer-events: none;
    transform: translate(-9999px, -9999px);
    background: radial-gradient(circle, rgba(198,164,108,0.16) 0%, rgba(198,164,108,0.06) 40%, transparent 70%);
    mix-blend-mode: screen;
    transition: opacity 600ms ease-out;
    opacity: 0;
    will-change: transform;
  }
  .cursor-glow.live { opacity: 1; }
  [data-theme="light"] .cursor-glow {
    background: radial-gradient(circle, rgba(161,126,63,0.12) 0%, rgba(161,126,63,0.04) 40%, transparent 70%);
    mix-blend-mode: multiply;
  }
}

/* ============================================================
   SCROLL CINEMATIC · subtitled captions, slow parallax reveals
   ============================================================ */

.cine-reveal { opacity: 0; transform: translateY(36px) scale(0.995); filter: blur(4px);
  transition: opacity 1400ms cubic-bezier(0.22, 0.61, 0.36, 1),
              transform 1400ms cubic-bezier(0.22, 0.61, 0.36, 1),
              filter 1400ms cubic-bezier(0.22, 0.61, 0.36, 1); }
.cine-reveal.in { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }

.cine-caption { display:block;
  font-family:'Manrope', sans-serif;
  font-size: 0.66rem; letter-spacing: 0.5em; text-transform: uppercase;
  color: var(--candlelight, #C6A46C);
  margin-bottom: 1rem;
  opacity: 0.85;
}
.cine-stage {
  position: relative;
  border-radius: 1.4rem;
  overflow: hidden;
  border: 1px solid rgba(198,164,108,0.18);
  background: linear-gradient(135deg, #1a0f25, #111111 60%, #112340);
  box-shadow: 0 30px 80px rgba(0,0,0,0.55);
}

/* ============================================================
   CHAPTER MARK · the small Roman numeral that anchors each page
   ============================================================ */
.chapter-mark {
  display: inline-flex; align-items: center; gap: 0.8rem;
  font-family: 'Manrope', sans-serif;
  font-size: 0.62rem; letter-spacing: 0.5em; text-transform: uppercase;
  color: rgba(244,233,218,0.55);
}
.chapter-mark::before {
  content: ""; display: inline-block; width: 36px; height: 1px;
  background: linear-gradient(90deg, transparent, #C6A46C);
}
[data-theme="light"] .chapter-mark { color: rgba(45,27,61,0.55); }

/* ============================================================
   ACCESSIBILITY · reduced motion respects everything
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .cold-open .reflection { transition: opacity 600ms; transform: none; animation: none; }
  .cold-open .ignition   { transition: opacity 600ms; }
  .cold-open .phrase .line { transition: opacity 600ms; filter: none; transform: none; }
  .cold-open .enter { transition: opacity 200ms; }
  .cold-open .grain { animation: none; }
  .curtain { transition: opacity 0s; }
  .page-enter { animation: none; opacity: 1; }
  .cine-reveal { opacity: 1; transform: none; filter: none; transition: none; }
}

/* Don't show cursor glow on touch */
@media (hover: none), (pointer: coarse) {
  .cursor-glow { display: none; }
}
