/* =====================================================================
   Andrés Arango — Mejoras premium (v2)
   Loader, menú móvil, toggle dark/light, cursor, magnetic, scroll progress,
   exit popup, sticky CTA, WhatsApp flotante, split text, page transitions.
   ===================================================================== */

/* ====== SKIP LINK (accesibilidad) ====== */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--accent);
    color: var(--bg);
    padding: 12px 18px;
    z-index: 99999;
    font-weight: 500;
    text-decoration: none;
}
.skip-link:focus {
    left: 16px;
    top: 16px;
}

/* Mejor focus visible para teclado */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

/* Reduced motion: desactiva transiciones */
.reduced-motion *,
.reduced-motion *::before,
.reduced-motion *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
}

/* ====== LOADER INICIAL ====== */
#aa-loader {
    position: fixed; inset: 0;
    background: var(--bg);
    z-index: 100000;
    display: grid; place-items: center;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}
#aa-loader.aa-loader-out { opacity: 0; visibility: hidden; pointer-events: none; }
.aa-loader-inner {
    font-family: var(--font-display);
    font-size: 80px;
    font-style: italic;
    color: var(--accent);
    animation: aa-loader-pulse 1.4s ease-in-out infinite;
}
@keyframes aa-loader-pulse {
    0%, 100% { transform: scale(1); opacity: 0.4; }
    50% { transform: scale(1.1); opacity: 1; }
}

/* ====== SCROLL PROGRESS BAR ====== */
.aa-progress {
    position: fixed; top: 0; left: 0;
    height: 2px;
    background: var(--accent);
    z-index: 9999;
    width: 0;
    transition: width 0.05s linear;
    box-shadow: 0 0 8px var(--accent);
}

/* ====== TOGGLE DARK/LIGHT ====== */
.aa-theme-toggle {
    background: transparent;
    border: 1px solid var(--line-strong);
    color: var(--text);
    width: 38px; height: 38px;
    border-radius: 50%;
    display: grid; place-items: center;
    cursor: pointer;
    margin-left: 16px;
    transition: border-color 0.3s ease, color 0.3s ease;
}
.aa-theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.aa-theme-toggle .i-sun { display: none; }
.aa-theme-toggle .i-moon { display: block; }
html[data-mode="light"] .aa-theme-toggle .i-sun { display: block; }
html[data-mode="light"] .aa-theme-toggle .i-moon { display: none; }

/* ====== MENÚ MÓVIL (panel lateral) ====== */
.aa-mobile-panel {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(12px);
    z-index: 9998;
    visibility: hidden; opacity: 0;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}
.aa-mobile-panel.is-open { visibility: visible; opacity: 1; }
.aa-mobile-inner {
    position: absolute; right: 0; top: 0; bottom: 0;
    width: min(420px, 92%);
    background: var(--bg);
    padding: 88px 32px 32px;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.5s cubic-bezier(0.7, 0, 0.2, 1);
    border-left: 1px solid var(--line);
}
.aa-mobile-panel.is-open .aa-mobile-inner { transform: translateX(0); }
.aa-mobile-close {
    position: absolute; top: 24px; right: 28px;
    background: transparent; border: 0;
    color: var(--text); font-size: 36px; line-height: 1;
    cursor: pointer; padding: 4px 12px;
    transition: color 0.3s ease;
}
.aa-mobile-close:hover { color: var(--accent); }
.aa-mobile-nav {
    list-style: none; padding: 0; margin: 0;
    display: flex; flex-direction: column; gap: 0;
}
.aa-mobile-nav li {
    border-bottom: 1px solid var(--line);
}
.aa-mobile-nav a {
    display: block;
    padding: 20px 0;
    font-family: var(--font-display);
    font-size: 26px;
    color: var(--text);
    text-decoration: none;
    transition: color 0.3s ease, padding 0.3s ease;
}
.aa-mobile-nav a:hover { color: var(--accent); padding-left: 8px; }

