/* ============================================================
   DENTAL HERPAN — ANIMACIONES PREMIUM DE SCROLL
   ============================================================ */

/* ====== VARIABLES DE ANIMACIÓN ====== */
:root {
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-out-back: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --duration-fast: 0.4s;
    --duration-med: 0.7s;
    --duration-slow: 1s;
}

/* ============================================================
   1. SISTEMA DE ANIMACIONES DE ENTRADA (SCROLL REVEAL)
   ============================================================ */

/* --- Fade Up (por defecto) --- */
.anim-fade-up {
    opacity: 0;
    transform: translateY(50px);
    transition: opacity var(--duration-med) var(--ease-out-expo),
                transform var(--duration-med) var(--ease-out-expo);
}

/* --- Fade desde la izquierda --- */
.anim-fade-left {
    opacity: 0;
    transform: translateX(-60px);
    transition: opacity var(--duration-med) var(--ease-out-expo),
                transform var(--duration-med) var(--ease-out-expo);
}

/* --- Fade desde la derecha --- */
.anim-fade-right {
    opacity: 0;
    transform: translateX(60px);
    transition: opacity var(--duration-med) var(--ease-out-expo),
                transform var(--duration-med) var(--ease-out-expo);
}

/* --- Zoom In --- */
.anim-zoom {
    opacity: 0;
    transform: scale(0.85);
    transition: opacity var(--duration-med) var(--ease-out-expo),
                transform var(--duration-med) var(--ease-out-expo);
}

/* --- Flip desde abajo (para tarjetas) --- */
.anim-flip-up {
    opacity: 0;
    transform: perspective(600px) rotateX(20deg) translateY(40px);
    transition: opacity var(--duration-slow) var(--ease-out-expo),
                transform var(--duration-slow) var(--ease-out-expo);
}

/* --- Activado (cuando entra en pantalla) --- */
.anim-fade-up.in-view,
.anim-fade-left.in-view,
.anim-fade-right.in-view,
.anim-zoom.in-view,
.anim-flip-up.in-view {
    opacity: 1;
    transform: none;
}

/* --- Delays escalonados para grupos --- */
.anim-delay-1 { transition-delay: 0.1s; }
.anim-delay-2 { transition-delay: 0.2s; }
.anim-delay-3 { transition-delay: 0.3s; }
.anim-delay-4 { transition-delay: 0.4s; }
.anim-delay-5 { transition-delay: 0.5s; }
.anim-delay-6 { transition-delay: 0.6s; }
.anim-delay-7 { transition-delay: 0.7s; }
.anim-delay-8 { transition-delay: 0.8s; }

/* ============================================================
   2. DIENTE FLOTANTE ANIMADO (decoración hero)
   ============================================================ */
.tooth-float {
    position: absolute;
    pointer-events: none;
    z-index: 0;
    font-size: 3rem;
    opacity: 0.06;
    animation: toothFloat 8s ease-in-out infinite;
    color: var(--gold);
    filter: drop-shadow(0 0 20px rgba(201,168,76,0.4));
}

.tooth-float:nth-child(2) { animation-delay: -2s; animation-duration: 10s; }
.tooth-float:nth-child(3) { animation-delay: -4s; animation-duration: 12s; }

@keyframes toothFloat {
    0%, 100% { transform: translateY(0px) rotate(-10deg); }
    50%       { transform: translateY(-20px) rotate(10deg); }
}

/* ============================================================
   3. CONTADOR ANIMADO DE ESTADÍSTICAS
   ============================================================ */
.stat-counter {
    display: inline-block;
    transition: transform 0.3s var(--ease-out-back);
}

.stat:hover .stat-counter {
    transform: scale(1.1);
    color: var(--gold-light);
}

/* Pulso dorado cuando el número termina de contar */
@keyframes statPulse {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.15); color: var(--gold-light); }
    100% { transform: scale(1); }
}

.stat-done .stat-counter {
    animation: statPulse 0.5s var(--ease-out-back) forwards;
}

/* ============================================================
   4. HOVER PREMIUM EN TARJETAS DE TRATAMIENTO
   ============================================================ */
.treatment-card {
    position: relative;
    overflow: hidden;
    transition: transform 0.4s var(--ease-out-back),
                box-shadow 0.4s ease,
                border-color 0.3s ease !important;
}

/* Brillo que pasa al hover */
.treatment-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -75%;
    width: 50%;
    height: 200%;
    background: linear-gradient(
        to right,
        transparent 0%,
        rgba(201,168,76,0.15) 50%,
        transparent 100%
    );
    transform: skewX(-15deg);
    transition: left 0.5s ease;
    pointer-events: none;
    z-index: 1;
}

.treatment-card:hover::before {
    left: 125%;
}

.treatment-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 25px 50px rgba(13, 27, 62, 0.15),
                0 0 0 2px rgba(201,168,76,0.3);
}

.treatment-card:hover .card-icon {
    transform: scale(1.2) rotate(-5deg);
    color: var(--gold);
}

.card-icon {
    transition: transform 0.4s var(--ease-out-back), color 0.3s ease;
}

/* ============================================================
   5. WHY-CARDS: ANIMACIÓN ENTRADA CON ÍCONO QUE LATE
   ============================================================ */
.why-card {
    transition: transform 0.4s var(--ease-out-back),
                box-shadow 0.4s ease,
                background 0.3s ease;
}

.why-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(13,27,62,0.12);
    background: white;
}

.why-card:hover .why-icon {
    animation: heartbeat 0.6s var(--ease-out-back);
}

@keyframes heartbeat {
    0%   { transform: scale(1); }
    30%  { transform: scale(1.3); }
    60%  { transform: scale(0.95); }
    100% { transform: scale(1); }
}

