/* ═══════════════════════════════════════════════════════════════
   HELVEN STUDIO - Animations Stylesheet
   All keyframes, scroll animations, hover effects
   ═══════════════════════════════════════════════════════════════ */

/* ─── FLOATING ANIMATION (Hero Photo) ─── */
/* fluttuazione appena percettibile: niente rotazione, niente zoom al passaggio */
@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-8px);
    }
}

.floating {
    animation: float 7s ease-in-out infinite;
}

/* ─── SCROLL BOUNCE (Hero indicator) ─── */
@keyframes scrollBounce {
    0%, 100% {
        transform: rotate(45deg) translateY(0);
        opacity: 1;
    }
    50% {
        transform: rotate(45deg) translateY(8px);
        opacity: 0.5;
    }
}

/* ─── PAGE LOAD ANIMATIONS ─── */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-24px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(60px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ─── HERO STAGGERED LOAD ─── */
.hero .animate-fade-in {
    opacity: 0;
    animation: fadeInUp 0.7s cubic-bezier(0.23, 1, 0.32, 1) both;
}

.hero .animate-fade-in:nth-child(1) { animation-delay: 0.05s; }
.hero .animate-fade-in:nth-child(2) { animation-delay: 0.12s; }
.hero .animate-fade-in:nth-child(3) { animation-delay: 0.19s; }
.hero .animate-fade-in:nth-child(4) { animation-delay: 0.26s; }
.hero .animate-fade-in:nth-child(5) { animation-delay: 0.33s; }

/* la foto entra solo in dissolvenza: il suo contenitore e' gia' posizionato con transform */
@keyframes heroPhotoIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.hero__image.animate-fade-in {
    animation: heroPhotoIn 0.9s cubic-bezier(0.23, 1, 0.32, 1) both;
    animation-delay: 0.05s;
}

/* ─── SCROLL REVEAL ─── */
.reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.7s cubic-bezier(0.23, 1, 0.32, 1),
                transform 0.7s cubic-bezier(0.23, 1, 0.32, 1);
}

/* senza JavaScript i contenuti restano visibili */
html:not(.js) .reveal {
    opacity: 1;
    transform: none;
}

.reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger for grid children */
.services__grid .reveal:nth-child(1) { transition-delay: 0.0s; }
.services__grid .reveal:nth-child(2) { transition-delay: 0.06s; }
.services__grid .reveal:nth-child(3) { transition-delay: 0.12s; }
.services__grid .reveal:nth-child(4) { transition-delay: 0s; }
.services__grid .reveal:nth-child(5) { transition-delay: 0.06s; }
.services__grid .reveal:nth-child(6) { transition-delay: 0.12s; }

.services-extra__grid .reveal:nth-child(1) { transition-delay: 0.0s; }
.services-extra__grid .reveal:nth-child(2) { transition-delay: 0.15s; }
.services-extra__grid .reveal:nth-child(3) { transition-delay: 0.3s; }

.stats-showcase__grid .reveal:nth-child(1) { transition-delay: 0.0s; }
.stats-showcase__grid .reveal:nth-child(2) { transition-delay: 0.1s; }
.stats-showcase__grid .reveal:nth-child(3) { transition-delay: 0.2s; }
.stats-showcase__grid .reveal:nth-child(4) { transition-delay: 0.3s; }

.consulting-results__grid .reveal:nth-child(1) { transition-delay: 0.0s; }
.consulting-results__grid .reveal:nth-child(2) { transition-delay: 0.1s; }
.consulting-results__grid .reveal:nth-child(3) { transition-delay: 0.2s; }
.consulting-results__grid .reveal:nth-child(4) { transition-delay: 0.3s; }

.clients__grid .reveal:nth-child(1) { transition-delay: 0.0s; }
.clients__grid .reveal:nth-child(2) { transition-delay: 0.1s; }
.clients__grid .reveal:nth-child(3) { transition-delay: 0.2s; }
.clients__grid .reveal:nth-child(4) { transition-delay: 0.3s; }

/* ─── PULSE GLOW (CTA Buttons) ─── */
@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(245, 183, 49, 0.4);
    }
    50% {
        box-shadow: 0 0 0 15px rgba(245, 183, 49, 0);
    }
}

.cta-mid .btn--primary {
    animation: pulseGlow 3s ease-in-out infinite;
}

/* ─── NUMBER COUNTER ANIMATION ─── */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ─── PARALLAX HELPER ─── */
.parallax-element {
    will-change: transform;
    transition: transform 0.1s linear;
}

/* ─── CARD HOVER ENHANCEMENTS ─── */
/* will-change permanente rimosso: teneva in memoria un layer per ogni card */

/* ─── LINK UNDERLINE ANIMATION ─── */
.service-card__link {
    position: relative;
    display: inline-block;
}

.service-card__link::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 0;
    width: 100%;
    height: 2px;
    border-radius: 2px;
    background: var(--accent);
    transform: scaleX(0.35);
    transform-origin: left;
    transition: transform 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

.service-card__link:hover::after,
.service-card__link:focus-visible::after {
    transform: scaleX(1);
}

/* ─── FORM FOCUS ANIMATIONS ─── */
.form-group input,
.form-group textarea {
    transition: border-color 0.3s ease,
                box-shadow 0.3s ease,
                background-color 0.3s ease,
                transform 0.2s ease;
}

/* ─── HEADER SCROLL TRANSITION ─── */
.header {
    transition: height 0.3s ease,
                box-shadow 0.3s ease,
                background-color 0.3s ease;
}

/* ─── SMOOTH MOBILE MENU ─── */
.header__nav {
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1),
                opacity 0.25s ease,
                visibility 0s linear 0.35s;
}

.header__nav.active {
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1),
                opacity 0.25s ease,
                visibility 0s linear 0s;
}

/* ─── REDUCED MOTION ─── */
/* Movimento ridotto: niente spostamenti né loop, restano le dissolvenze brevi */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .floating,
    .cta-mid .btn--primary,
    .vsl-unmute-btn {
        animation: none;
    }

    .clients__track {
        animation-play-state: paused;
    }

    .hero .animate-fade-in,
    .hero__image.animate-fade-in {
        animation: fadeIn 0.3s ease both;
    }

    .reveal {
        transform: none;
        transition: opacity 0.3s ease;
    }

    .btn,
    .btn:hover,
    .btn:active,
    .service-card:hover,
    .services-extra__card:hover,
    .consulting-result:hover,
    .case-study__image:hover img {
        transform: none !important;
    }
}