/* ====== CURSOR PERSONALIZADO ====== */
@media (hover: hover) and (pointer: fine) {
    .aa-cursor, .aa-cursor-ring {
        position: fixed; top: 0; left: 0;
        pointer-events: none;
        z-index: 99998;
        will-change: transform;
    }
    .aa-cursor {
        width: 6px; height: 6px;
        background: var(--accent);
        border-radius: 50%;
        margin: -3px 0 0 -3px;
    }
    .aa-cursor-ring {
        width: 32px; height: 32px;
        border: 1px solid var(--accent);
        border-radius: 50%;
        margin: -16px 0 0 -16px;
        transition: width 0.3s ease, height 0.3s ease, margin 0.3s ease, background 0.3s ease;
    }
    .aa-cursor-ring.is-hover {
        width: 64px; height: 64px;
        margin: -32px 0 0 -32px;
        background: rgba(201, 169, 97, 0.1);
    }
    body { cursor: none; }
    a, button, input, select, textarea, [onclick] { cursor: none; }
}

/* ====== MAGNETIC BUTTONS ====== */
.btn-primary, .btn-ghost {
    transition: transform 0.3s cubic-bezier(0.2, 1, 0.3, 1), background 0.3s ease, color 0.3s ease, border-color 0.3s ease !important;
}

/* ====== STICKY CTA (móvil) ====== */
.aa-sticky-cta {
    position: fixed; bottom: 20px; right: 20px;
    background: var(--accent);
    color: var(--bg);
    padding: 14px 22px;
    font-size: 13px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 500;
    text-decoration: none;
    display: none;
    align-items: center; gap: 10px;
    z-index: 9990;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}
.aa-sticky-cta.is-visible { opacity: 1; transform: translateY(0); }
@media (max-width: 768px) {
    .aa-sticky-cta { display: inline-flex; bottom: 16px; right: 16px; left: 16px; justify-content: center; }
}

/* ====== WHATSAPP FLOTANTE ====== */
.aa-whatsapp {
    position: fixed; bottom: 24px; left: 24px;
    width: 56px; height: 56px;
    background: #25D366;
    color: #fff;
    border-radius: 50%;
    display: grid; place-items: center;
    text-decoration: none;
    z-index: 9991;
    box-shadow: 0 10px 30px rgba(37, 211, 102, 0.4);
    animation: aa-wa-pulse 2.6s ease-in-out infinite;
    transition: transform 0.3s ease;
}
.aa-whatsapp:hover { transform: scale(1.08); }
@keyframes aa-wa-pulse {
    0%, 100% { box-shadow: 0 10px 30px rgba(37, 211, 102, 0.3), 0 0 0 0 rgba(37, 211, 102, 0.5); }
    50% { box-shadow: 0 10px 30px rgba(37, 211, 102, 0.3), 0 0 0 12px rgba(37, 211, 102, 0); }
}
@media (max-width: 768px) {
    .aa-whatsapp { bottom: 92px; left: 16px; width: 50px; height: 50px; }
}

/* ====== EXIT-INTENT POPUP ====== */
.aa-exit-popup {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(8px);
    z-index: 99997;
    display: grid; place-items: center;
    visibility: hidden; opacity: 0;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    padding: 20px;
}
.aa-exit-popup.is-open { visibility: visible; opacity: 1; }
.aa-exit-inner {
    background: var(--bg-elev);
    border: 1px solid var(--line-strong);
    padding: 56px 48px;
    max-width: 540px;
    width: 100%;
    position: relative;
    transform: scale(0.92);
    transition: transform 0.5s cubic-bezier(0.2, 1, 0.3, 1);
}
.aa-exit-popup.is-open .aa-exit-inner { transform: scale(1); }
.aa-exit-close {
    position: absolute; top: 12px; right: 16px;
    background: transparent; border: 0;
    color: var(--text-muted); font-size: 32px; line-height: 1;
    cursor: pointer;
    transition: color 0.3s ease;
}
.aa-exit-close:hover { color: var(--accent); }
.aa-exit-inner h3 {
    font-family: var(--font-display);
    font-size: clamp(26px, 3vw, 36px);
    line-height: 1.15;
    margin: 16px 0 14px;
}
.aa-exit-inner p {
    color: var(--text-muted);
    margin-bottom: 28px;
    line-height: 1.6;
}
@media (max-width: 600px) {
    .aa-exit-inner { padding: 36px 24px; }
}

