/* ================================================================
   Holy Dan — Parallax Storytelling Layer
================================================================ */

/* Hide native cursor on desktop */
@media (hover: hover) and (pointer: fine) {
  body.story-mode, body.story-mode * { cursor: none !important; }
}

/* Custom candle cursor */
.cursor-spark {
  position: fixed;
  top: 0;
  left: 0;
  width: 28px;
  height: 28px;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  mix-blend-mode: screen;
  transition: opacity 0.3s ease;
}
.cursor-spark::before {
  content: "";
  position: absolute;
  inset: 10px;
  background: radial-gradient(circle, #FFE9B8 0%, var(--mystic-gold) 40%, transparent 70%);
  border-radius: 50%;
  filter: blur(0.5px);
  animation: candle-flicker 2.4s ease-in-out infinite;
}
.cursor-spark::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255, 233, 184, 0.4) 0%, transparent 60%);
  border-radius: 50%;
  filter: blur(3px);
  animation: candle-flicker 3.2s ease-in-out infinite reverse;
}
@keyframes candle-flicker {
  0%, 100% { transform: scale(1) translateY(0); opacity: 1; }
  50% { transform: scale(1.15) translateY(-1px); opacity: 0.85; }
}
@media (hover: none), (pointer: coarse) { .cursor-spark { display: none; } }

/* Scroll progress */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 200;
  background: rgba(198, 160, 106, 0.08);
}
.scroll-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--mystic-gold), var(--gold-soft));
  width: 0%;
  transition: width 0.1s linear;
  box-shadow: 0 0 8px rgba(198, 160, 106, 0.5);
}

/* Audio toggle */
.audio-toggle {
  position: fixed;
  bottom: 28px;
  left: 28px;
  z-index: 150;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(31, 70, 68, 0.85);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--mystic-gold);
  border: 1px solid var(--gold-line);
  transition: all 0.4s ease;
}
.audio-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 0 18px rgba(198, 160, 106, 0.4);
}
.audio-bars {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 16px;
}
.audio-bars span {
  width: 2px;
  background: currentColor;
  border-radius: 2px;
  height: 60%;
  animation: bars 1.2s ease-in-out infinite;
}
.audio-bars span:nth-child(2) { height: 100%; animation-delay: 0.15s; }
.audio-bars span:nth-child(3) { height: 80%; animation-delay: 0.3s; }
.audio-bars span:nth-child(4) { height: 50%; animation-delay: 0.45s; }
@keyframes bars {
  0%, 100% { transform: scaleY(0.5); }
  50% { transform: scaleY(1); }
}
.audio-toggle.muted .audio-bars span { animation-play-state: paused; opacity: 0.4; }

/* ================================================================
   Story scenes
================================================================ */
.story-section {
  position: relative;
  width: 100%;
  overflow: hidden;
}

/* Scene 1: Breath — full viewport, dark teal */
.scene-breath {
  height: 100vh;
  background: radial-gradient(ellipse at center, #2a5d5a 0%, var(--midnight-plum) 60%, #0f2c2b 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.scene-breath::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(198, 160, 106, 0.08), transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(198, 160, 106, 0.06), transparent 50%);
}

.breath-content {
  text-align: center;
  color: var(--moonlight);
  z-index: 2;
  position: relative;
  max-width: 800px;
  padding: 0 32px;
}

.breath-eyebrow {
  font-size: 11px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--mystic-gold);
  margin-bottom: 36px;
  opacity: 0;
  animation: fade-slow 2s ease 0.4s forwards;
}

.breath-script {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(48px, 8vw, 110px);
  line-height: 1.1;
  color: var(--moonlight);
  letter-spacing: -0.01em;
  margin-bottom: 24px;
}

