﻿/* Versión: Fix Mobile & Dark Mode - v7 (SEO Final Check) */
:root {
    --primary-color: #0f172a;
    --accent-color: #3b82f6;
    --text-color: #334155;
    --bg-color: #ffffff;
    --light-bg: #f8fafc;
    --card-bg: #ffffff;
    --nav-height: 80px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: hidden; }

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    transition: background-color 0.3s, color 0.3s;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.section-padding { padding: 80px 0; }
.bg-light { background-color: var(--light-bg); }
.text-center { text-align: center; }

/* --- HEADER --- */
.site-header {
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    min-height: var(--nav-height); 
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    padding: 10px 0;
}

.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    flex-wrap: wrap;
}

/* Logo Responsive */
.logo-link { text-decoration: none; display: block; max-width: 100%; }
.logo-svg svg { 
    display: block; 
    height: auto; 
    width: 100%; 
    max-width: 320px;
    max-height: 50px;
}

/* Navegación */
nav ul { list-style: none; display: flex; gap: 30px; align-items: center; }
nav a { text-decoration: none; color: var(--text-color); font-weight: 500; transition: color 0.3s; }
nav a:hover { color: var(--accent-color); }

.btn-nav {
    background-color: var(--primary-color);
    color: white !important;
    padding: 8px 20px;
    border-radius: 6px;
    transition: background-color 0.3s, color 0.3s;
    white-space: nowrap;
}
.btn-nav:hover { opacity: 0.9; }

/* --- HERO SECTION --- */
.hero {
    padding: 100px 0;
    text-align: center;
    position: relative;
    overflow: hidden;
    /* El fondo ahora lo maneja el carrusel */
    background: var(--primary-color); 
}

/* Capa oscura (Overlay) para que el texto se lea bien sobre cualquier imagen */
.hero::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(rgba(15, 23, 42, 0.6), rgba(15, 23, 42, 0.5)); /* Opacidad reducida para ver mejor las imágenes */
    z-index: 2;
}

/* Contenedor del Carrusel */
.hero-bg-carousel {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 1;
}

/* Diapositivas individuales */
.hero-slide {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0;
    animation: slideShow 25s linear infinite;
}

/* Retrasos para cada imagen (5 imágenes * 5s cada una = 25s total) */
.hero-slide:nth-child(1) { animation-delay: 0s; }
.hero-slide:nth-child(2) { animation-delay: 5s; }
.hero-slide:nth-child(3) { animation-delay: 10s; }
.hero-slide:nth-child(4) { animation-delay: 15s; }
.hero-slide:nth-child(5) { animation-delay: 20s; }

/* Asegurar que el contenido esté por encima del fondo */
.hero-content { position: relative; z-index: 3; }

