/**
 * 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;
  /* Soft shadow only — hard box shadows look like a bottom border on white GIFs */
  filter: drop-shadow(0 1px 2px rgba(40, 20, 30, 0.12));
}

.nf-actor svg,
.nf-actor .nf-sprite {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  object-fit: contain;
  pointer-events: none !important;
  user-select: none;
  -webkit-user-drag: none;
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
}

/* Knock out white / black photo backgrounds on light CRM UI */
.nf-blend-multiply {
  mix-blend-mode: multiply;
}
.nf-blend-screen {
  mix-blend-mode: screen;
}
.nf-blend-normal {
  mix-blend-mode: normal;
}

/* Opaque white-box GIFs: no rectangular drop-shadow (reads as a border) */
.nf-actor.nf-sprite {
  filter: none;
}
.nf-actor.nf-sprite.nf-has-shadow {
  filter: drop-shadow(0 2px 4px rgba(40, 20, 30, 0.16));
}

.nf-actor.nf-motion-fly.nf-has-shadow {
  filter: drop-shadow(0 2px 3px rgba(40, 20, 30, 0.14));
}

.nf-actor.nf-motion-hop.nf-has-shadow {
  filter: drop-shadow(0 3px 5px rgba(40, 50, 20, 0.16));
}

/* ---- 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));
}

/* ---- Preview helpers (Settings) ---- */
.nf-preview-banner {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  z-index: 1100;
  pointer-events: none;
  background: rgba(47, 36, 48, 0.88);
  color: #fff;
  font-family: Outfit, sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 10px 18px;
  border-radius: 999px;
  opacity: 0;
  transition: opacity .25s ease, transform .25s ease;
  box-shadow: 0 10px 28px rgba(0,0,0,0.2);
  white-space: nowrap;
  max-width: 90vw;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nf-preview-banner.is-on {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.nf-actor.nf-previewing .nf-sprite-label {
  position: absolute;
  left: 50%;
  top: -22px;
  bottom: auto;
  transform: translateX(-50%);
  background: rgba(47, 36, 48, 0.85);
  color: #fff;
  font-size: 10px;
  font-family: Outfit, sans-serif;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: none;
  border: 0;
}

.nf-actor.nf-previewing {
  filter: none;
}
.nf-actor.nf-previewing.nf-has-shadow {
  filter: drop-shadow(0 2px 4px rgba(40, 20, 30, 0.18));
}

.nf-sprite-thumb {
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}
.nf-sprite-thumb:hover {
  transform: translateY(-2px) scale(1.06);
  box-shadow: 0 6px 14px rgba(196, 83, 116, 0.2);
}

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