/* ============================================================
   6. SECCIÓN HERO: PARALLAX SUAVE EN IMÁGENES
   ============================================================ */
.hero-parallax {
    transition: transform 0.1s linear;
    will-change: transform;
}

/* Efecto de brillo en imágenes de la grilla del hero */
.grid-item {
    position: relative;
    overflow: hidden;
    transition: transform 0.4s var(--ease-out-back);
}

.grid-item:hover {
    transform: scale(1.04);
    z-index: 2;
}

.grid-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(201,168,76,0.2), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: inherit;
}

.grid-item:hover::after {
    opacity: 1;
}

/* ============================================================
   7. BOTONES: ANIMACIÓN PREMIUM
   ============================================================ */
.btn {
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(255,255,255,0.3) 0%, transparent 70%);
    opacity: 0;
    transform: scale(0);
    transition: opacity 0.4s ease, transform 0.5s ease;
    border-radius: inherit;
}

.btn:active::after {
    opacity: 1;
    transform: scale(2.5);
    transition: 0s;
}

/* ============================================================
   8. LÍNEA DORADA ANIMADA: Separador decorativo
   ============================================================ */
.gold-line-anim {
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--gold), var(--gold-light), var(--gold));
    border-radius: 2px;
    margin: 15px 0 25px;
    transition: width 1s var(--ease-out-expo);
}

.in-view .gold-line-anim,
.gold-line-anim.in-view {
    width: 60px;
}

/* ============================================================
   9. SECCIÓN NOSOTROS: LOGO CON AURA PULSANTE
   ============================================================ */
.doctor-image {
    position: relative;
    transition: transform 0.4s var(--ease-out-back);
}

.doctor-image::before {
    content: '';
    position: absolute;
    inset: -10px;
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(201,168,76,0.2), rgba(13,27,62,0.1));
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: -1;
}

.doctor-image:hover {
    transform: scale(1.03);
}

.doctor-image:hover::before {
    opacity: 1;
}

/* Aura / halo pulsante de fondo */
@keyframes auraPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(201,168,76,0.15),
                    0 0 40px rgba(201,168,76,0.05);
    }
    50% {
        box-shadow: 0 0 0 20px rgba(201,168,76,0),
                    0 0 80px rgba(201,168,76,0.1);
    }
}

.doctor-image {
    animation: auraPulse 4s ease-in-out infinite;
}

/* ============================================================
   10. RESEÑAS: CARD LEVITACIÓN
   ============================================================ */
.review-card {
    transition: transform 0.35s var(--ease-out-back),
                box-shadow 0.35s ease;
}

.review-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0,0,0,0.1),
                0 0 0 2px rgba(201,168,76,0.2);
}

/* ============================================================
   11. ENDO SECTION: BADGE FLOTANTE CON BRILLO
   ============================================================ */
@keyframes badgeFloat {
    0%, 100% { transform: translateY(0) rotate(-2deg); }
    50%       { transform: translateY(-8px) rotate(2deg); }
}

.endo-badge {
    animation: badgeFloat 3s ease-in-out infinite;
}

/* Microscopio ícono rotando al entrar en vista */
@keyframes microscopeIn {
    from { transform: rotate(-30deg) scale(0); opacity: 0; }
    to   { transform: rotate(0deg) scale(1); opacity: 1; }
}

.endo-badge.in-view {
    animation: badgeFloat 3s ease-in-out infinite;
}

/* ============================================================
   12. TEXTOS: EFECTO TYPING PARA EL SUBTÍTULO HERO
   ============================================================ */
@keyframes cursorBlink {
    0%, 100% { border-right-color: var(--gold); }
    50%       { border-right-color: transparent; }
}

.typing-text {
    overflow: hidden;
    border-right: 2px solid var(--gold);
    white-space: nowrap;
    animation: cursorBlink 0.8s step-end infinite;
}

/* ============================================================
   13. NAVEGACIÓN: INDICADOR ACTIVO ANIMADO
   ============================================================ */
.nav-link {
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--gold);
    border-radius: 2px;
    transform: translateX(-50%);
    transition: width 0.3s var(--ease-out-expo);
}

.nav-link:hover::after {
    width: 100%;
}

/* ============================================================
   14. FLOATING WA & FB: LATIDO
   ============================================================ */
@keyframes floatPulse {
    0%, 100% { box-shadow: 0 8px 30px rgba(37,211,102,0.4); }
    50%       { box-shadow: 0 8px 50px rgba(37,211,102,0.7), 0 0 0 10px rgba(37,211,102,0.05); }
}

.floating-wa {
    animation: floatPulse 2.5s ease-in-out infinite;
}

@keyframes fbPulse {
    0%, 100% { box-shadow: 0 8px 30px rgba(24,119,242,0.4); }
    50%       { box-shadow: 0 8px 50px rgba(24,119,242,0.7), 0 0 0 10px rgba(24,119,242,0.05); }
}

.floating-fb {
    animation: fbPulse 2.5s ease-in-out infinite 1.2s;
}

/* ============================================================
   15. SECCIÓN CITA: FONDO ANIMADO CON PARTÍCULAS DENTALES
   ============================================================ */
.appointment-particles {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.dental-particle {
    position: absolute;
    font-size: 1.5rem;
    opacity: 0.07;
    animation: particleDrift var(--pduration, 12s) ease-in-out infinite;
    animation-delay: var(--pdelay, 0s);
}

@keyframes particleDrift {
    0%   { transform: translateY(100px) rotate(0deg); opacity: 0; }
    10%  { opacity: 0.07; }
    90%  { opacity: 0.07; }
    100% { transform: translateY(-120px) rotate(360deg); opacity: 0; }
}

/* ============================================================
   16. REDUCIR MOVIMIENTO (accesibilidad)
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
