/* Living Garden Ambient Layer: Visual visitors for nature soundscape */
.garden-ambient-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 95;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.ambient-visitor {
  position: absolute;
  pointer-events: none;
  will-change: transform, opacity;
}

/* 1. Cheerful Bird Flight */
.ambient-bird {
  width: 56px;
  height: 42px;
  animation: birdFlyAcross 3.4s cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
}

.ambient-bird-body {
  position: relative;
  display: inline-block;
  animation: birdBob 0.6s ease-in-out infinite alternate;
}

.ambient-bird-svg {
  display: block;
  filter: drop-shadow(0 3px 6px rgba(32, 64, 46, 0.22));
}

.ambient-bird-wing {
  transform-origin: 20px 20px;
  animation: birdWingFlap 0.16s ease-in-out infinite alternate;
}

.ambient-bird-sparkles {
  position: absolute;
  left: -8px;
  top: 10px;
  font-size: 14px;
  animation: sparkleTrail 0.4s ease-in-out infinite alternate;
  opacity: 0.8;
}

@keyframes birdWingFlap {
  0% { transform: rotate(0deg) scaleY(1); }
  100% { transform: rotate(-38deg) scaleY(0.65); }
}

@keyframes birdBob {
  0% { transform: translateY(0); }
  100% { transform: translateY(-7px); }
}

@keyframes birdFlyAcross {
  0% {
    transform: translate3d(-70px, 0, 0);
    opacity: 0;
  }
  8% { opacity: 1; }
  30% { transform: translate3d(32cqw, -24px, 0); }
  55% { transform: translate3d(58cqw, 14px, 0); }
  80% { transform: translate3d(82cqw, -16px, 0); opacity: 1; }
  100% {
    transform: translate3d(calc(100cqw + 70px), 0, 0);
    opacity: 0;
  }
}

@keyframes sparkleTrail {
  0% { transform: scale(0.7) translateY(0); opacity: 0.4; }
  100% { transform: scale(1.2) translateY(-4px); opacity: 0.9; }
}

/* 2. Breeze & Swirling Leaves */
.ambient-breeze {
  inset: 0;
  width: 100%;
  height: 100%;
}

.ambient-wind-stream {
  position: absolute;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(180, 225, 195, 0.65) 40%, rgba(255, 255, 255, 0.85) 60%, rgba(255, 255, 255, 0) 100%);
  animation: windSwoosh 2.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.ambient-wind-stream.s1 {
  top: 28%;
  width: 48cqw;
  animation-delay: 0.1s;
}

.ambient-wind-stream.s2 {
  top: 52%;
  width: 62cqw;
  animation-delay: 0.35s;
}

.ambient-leaf {
  position: absolute;
  font-size: 26px;
  filter: drop-shadow(0 2px 5px rgba(40, 80, 50, 0.2));
  animation: leafSwirl 3.2s cubic-bezier(0.2, 0.8, 0.4, 1) forwards;
}

.ambient-leaf.l1 { top: 22%; animation-delay: 0.15s; font-size: 28px; }
.ambient-leaf.l2 { top: 38%; animation-delay: 0.3s; font-size: 24px; }
.ambient-leaf.l3 { top: 50%; animation-delay: 0.05s; font-size: 30px; }
.ambient-leaf.l4 { top: 62%; animation-delay: 0.45s; font-size: 22px; }
.ambient-leaf.l5 { top: 32%; animation-delay: 0.6s; font-size: 26px; }

@keyframes windSwoosh {
  0% { transform: translate3d(-100%, 0, 0) scaleX(0.4); opacity: 0; }
  30% { opacity: 0.8; }
  100% { transform: translate3d(150cqw, 0, 0) scaleX(1.3); opacity: 0; }
}

