/* =========================================
   1. VARIABLES: DARK "NIGHTY NIGHT" THEME
   ========================================= */
:root {
    /* Fondo transparente para ver el Shader */
    --bg-color: transparent; 
    
    /* Texto: Blanco roto para buen contraste */
    --text-color: #ffffff; 
    
    /* Acento Principal: Azul/Morado Eléctrico */
    --accent-color: #3e00fa; 
    
    /* Secundario: Gris medio */
    --secondary-color: #ffffff; 
    
    --font-main: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --easing: cubic-bezier(0.3, 1, 0.3, 1); 
}

* { margin: 0; padding: 0; box-sizing: border-box; cursor: auto; }

html {
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    height: 100%;
}

body {
    background-color: #00000025; /* Color de respaldo */
    color: var(--text-color);
    font-family: var(--font-main);
    margin: 0;
    overflow-x: hidden;
    height: 100%;
}

/* =========================================
   2. FONDOS (SHADER & OVERLAY)
   ========================================= */

/* EL SHADER (Sótano Absoluto) */
#shader-gradient-bg {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -9999; 
    pointer-events: none;
}

/* LA CAPA DE CONTRASTE (Para leer el texto) */
.bg-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -9998; 
    /* Negro azulado al 60% de opacidad */
    background: rgba(0, 0, 0, 0.178); 
    backdrop-filter: blur(2px); /* Desenfoque sutil del fondo */
    pointer-events: none;
}

/* =========================================
   3. LAYOUT GENERAL (SCROLLYTELLING MODE)
   ========================================= */

/* 1. EL CONTENEDOR LARGO (La "Pista" de Scroll) */
section.pantalla {
    /* Altura extra: 2.5 veces la pantalla. 
       Esto crea la "resistencia" y tiempo para la animación 3D. */
    height: 250vh; 
    
    /* Quitamos el snap magnético para que sea fluido */
    scroll-snap-align: none; 
    
    position: relative;
    padding: 0; /* Quitamos padding aquí, lo pasamos al contenido */
}

/* 2. EL CONTENIDO FIJO (Lo que se queda en pantalla) */
.contenido {
    /* STICKY: Se queda fijo arriba mientras recorres los 250vh */
    position: sticky;
    top: 0;
    
    /* Forzamos a que ocupe la ventana visual exacta */
    height: 100vh; 
    
    /* Centrado perfecto */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    
    /* Límites */
    max-width: 1200px; 
    width: 100%;
    margin: 0 auto;
    padding: 0 40px; /* Margen lateral para que no toque bordes */
    
    /* Capas */
    z-index: 10; 
}

/* 3. ESTRUCTURA INTERNA (Columnas) */
.split-layout { 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    gap: 80px; 
    width: 100%; /* Asegurar ancho completo */
}

.split-layout.reverse { flex-direction: row-reverse; }
.text-block { flex: 1; text-align: left; }
.split-layout.reverse .text-block { text-align: right; }

/* Ajuste móvil para que no se rompa el sticky */
@media (max-width: 900px) {
    section.pantalla {
        height: 200vh; /* Un poco menos de recorrido en móvil */
    }
}

/* =========================================
   4. TEXTOS Y EFECTOS (2 LÍNEAS + GLOW)
   ========================================= */
.efecto-titulo {
    font-size: clamp(3rem, 6vw, 7rem); /* Tamaño responsivo */
    line-height: 1.1; /* Un poco más de aire entre líneas */
    font-weight: 900; 
    text-align: center;
    color: #ffffff;
    cursor: default;
    
    /* Configuración Scrollytelling */
    position: relative;
    z-index: 100;
    pointer-events: auto !important;

    /* CONTENEDOR FLEX VERTICAL (Para apilar las líneas) */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 10px; /* Espacio entre la línea de arriba y la de abajo */

    /* Animación del Glow y Escala Global */
    transition: 
        transform 0.8s cubic-bezier(0.25, 1, 0.5, 1),
        text-shadow 0.5s ease-out;

    text-shadow: 0 0 10px rgba(0,0,0,0.5);
}