/* ====== SPLIT TEXT ANIMATION ====== */
.aa-word { display: inline-block; overflow: hidden; vertical-align: bottom; }
.aa-word-inner {
    display: inline-block;
    transform: translateY(110%);
    opacity: 0;
    transition: transform 0.8s cubic-bezier(0.2, 1, 0.3, 1), opacity 0.5s ease;
}
.aa-word-inner.is-in { transform: translateY(0); opacity: 1; }

/* ====== PAGE TRANSITION FADER ====== */
.aa-fader {
    position: fixed; inset: 0;
    background: var(--bg);
    z-index: 99996;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.28s ease, visibility 0.28s ease;
}
.aa-fader.is-shown {
    opacity: 1;
    visibility: visible;
}

/* ====== SOCIAL PROOF STRIP ====== */
.aa-social-proof {
    padding: 50px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}
.aa-social-proof-label {
    font-size: 10px;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--text-dim);
    text-align: center;
    margin-bottom: 28px;
}
.aa-social-proof-row {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 48px;
    opacity: 0.7;
    filter: grayscale(1);
    transition: opacity 0.3s ease, filter 0.3s ease;
}
.aa-social-proof-row:hover { opacity: 1; filter: grayscale(0); }
.aa-social-proof-item {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 22px;
    color: var(--text-muted);
}

/* ====== LEAD MAGNET HERO BANNER ====== */
.aa-lead-magnet {
    background: linear-gradient(135deg, var(--accent-soft), transparent);
    border: 1px solid var(--accent);
    padding: 56px;
    margin: 80px 0;
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 60px;
    align-items: center;
}
.aa-lead-magnet h2 {
    font-family: var(--font-display);
    font-size: clamp(28px, 3.4vw, 42px);
    line-height: 1.1;
    margin-bottom: 18px;
}
.aa-lead-magnet p {
    color: var(--text-muted);
    margin-bottom: 28px;
    line-height: 1.6;
}
.aa-lead-magnet-bullets {
    list-style: none; padding: 0; margin: 0 0 28px;
    display: flex; flex-direction: column; gap: 10px;
}
.aa-lead-magnet-bullets li {
    padding-left: 24px;
    position: relative;
    color: var(--text-muted);
    font-size: 14px;
}
.aa-lead-magnet-bullets li::before {
    content: "✓";
    position: absolute; left: 0; top: 0;
    color: var(--accent);
    font-weight: bold;
}
@media (max-width: 900px) {
    .aa-lead-magnet { grid-template-columns: 1fr; padding: 36px 28px; gap: 32px; }
}

/* ====== VIDEO TESTIMONIALS GRID ====== */
.aa-testimonial-videos {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
}
.aa-testimonial-video {
    aspect-ratio: 9/16;
    background: var(--bg-elev);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid var(--line);
    transition: border-color 0.3s ease, transform 0.4s ease;
}
.aa-testimonial-video:hover { border-color: var(--accent); transform: translateY(-4px); }
.aa-testimonial-video iframe,
.aa-testimonial-video video {
    position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: cover;
}
.aa-testimonial-placeholder {
    position: absolute; inset: 0;
    display: grid; place-items: center;
    color: var(--text-dim);
    text-align: center;
    padding: 24px;
    font-size: 13px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}
@media (max-width: 900px) {
    .aa-testimonial-videos { grid-template-columns: 1fr; }
}

/* ====== AJUSTES NAV en mobile (mostrar toggle, esconder links) ====== */
@media (max-width: 900px) {
    .nav-links { display: none !important; }
    .nav-toggle { display: inline-flex !important; }
}
@media (min-width: 901px) {
    .nav-toggle { display: none !important; }
}