.hero h1 { font-size: 3.5rem; line-height: 1.2; margin-bottom: 1.5rem; color: #ffffff; }
.highlight { color: var(--accent-color); }
.hero p { font-size: 1.25rem; color: #e2e8f0; max-width: 700px; margin: 0 auto 2rem; }
.hero-buttons { display: flex; gap: 15px; justify-content: center; flex-wrap: wrap; }

.btn-primary, .btn-secondary {
    padding: 12px 28px; border-radius: 6px; text-decoration: none; font-weight: 600; transition: transform 0.2s; display: inline-block;
}
.btn-primary { background-color: var(--accent-color); color: white; border: none; }
.btn-secondary { background-color: transparent; color: var(--primary-color); border: 1px solid #cbd5e1; }
.btn-primary:hover, .btn-secondary:hover { transform: translateY(-2px); }

/* Ajuste para que el botón secundario se vea bien sobre el fondo oscuro */
.hero .btn-secondary { color: white; border-color: rgba(255,255,255,0.5); }

/* --- SERVICIOS (GRID) --- */
.section-header { text-align: center; margin-bottom: 60px; }
.section-header h2 { font-size: 2.25rem; color: var(--primary-color); margin-bottom: 10px; }

.grid-layout { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); 
    gap: 30px; 
}

.card {
    background: var(--card-bg); padding: 40px 30px; border-radius: 12px; box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s; border: 1px solid transparent;
}
.card:hover {
    transform: translateY(-5px); box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1); border-color: var(--accent-color);
}
.icon-box { font-size: 2.5rem; color: var(--accent-color); margin-bottom: 20px; }

/* --- TECNOLOGÍAS --- */
.tech-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 15px; }
.tech-tag { background: #e2e8f0; padding: 10px 20px; border-radius: 50px; font-weight: 600; color: var(--text-color); }

/* --- FOOTER --- */
footer { background-color: var(--primary-color); color: #94a3b8; padding: 40px 0; }
.footer-content { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 20px; }
.socials a { color: #94a3b8; margin-left: 20px; font-size: 1.2rem; transition: color 0.3s; }
.socials a:hover { color: white; }

/* --- UTILIDADES EXTRA --- */
.bg-primary { background-color: var(--accent-color); }
.text-white { color: white; }

/* Botón WhatsApp */
.btn-white {
    background-color: white; 
    color: var(--accent-color); 
    border: none;
    padding: 12px 30px; 
    border-radius: 6px; 
    font-weight: bold; 
    cursor: pointer; 
    margin-top: 20px;
    display: inline-block;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
}
.btn-white:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Utilidad SEO: Texto oculto visualmente pero legible por robots */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --- MODO OSCURO --- */
body.dark-mode {
    --primary-color: #f8fafc; --text-color: #cbd5e1; --bg-color: #0f172a; --light-bg: #1e293b; --card-bg: #1e293b; --shadow: none;
}
body.dark-mode .site-header { background-color: rgba(15, 23, 42, 0.95); border-bottom: 1px solid #334155; }
body.dark-mode .tech-tag { background: #334155; color: white; }
body.dark-mode .btn-secondary { border-color: #475569; color: white; }
body.dark-mode .card { border-color: #334155; }

/* Logo en modo oscuro: Forzar color claro de forma más general */
body.dark-mode .logo-svg svg path,
body.dark-mode .logo-svg svg text,
body.dark-mode .logo-svg svg rect { fill: #f8fafc; }

body.dark-mode .btn-nav {
    color: var(--bg-color) !important; 
    font-weight: 700;
}

#theme-toggle { background: none; border: none; cursor: pointer; font-size: 1.2rem; color: var(--text-color); }

/* Botón Hamburguesa (Oculto en escritorio) */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-color);
    cursor: pointer;
}

/* =========================================
   MEDIA QUERIES (RESPONSIVE DESIGN)
   ========================================= */

@media (max-width: 768px) {
    /* Mostrar botón hamburguesa */
    .menu-toggle {
        display: block;
        order: 3;
    }
    
    /* Header: Permitir que el menú baje a la siguiente línea */
    .site-header .container {
        flex-wrap: wrap; 
        position: relative; /* Referencia para que el menú se posicione correctamente */
    }

    /* Ajuste del Logo para que no rompa el diseño en móviles */
    .logo-link {
        max-width: 230px; /* Limita el ancho para dejar espacio a los botones */
        order: 1;
        margin-right: auto; /* Empuja los botones hacia la derecha */
    }

    /* Botón de tema alineado junto al menú */
    #theme-toggle {
        order: 2;
        margin-right: 15px;
    }
    
    /* El nav ocupa todo el ancho y baja al final */
    nav {
        width: 100%;
        order: 4;
    }

    nav ul {
        display: none; /* OCULTO POR DEFECTO */
        flex-direction: column;
        gap: 0;
        width: 100%;
        text-align: center;
        padding: 0;
        background-color: var(--bg-color);
        border-top: 1px solid #e2e8f0;
        
        /* Menú flotante: Se superpone al contenido en lugar de empujarlo */
        position: absolute;
        top: 100%;
        left: 0;
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
        z-index: 1001;
    }

    /* Corrección: Soporte para ambas formas de activar el menú (nav.active o ul.active) */
    nav.active ul, nav ul.active {
        display: flex;
    }
    
    nav a { display: block; padding: 15px 20px; border-bottom: 1px solid #f1f5f9; }

    /* Ajuste del borde en modo oscuro para el menú móvil */
    body.dark-mode nav a {
        border-bottom-color: #334155;
    }
    
    .hero { padding: 60px 0; }
    .hero h1 { font-size: 2.2rem; }
    .hero p { font-size: 1rem; }
    
    .hero-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-primary, .btn-secondary {
        width: 100%;
        text-align: center;
    }

    .section-padding { padding: 50px 0; }
    .section-header h2 { font-size: 1.8rem; }
    
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
    .socials a { margin: 0 10px; }
    
    .btn-white { width: 100%; text-align: center; }
}

/* =========================================
   ANIMACIONES
   ========================================= */

@keyframes slideShow {
    0% { opacity: 0; }
    4% { opacity: 1; }   /* Entra rápido (1s) */
    20% { opacity: 1; }  /* Se mantiene visible (4s) */
    24% { opacity: 0; }  /* Sale rápido (1s) */
    100% { opacity: 0; }
}