/* CLASE NUEVA PARA LAS LÍNEAS */
.titulo-linea {
    display: block; 
    white-space: nowrap; /* Las palabras de una misma línea no se rompen */
}

/* ESTILOS PARA CADA LETRA (Igual que antes) */
.char-span {
    display: inline-block;
    transition: margin 0.8s cubic-bezier(0.25, 1, 0.5, 1); /* Animamos MARGIN */
    margin: 0 -2px; 
}

/* HOVER (Activado en el padre) */
.efecto-titulo:hover,
.efecto-titulo.manual-hover {
    transform: scale(1.05);
    
    /* SUPER GLOW */
    text-shadow: 
        0 0 10px rgba(255, 255, 255, 0),  
        0 0 20px rgb(64, 0, 255),   
        0 0 40px rgb(64, 0, 255),   
        0 0 80px rgb(64, 0, 255);   
}

/* ANIMACIÓN DE SEPARACIÓN */
.efecto-titulo:hover .char-span,
.efecto-titulo.manual-hover .char-span {
    /* Separación suave */
    margin: 0 5px; 
}

/* =========================================
   5. TARJETAS 3D TILT (DARK GLASS)
   ========================================= */
.tilt-card {
    flex: 1;
    background: rgba(21, 7, 49, 0.589); 
    border: 1px solid rgba(135, 95, 255, 0.322);
    border-radius: 20px;
    padding: 60px 40px;
    
    transform-style: preserve-3d; /* Vital para que los hijos floten */
    transition: transform 0.1s linear;
    
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.925);
    backdrop-filter: blur(10px);
}

.tilt-content { 
    transform: translateZ(90px); 
    pointer-events: none; 
}
.tilt-card h3 { font-size: 2rem; margin-bottom: 15px; color: #ffffff; }
.tilt-card p { color: var(--secondary-color); }

/* =========================================
   6. SKILLS GRID (BOTONES CYBER-GLASS)
   ========================================= */
.skills-grid { 
    display: flex; gap: 12px; flex-wrap: wrap; 
    transform-style: preserve-3d; /* Permite que los botones salgan */
}
.split-layout.reverse .skills-grid { justify-content: flex-end; }

.skill-item {
    /* Estilo Base: Cristal Oscuro */
    background: rgba(29, 14, 70, 0.03); 
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.15); 
    border-radius: 4px;
    color: rgb(255, 255, 255); 
    font-family: 'Courier New', monospace; font-size: 0.9rem; font-weight: bold;
    padding: 10px 18px;
    
    /* Flotan por defecto (Ya no se ven hundidos) */
    transform: translateZ(20px); 
    
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: default; position: relative; overflow: hidden;
}

/* Brillo rápido al cargar */
.skill-item::before {
    content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: 0.5s;
}

/* HOVER: Cian Neón y Salto 3D */
.skill-item:hover {
    background: rgba(0, 229, 255, 0.1); border-color: #00e5ff; 
    color: #fff; text-shadow: 0 0 8px rgba(0, 229, 255, 0.8);
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.4), inset 0 0 10px rgba(0, 229, 255, 0.1);
    transform: translateZ(50px) scale(1.1); /* Salto hacia el usuario */
    z-index: 10;
}

/* HOVER ALTERNATIVO: Magenta (Pares) */
.skill-item:nth-child(even):hover {
    background: rgba(255, 0, 127, 0.1); border-color: #ff007f;
    text-shadow: 0 0 8px rgba(255, 0, 127, 0.8);
    box-shadow: 0 0 20px rgba(255, 0, 127, 0.4), inset 0 0 10px rgba(255, 0, 127, 0.1);
}

/* =========================================
   7. BOTONES PRINCIPALES (SECCIÓN FINAL)
   ========================================= */
