/* =========================================================
   HFT — Scroll Scene: "Quần thể Núi Bà Đen · Tây Ninh"
   100% Procedural SVG/CSS (Aerial Dusk + Phật Bà + Phật Di Lặc)
   Zero raster images · GPU-composited · Reduced-motion safe
   ========================================================= */

/* Tighten gap below #philosophy ("Đồng hành") so scene appears right away */
.section.philosophy {
  padding-bottom: 48px;
}

.baden-scroll {
  position: relative;
  height: 250vh;
  width: 100%;
  margin-top: -12px;
  pointer-events: none;
  user-select: none;
  background: linear-gradient(
    180deg,
    #ffffff 0%,
    #eef4fa 12%,
    #e6eff8 50%,
    #f2f6fb 88%,
    #ffffff 100%
  );
}

.baden-scroll__sticky {
  position: sticky;
  top: 0;
  width: 100%;
  height: 100vh;
  display: grid;
  place-items: center;
  overflow: clip;
  perspective: 1200px;
}

/* Warm amber + HFT cyan ambient backlight behind the panoramic frame */
.baden-scroll__glow {
  position: absolute;
  width: min(980px, 88vw);
  height: min(540px, 64vh);
  border-radius: 50%;
  background: radial-gradient(
    ellipse at 50% 54%,
    rgba(245, 168, 78, .22) 0%,
    rgba(0, 174, 239, .12) 48%,
    transparent 74%
  );
  filter: blur(30px);
  opacity: var(--bd-glow-o, 0);
  will-change: opacity;
  pointer-events: none;
}

/* Main 3D Stage driven by scroll progress p */
.baden-stage {
  position: relative;
  width: min(1160px, 92vw);
  height: min(640px, 78vh);
  border-radius: 28px;
  overflow: hidden;
  background: #07101a;
  border: 1px solid rgba(255, 206, 128, .28);
  box-shadow:
    0 34px 80px rgba(6, 15, 26, .38),
    0 8px 24px rgba(6, 15, 26, .2),
    inset 0 1px 0 rgba(255, 255, 255, .24);
  opacity: 0;
  visibility: hidden;
  transform: translate3d(0, -28vh, 0) scale(.92);
  transform-origin: 50% 50%;
  will-change: transform, opacity;
}

.baden-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow:
    inset 0 0 84px rgba(3, 8, 16, .52),
    inset 0 1px 0 rgba(255, 240, 200, .2);
  pointer-events: none;
}

.baden-svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* ---------- Multi-Plane Parallax Layers ---------- */

.bd-layer-horizon {
  transform: translate3d(0, var(--bd-far-y, 0px), 0);
  will-change: transform;
}
.bd-layer-summit {
  transform: translate3d(0, var(--bd-mid-y, 0px), 0);
  will-change: transform;
}
.bd-layer-maitreya {
  transform: translate3d(0, var(--bd-fore-y, 0px), 0);
  will-change: transform;
}

/* ---------- Ambient Micro-Animations (Paused when offscreen) ---------- */

.bd-star--twinkle,
.bd-city-flicker,
.bd-cloud-drift,
.bd-halo-pulse,
.bd-guanyin-float,
.bd-tower-shimmer,
.bd-deck-lights,
.bd-mist-band,
.baden-mote {
  animation-play-state: paused;
}

.baden-scroll.is-active .bd-star--twinkle,
.baden-scroll.is-active .bd-city-flicker,
.baden-scroll.is-active .bd-cloud-drift,
.baden-scroll.is-active .bd-halo-pulse,
.baden-scroll.is-active .bd-guanyin-float,
.baden-scroll.is-active .bd-tower-shimmer,
.baden-scroll.is-active .bd-deck-lights,
.baden-scroll.is-active .bd-mist-band,
.baden-scroll.is-active .baden-mote {
  animation-play-state: running;
}

.bd-star--twinkle {
  animation: bd-twinkle 4.2s ease-in-out infinite;
}
.bd-star--d1 { animation-delay: -1.5s; }
.bd-star--d2 { animation-delay: -2.9s; }

.bd-city-flicker {
  animation: bd-twinkle 5.4s ease-in-out infinite;
}
.bd-city-flicker--alt {
  animation-delay: -2.6s;
}