@keyframes leafSwirl {
  0% {
    transform: translate3d(-50px, 0, 0) rotate(0deg);
    opacity: 0;
  }
  12% { opacity: 1; }
  50% { transform: translate3d(52cqw, -28px, 0) rotate(380deg); }
  85% { opacity: 1; }
  100% {
    transform: translate3d(calc(100cqw + 60px), 80px, 0) rotate(760deg);
    opacity: 0;
  }
}

/* 3. Rain Cloud & Droplets */
.ambient-rain {
  top: 8%;
  left: 20%;
  animation: cloudDrift 3.5s cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
}

.ambient-cloud-shape {
  font-size: 52px;
  filter: drop-shadow(0 6px 12px rgba(80, 120, 150, 0.25));
  animation: cloudBob 1.2s ease-in-out infinite alternate;
}

.ambient-droplets {
  position: relative;
  width: 60px;
  margin-top: -10px;
}

.ambient-drop {
  position: absolute;
  font-size: 16px;
  opacity: 0;
  animation: dropRain 1.4s ease-in infinite;
}

.ambient-drop.d1 { left: 8px; animation-delay: 0.2s; }
.ambient-drop.d2 { left: 22px; animation-delay: 0.55s; }
.ambient-drop.d3 { left: 36px; animation-delay: 0.1s; }
.ambient-drop.d4 { left: 48px; animation-delay: 0.75s; }
.ambient-drop.d5 { left: 28px; animation-delay: 0.95s; }

@keyframes cloudDrift {
  0% { transform: translate3d(-40px, 0, 0); opacity: 0; }
  15% { opacity: 1; }
  80% { opacity: 1; }
  100% { transform: translate3d(45cqw, 0, 0); opacity: 0; }
}

@keyframes cloudBob {
  0% { transform: translateY(0); }
  100% { transform: translateY(-5px); }
}

@keyframes dropRain {
  0% { transform: translate3d(0, 0, 0) scale(0.6); opacity: 0; }
  20% { opacity: 0.9; }
  80% { opacity: 0.7; }
  100% { transform: translate3d(-10px, 160px, 0) scale(1.1); opacity: 0; }
}