.scroll-hidden { opacity: 0; transition: all 1.5s var(--easing); }
.fade-up { transform: translateY(50px); }
.fade-left { transform: translateX(-50px); }
.fade-right { transform: translateX(50px); }
.scale-up { transform: scale(0.95); filter: blur(5px); }
.activo { opacity: 1; transform: translate(0) scale(1); filter: blur(0); }

.botones-container { display: flex; gap: 20px; justify-content: center; margin-top: 100px; }
.btn {
    padding: 15px 40px; border-radius: 50px; text-decoration: none; font-weight: bold;
    text-transform: uppercase; letter-spacing: 2px; position: relative;
    background: #ffffff; color: #020211; transition: 0.3s;
}
.btn:hover { 
    background: var(--accent-color); color: #ffffff;
    box-shadow: 0 10px 30px rgba(106, 58, 255, 0.5); transform: scale(1.05); 
}
.btn-outline { background: transparent; border: 2px solid #ffffff; color: #ffffff; }
.btn-outline:hover { background: #ffffff; color: #020211; }

@media (max-width: 900px) {
    .split-layout, .split-layout.reverse { flex-direction: column; text-align: center; gap: 40px; }
    .split-layout.reverse .text-block { text-align: center; }
    .split-layout.reverse .skills-grid { justify-content: center; }
    .efecto-titulo { font-size: 3.5rem; }
}

/* =========================================
   8. ESTILOS PÁGINA DISEÑO (ROBOT)
   ========================================= */
body.no-scroll { overflow: hidden; height: 100vh; width: 100vw; }

.spline-wrapper {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 5; pointer-events: auto;
}

/* CONFIGURACIÓN DEL ROBOT (ZOOM + BAJAR) */
spline-viewer { 
    width: 100%; height: 100%; display: block; 
    background: transparent !important; 
    transform: scale(1.25) translateY(15vh); 
    transform-origin: center center;
}

.ui-layer {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 10; pointer-events: none;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
}

/* Botón Volver */
.btn-volver-fixed {
    position: fixed; top: 30px; left: 30px; z-index: 20; pointer-events: auto;
    text-decoration: none; font-weight: bold; color: #000; border: 1px solid #000;
    padding: 10px 25px; border-radius: 50px; background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px); transition: all 0.3s ease;
}
.btn-volver-fixed:hover { background: #000; color: #fff; transform: scale(1.05); }

/* =========================================
   9. BURBUJAS FLOTANTES (ESFERAS EXPANSIVAS)
   ========================================= */
.bubbles-container {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 15; pointer-events: none;
}

.bubble-wrapper {
    position: absolute; 
    /* pointer-events: auto; <--- LO QUITAMOS PARA USAR EL SCRIPT DE RADAR */
    animation: floatBubble 6s ease-in-out infinite;
}

.glass-bubble {
    width: 80px; height: 80px;
    border-radius: 50%; /* SIEMPRE REDONDO */
    background: rgba(255, 255, 255, 0.041);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    
    display: flex; justify-content: center; align-items: center;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
    cursor: pointer; overflow: hidden; position: relative;
    
    /* CRÍTICO: Hacerlas invisibles al mouse para que el Robot no se trabe */
    pointer-events: none !important;
}

.bubble-icon {
    font-size: 1.5rem; color: rgba(255, 255, 255, 0.8);
    transition: opacity 0.3s ease; z-index: 2;
}

.bubble-image {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background-size: cover; background-position: center;
    opacity: 0; transition: opacity 0.4s ease; z-index: 1;
    filter: brightness(0.9);
}

/* --- HOVER ACTIVADO POR SCRIPT (.manual-hover) --- */
.glass-bubble:hover,
.glass-bubble.manual-hover {
    width: 180px; height: 180px; /* Esfera grande */
    border-color: rgba(255, 255, 255, 0.6);
    box-shadow: 0 0 30px rgba(0, 229, 255, 0.3);
    transform: scale(1.1);
    z-index: 100;
}

.glass-bubble:hover .bubble-icon,
.glass-bubble.manual-hover .bubble-icon { opacity: 0; }

.glass-bubble:hover .bubble-image,
.glass-bubble.manual-hover .bubble-image { opacity: 1; }

@keyframes floatBubble {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

@media (max-width: 768px) {
    .glass-bubble { width: 50px; height: 50px; }
    .glass-bubble:hover, .glass-bubble.manual-hover { width: 120px; height: 120px; }
}

/* =========================================
   10. CORRECCIÓN DE FLUIDEZ (ROBOT)
   ========================================= */
/* Elementos que tapan el robot se vuelven invisibles al mouse */
/* El Script de Radar se encarga de activar sus efectos visuales */
.design-title {
    pointer-events: none !important;
}

/* =========================================
   11. FONDO DISEÑO (PARTICULAS CLARAS)
   ========================================= */

#design-bg {
    position: fixed;
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    
    /* Z-Index Estratégico */
    /* -10 está detrás del Robot (5) y del texto (10), pero tapa el color body base */
    z-index: -10; 
    
    pointer-events: none; /* No bloquea nada */
}

/* =========================================
   12. PÁGINA PROGRAMACIÓN (GRID SCAN)
   ========================================= */

#grid-scan-canvas {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 1; /* Detrás del contenido */
    /* No ponemos pointer-events: none aquí si quieres interactividad futura */
}

/* LAYOUT DE PROYECTOS DE CÓDIGO */
.projects-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 40px;
    padding: 150px 40px 40px 40px; /* Padding superior para el título */
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    z-index: 10;
}

