/*
 * MF Elementor Kit – animazioni d'ingresso aggiuntive (menu "Animazione d'ingresso" → gruppo "Marco Fragale").
 * Caricato dopo il CSS di Elementor: .mfX (0,1,0) sostituisce la durata "Normale" di .animated,
 * mentre .animated.animated-slow / .animated-fast (0,2,0) restano scelte dell'utente.
 * Nessun !important. I keyframes definiscono solo "from": lo stato finale è quello impostato in Elementor.
 */

:where(body) {
	--mf-ease-out: cubic-bezier(.22, 1, .36, 1);
	--mf-ease-io: cubic-bezier(.77, 0, .175, 1);
	--mf-ease-std: cubic-bezier(.4, 0, .2, 1);
	--mf-shift: 40px;
}

@media (max-width: 767px) {
	:where(body) { --mf-shift: 24px; }
}

.mfRiseIn { animation-name: mfRiseIn; animation-duration: 900ms; }
.mfSlideInLeft { animation-name: mfSlideInLeft; animation-duration: 900ms; }
.mfSlideInRight { animation-name: mfSlideInRight; animation-duration: 900ms; }
.mfInkReveal { animation-name: mfInkReveal; animation-duration: 1100ms; animation-timing-function: var(--mf-ease-io); }
.mfCurtainUp { animation-name: mfCurtainUp; animation-duration: 1000ms; animation-timing-function: var(--mf-ease-io); }
.mfZoomSoft { animation-name: mfZoomSoft; animation-duration: 1200ms; }
.mfBlurIn { animation-name: mfBlurIn; animation-duration: 1000ms; }
.mfTitleBar { animation-name: mfTitleBar; animation-duration: 800ms; }
.mfPopIn { animation-name: mfPopIn; animation-duration: 700ms; }

:where(.mfRiseIn, .mfSlideInLeft, .mfSlideInRight, .mfZoomSoft, .mfBlurIn, .mfTitleBar, .mfPopIn) {
	animation-timing-function: var(--mf-ease-out);
}

:where(.mfRiseIn, .mfSlideInLeft, .mfSlideInRight, .mfInkReveal, .mfCurtainUp, .mfZoomSoft, .mfBlurIn, .mfTitleBar, .mfPopIn) {
	animation-fill-mode: backwards;
}

@keyframes mfRiseIn { from { opacity: 0; transform: translate3d(0, var(--mf-shift, 40px), 0); } }
@keyframes mfSlideInLeft { from { opacity: 0; transform: translate3d(calc(var(--mf-shift, 40px) * -1.5), 0, 0); } }
@keyframes mfSlideInRight { from { opacity: 0; transform: translate3d(calc(var(--mf-shift, 40px) * 1.5), 0, 0); } }
@keyframes mfInkReveal { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes mfCurtainUp { from { clip-path: inset(100% 0 0 0); transform: translate3d(0, 24px, 0); } to { clip-path: inset(0 0 0 0); transform: none; } }
@keyframes mfZoomSoft { from { opacity: 0; transform: scale(.94); } }
@keyframes mfBlurIn { from { opacity: 0; filter: blur(12px); transform: translate3d(0, 12px, 0); } }
@keyframes mfTitleBar { from { opacity: 0; transform: translate3d(calc(var(--mf-shift, 40px) * -1), 0, 0); } }
@keyframes mfPopIn { from { opacity: 0; transform: scale(.85); } 60% { opacity: 1; transform: scale(1.04); } }
@keyframes mfBarGrow { from { transform: scaleY(0); } }
@keyframes mfImgSettle { from { transform: scale(1.15); } }
@keyframes mfFade { from { opacity: 0; } }

/* Elementi interni: barra del titolo e assestamento dell'immagine */
:where(.mfTitleBar.animated) .elementor-heading-title::before { animation: mfBarGrow 700ms var(--mf-ease-out) 250ms backwards; }
:where(.mfInkReveal.animated) img { animation: mfImgSettle 1400ms var(--mf-ease-out) backwards; }

/* Cascata: --mf-i viene impostato dal JS sui figli diretti di .mf-stagger */
:where(.mf-stagger, .mf-stagger > .e-con-inner) > .animated { animation-delay: calc(var(--mf-i, 0) * var(--mf-stagger-step, 120ms)); }
:where(.mf-stagger--fast) { --mf-stagger-step: 60ms; }
:where(.mf-stagger.mf-pending) > :where(:not(.elementor-invisible, .animated)) { opacity: 0; transform: translate3d(0, var(--mf-shift, 40px), 0); }
:where(.mf-stagger.mf-reveal) > * {
	transition: opacity 700ms var(--mf-ease-out), transform 700ms var(--mf-ease-out);
	transition-delay: calc(var(--mf-i, 0) * var(--mf-stagger-step, 120ms));
}

/* Nell'editor i contenuti restano sempre visibili */
:where(.elementor-editor-active) :where(.mf-stagger.mf-pending) > * { opacity: 1; transform: none; }

/* Movimento ridotto: unico punto con specificità più alta, voluto (la preferenza dell'utente vince). */
@media (prefers-reduced-motion: reduce) {
	.elementor-element.animated { animation-name: mfFade; animation-duration: 200ms; animation-delay: 0s; animation-timing-function: linear; }
	:where(.mfTitleBar.animated) .elementor-heading-title::before,
	:where(.mfInkReveal.animated) img { animation: none; }
	:where(.mf-stagger.mf-pending) > * { opacity: 1; transform: none; }
}
