/* Microinteracciones. `.fx` lo agrega interactions.js solo con mouse y sin "reducir movimiento". */

/* Barra de progreso de scroll bajo el header */
header {
    position: sticky;
}

.scroll-progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 3px;
    background: linear-gradient(90deg, var(--navy), var(--coral));
    transform: scaleX(0);
    transform-origin: 0 50%;
    pointer-events: none;
}

/* Halo que sigue al cursor */
.cursor-halo {
    position: fixed;
    top: 0;
    left: 0;
    width: 420px;
    height: 420px;
    margin: -210px 0 0 -210px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(218, 92, 88, 0.05), rgba(24, 36, 61, 0.02) 40%, rgba(24, 36, 61, 0) 65%);
    pointer-events: none;
    z-index: 90;
    opacity: 0;
    transition: opacity var(--t-medium) var(--ease), width var(--t-medium) var(--ease), height var(--t-medium) var(--ease), margin var(--t-medium) var(--ease);
    will-change: transform;
}

.cursor-halo.is-visible {
    opacity: 1;
}

.cursor-halo.is-active {
    width: 460px;
    height: 460px;
    margin: -230px 0 0 -230px;
}

/* Tilt 3D con brillo */
.fx .fx-tilt {
    position: relative;
    transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(var(--lift, 0px));
    transition: transform 520ms var(--ease), box-shadow var(--t-medium) var(--ease);
}

.fx .float-card.fx-tilt {
    position: absolute;
}

.fx .fx-tilt.is-tilting {
    --lift: -4px;
    transition: transform 90ms linear, box-shadow var(--t-medium) var(--ease);
}

.fx-glare {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    opacity: 0;
    background: radial-gradient(circle at var(--gx, 50%) var(--gy, 50%), var(--glare, rgba(218, 92, 88, 0.10)), rgba(255, 255, 255, 0) 55%);
    transition: opacity var(--t-medium) var(--ease);
}

.is-tilting > .fx-glare {
    opacity: 1;
}

.download-card,
.benefits {
    --glare: rgba(255, 255, 255, 0.16);
}

/* Botones magnéticos (translate lo mueve el JS; transform queda para el press) */
.fx .btn,
.fx .mobile-menu-toggle,
.fx .social-link-large a,
.fx .footer-links a,
.fx .nav-links a {
    transition:
        transform var(--t-press) var(--ease),
        translate 320ms var(--ease),
        background-color var(--t-short) var(--ease),
        box-shadow var(--t-short) var(--ease),
        color var(--t-short) var(--ease);
}

/* Parallax del hero */
.fx .hero::before,
.fx .hero-disc,
.fx .phone-mockup,
.fx .float-card {
    transition: translate 700ms var(--ease), transform 700ms var(--ease), box-shadow var(--t-medium) var(--ease);
}

.fx .hero::before { translate: calc(var(--px, 0) * 40px) calc(var(--py, 0) * 30px); }
.fx .hero-disc { translate: calc(var(--px, 0) * -14px) calc(var(--py, 0) * -14px); }
.fx .phone-mockup {
    translate: calc(var(--px, 0) * -8px) calc(var(--py, 0) * -6px);
    transform: perspective(1200px) rotateY(calc(var(--px, 0) * -7deg)) rotateX(calc(var(--py, 0) * 5deg));
}
.fx .float-card--top { translate: calc(var(--px, 0) * 26px) calc(var(--py, 0) * 20px); }
.fx .float-card--bottom { translate: calc(var(--px, 0) * -22px) calc(var(--py, 0) * -24px); }

/* Indicador de navegación */
.nav-links.has-indicator {
    position: relative;
}

.nav-indicator {
    position: absolute;
    top: 0;
    left: 0;
    border-radius: var(--r-pill);
    background: var(--navy-soft);
    opacity: 0;
    pointer-events: none;
    transition: transform 380ms var(--ease), width 380ms var(--ease), height 380ms var(--ease), opacity var(--t-short) var(--ease);
}

.nav-links.has-indicator a {
    position: relative;
}

@media (min-width: 901px) {
    .nav-links.has-indicator a.active {
        background: transparent;
    }
}

@media (max-width: 900px) {
    .nav-indicator {
        display: none;
    }
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
    /* Íconos que rebotan */
    .icon-tile {
        transition: transform 420ms cubic-bezier(0.34, 1.56, 0.64, 1), background-color var(--t-short) var(--ease), color var(--t-short) var(--ease);
    }

    .card:hover .icon-tile,
    .benefits-list li:hover .icon-tile,
    .float-card:hover .icon-tile {
        transform: translateY(-3px) rotate(-8deg) scale(1.08);
    }

    /* Brillo que cruza el botón */
    .btn {
        position: relative;
        overflow: hidden;
        isolation: isolate;
    }

    .btn::after {
        content: "";
        position: absolute;
        inset: 0;
        z-index: -1;
        background: linear-gradient(110deg, rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, 0.28) 50%, rgba(255, 255, 255, 0) 70%);
        transform: translateX(-120%);
        transition: transform 700ms var(--ease);
    }

    .btn:hover::after {
        transform: translateX(120%);
    }

    .btn i {
        transition: transform 360ms cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    .btn:hover i {
        transform: scale(1.18) rotate(-6deg);
    }

    /* Estrellas que saltan en cascada */
    .testimonial-rating i {
        transition: transform 360ms cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    .testimonial-card:hover .testimonial-rating i {
        transform: translateY(-4px) scale(1.15);
    }

    .testimonial-rating i:nth-child(2) { transition-delay: 40ms; }
    .testimonial-rating i:nth-child(3) { transition-delay: 80ms; }
    .testimonial-rating i:nth-child(4) { transition-delay: 120ms; }
    .testimonial-rating i:nth-child(5) { transition-delay: 160ms; }

    /* Avatar y logo */
    .testimonial-avatar {
        transition: background-color var(--t-short) var(--ease), color var(--t-short) var(--ease), transform 360ms cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    .testimonial-card:hover .testimonial-avatar {
        background: var(--navy);
        color: #fff;
        transform: scale(1.08);
    }

    .logo img,
    .download-logo {
        transition: transform 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    .logo:hover img {
        transform: rotate(-10deg) scale(1.08);
    }

    .download-card:hover .download-logo {
        transform: translateY(-4px) rotate(6deg);
    }

    /* Subrayado que se dibuja en los acentos de título */
    .section-title span {
        background: linear-gradient(var(--coral-soft), var(--coral-soft)) 0 88% / 0% 0.28em no-repeat;
        transition: background-size 600ms var(--ease);
    }

    .section-head:hover .section-title span,
    .benefits-text:hover .section-title span,
    .download-card:hover .section-title span {
        background-size: 100% 0.28em;
    }

    .benefits .section-title span,
    .download-card .section-title span {
        background-image: linear-gradient(rgba(218, 92, 88, 0.3), rgba(218, 92, 88, 0.3));
    }

    /* Teléfono de beneficios */
    .benefits-image .phone-frame {
        transition: transform 700ms cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    .benefits-image:hover .phone-frame {
        transform: rotate(0deg) translateY(-8px) scale(1.02);
    }

    /* Pills del hero */
    .pill {
        transition: box-shadow var(--t-short) var(--ease), transform 360ms cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    .pill:hover {
        transform: translateY(-2px);
        box-shadow: inset 0 0 0 1px var(--navy), 0 6px 16px rgba(24, 36, 61, 0.08);
    }
}