/* TARJETA ESTILO "TERMINAL" */
.code-card {
    background: rgba(10, 10, 18, 0.7); /* Oscuro semitransparente */
    border: 1px solid #333;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    
    /* Efecto inicial */
    opacity: 0;
    transform: translateY(20px);
    animation: fadeUpCode 0.6s forwards;
}

/* Cabecera de la terminal (los 3 puntitos) */
.terminal-header {
    background: #1a1a2e;
    padding: 10px 15px;
    display: flex; gap: 8px;
    border-bottom: 1px solid #333;
}
.dot { width: 12px; height: 12px; border-radius: 50%; }
.red { background: #ff5f56; }
.yellow { background: #ffbd2e; }
.green { background: #27c93f; }

.terminal-body {
    padding: 25px;
    font-family: 'Courier New', monospace;
}

.code-title {
    color: #00e5ff; /* Cian */
    font-size: 1.5rem;
    margin-bottom: 10px;
    display: block;
}

.code-desc {
    color: #a0a0b0;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 20px;
}

.tech-tags {
    display: flex; gap: 10px; flex-wrap: wrap;
    margin-top: 15px;
}

.tag {
    background: rgba(106, 58, 255, 0.2);
    color: #bfa3ff;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    border: 1px solid rgba(106, 58, 255, 0.3);
}

/* HOVER EFFECT */
.code-card:hover {
    transform: translateY(-5px);
    border-color: #00e5ff;
    box-shadow: 0 10px 30px rgba(0, 229, 255, 0.15);
}
.code-card:hover .terminal-header { background: #0f204d; }

@keyframes fadeUpCode {
    to { opacity: 1; transform: translateY(0); }
}

/* Stagger de animación (para que aparezcan una tras otra) */
.code-card:nth-child(1) { animation-delay: 0.1s; }
.code-card:nth-child(2) { animation-delay: 0.2s; }
.code-card:nth-child(3) { animation-delay: 0.3s; }
.code-card:nth-child(4) { animation-delay: 0.4s; }

/* =========================================
   13. LANDING 3D OBJECT (CORRECCIÓN DE CAPAS)
   ========================================= */

#hero-3d-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;   /* Forzamos ancho de ventana */
    height: 100vh;  /* Forzamos alto de ventana */
    z-index: 1;     /* Nivel 1: Encima del fondo, debajo del texto */
    pointer-events: none; /* Deja pasar los clics */
    overflow: hidden; /* Evita barras de scroll accidentales */
    opacity: 1 !important;
}


/* Aseguramos que el contenido principal esté SIEMPRE encima */
.contenido {
    position: relative; 
    z-index: 10; /* Debe ser mayor que el container 3D */
}

/* Aseguramos que el fondo shader se quede atrás */
#shader-gradient-bg, .bg-overlay {
    z-index: -9999 !important;
}

/* =========================================
   14. QUANTUM CURSOR (CUSTOM)
   ========================================= */

/* Ocultar el cursor por defecto del sistema */
body, a, button {
    cursor: none !important;
}

/* El Punto Central (Precisión) */
#cursor-dot {
    width: 6px;
    height: 6px;
    background-color: white; /* Diferencia sobre negro = Blanco */
    border-radius: 50%;
    position: fixed;
    top: 0; left: 0;
    z-index: 9999999; /* Por encima de TODO */
    pointer-events: none; /* Vital: dejar pasar los clics */
    transform: translate(-50%, -50%); /* Centrado */
    margin-left: -3px; /* Ajuste fino de centro */
    margin-top: -3px;
    mix-blend-mode: difference; /* EL TRUCO MAGICO */
    transition: width 0.3s, height 0.3s, background-color 0.3s;
}

/* El Anillo Fantasma (Fluidez) */
#cursor-ring {
    width: 40px;
    height: 40px;
    border: 1px solid white; /* Diferencia sobre negro = Borde Blanco */
    border-radius: 50%;
    position: fixed;
    top: 0; left: 0;
    z-index: 9999998; /* Justo debajo del punto */
    pointer-events: none;
    margin-left: -20px; /* Centrado (mitad de width) */
    margin-top: -20px;
    mix-blend-mode: difference;
    transition: width 0.3s cubic-bezier(0.25, 1, 0.5, 1), 
                height 0.3s cubic-bezier(0.25, 1, 0.5, 1),
                border-width 0.3s,
                opacity 0.3s;
}

