/* Optimizaciones CSS para mejorar el rendimiento en MACOTO */

/* Animaciones optimizadas */
@keyframes fadeInBlur {
    from {
        opacity: 0;
        filter: blur(10px);
    }
    to {
        opacity: 1;
        filter: blur(0);
    }
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-15px);
    }
    100% {
        transform: translateY(0px);
    }
}

@keyframes rotateGlow {
    0% {
        transform: rotate(0deg);
        box-shadow: 0 0 15px 2px rgba(100, 255, 218, 0.2);
    }
    50% {
        box-shadow: 0 0 30px 5px rgba(100, 255, 218, 0.3);
    }
    100% {
        transform: rotate(360deg);
        box-shadow: 0 0 15px 2px rgba(100, 255, 218, 0.2);
    }
}

/* Optimizaciones para la animación de partículas */
@keyframes floatParticle {
    0% {
        transform: translateY(0) rotate(0deg);
    }
    100% {
        transform: translateY(-100vh) rotate(360deg);
    }
}

.particle {
    will-change: transform;
    position: absolute;
    width: 3px !important; /* Partículas más pequeñas */
    height: 3px !important;
    border-radius: 50%;
    /* Usa translate3d para forzar aceleración por hardware */
    transform: translate3d(0, 0, 0);
}

/* CORRECCIÓN: Eliminar círculos/bolas detrás de los iconos de servicio */
.service-icon::after {
    display: none !important;
    content: none !important;
}

/* También aplicar al hover para seguridad */
.service-card:hover .service-icon::after {
    display: none !important;
    content: none !important;
}

/* Optimizaciones para elementos 3D */
.card-3d {
    transform-style: preserve-3d;
    perspective: 1000px;
    transition: transform 0.4s;
    will-change: transform;
}

.service-card, .testimonial-item, .contact-form {
    will-change: transform;
    /* Forzar aceleración por hardware en todos los navegadores */
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
}

/* Reducciones de complejidad visual para móviles */
@media screen and (max-width: 768px) {
    /* Desactivar efectos parallax en móviles */
    .hero-layer-1, .hero-layer-2, .hero-layer-3, .hero-layer-4,
    .parallax-mouse, .about-bg-elements, .floating-elements {
        transform: none !important;
        animation: none !important;
        transition: none !important;
    }
    
    /* Reducir complejidad de las sombras */
    .glass-card, .service-card, .testimonial-item, .contact-form {
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2) !important;
    }
    
    /* Simplificar animaciones */
    .btn:hover, .service-card:hover, .testimonial-item:hover, .contact-form:hover {
        transform: translateY(-5px) !important;
        transition: transform 0.3s ease !important;
    }
    
    /* Optimizar los fondos gradientes */
    .hero::before, .services::before, .about::before, .testimonials::before {
        opacity: 0.5;
        background-size: 200% 200% !important;
    }
    
    /* Limitar las animaciones del encabezado */
    .logo span, .section-header h2:after, .about-content h2::after {
        animation: gradientFlow 6s ease infinite !important;
    }
}

/* Optimizaciones para todos los dispositivos */
body {
    text-rendering: optimizeSpeed;
}

img {
    content-visibility: auto;
}

/* Optimizar visualización de fuentes */
@media screen and (max-width: 576px) {
    h1, h2, h3 {
        letter-spacing: normal;
    }
}

/* Reducir complejidad de efectos de hover en pantallas táctiles */
@media (hover: none) {
    .service-card:hover, .testimonial-item:hover, .glass-card:hover, 
    .contact-form:hover, .btn:hover {
        transform: none !important;
        box-shadow: inherit !important;
    }
    
    .service-card ul li:hover, .footer-col ul li a:hover, 
    nav ul li a::before, .btn::before {
        transform: none !important;
    }
}

/* Fix para animación de fondo que consume recursos */
@keyframes gradientFlow {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

/* Optimizar z-index para evitar problemas de contexto de apilamiento */
header {
    z-index: 10;
}

section {
    z-index: 1;
}

/* Solución a problemas con las transformaciones en SVG */
.service-icon svg, .contact-icon svg {
    transform-origin: center center;
}

/* Optimizaciones para el scrolling */
html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}