.bd-cloud-drift {
  animation: bd-drift-x 24s ease-in-out infinite alternate;
}

.bd-halo-pulse {
  transform-box: fill-box;
  transform-origin: center center;
  animation: bd-halo 5.6s ease-in-out infinite;
}

.bd-guanyin-float {
  transform-box: fill-box;
  transform-origin: center bottom;
  animation: bd-float 5.4s ease-in-out infinite;
}

.bd-tower-shimmer {
  animation: bd-glow-pulse 3.4s ease-in-out infinite;
}

.bd-deck-lights {
  animation: bd-glow-pulse 4s ease-in-out -1.7s infinite;
}

.bd-mist-band {
  animation: bd-mist-slide 18s ease-in-out infinite alternate;
}
.bd-mist-band--2 {
  animation-duration: 23s;
  animation-direction: alternate-reverse;
}

@keyframes bd-twinkle {
  0%, 100% { opacity: .42; }
  50% { opacity: .96; }
}

@keyframes bd-drift-x {
  from { transform: translate3d(-16px, 0, 0); }
  to { transform: translate3d(16px, 0, 0); }
}

@keyframes bd-float {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(0, -2.5px, 0); }
}

@keyframes bd-halo {
  0%, 100% { opacity: .82; transform: scale(.985); }
  50% { opacity: 1; transform: scale(1.03); }
}

@keyframes bd-glow-pulse {
  0%, 100% { opacity: .88; }
  50% { opacity: 1; }
}

@keyframes bd-mist-slide {
  from { transform: translate3d(-22px, 0, 0); }
  to { transform: translate3d(22px, 0, 0); }
}

/* ---------- Floating Light Particles ---------- */

.baden-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.baden-mote {
  position: absolute;
  width: var(--sz, 4px);
  height: var(--sz, 4px);
  left: var(--x, 50%);
  top: var(--y, 70%);
  border-radius: 50%;
  background: radial-gradient(circle, #fff9e2 0%, #ffd06b 55%, rgba(255, 185, 60, 0) 100%);
  box-shadow: 0 0 10px rgba(255, 210, 102, .8);
  opacity: 0;
  animation: bd-mote-rise var(--dur, 7s) ease-in-out var(--del, 0s) infinite;
  will-change: transform, opacity;
}

.baden-mote--cyan {
  background: radial-gradient(circle, #e8faff 0%, #52cfff 55%, rgba(0, 174, 239, 0) 100%);
  box-shadow: 0 0 10px rgba(0, 174, 239, .85);
}

@keyframes bd-mote-rise {
  0% {
    opacity: 0;
    transform: translate3d(0, 10px, 0) scale(.7);
  }
  28% { opacity: .9; }
  72% { opacity: .7; }
  100% {
    opacity: 0;
    transform: translate3d(var(--dx, 14px), -50px, 0) scale(1.1);
  }
}

/* ---------- Mobile Simplification (<= 768px) ---------- */

@media (max-width: 768px) {
  .section.philosophy {
    padding-bottom: 32px;
  }

  .baden-scroll {
    height: 200vh;
    margin-top: 0;
  }

  .baden-stage {
    width: 93vw;
    height: min(490px, 66vh);
    border-radius: 22px;
  }

  .baden-scroll__glow {
    display: none;
  }

  .baden-mote:nth-child(n + 6) {
    display: none;
  }

  .bd-blur-soft {
    filter: none !important;
  }
}

/* ---------- Accessibility: Prefers Reduced Motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .baden-scroll {
    height: auto !important;
    padding: 44px 0 56px !important;
  }

  .baden-scroll__sticky {
    position: relative !important;
    height: auto !important;
  }

  .baden-stage {
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    height: min(560px, 70vh);
  }

  .baden-particles,
  .baden-scroll__glow {
    display: none !important;
  }

  .bd-star--twinkle,
  .bd-city-flicker,
  .bd-cloud-drift,
  .bd-halo-pulse,
  .bd-guanyin-float,
  .bd-tower-shimmer,
  .bd-deck-lights,
  .bd-mist-band {
    animation: none !important;
    transform: none !important;
  }
}
