/* ==========================================================
   Effetti del popup avvisi (entrata, uscita, neve/petali/coriandoli)
   L'effetto (neve, petali, uova, coriandoli) si sceglie in includes/config.php ('effetto').
   ========================================================== */
.avviso .avviso-box { z-index: 1; overflow-x: hidden; }
.avviso-media { position: relative; overflow: hidden; min-height: 260px; }
.avviso-media .avviso-img { display: block; }
.avviso-fx-canvas { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; transition: opacity .4s ease; }

/* entrata */
.avviso.fx-on { animation: avFadeIn .5s ease both; }
.avviso.fx-on .avviso-box { animation: avPop 1s cubic-bezier(.18, 1.2, .3, 1) both; transform-origin: 50% 70%; }
.avviso.fx-on .avviso-media { animation: avReveal 1.2s .3s cubic-bezier(.65, 0, .25, 1) both; }
.avviso.fx-on .avviso-media .avviso-img { animation: avZoom 10s .3s ease-out both; }
.avviso.fx-on .avviso-body > * { animation: avUp .7s cubic-bezier(.2, .8, .2, 1) both; }
.avviso.fx-on .avviso-body > :nth-child(1) { animation-delay: .5s; }
.avviso.fx-on .avviso-body > :nth-child(2) { animation-delay: .65s; }
.avviso.fx-on .avviso-body > .avviso-chiudi { animation: avUp .7s .8s cubic-bezier(.2, .8, .2, 1) both, avPulse 2.2s 2s ease-in-out 2; }
.avviso.fx-on .avviso-x { animation: avSpin .7s .9s cubic-bezier(.2, 1.4, .3, 1) both; }
.avviso.fx-on .avviso-box::after {
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none; border-radius: inherit;
  background: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, .6) 50%, transparent 65%);
  transform: translateX(-130%); animation: avShine 1.6s 1.1s ease-in-out both;
}

/* uscita */
.avviso.fx-leaving[hidden] { display: grid; pointer-events: none; animation: avFadeOut .42s ease both; }
.avviso.fx-leaving .avviso-box { animation: avOut .42s cubic-bezier(.4, 0, 1, 1) both; }
.avviso.fx-leaving .avviso-fx-canvas { opacity: 0; }

@keyframes avFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes avFadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes avPop {
  0% { opacity: 0; transform: perspective(1000px) translateY(70px) rotateX(30deg) scale(.7); filter: blur(10px); }
  55% { opacity: 1; filter: blur(0); }
  100% { opacity: 1; transform: none; filter: none; }
}
@keyframes avReveal { from { clip-path: circle(0% at 50% 40%); } to { clip-path: circle(140% at 50% 40%); } }
@keyframes avZoom { from { transform: scale(1.15); } to { transform: scale(1); } }
@keyframes avUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
@keyframes avSpin { from { opacity: 0; transform: scale(0) rotate(-180deg); } to { opacity: 1; transform: none; } }
@keyframes avShine { to { transform: translateX(130%); } }
@keyframes avPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(107, 62, 102, .45); } 50% { box-shadow: 0 0 0 14px rgba(107, 62, 102, 0); } }
@keyframes avOut { to { opacity: 0; transform: translateY(40px) scale(.88); filter: blur(6px); } }

@media (max-width: 640px) {
  .avviso-media { min-height: 0; max-height: 210px; }
}
@media (prefers-reduced-motion: reduce) {
  .avviso.fx-on, .avviso.fx-on *, .avviso.fx-leaving, .avviso.fx-leaving * { animation: none !important; }
  .avviso.fx-on .avviso-box::after { display: none; }
}