/* --- ESTADOS INTERACTIVOS --- */

/* 1. HOVER (Cuando pasas sobre un botón/link) */
#cursor-ring.hover-active {
    width: 80px;  /* Se hace grande */
    height: 80px;
    margin-left: -40px;
    margin-top: -40px;
    border-color: rgba(255, 255, 255, 0.5); /* Más sutil */
    background-color: rgba(255, 255, 255, 0.1); /* Relleno leve */
    backdrop-filter: blur(2px); /* Un toque de distorsión */
}

#cursor-dot.hover-active {
    opacity: 0; /* El punto desaparece para dejar ver el texto */
}

/* 2. CLICK (Cuando presionas) */
#cursor-ring.click-active {
    width: 30px; /* Se contrae rápido */
    height: 30px;
    margin-left: -15px;
    margin-top: -15px;
    border-width: 3px; /* Borde más grueso */
    border-color: #00e5ff; /* Color de acento cian */
}

/* =========================================
   14. CONTINUOUS LASER CURSOR
   ========================================= */

/* Ocultar cursor nativo */
html, body, a, button {
    cursor: none !important;
}

/* 1. El Canvas de la Estela (Fondo) */
#cursor-canvas {
    position: fixed;
    top: 0; left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999998; /* Detrás de la cabeza del cursor */
    pointer-events: none; /* VITAL: Dejar pasar los clics a través del dibujo */
    opacity: 0.8; /* Un poco de transparencia global */
}

/* 2. La Cabeza del Cursor (Diamante Solido) */
#cursor-head {
    width: 10px;
    height: 10px;
    background-color: white; /* Blanco puro para el núcleo */
    box-shadow: 0 0 10px #00e5ff, 0 0 20px #00e5ff; /* Glow cian */
    position: fixed;
    top: 0; left: 0; /* JS se encarga de moverlo */
    z-index: 9999999; /* Al frente de todo */
    pointer-events: none;
    
    /* Centrar el div en el punto del mouse */
    margin-left: -5px; 
    margin-top: -5px;
    
    transform: rotate(45deg); /* Rombo */
    transition: width 0.2s, height 0.2s, background-color 0.2s, transform 0.1s;
    mix-blend-mode: screen;
}