.breath-script .line {
  display: block;
  opacity: 0;
  transform: translateY(20px);
  animation: line-rise 1.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
.breath-script .line:nth-child(1) { animation-delay: 1s; }
.breath-script .line:nth-child(2) { animation-delay: 2.2s; color: var(--mystic-gold); font-weight: 500; }
.breath-script .line:nth-child(3) { animation-delay: 3.4s; }

.breath-sub {
  font-family: var(--font-sans);
  font-size: 14px;
  color: rgba(245, 240, 235, 0.6);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-top: 56px;
  opacity: 0;
  animation: fade-slow 2s ease 4.6s forwards;
}

@keyframes line-rise {
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fade-slow {
  to { opacity: 1; }
}

/* Breathing orb */
.breath-orb {
  position: absolute;
  width: 60vh;
  height: 60vh;
  max-width: 600px;
  max-height: 600px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(198, 160, 106, 0.08) 0%, transparent 70%);
  animation: breath-pulse 6s ease-in-out infinite;
  z-index: 1;
}
@keyframes breath-pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.6; }
  50% { transform: translate(-50%, -50%) scale(1.1); opacity: 1; }
}

.breath-orb-ring {
  position: absolute;
  inset: -40px;
  border-radius: 50%;
  border: 1px solid rgba(198, 160, 106, 0.18);
  animation: breath-pulse 6s ease-in-out infinite reverse;
}

