:root {
    --azul-aok: #0077be;
    --naranja-aok: #ff9900;
    --fondo-claro: #fafdfc;
    --texto-base: #2d3436;
    --sombra-suave: 0 10px 30px rgba(0, 0, 0, 0.05);
}

body {
    background-color: var(--fondo-claro);
    color: var(--texto-base);
    font-family: 'Poppins', sans-serif;
    margin: 0;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

/* Tipografía y Encabezados */
.section-header { text-align: center; margin-bottom: 50px; }
.section-header h2 { font-size: 2.5rem; color: var(--azul-aok); margin-bottom: 10px; }
.divider { height: 4px; width: 60px; background: var(--naranja-aok); margin: 0 auto; border-radius: 2px; }

/* Menú Estilo "Glassmorphism" Moderno */
nav {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
    width: 90%; max-width: 900px; display: flex; justify-content: space-between;
    align-items: center; padding: 15px 40px; 
    background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(12px);
    border-radius: 50px; box-shadow: var(--sombra-suave); z-index: 1000;
}

.logo-img { height: 45px; width: auto; transition: 0.3s; }
.logo-img:hover { transform: scale(1.05); }

nav ul { display: flex; list-style: none; margin: 0; padding: 0; }
nav ul li a {
    color: var(--texto-base); text-decoration: none; font-weight: 500;
    margin-left: 20px; padding: 8px 20px; border-radius: 20px; transition: 0.3s;
}
nav ul li a:hover { background: var(--naranja-aok); color: white; box-shadow: 0 5px 15px rgba(255,153,0,0.3); }


/* =========================================
   HEADER Y ANIMACIÓN DE COLOR
   ========================================= */

/* 1. Contenedor principal del Header */
header {
    height: 100vh; 
    display: flex; 
    justify-content: center; 
    align-items: center;
    text-align: center; 
    position: relative; 
    overflow: hidden;
    background-color: #050505; 
}

/* 2. El carrusel de fotos (Al fondo) */
#headerSlideshow {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 0;
}

.slide-img {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 2s ease-in-out; 
}

.slide-img.active {
    opacity: 1;
}

/* 3. El filtro de color animado (Cristal transparente) */
.header-gradient {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(135deg, rgba(0, 119, 190, 0.75), rgba(5, 5, 5, 0.8), rgba(255, 153, 0, 0.75));
    /* Estas dos propiedades son las que obligan al color a moverse */
    background-size: 300% 300%; 
    animation: gradientFlow 8s ease infinite;
    z-index: 1; 
}

/* 4. EL MOTOR DE LA ANIMACIÓN (Verifica que este bloque esté presente) */
@keyframes gradientFlow { 
    0% { background-position: 0% 50%; } 
    50% { background-position: 100% 50%; } 
    100% { background-position: 0% 50%; } 
}

/* 5. Z-index de los elementos superiores para que no queden detrás del color */
#magicParticles { z-index: 2; }
.header-content { z-index: 3; position: relative; }

/* Texto en blanco para contrastar con el fondo colorido */
h1 { 
    font-size: 4.5rem; 
    text-transform: uppercase; 
    color: #ffffff; 
    letter-spacing: 2px; 
    margin: 0; 
}

.highlight { color: var(--naranja-aok); }
.highlight-blue { color: var(--azul-aok); } 


/* Contenedor principal del eslogan */
/* 1. El nuevo contenedor que permite volar a las chispas */
.slogan-wrapper {
    position: relative;
    display: inline-block;
    margin-top: 10px;
}

/* 2. El texto con su caja de cristal (corta letras, pero NO chispas) */
.slogan { 
    font-size: 1.8rem; 
    color: rgba(255, 255, 255, 0.9); 
    font-weight: 300; 
    margin: 0; 
    
    display: inline-block;
    overflow: hidden; 
    white-space: nowrap;
    width: 0;
    
    border-bottom: 3px solid #ffea00; 
    
    /* 
      Ajuste exacto del resplandor:
      - 0px (Eje X: Sin movimiento lateral)
      - 15px (Eje Y: Empujado hacia abajo)
      - 10px (Difuminado)
      - -12px (Contracción: Encoge la sombra para que no alcance los lados)
    */
    box-shadow: 0px 15px 10px -12px rgba(255, 234, 0, 1);
    
    animation: escribirMagia 2.5s steps(25, end) forwards;
    animation-delay: 0.5s; 
}

/* 3. Los fuegos artificiales unidos al contenedor libre */
.slogan-wrapper::after {
    content: '';
    position: absolute;
    right: 0;       
    bottom: -2px;   
    /* Aumentamos el tamaño base de la chispa */
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: transparent;
    opacity: 0;
    
    animation: explosionFuegosArtificiales 1.5s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
    animation-delay: 3s; 
}