/* Estado Hover (Se hace más grande y cambia de color) */
#cursor-head.active {
    width: 25px;
    height: 25px;
    margin-left: -12.5px;
    margin-top: -12.5px;
    background-color: rgba(0, 229, 255, 0.2); /* Interior transparente */
    border: 2px solid white; /* Borde sólido */
    box-shadow: 0 0 20px white;
    transform: rotate(0deg); /* Se vuelve cuadrado */
}

/* Estado Click */
#cursor-head.clicked {
    transform: scale(0.8) rotate(45deg);
    background-color: #ff0055; /* Feedback rojo al hacer click */
    box-shadow: 0 0 20px #ff0055;
}

/* =========================================
   15. PAGE TRANSITIONS (CORREGIDO - NO DAÑA FONDOS)
   ========================================= */

/* 1. ELIMINAMOS EL FONDO NEGRO GLOBAL QUE DAÑABA EL DISEÑO */
/* html { background-color: #000000; }  <-- BORRADO */

#page-transition-curtain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #000000; /* El telón es negro */
    z-index: 9999990; /* Encima de todo, debajo del cursor */
    
    /* Estado Inicial: Visible y Opaco */
    opacity: 1;
    visibility: visible;
    pointer-events: all; 
    
    /* ANIMACIÓN DE SALIDA (Fade Out) */
    /* Opacidad tarda 1s. Visibility espera 1s para cambiar (delay) */
    transition: opacity 1.0s ease-in-out, visibility 0s linear 1.0s;
    
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Estado "Reveal": La cortina desaparece */
#page-transition-curtain.reveal {
    opacity: 0;
    visibility: hidden; /* ESTO ES LA CLAVE: Desaparece físicamente */
    pointer-events: none;
    
    /* Cuando se revela, reseteamos el delay del visibility para la próxima vez */
    transition: opacity 1.0s ease-in-out, visibility 0s linear 1.0s;
}

#transition-loader {
    font-family: 'Courier New', monospace;
    color: #00e5ff;
    font-size: 0.8rem;
    letter-spacing: 3px;
    opacity: 1;
    transition: opacity 0.5s;
}

#page-transition-curtain.reveal #transition-loader {
    opacity: 0;
}

/* =========================================
   16. NAVEGACIÓN SUPERIOR (HUD)
   ========================================= */

.nav-btn {
    position: fixed;
    top: 40px; /* Margen desde arriba */
    z-index: 100; /* Por encima del contenido normal */
    
    font-family: 'Courier New', monospace; /* Tu fuente tech */
    font-size: 0.9rem;
    font-weight: bold;
    text-decoration: none;
    letter-spacing: 2px;
    
    padding: 10px 20px;
    border: 1px solid rgba(255, 255, 255, 0.2); /* Borde sutil */
    background: rgba(0, 0, 0, 0.5); /* Fondo semitransparente */
    backdrop-filter: blur(5px); /* Efecto vidrio */
    
    color: white; /* Color base */
    transition: all 0.3s ease;
    
    /* Forma tecnológica */
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}

/* Posiciones */
.nav-btn.left {
    left: 40px;
}

.nav-btn.right {
    right: 40px;
    text-align: right;
}

/* Hover Effects */
.nav-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #00e5ff; /* Color Cyan al pasar mouse */
    color: #00e5ff;
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.3);
    transform: translateY(-2px); /* Pequeña elevación */
}

/* Estilo específico para el botón de cambio de modo (derecha) */
.switch-mode:hover {
    border-color: #ff0055; /* Magenta para el cambio */
    color: #ff0055;
    box-shadow: 0 0 15px rgba(255, 0, 85, 0.3);
}

/* ICONOS Y FLECHAS */
.nav-btn .flecha {
    display: inline-block;
    transition: transform 0.3s;
}

.nav-btn:hover .flecha {
    transform: translateX(-5px); /* La flecha se mueve a la izq */
}