/* Drifting stars */
.star-field {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.drift-star {
  position: absolute;
  background: var(--mystic-gold);
  border-radius: 50%;
  opacity: 0;
  animation: star-twinkle 4s ease-in-out infinite;
}
@keyframes star-twinkle {
  0%, 100% { opacity: 0; transform: scale(0.5); }
  50% { opacity: 0.8; transform: scale(1); }
}

.scroll-cue {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(245, 240, 235, 0.5);
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  opacity: 0;
  animation: fade-slow 2s ease 5s forwards;
}
.scroll-cue::after {
  content: "";
  width: 1px;
  height: 36px;
  background: linear-gradient(180deg, var(--mystic-gold), transparent);
  animation: scroll-line 2s ease-in-out infinite;
}
@keyframes scroll-line {
  0% { transform: scaleY(0); transform-origin: top; }
  50% { transform: scaleY(1); transform-origin: top; }
  51% { transform: scaleY(1); transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}

/* ================================================================
   Scene 2: Locked door (sticky, scroll-driven)
================================================================ */
.scene-door {
  height: 300vh;
  position: relative;
  background: linear-gradient(180deg, #0f2c2b 0%, var(--midnight-plum) 50%, #1a3d3b 100%);
}

.door-sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.door-bg-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 50%, rgba(198, 160, 106, 0.15), transparent 50%);
  opacity: var(--door-progress, 0);
  transition: opacity 0.3s ease;
}

.door-frame {
  position: relative;
  width: 360px;
  height: 540px;
  z-index: 2;
}

.door-arch {
  width: 100%;
  height: 100%;
  border-radius: 180px 180px 12px 12px;
  background: linear-gradient(180deg, #1F4644 0%, #0f2c2b 100%);
  border: 2px solid var(--mystic-gold);
  position: relative;
  overflow: hidden;
  box-shadow:
    0 0 60px rgba(198, 160, 106, 0.2),
    inset 0 0 40px rgba(0, 0, 0, 0.3);
}

.door-inner {
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(198, 160, 106, 0.4);
  border-radius: 170px 170px 8px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.door-keyhole {
  width: 80px;
  height: 80px;
  position: relative;
}
.door-keyhole::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 1.5px solid var(--mystic-gold);
  border-radius: 50%;
  background: rgba(15, 44, 43, 0.8);
}
.door-keyhole::after {
  content: "";
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 24px;
  background: var(--mystic-gold);
  clip-path: polygon(0 0, 100% 0, 75% 100%, 25% 100%);
}

/* Door light leak */
.door-light {
  position: absolute;
  inset: 4px;
  background: radial-gradient(circle at 50% 60%, rgba(255, 233, 184, 0.95) 0%, rgba(198, 160, 106, 0.4) 30%, transparent 60%);
  border-radius: 170px 170px 8px 8px;
  opacity: var(--door-progress, 0);
  transition: opacity 0.4s ease;
  z-index: 1;
}

.door-text {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  pointer-events: none;
}

.door-text--left {
  right: calc(50% + 240px);
  text-align: right;
  max-width: 320px;
}
.door-text--right {
  left: calc(50% + 240px);
  text-align: left;
  max-width: 320px;
}

.door-text h2 {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(32px, 4vw, 48px);
  color: var(--moonlight);
  line-height: 1.1;
  margin-bottom: 18px;
}
.door-text h2 em {
  color: var(--mystic-gold);
  font-style: italic;
}
.door-text p {
  font-size: 15px;
  line-height: 1.7;
  color: rgba(245, 240, 235, 0.7);
}

.door-eyebrow {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--mystic-gold);
  margin-bottom: 20px;
}

/* Floating glyphs around door */
.door-glyph {
  position: absolute;
  color: var(--mystic-gold);
  opacity: 0.5;
  pointer-events: none;
}

/* ================================================================
   Scene 3: Opening — door becomes archway, garden glimpse
================================================================ */
.scene-opening {
  height: 200vh;
  position: relative;
  background: linear-gradient(180deg, #1a3d3b 0%, #2F6E6A 50%, #4a8a85 100%);
}

.opening-sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.opening-archway {
  position: relative;
  width: 70vw;
  max-width: 800px;
  height: 90vh;
  max-height: 900px;
  border-radius: 50% 50% 12px 12px / 35% 35% 12px 12px;
  background: linear-gradient(180deg, #F5F0EB 0%, #EFE3D5 50%, #C8B89E 100%);
  overflow: hidden;
  box-shadow: 0 0 80px rgba(255, 233, 184, 0.5);
  border: 2px solid var(--mystic-gold);
}

.opening-archway::before {
  content: "";
  position: absolute;
  inset: 16px;
  border: 1px solid rgba(198, 160, 106, 0.4);
  border-radius: 50% 50% 8px 8px / 35% 35% 8px 8px;
}

/* Garden layers — parallax depth */
.garden-layer {
  position: absolute;
  left: 0;
  right: 0;
  pointer-events: none;
}

.garden-sky {
  top: 0;
  height: 60%;
  background: linear-gradient(180deg, #FFE9B8 0%, #F5D89C 50%, #E8C593 100%);
}

.garden-sun {
  position: absolute;
  top: 18%;
  left: 50%;
  transform: translateX(-50%);
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle, #FFFAF0 0%, #FFE9B8 40%, transparent 70%);
  filter: blur(2px);
  animation: sun-glow 4s ease-in-out infinite;
}
@keyframes sun-glow {
  0%, 100% { transform: translateX(-50%) scale(1); opacity: 0.95; }
  50% { transform: translateX(-50%) scale(1.06); opacity: 1; }
}

.garden-mountains {
  bottom: 30%;
  height: 25%;
  background:
    linear-gradient(180deg, transparent 0%, rgba(168, 137, 107, 0.5) 100%);
  clip-path: polygon(0 100%, 0 60%, 15% 30%, 28% 55%, 42% 25%, 55% 50%, 70% 20%, 85% 45%, 100% 30%, 100% 100%);
}

.garden-trees {
  bottom: 18%;
  height: 18%;
  background: linear-gradient(180deg, transparent, rgba(31, 70, 68, 0.6));
  clip-path: polygon(0 100%, 0 70%, 8% 40%, 16% 70%, 22% 30%, 30% 65%, 38% 45%, 46% 25%, 54% 60%, 62% 40%, 72% 55%, 80% 30%, 88% 60%, 96% 35%, 100% 55%, 100% 100%);
}

.garden-ground {
  bottom: 0;
  height: 30%;
  background: linear-gradient(180deg, #C8B89E 0%, #A8896B 100%);
}

.garden-path {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 28%;
  background: linear-gradient(180deg, rgba(245, 240, 235, 0.5) 0%, rgba(245, 240, 235, 0.9) 100%);
  clip-path: polygon(40% 0, 60% 0, 100% 100%, 0 100%);
}

/* Floating petals */
.petal {
  position: absolute;
  width: 8px;
  height: 12px;
  background: var(--mystic-gold);
  border-radius: 50% 50% 50% 0;
  opacity: 0.6;
  animation: petal-fall 12s linear infinite;
}
@keyframes petal-fall {
  0% { transform: translateY(-20px) rotate(0deg); opacity: 0; }
  10% { opacity: 0.7; }
  90% { opacity: 0.5; }
  100% { transform: translateY(120vh) rotate(720deg); opacity: 0; }
}

.opening-text {
  position: absolute;
  bottom: 12%;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  z-index: 4;
  max-width: 600px;
  padding: 0 32px;
}

.opening-text .script {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(36px, 5vw, 64px);
  color: var(--midnight-plum);
  line-height: 1.15;
  letter-spacing: -0.005em;
}
.opening-text .script em {
  color: var(--deep-plum);
}
.opening-text p {
  font-size: 14px;
  color: rgba(31, 70, 68, 0.7);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-top: 20px;
}

/* ================================================================
   Scene 4: Inner garden — full reveal, Holy Dan greeting
================================================================ */
.scene-garden {
  position: relative;
  background: linear-gradient(180deg, #4a8a85 0%, #EFE3D5 30%, var(--moonlight) 100%);
  padding: 120px 0 60px;
  overflow: hidden;
}

.garden-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 32px;
  text-align: center;
  position: relative;
  z-index: 2;
}

.garden-greeting {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(40px, 5.5vw, 72px);
  line-height: 1.15;
  color: var(--midnight-plum);
  margin-bottom: 32px;
  letter-spacing: -0.005em;
}
.garden-greeting em {
  color: var(--deep-plum);
}

.garden-sub {
  font-size: 18px;
  line-height: 1.7;
  color: rgba(31, 70, 68, 0.78);
  max-width: 640px;
  margin: 0 auto 56px;
}

.garden-photo-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 80px;
}

.photo-card {
  aspect-ratio: 3 / 4;
  background: var(--soft-sand);
  border-radius: 200px 200px 12px 12px / 30% 30% 12px 12px;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--gold-line-faint);
  box-shadow: var(--shadow-md);
}

.photo-card::before {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px solid var(--gold-line-faint);
  border-radius: 190px 190px 8px 8px / 28% 28% 8px 8px;
  background:
    repeating-linear-gradient(135deg, transparent 0, transparent 14px, rgba(198, 160, 106, 0.15) 14px, rgba(198, 160, 106, 0.15) 15px);
}

.photo-card-label {
  position: absolute;
  bottom: 24px;
  left: 0;
  right: 0;
  text-align: center;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  color: rgba(31, 70, 68, 0.5);
  text-transform: uppercase;
  z-index: 2;
}

.photo-card-caption {
  position: absolute;
  top: 24px;
  left: 0;
  right: 0;
  text-align: center;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 18px;
  color: var(--midnight-plum);
  z-index: 2;
}

/* Reveal as scrolled into view */
.reveal-up {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 1s cubic-bezier(0.2, 0.8, 0.2, 1), transform 1s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.reveal-up.in {
  opacity: 1;
  transform: translateY(0);
}

/* Story large script accent */
.story-script {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
}

/* ================================================================
   Responsive — story
================================================================ */
@media (max-width: 1024px) {
  .door-text--left, .door-text--right {
    position: static;
    transform: none;
    text-align: center;
    max-width: 90%;
    margin: 0 auto;
  }
  .door-text--left { display: none; }
  .door-text--right {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
  }
  .opening-archway {
    width: 92vw;
    height: 80vh;
  }
  .garden-photo-strip { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .breath-script { font-size: 44px; }
  .door-frame { width: 240px; height: 360px; }
  .door-keyhole { width: 56px; height: 56px; }
  .scroll-progress { height: 1.5px; }
}
