/**
 * Animaciones y microinteracciones — solo página principal (.page-home)
 * Respeta prefers-reduced-motion
 */

/* ---------- Variables ---------- */
.page-home {
    --motion-duration: 0.65s;
    --motion-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --stagger-step: 0.07s;
}

/* ---------- Hero: brillo y chips ---------- */
.page-home .hero-background::after {
    animation: heroTintPulse 14s ease-in-out infinite;
}

@keyframes heroTintPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.92; }
}

.page-home .hero-content {
    animation: none;
}

.page-home .hero-title {
    animation: heroTitleIn 1s var(--motion-ease) both;
}

.page-home .hero-subtitle {
    animation: heroFadeUp 0.85s var(--motion-ease) 0.12s both;
}

.page-home .hero-benefits--motion {
    animation: heroFadeUp 0.85s var(--motion-ease) 0.22s both;
}

.page-home .hero-stats {
    animation: heroFadeUp 0.85s var(--motion-ease) 0.28s both;
}

.page-home .hero-cta-group {
    animation: heroFadeUp 0.85s var(--motion-ease) 0.34s both;
}

@keyframes heroTitleIn {
    from {
        opacity: 0;
        transform: translateY(28px);
        letter-spacing: 0.04em;
    }
    to {
        opacity: 1;
        transform: translateY(0);
        letter-spacing: -1px;
    }
}

@keyframes heroFadeUp {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-home .benefit-item {
    transition: transform 0.35s var(--motion-ease), box-shadow 0.35s ease, border-color 0.35s ease;
}

.page-home .benefit-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.45);
}

.page-home .hero-cta-group .btn-primary.btn-large {
    animation: ctaPulseSoft 3.2s ease-in-out infinite;
}

@keyframes ctaPulseSoft {
    0%, 100% { box-shadow: 0 8px 28px rgba(59, 130, 246, 0.25); }
    50% { box-shadow: 0 12px 36px rgba(59, 130, 246, 0.45); }
}

/* ---------- Scroll reveal ---------- */
.page-home .el-reveal {
    opacity: 0;
    transform: translateY(28px);
    transition:
        opacity var(--motion-duration) var(--motion-ease),
        transform var(--motion-duration) var(--motion-ease);
    will-change: opacity, transform;
}

.page-home .el-reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.page-home .el-reveal-scale {
    opacity: 0;
    transform: scale(0.96);
    transition:
        opacity var(--motion-duration) var(--motion-ease),
        transform var(--motion-duration) var(--motion-ease);
}

.page-home .el-reveal-scale.is-visible {
    opacity: 1;
    transform: scale(1);
}

.page-home .el-reveal-stagger > * {
    opacity: 0;
    transform: translateY(22px);
    transition:
        opacity 0.55s var(--motion-ease),
        transform 0.55s var(--motion-ease);
}

.page-home .el-reveal-stagger.is-visible > * {
    opacity: 1;
    transform: translateY(0);
}

.page-home .el-reveal-stagger.is-visible > *:nth-child(1) { transition-delay: calc(var(--stagger-step) * 0); }
.page-home .el-reveal-stagger.is-visible > *:nth-child(2) { transition-delay: calc(var(--stagger-step) * 1); }
.page-home .el-reveal-stagger.is-visible > *:nth-child(3) { transition-delay: calc(var(--stagger-step) * 2); }
.page-home .el-reveal-stagger.is-visible > *:nth-child(4) { transition-delay: calc(var(--stagger-step) * 3); }
.page-home .el-reveal-stagger.is-visible > *:nth-child(5) { transition-delay: calc(var(--stagger-step) * 4); }
.page-home .el-reveal-stagger.is-visible > *:nth-child(6) { transition-delay: calc(var(--stagger-step) * 5); }
.page-home .el-reveal-stagger.is-visible > *:nth-child(7) { transition-delay: calc(var(--stagger-step) * 6); }
.page-home .el-reveal-stagger.is-visible > *:nth-child(8) { transition-delay: calc(var(--stagger-step) * 7); }
.page-home .el-reveal-stagger.is-visible > *:nth-child(9) { transition-delay: calc(var(--stagger-step) * 8); }
.page-home .el-reveal-stagger.is-visible > *:nth-child(10) { transition-delay: calc(var(--stagger-step) * 9); }
.page-home .el-reveal-stagger.is-visible > *:nth-child(11) { transition-delay: calc(var(--stagger-step) * 10); }
.page-home .el-reveal-stagger.is-visible > *:nth-child(12) { transition-delay: calc(var(--stagger-step) * 11); }

