@keyframes scroll {
    0% {
        transform: translateX(0);
    }
    100% {
        /* Se mueve exactamente la mitad del ancho total del track duplicado */
        transform: translateX(-50%);
    }
}

html, body {
    max-width: 100%;
    overflow-x: hidden;
    position: relative;
}

#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

/* Glassmorphism */
.glass {
    background: rgba(10, 25, 47, 0.6);
    backdrop-filter: blur(15px) saturate(160%);
    -webkit-backdrop-filter: blur(15px) saturate(160%);
}

.glass-card {
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 1.5rem;
    overflow: hidden;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-card:hover {
    border-color: rgba(0, 180, 216, 0.5);
    background: rgba(0, 180, 216, 0.05);
    transform: translateY(-10px);
}

/* Animación Carrusel Infinito */
@keyframes scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.logo-track {
    display: flex;
    width: max-content;
    animation: scroll 20s linear infinite;
}

.logo-track:hover { animation-play-state: paused; }

/* Reveal Effects */
.reveal, .reveal-left, .reveal-right {
    opacity: 0;
    transition: all 1s ease-out;
}

.reveal { transform: translateY(50px); }
.reveal-left { transform: translateX(-80px); }
.reveal-right { transform: translateX(80px); }

.reveal.active, .reveal-left.active, .reveal-right.active {
    opacity: 1;
    transform: translate(0, 0);
}

#main-header.scrolled {
    background: rgba(6, 11, 19, 0.9);
    backdrop-filter: blur(10px);
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Variables para manejo de temas */
:root {
    --primary-bg: #060b13;
    --text-main: #e0e1dd;
}

body.light-theme {
    background-color: #f8fafc;
    color: #0f172a;
}

body.light-theme .glass, 
body.light-theme .glass-card {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.05);
    color: #1e293b;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}

body.light-theme #main-header.scrolled {
    background: rgba(255, 255, 255, 0.9);
}

body.light-theme .text-gray-400, 
body.light-theme .text-gray-500 {
    color: #475569;
}

/* Ajuste del canvas en modo claro */
body.light-theme #bg-canvas {
    opacity: 0.15; /* Más sutil en fondo blanco */
}

#main-header {
    border-bottom: 1px solid rgba(0, 180, 216, 0.1); /* Línea sutil cian */
}

#main-header.scrolled {
    border-bottom: 2px solid var(--accentCyan); /* Color más marcado al hacer scroll */
}

body.light-theme h1 {
    /* Cambiamos 'from-white' a un color oscuro para que sea legible */
    background-image: linear-gradient(to right, #0f172a, #00b4d8);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* Delineado y fondos de Formulario en Modo Claro */
body.light-theme input, 
body.light-theme textarea,
body.light-theme select {
    background-color: rgba(255, 255, 255, 0.9) !important;
    border: 1px solid #cbd5e1 !important; /* Gris delineado (slate-300) */
    color: #1e293b !important;
}

body.light-theme select option {
    background-color: white;
    color: #1e293b;
}

body.light-theme input:focus, 
body.light-theme textarea:focus,
body.light-theme select:focus {
    border-color: #00b4d8 !important;
    box-shadow: 0 0 0 2px rgba(0, 180, 216, 0.1);
}

/* --- FOOTER SIEMPRE OSCURO --- */
/* Forzamos a que el footer ignore el cambio de tema del body */
footer {
    background-color: #060b13 !important;
    color: white !important;
}

footer p, 
footer a, 
footer li button {
    color: #94a3b8 !important; /* Gris suave para que no compita con los títulos */
    transition: color 0.3s ease;
}

footer a:hover, 
footer li button:hover {
    color: #00b4d8 !important;
}

/* Convierte cualquier logo de color a blanco puro */
.logo-white-filter {
    filter: brightness(0) invert(1);
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.logo-white-filter:hover {
    opacity: 1;
}

/* Animación de Flujo de Circuito */
.circuit-line {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: energyFlow 4s linear infinite;
    filter: drop-shadow(0 0 8px rgba(0, 180, 216, 0.8));
    opacity: 0.6;
}

@keyframes energyFlow {
    to {
        stroke-dashoffset: 0;
    }
}

/* Brillo intermitente en los nodos */
.circuit-node {
    animation: nodePulse 2s ease-in-out infinite;
    filter: drop-shadow(0 0 12px #00b4d8);
}

@keyframes nodePulse {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.5); }
}

/* Efecto de escaneo de pantalla */
.animate-scan {
    animation: scanLine 8s linear infinite;
}

@keyframes scanLine {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(100%); }
}

/* Mejora del Bounce Slow para que sea más sutil */
.animate-bounce-slow {
    animation: bounceSlow 6s ease-in-out infinite;
}

@keyframes bounceSlow {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}
/* Brillo Neon Intensificado */
.neon-glow {
    filter: drop-shadow(0 0 15px #00b4d8) drop-shadow(0 0 5px #fff);
}

.neon-glow-alt {
    filter: drop-shadow(0 0 10px #00b4d8);
    animation-delay: 2s;
}

/* Circuitos con flujo rápido */
.circuit-line {
    stroke-dasharray: 800;
    stroke-dashoffset: 800;
    animation: flowPower 3s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes flowPower {
    0% { stroke-dashoffset: 800; opacity: 0.2; }
    50% { opacity: 1; }
    100% { stroke-dashoffset: 0; opacity: 0.2; }
}

/* Nodos de Energía Pesados */
.circuit-node-heavy {
    animation: pulseHeavy 1.5s infinite;
}

@keyframes pulseHeavy {
    0%, 100% { filter: blur(2px) brightness(1); transform: scale(1); }
    50% { filter: blur(4px) brightness(2); transform: scale(1.3); }
}

/* Efecto de pausa suave */
.video-playing #playBtn {
    opacity: 0;
    pointer-events: none;
}

.video-playing video {
    opacity: 1;
}

/* Ajustes para el logo en scroll */
#main-header.scrolled #header-logo {
    height: 3rem; /* Se hace más pequeño al bajar */
}

/* Animación de entrada para el menú móvil */
#mobile-menu {
    animation: fadeIn 0.3s ease-out;
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999; 
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* En modo claro, el menú móvil debe adaptarse */
body.light-theme #mobile-menu .absolute.inset-0 {
    background-color: rgba(248, 250, 252, 0.98); /* Fondo claro con blur */
}

body.light-theme #mobile-menu a,
body.light-theme #mobile-menu button {
    color: #0f172a;
}