/* Animación del texto */
@keyframes escribirMagia {
    from { width: 0; }
    to { width: 25ch; } 
}

/* 4. Efecto de pirotecnia amplio en el cielo */
@keyframes explosionFuegosArtificiales {
    0% {
        opacity: 1;
        /* Inicializamos 15 chispas concentradas */
        box-shadow: 
            0 0 0 0 #ffea00, 0 0 0 0 #ffaa00, 0 0 0 0 #ffffff, 
            0 0 0 0 #ff7700, 0 0 0 0 #ffea00, 0 0 0 0 #ffaa00, 
            0 0 0 0 #ffffff, 0 0 0 0 #ff7700, 0 0 0 0 #ffea00, 
            0 0 0 0 #ffaa00, 0 0 0 0 #ffffff, 0 0 0 0 #ffea00,
            0 0 0 0 #ff7700, 0 0 0 0 #ffffff, 0 0 0 0 #ffaa00;
    }
    100% {
        opacity: 0;
        /* Las 15 chispas estallan con mayor tamaño (cuarto valor: spread radius) */
        box-shadow: 
            /* Ráfaga Centro Arriba */
            0px -200px 25px 8px #ffffff,
            25px -160px 15px 5px #ffea00,
            -25px -160px 15px 5px #ffaa00,
            
            /* Ráfaga Derecha */
            100px -140px 18px 6px #ffea00,
            150px -90px 20px 5px #ffaa00,
            170px -30px 15px 4px #ff7700,
            60px -100px 12px 4px #ffffff,
            120px -10px 15px 3px #ffea00,
            
            /* Ráfaga Izquierda */
            -100px -140px 18px 6px #ffea00,
            -150px -90px 20px 5px #ffaa00,
            -170px -30px 15px 4px #ff7700,
            -60px -100px 12px 4px #ffffff,
            -120px -10px 15px 3px #ffea00,
            
            /* Chispas bajas centrales */
            -40px -50px 10px 4px #ffffff,
            40px -50px 10px 4px #ffaa00;
    }
}

/* Secciones Generales */
section { padding: 100px 10%; transition: opacity 0.8s, transform 0.8s; }
.content-box { text-align: center; max-width: 800px; margin: 0 auto; font-size: 1.1rem; line-height: 1.8; color: #555; }

/* Tarjetas de Servicios */
.services-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 40px; }
.service-card {
    background: white; padding: 40px 30px; border-radius: 20px; text-align: center;
    box-shadow: var(--sombra-suave); transition: 0.4s ease; border-bottom: 4px solid transparent;
}
.service-card:hover { transform: translateY(-10px); border-bottom: 4px solid var(--azul-aok); box-shadow: 0 15px 40px rgba(0,0,0,0.1); }
.service-icon { font-size: 3rem; color: var(--naranja-aok); margin-bottom: 20px; }
.service-card h3 { color: var(--azul-aok); margin-bottom: 15px; }

/* Galería de Trabajos */
.gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 30px; }
.gallery-item {
    height: 300px; 
    background: white; 
    border-radius: 20px;
    display: flex; 
    flex-direction: column; 
    justify-content: flex-end;
    padding: 25px; 
    transition: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
    cursor: pointer;
    
    /* --- AQUÍ ESTÁ LA MAGIA DEL AUTOAJUSTE --- */
    background-size: contain;      /* Muestra la imagen completa sin recortar */
    background-position: center;   /* La centra en la tarjeta */
    background-repeat: no-repeat;  /* Evita que la imagen se duplique como un mosaico */
    background-color: #f8f9fa;     /* Un color de fondo suave por si la foto no llena los lados */
    
    position: relative; 
    /* Evitamos el overflow hidden para que el borde mágico funcione */
    transform-style: preserve-3d;
    border: none;
}

.gallery-item::before {
    content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(to top, rgba(0,119,190,0.9) 0%, rgba(0,0,0,0) 100%);
    opacity: 0; transition: 0.4s;
}

.gallery-item:hover { transform: scale(1.03); box-shadow: 0 20px 40px rgba(0,119,190,0.2); }
.gallery-item:hover::before { opacity: 1; }

.gallery-info { position: relative; z-index: 1; transform: translateY(20px); opacity: 0; transition: 0.4s; color: white; }
.gallery-item:hover .gallery-info { transform: translateY(0); opacity: 1; }
.gallery-info h3 { margin: 0 0 5px 0; color: var(--naranja-aok); }

