/**
 * Calling CRM — Ambient Nature FX (realistic)
 * Soft depth, hinged wing flaps, glow blink. pointer-events: none.
 */

#crm-nature-fx {
  position: fixed;
  inset: 0;
  z-index: 1080;
  pointer-events: none !important;
  overflow: hidden;
  contain: layout style paint;
}

.nf-actor {
  position: absolute;
  top: 0;
  left: 0;
  will-change: transform, opacity;
  pointer-events: none !important;
  user-select: none;
  opacity: 0;
  filter: drop-shadow(0 2px 3px rgba(40, 20, 30, 0.18));
}

.nf-actor svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* ---- Butterfly: hinged wing flap (scale from body) ---- */
.nf-butterfly .nf-wing-l,
.nf-butterfly .nf-wing-r {
  animation: nfButterflyWing calc(0.22s * var(--nf-flap, 1)) ease-in-out infinite alternate;
  transform-box: fill-box;
}

.nf-butterfly .nf-wing-r {
  animation-name: nfButterflyWingR;
  animation-delay: calc(-0.11s * var(--nf-flap, 1));
}

@keyframes nfButterflyWing {
  from { transform: scaleX(1) rotate(-2deg); }
  to   { transform: scaleX(0.28) rotate(4deg); }
}

@keyframes nfButterflyWingR {
  from { transform: scaleX(1) rotate(2deg); }
  to   { transform: scaleX(0.28) rotate(-4deg); }
}

/* ---- Dragonfly: rapid translucent buzz ---- */
.nf-dragonfly .nf-wing {
  animation: nfDragonBuzz 0.08s linear infinite alternate;
}

.nf-dragonfly .nf-wing-tr { animation-delay: -0.02s; }
.nf-dragonfly .nf-wing-bl { animation-delay: -0.04s; }
.nf-dragonfly .nf-wing-br { animation-delay: -0.06s; }

@keyframes nfDragonBuzz {
  from { opacity: 0.22; transform: scaleY(1) skewX(-2deg); }
  to   { opacity: 0.55; transform: scaleY(0.25) skewX(2deg); }
}

/* ---- Bird: strong downstroke / soft upstroke ---- */
.nf-bird .nf-wing-l,
.nf-bird .nf-wing-r {
  animation: nfBirdWingL calc(0.32s * var(--nf-flap, 1)) cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite alternate;
  transform-box: fill-box;
}

.nf-bird .nf-wing-r {
  animation-name: nfBirdWingR;
}

@keyframes nfBirdWingL {
  from { transform: rotate(8deg) scaleY(1); }
  to   { transform: rotate(-38deg) scaleY(0.85); }
}

@keyframes nfBirdWingR {
  from { transform: rotate(-8deg) scaleY(1); }
  to   { transform: rotate(38deg) scaleY(0.85); }
}

/* ---- Firefly: organic glow pulse ---- */
.nf-firefly {
  filter: drop-shadow(0 0 6px rgba(255, 220, 100, 0.45));
}

.nf-firefly .nf-glow {
  animation: nfFireGlow 1.1s ease-in-out infinite alternate;
  transform-origin: center;
}

.nf-firefly .nf-glow-core {
  animation: nfFireCore 0.9s ease-in-out infinite alternate;
}

@keyframes nfFireGlow {
  from { opacity: 0.35; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1.15); }
}

@keyframes nfFireCore {
  from { opacity: 0.55; }
  to   { opacity: 1; }
}

/* ---- Ladybug: tiny leg scurry ---- */
.nf-ladybug .nf-leg {
  transform-origin: center;
  animation: nfLadyLegs 0.18s ease-in-out infinite alternate;
}

.nf-ladybug .nf-leg:last-child {
  animation-delay: -0.09s;
}

@keyframes nfLadyLegs {
  from { transform: rotate(-4deg); }
  to   { transform: rotate(4deg); }
}

/* ---- Leaf / feather: softer shadow ---- */
.nf-leaf,
.nf-feather {
  filter: drop-shadow(0 3px 4px rgba(60, 40, 30, 0.2));
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  #crm-nature-fx { display: none !important; }
}