/* Responsive (Móvil) */
@media (max-width: 768px) {
    .nav-btn {
        top: 20px;
        padding: 8px 12px;
        font-size: 0.7rem;
    }
    .nav-btn.left { left: 20px; }
    .nav-btn.right { right: 20px; }
}

/* =========================================
   17. INFINITE SCROLL CAROUSEL
   ========================================= */

/* El visor que recorta el contenido */
.infinite-scroll-viewport {
    position: relative; 
    z-index: 10; 
    width: 100%; 
    height: 100vh;
    overflow-y: auto; 
    
    /* === AQUÍ ESTÁ EL IMÁN === */
    scroll-snap-type: y mandatory; /* "Mandatory" obliga a pegarse siempre */
    scroll-behavior: auto; /* IMPORTANTE: Debe ser auto para que el loop infinito no falle */
    
    /* Ocultar barra scroll */
    scrollbar-width: none; 
    opacity: 0; 
    animation: fadeInSimple 1s forwards 3s;
}

/* Ocultar barra de scroll (Chrome/Safari/Edge) */
.infinite-scroll-viewport::-webkit-scrollbar {
    display: none;
}

.infinite-scroll-content {
    /* Aseguramos que el contenido fluya normal */
    display: flex;
    flex-direction: column;
    /* Ajusta el gap entre proyectos si lo necesitas */
    gap: 50px; 
    padding-bottom: 50px; /* Un poco de aire al final */
}

/* =========================================
   18. BOTÓN VOLVER AL INICIO (LANDING)
   ========================================= */

.footer-return-container {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px 0 80px 0; /* Espacio generoso abajo */
    position: relative;
    z-index: 10;
}

.btn-return-base {
    background: rgba(0, 0, 0, 0.6); /* Fondo oscuro semitransparente */
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #aaaaaa;
    
    font-family: 'Courier New', monospace; /* Tu fuente tech */
    font-size: 1rem;
    letter-spacing: 2px;
    font-weight: bold;
    
    padding: 15px 50px; /* Botón grande y ancho */
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    
    /* Forma tecnológica (esquinas cortadas) */
    clip-path: polygon(
        15px 0, 100% 0, 
        100% calc(100% - 15px), 
        calc(100% - 15px) 100%, 
        0 100%, 
        0 15px
    );
    
    display: flex;
    align-items: center;
    gap: 15px; /* Espacio entre flecha y texto */
}

/* La flechita */
.arrow-up {
    font-size: 0.8rem;
    color: #00e5ff; /* Color Cian (Tron) */
    transition: transform 0.4s;
}

/* EFECTO HOVER (El botón se enciende) */
.btn-return-base:hover {
    background: rgba(0, 229, 255, 0.1); /* Tinte azul muy leve */
    border-color: #00e5ff; /* Borde brillante */
    color: #ffffff; /* Texto blanco */
    box-shadow: 0 0 30px rgba(0, 229, 255, 0.2); /* Glow externo */
    transform: translateY(-5px); /* Flota un poco hacia arriba */
}

.btn-return-base:hover .arrow-up {
    transform: translateY(-3px); /* La flecha sube animada */
}

/* EFECTO CLICK (Feedback visual) */
.btn-return-base:active {
    transform: scale(0.95);
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.5);
}

/* =========================================
   20. DISEÑO - VERTICAL SCROLL & BUBBLES
   ========================================= */

/* Habilitar Scroll solo en la página de diseño */
body.design-page {
    overflow-x: hidden;
    overflow-y: auto !important; /* Forzamos el scroll vertical nativo */
    background-color: #f0f0f0;
}

/* Fondo 3D Fijo (Spline) */
body.design-page .spline-wrapper {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 0; /* Al fondo */
    pointer-events: none;
}

#design-bg {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1;
}

/* Botones de Navegación Fijos */
.fixed-nav {
    position: fixed !important; /* Asegurar que no scrolleen */
    z-index: 100;
}