/* Sección de Contacto Mejorada */
.contact-container { display: grid; grid-template-columns: 1fr 1fr; gap: 50px; align-items: center; }
.map-box { border-radius: 20px; overflow: hidden; box-shadow: var(--sombra-suave); }
.social-panel { background: white; padding: 40px; border-radius: 20px; box-shadow: var(--sombra-suave); text-align: center; }
.social-panel h3 { color: var(--azul-aok); margin-bottom: 30px; font-size: 1.5rem; }

/* Botones de Redes Sociales Llamativos */
.social-links { display: flex; flex-direction: column; gap: 15px; }
.social-btn {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    padding: 15px; border-radius: 12px; font-weight: 600; font-size: 1.1rem;
    color: white; text-decoration: none; transition: 0.3s;
}

.social-btn i { font-size: 1.4rem; }
.social-btn.whatsapp { background: #25D366; }
.social-btn.instagram { background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%); }
.social-btn.facebook { background: #1877F2; }
.social-btn.tiktok { background: #000000; }

.social-btn:hover { transform: translateX(10px); filter: brightness(1.1); box-shadow: 0 5px 15px rgba(0,0,0,0.2); }

/* Botón Flotante de WhatsApp */
.whatsapp-float {
    position: fixed; bottom: 30px; right: 30px; width: 65px; height: 65px;
    background-color: #25d366; color: white; border-radius: 50px;
    display: flex; justify-content: center; align-items: center;
    box-shadow: 0 10px 25px rgba(37, 211, 102, 0.4); z-index: 1000; transition: 0.3s;
    font-size: 2.2rem; text-decoration: none;
}
.whatsapp-float:hover { transform: scale(1.15) rotate(-10deg); }

/* Footer */
footer { text-align: center; padding: 20px; background: var(--azul-aok); color: white; margin-top: 50px; }

/* Responsivo */
@media (max-width: 768px) {
    nav { flex-direction: column; gap: 15px; border-radius: 20px; padding: 15px; }
    h1 { font-size: 3rem; }
    .contact-container { grid-template-columns: 1fr; }
}



/* --- EFECTOS DE MAGIA AVANZADOS --- */

/* 1. Posición del lienzo de estrellas */
#magicParticles {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 0;
    pointer-events: none; /* Evita que el canvas bloquee los clics */
}

/* 2. Preparación 3D para las Tarjetas */
.service-card, .gallery-item {
    position: relative;
    /* Evitamos el overflow hidden para que el borde pueda brillar por fuera */
    transform-style: preserve-3d;
    transition: transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94), box-shadow 0.2s;
    background: white; 
    border: none; /* Quitamos el borde sólido actual */
}

/* 3. Borde Magnético (Glow Border) */
.service-card::after, .gallery-item::after {
    content: "";
    position: absolute;
    /* Lo hacemos 2 píxeles más grande que la tarjeta para que actúe de borde */
    top: -2px; left: -2px; right: -2px; bottom: -2px;
    background: radial-gradient(
        400px circle at var(--mouse-x, 0) var(--mouse-y, 0), 
        rgba(255, 153, 0, 1), /* Color del borde mágico (Naranja Aok) */
        transparent 40%
    );
    z-index: -1;
    opacity: 0;
    transition: opacity 0.4s ease;
    border-radius: 22px; /* Ligeramente mayor que el border-radius de la tarjeta */
}

/* El borde se enciende solo cuando el ratón entra en la tarjeta */
.service-card:hover::after, .gallery-item:hover::after {
    opacity: 1;
}

/* Elevamos el contenido de las tarjetas para que no lo tape el brillo */
.service-card > *, .gallery-info {
    transform: translateZ(20px); /* El contenido "flota" dentro de la tarjeta 3D */
}


/* El nuevo contenedor exclusivo para la fotografía */
.card-image {
    position: absolute;
    top: 0; 
    left: 0;
    width: 100%; 
    height: 100%;
    
    /* Autoajuste perfecto */
    background-size: contain;      /* Usa 'cover' si prefieres que llene todo sin dejar bordes blancos */
    background-position: center;
    background-repeat: no-repeat;
    
    border-radius: 20px;
    z-index: -2; /* Lo enviamos al fondo para que no tape el texto */
}

/* IMPORTANTE: Quita el background-size de la tarjeta principal si lo habías puesto antes */
.gallery-item {
    height: 300px; 
    background: #f8f9fa; /* Fondo suave por si la foto no llena los lados */
    border-radius: 20px;
    display: flex; 
    flex-direction: column; 
    justify-content: flex-end;
    padding: 25px; 
    transition: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
    cursor: pointer;
    position: relative; 
    transform-style: preserve-3d;
    border: none;
}