/* ---------- Stats contador ---------- */
.page-home .stat-number .js-count {
    font-variant-numeric: tabular-nums;
}

.page-home .stats-grid .stat-item {
    transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.page-home .stats-grid .stat-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
}

/* ---------- Process steps línea ---------- */
.page-home .process-steps .step {
    transition: transform 0.35s ease;
}

.page-home .process-steps .step:hover {
    transform: translateY(-4px);
}

/* ---------- Testimonios CTA ---------- */
.page-home .testimonials-cta .btn-primary {
    position: relative;
    overflow: hidden;
}

.page-home .testimonials-cta .btn-primary::after {
    content: '';
    position: absolute;
    inset: -50%;
    background: linear-gradient(
        120deg,
        transparent 40%,
        rgba(255, 255, 255, 0.15) 50%,
        transparent 60%
    );
    animation: btnShine 4s ease-in-out infinite;
}

@keyframes btnShine {
    0% { transform: translateX(-100%) rotate(25deg); }
    100% { transform: translateX(100%) rotate(25deg); }
}

/* ---------- Barra flotante conversión ---------- */
.home-float-cta {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 998;
    padding: 0.65rem 1rem calc(0.65rem + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(180deg, rgba(15, 23, 42, 0) 0%, rgba(15, 23, 42, 0.92) 18%);
    pointer-events: none;
    transform: translateY(110%);
    opacity: 0;
    transition: transform 0.45s var(--motion-ease), opacity 0.35s ease;
}

.home-float-cta.is-active {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.home-float-cta__inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.65rem 1rem;
    padding: 0.55rem 1rem;
    background: rgba(255, 255, 255, 0.97);
    border: 1px solid rgba(59, 130, 246, 0.18);
    border-radius: 16px;
    box-shadow: 0 -8px 40px rgba(15, 23, 42, 0.18);
}

.home-float-cta__hook {
    font-size: 0.9rem;
    font-weight: 600;
    color: #0f172a;
    flex: 1 1 180px;
    text-align: center;
}

.home-float-cta .btn-float-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 1.35rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.88rem;
    text-decoration: none;
    background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(37, 99, 235, 0.45);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.home-float-cta .btn-float-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 26px rgba(37, 99, 235, 0.55);
}

.home-float-cta .btn-float-wa {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 1.25rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.88rem;
    text-decoration: none;
    background: #25d366;
    color: #fff;
    transition: transform 0.2s ease, filter 0.2s ease;
}

.home-float-cta .btn-float-wa:hover {
    transform: translateY(-2px);
    filter: brightness(1.06);
}

.home-float-cta__close {
    margin-left: 0.25rem;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.06);
    color: #475569;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease;
}

.home-float-cta__close:hover {
    background: rgba(15, 23, 42, 0.12);
}

@media (max-width: 640px) {
    .home-float-cta__hook {
        flex-basis: 100%;
        font-size: 0.82rem;
    }
}

/* Cuando la barra está visible, espacio para no tapar contenido */
.page-home.body-float-cta-on {
    padding-bottom: 5.5rem;
}

@media (prefers-reduced-motion: reduce) {
    .page-home .hero-background::after,
    .page-home .hero-cta-group .btn-primary.btn-large,
    .page-home .testimonials-cta .btn-primary::after {
        animation: none !important;
    }

    .page-home .el-reveal,
    .page-home .el-reveal-scale,
    .page-home .el-reveal-stagger > *,
    .page-home .hero-title,
    .page-home .hero-subtitle,
    .page-home .hero-benefits--motion,
    .page-home .hero-stats,
    .page-home .hero-cta-group {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    .home-float-cta {
        transition: none;
    }
}