/* Títulos UI (Portada) */
.ui-layer {
    position: relative; /* Relativo para que ocupe espacio y empuje el scroll */
    width: 100%;
    height: 90vh; /* Ocupa casi toda la primera pantalla */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 5;
    pointer-events: none;
}

.design-title {
    font-size: 5rem; color: #111; font-weight: 900; line-height: 0.9;
    text-shadow: 0 10px 30px rgba(0,0,0,0.1); margin: 0;
}

.design-subtitle {
    margin-top: 20px; font-size: 1.2rem; font-weight: bold; opacity: 0.6;
    letter-spacing: 3px; color: #333;
}

/* Contenedor Principal de Burbujas */
.scroll-container {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding-bottom: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 150px; /* Distancia vertical entre proyectos */
}

/* === BURBUJA (WRAPPER) === */
.bubble-wrapper {
    width: 350px; height: 350px;
    position: relative;
    display: flex; justify-content: center; align-items: center;
    
    /* Animación de entrada (Estado inicial invisible) */
    opacity: 0;
    transform: translateY(100px) scale(0.8);
    transition: all 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}

/* Estado Visible (Activado por JS) */
.bubble-wrapper.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Diseño ZIG-ZAG (Alternar Izquierda/Derecha) */
.bubble-wrapper:nth-child(odd) { 
    align-self: flex-start; 
    margin-left: 10%; 
}
.bubble-wrapper:nth-child(even) { 
    align-self: flex-end; 
    margin-right: 10%; 
}

/* === ESTÉTICA CRISTAL (GLASSMORPHISM) === */
.glass-bubble {
    width: 100%; height: 100%; border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: inset 0 0 20px rgba(255,255,255,0.5), 0 20px 50px rgba(0,0,0,0.15);
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    overflow: hidden; position: relative; cursor: pointer;
    transition: transform 0.4s ease, border-color 0.4s;
}

.bubble-icon { 
    font-size: 4rem; margin-bottom: 10px; z-index: 2; 
    filter: drop-shadow(0 5px 10px rgba(0,0,0,0.1)); 
    transition: 0.4s;
}

.bubble-image {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background-size: cover; background-position: center;
    opacity: 0.2; z-index: 1; transition: 0.4s; mix-blend-mode: overlay;
}

.bubble-info {
    position: absolute; bottom: 50px; text-align: center; z-index: 3;
    opacity: 0; transform: translateY(20px); transition: 0.4s;
}
.bubble-info h3 { margin: 0; font-size: 1.4rem; color: #000; font-weight: 800; }
.bubble-info p { margin: 0; font-size: 1rem; color: #444; }

/* HOVER INTERACTION */
.glass-bubble:hover {
    transform: scale(1.05); 
    background: rgba(255, 255, 255, 0.4); 
    border-color: #fff;
    box-shadow: 0 0 40px rgba(255, 255, 255, 0.6);
}
.glass-bubble:hover .bubble-image { opacity: 0.6; transform: scale(1.1); }
.glass-bubble:hover .bubble-icon { transform: scale(1.2) translateY(-10px); }
.glass-bubble:hover .bubble-info { opacity: 1; transform: translateY(0); }

/* Responsive Mobile */
@media (max-width: 768px) {
    .bubble-wrapper:nth-child(odd), 
    .bubble-wrapper:nth-child(even) {
        align-self: center; margin: 0; /* Centrar todo en móvil */
    }
    .design-title { font-size: 3rem; }
    .bubble-wrapper { width: 280px; height: 280px; }
}

/* =========================================
   AJUSTE FINAL (CORTAR ESPACIO SOBRANTE)
   ========================================= */

/* Las primeras secciones siguen siendo largas para dar tiempo a la animación */
section.pantalla {
    height: 250vh; 
}

/* PERO la última sección (Contacto) debe ser el final absoluto */
section.pantalla:last-of-type {
    height: 100vh; /* Se acaba justo al final de la pantalla */
    min-height: 800px; /* Seguridad para móviles */
}