/* 4. Hopping Frog */
.ambient-frog {
  bottom: 12px;
  width: 58px;
  height: 58px;
  animation: frogHopSequence 2.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.ambient-frog-sprite {
  font-size: 42px;
  display: block;
  filter: drop-shadow(0 4px 8px rgba(30, 60, 40, 0.25));
}

.ambient-frog-ripple {
  position: absolute;
  bottom: -4px;
  left: 50%;
  width: 44px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(130, 195, 140, 0.7);
  transform: translateX(-50%) scale(0);
  animation: frogRippleRing 0.8s ease-out 0.8s forwards;
}

@keyframes frogHopSequence {
  0% {
    transform: translate3d(0, 70px, 0) scale(0.7);
    opacity: 0;
  }
  15% {
    transform: translate3d(15px, -85px, 0) scale(1.15) rotate(12deg);
    opacity: 1;
  }
  35% {
    transform: translate3d(35px, 0, 0) scale(0.95, 0.8) rotate(0deg);
  }
  45% {
    transform: translate3d(35px, 0, 0) scale(1.05, 1);
  }
  60% {
    transform: translate3d(55px, -95px, 0) scale(1.15) rotate(15deg);
    opacity: 1;
  }
  85% {
    transform: translate3d(80px, 0, 0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate3d(95px, 75px, 0) scale(0.7);
    opacity: 0;
  }
}

@keyframes frogRippleRing {
  0% { transform: translateX(-50%) scale(0.3); opacity: 0.9; }
  100% { transform: translateX(-50%) scale(2.2); opacity: 0; }
}

/* 5. Friendly Honeybee */
.ambient-bee {
  width: 48px;
  height: 48px;
  animation: beeFlyAcross 3.2s cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
}

.ambient-bee-inner {
  position: relative;
  display: inline-block;
  animation: beeWobble 0.22s ease-in-out infinite alternate;
}

.ambient-bee-sprite {
  font-size: 36px;
  display: block;
  filter: drop-shadow(0 3px 6px rgba(180, 130, 20, 0.3));
}

.ambient-bee-trail {
  position: absolute;
  left: -8px;
  top: 8px;
  font-size: 14px;
  animation: sparkleTrail 0.35s ease-in-out infinite alternate;
}

@keyframes beeWobble {
  0% { transform: translateY(-3px) rotate(-6deg); }
  100% { transform: translateY(3px) rotate(6deg); }
}

@keyframes beeFlyAcross {
  0% { transform: translate3d(-60px, 0, 0); opacity: 0; }
  10% { opacity: 1; }
  25% { transform: translate3d(24cqw, -35px, 0); }
  50% { transform: translate3d(50cqw, 30px, 0); }
  75% { transform: translate3d(76cqw, -25px, 0); opacity: 1; }
  100% { transform: translate3d(calc(100cqw + 60px), 10px, 0); opacity: 0; }
}

/* 6. Dew Droplet & Ripple */
.ambient-droplet {
  top: 15%;
  width: 60px;
  height: 120px;
}

.ambient-droplet-drop {
  font-size: 28px;
  filter: drop-shadow(0 2px 6px rgba(40, 130, 180, 0.35));
  animation: dropletFall 1.8s cubic-bezier(0.4, 0, 0.8, 0.6) forwards;
}

.ambient-droplet-ring {
  position: absolute;
  top: 100px;
  left: 50%;
  width: 48px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(80, 180, 230, 0.75);
  animation: dropletRipple 0.8s ease-out 1.25s forwards;
  opacity: 0;
}

@keyframes dropletFall {
  0% { transform: translate3d(0, -30px, 0) scale(0.6); opacity: 0; }
  15% { opacity: 1; }
  72% { transform: translate3d(0, 85px, 0) scale(1.15); opacity: 1; }
  78% { transform: translate3d(0, 92px, 0) scale(1.3, 0.4); opacity: 0.8; }
  85% { transform: translate3d(0, 92px, 0) scale(1.5, 0.2); opacity: 0; }
  100% { transform: translate3d(0, 92px, 0) scale(1.5, 0.2); opacity: 0; }
}

@keyframes dropletRipple {
  0% { transform: translateX(-50%) scale(0.2); opacity: 0.9; }
  100% { transform: translateX(-50%) scale(2.6); opacity: 0; }
}

/* 7. Cricket Peeking in Grass */
.ambient-cricket {
  bottom: 0;
  width: 70px;
  height: 60px;
  animation: cricketSequence 2.8s cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
}

.ambient-cricket-inner {
  position: relative;
  display: flex;
  align-items: flex-end;
}

.ambient-cricket-grass {
  font-size: 34px;
  filter: drop-shadow(0 2px 4px rgba(30, 70, 30, 0.2));
}

.ambient-cricket-sprite {
  font-size: 28px;
  margin-left: -14px;
  margin-bottom: 6px;
  animation: cricketAntennae 0.28s ease-in-out infinite alternate;
  filter: drop-shadow(0 2px 4px rgba(20, 50, 20, 0.25));
}

@keyframes cricketAntennae {
  0% { transform: rotate(-8deg) scale(0.95); }
  100% { transform: rotate(8deg) scale(1.05); }
}

@keyframes cricketSequence {
  0% { transform: translate3d(0, 55px, 0); opacity: 0; }
  18% { transform: translate3d(0, 0, 0); opacity: 1; }
  45% { transform: translate3d(0, -6px, 0); }
  75% { transform: translate3d(0, 0, 0); opacity: 1; }
  100% { transform: translate3d(0, 55px, 0); opacity: 0; }
}

/* Accessibility: Respect Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .ambient-bird,
  .ambient-leaf,
  .ambient-wind-stream,
  .ambient-rain,
  .ambient-frog,
  .ambient-bee,
  .ambient-droplet-drop,
  .ambient-cricket {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    display: none !important;
  }
}
