/* ===== Music page ambience: gentle beach motion while a track plays =====
   Injected by js/ambience.js into .scene (behind all content). Only transform/opacity animate. */
.ambience { position: absolute; inset: 0; opacity: 0; transition: opacity 1.6s ease; pointer-events: none; }
.scene.is-playing .ambience { opacity: 1; }
.scene.is-paused .ambience { transition-duration: 2.2s; }

/* Rolling waves at the shoreline */
.amb-waves { position: absolute; left: 0; right: 0; bottom: 1.5vh; height: 15vh; transform-origin: 50% 100%; will-change: transform; }
.amb-wave { position: absolute; left: 0; bottom: 0; width: 200%; height: 100%; will-change: transform;
  animation: amb-roll var(--dur, 24s) linear infinite, amb-bob var(--bob, 7s) ease-in-out infinite alternate; animation-play-state: paused; }
.amb-wave svg { display: block; width: 100%; height: 100%; }
.amb-wave.w1 { --dur: 34s; --bob: 9s; bottom: 5vh; height: 70%; opacity: 0.55; }
.amb-wave.w2 { --dur: 24s; --bob: 7s; bottom: 2.5vh; height: 60%; opacity: 0.6; animation-direction: reverse, alternate; }
.amb-wave.w3 { --dur: 17s; --bob: 5.5s; bottom: 0; height: 50%; opacity: 0.7; }
.amb-wave.w1 path { fill: rgba(167, 123, 255, 0.35); }
.amb-wave.w2 path { fill: rgba(127, 245, 217, 0.28); }
.amb-wave.w3 path { fill: rgba(255, 247, 251, 0.30); }

/* Sun reflection shimmering on the water, under the sun */
.amb-shimmer { position: absolute; left: 50%; bottom: 20vh; width: min(46vw, 360px); height: 13vh; margin-left: calc(min(46vw, 360px) / -2);
  background: repeating-linear-gradient(180deg, rgba(255, 238, 170, 0.55) 0 3px, transparent 3px 14px);
  -webkit-mask: radial-gradient(closest-side, #000, transparent); mask: radial-gradient(closest-side, #000, transparent);
  opacity: 0.5; animation: amb-shimmer 4.5s ease-in-out infinite alternate; animation-play-state: paused; will-change: transform, opacity; }

/* Slow drifting glow around the sun */
.amb-glow { position: absolute; left: 50%; top: 14vh; width: min(90vw, 760px); aspect-ratio: 1; margin-left: calc(min(90vw, 760px) / -2);
  background: radial-gradient(closest-side, rgba(255, 126, 182, 0.28), rgba(255, 226, 138, 0.12) 55%, transparent);
  animation: amb-drift 22s ease-in-out infinite alternate; animation-play-state: paused; will-change: transform, opacity; }

.scene.is-playing .amb-wave, .scene.is-playing .amb-shimmer, .scene.is-playing .amb-glow { animation-play-state: running; }

@keyframes amb-roll { to { transform: translate3d(-50%, 0, 0); } }
@keyframes amb-bob { from { translate: 0 0; } to { translate: 0 -0.9vh; } }
@keyframes amb-shimmer { from { transform: scaleX(0.82); opacity: 0.32; } to { transform: scaleX(1.06); opacity: 0.6; } }
@keyframes amb-drift { from { transform: translate3d(-4vw, 0, 0) scale(0.94); opacity: 0.7; } to { transform: translate3d(4vw, -2vh, 0) scale(1.06); opacity: 1; } }

@media (max-width: 700px) {
  .amb-wave.w1 { display: none; }
  .amb-waves { height: 11vh; }
  .amb-glow { width: 110vw; margin-left: -55vw; }
}
/* Reduced motion: a calm, static scene while playing; no movement at all */
@media (prefers-reduced-motion: reduce) {
  .ambience { transition: none; }
  .amb-wave, .amb-shimmer, .amb-glow { animation: none !important; }
}
