/* =========================================
   1. CORE & RESET
   ========================================= */
:root {
    --bg-void: #0f0f0f;
    --text-white: #e6e6e6;
    --text-muted: #dbdbdbd7;
    --line-faint: rgba(255, 255, 255, 0.398);
    
    --font-main: "Gill Sans", "Gill Sans MT", Calibri, sans-serif;
    --font-tech: "Gill Sans", "Gill Sans MT", Calibri, sans-serif;
    
    --ease-lux: cubic-bezier(0.2, 1, 0.3, 1);
    --ease-shutter: cubic-bezier(0.7, 0, 0.3, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; cursor: none; }

/* Restaurar cursor nativo en móvil */
@media (max-width: 900px) {
    *, *::before, *::after { cursor: auto !important; }
}

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
    width: 100%; min-height: 100vh;
    background-color: var(--bg-void) !important;
    color: var(--text-white);
    font-family: var(--font-main);
    font-weight: 300 !important;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, a, p, span, strong, b, div { font-weight: 300 !important; }
img { display: block; width: 100%; height: auto; object-fit: cover; }
a { text-decoration: none; color: inherit; cursor: pointer; }

/* =========================================
   2. FX
   ======================================== */
.noise-layer {
    position: fixed; inset: 0; z-index: 9000; pointer-events: none; 
    opacity: 0.015; 
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

#cursor { position: fixed; top: 0; left: 0; z-index: 99999; pointer-events: none; mix-blend-mode: exclusion; }
.c-dot { width: 4px; height: 4px; background: #fff; border-radius: 50%; position: absolute; transform: translate(-50%, -50%); }
.c-ring { 
    width: 40px; height: 40px; border: 1px solid rgba(255,255,255,0.4); border-radius: 50%; 
    position: absolute; transform: translate(-50%, -50%); transition: 0.2s ease-out;
}
body.hovering .c-ring { width: 60px; height: 60px; background: rgba(255,255,255,0.1); border-color: transparent; }

/* =========================================
   3. STRUCTURAL SHUTTER (COMPUERTAS)
   ======================================== */
#structural-shutter { 
    position: fixed; inset: 0; z-index: 10000; 
    display: flex; 
    background: transparent; 
    pointer-events: none; 
}

.shutter-panel { 
    flex: 1; height: 100%; 
    background-color: rgba(5, 5, 5, 0.4); 
    backdrop-filter: blur(50px);
    -webkit-backdrop-filter: blur(50px);
    border-right: 1px solid rgba(255,255,255,0.02); 
    transform: translateY(0); 
    transition: transform 1.8s var(--ease-shutter); 
    will-change: transform; 
}

.shutter-center { 
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); 
    display: flex; flex-direction: column; align-items: center; justify-content: center; 
    z-index: 10001; transition: opacity 0.5s ease; width: 100%; 
    pointer-events: none; 
}

#intro-video { 
    width: 500px; max-width: 80vw; height: auto; display: block;
    opacity: 1;
    background: transparent !important;
    mix-blend-mode: normal; 
}

.intro-text {
    font-family: var(--font-tech); font-size: 0.95rem; letter-spacing: 0.3em; color: #fff; font-weight: 300;
    margin-top: -15px; opacity: 0; transform: translateY(10px); z-index: 10002;
    animation: fadeUpText 3s ease forwards; animation-delay: 3.5s; 
}
@keyframes fadeUpText { to { opacity: 1; transform: translateY(0); } }

/* Shutter Open State */
body.loaded .shutter-center { opacity: 0; }
body.loaded .shutter-panel:nth-child(odd) { transform: translateY(-100%); }
body.loaded .shutter-panel:nth-child(even) { transform: translateY(100%); }

/* Delays para efecto cascada */
body.loaded .shutter-panel:nth-child(1) { transition-delay: 0s; }
body.loaded .shutter-panel:nth-child(2) { transition-delay: 0.1s; }
body.loaded .shutter-panel:nth-child(3) { transition-delay: 0.05s; }
body.loaded .shutter-panel:nth-child(4) { transition-delay: 0.15s; }
body.loaded .shutter-panel:nth-child(5) { transition-delay: 0.0s; }

/* =========================================
   4. NAVEGACIÓN
   ======================================== */
.nav-hud { 
    position: fixed; top: 0; left: 0; width: 100%; height: 90px; 
    display: flex; justify-content: space-between; align-items: center; 
    padding: 0 4vw; z-index: 100; mix-blend-mode: none; 
    opacity: 0; transition: opacity 1s ease 1s; 
}
body.loaded .nav-hud { opacity: 1; }

.brand-type { font-size: 1rem; letter-spacing: 0.15em; text-transform: uppercase; font-family: var(--font-tech); }

.desktop-only { display: flex; gap: 3vw; } 
.mobile-menu-trigger { display: none; } 

.magnetic-link { font-size: 0.95rem; letter-spacing: 0.1em; opacity: 0.95; transition: opacity 0.3s; padding: 10px; display: inline-block; font-family: var(--font-tech); }
.magnetic-link:hover { opacity: 1; }

.lang-switch { display: flex; gap: 5px; align-items: center; }
.lang-btn { cursor: pointer; opacity: 0.85; transition: opacity 0.3s ease, font-weight 0.3s ease; display: inline-block; padding: 0 2px; }
.lang-btn:hover { opacity: 0.95; }
.lang-btn.active { opacity: 1; font-weight: 600; }
.lang-switch, .footer-lang { pointer-events: auto !important; }

/* =========================================
   5. MENU MÓVIL (Overlay)
   ======================================== */
#mobile-menu-overlay {
    position: fixed; inset: 0; width: 100%; height: 100%;
    background-color: rgba(5, 5, 5, 0.92);
    backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
    z-index: 9000; 
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    opacity: 0; pointer-events: none; transition: opacity 0.5s var(--ease-lux);
}
#mobile-menu-overlay.active { opacity: 1; pointer-events: auto; }

.mm-content { display: flex; flex-direction: column; align-items: center; gap: 6vh; transform: translateY(20px); transition: transform 0.6s var(--ease-lux); }
#mobile-menu-overlay.active .mm-content { transform: translateY(0); }

.mm-link { font-family: var(--font-main); font-size: 2rem; color: #e6e6e6; letter-spacing: 0.05em; display: block; text-align: center; margin: 10px 0; opacity: 0; transform: translateY(10px); transition: opacity 0.4s ease, transform 0.4s ease; }
#mobile-menu-overlay.active .mm-link:nth-child(1) { transition-delay: 0.1s; opacity: 1; transform: translateY(0); }
#mobile-menu-overlay.active .mm-link:nth-child(2) { transition-delay: 0.15s; opacity: 1; transform: translateY(0); }
#mobile-menu-overlay.active .mm-link:nth-child(3) { transition-delay: 0.2s; opacity: 1; transform: translateY(0); }
#mobile-menu-overlay.active .mm-link:nth-child(4) { transition-delay: 0.25s; opacity: 1; transform: translateY(0); }

.mm-footer { margin-top: 4vh; border-top: 1px solid rgba(255,255,255,0.1); padding-top: 20px; width: 100%; display: flex; justify-content: center; }
.mm-lang { font-family: var(--font-tech); font-size: 1rem; letter-spacing: 0.2em; color: var(--text-muted); }

/* =========================================
   6. HERO
   ======================================== */
.hero-section { position: relative; height: 100vh; width: 100%; display: flex; justify-content: center; align-items: center; overflow: hidden; }
.hero-bg-parallax { position: fixed; inset: 0; width: 100%; height: 120%; top: -10%; z-index: -5; }
.hero-slide { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: 0; transform: scale(1.1); transition: opacity 2.5s ease, transform 12s linear; }
.hero-slide.active { opacity: 0.8; transform: scale(1); }
.hero-overlay { position: absolute; inset: 0; z-index: 1; background: radial-gradient(circle, transparent 80%, #050505 130%); }
.hero-tech-data { position: absolute; z-index: 10; bottom: 15vh; display: flex; flex-direction: column; align-items: center; gap: 10px; font-family: var(--font-tech); font-size: 0.7rem; letter-spacing: 0.2em; color: rgba(255,255,255,0.6); }
.data-row { display: flex; gap: 15px; }
.separator { opacity: 0.3; }
.scroll-down { position: absolute; bottom: 40px; display: flex; flex-direction: column; align-items: center; gap: 10px; z-index: 10; }
.sd-text { font-size: 0.6rem; letter-spacing: 0.2em; opacity: 0.5; font-family: var(--font-tech); }
.sd-line { width: 1px; height: 40px; background: rgba(255, 255, 255, 0.389); }
.reveal-hero { opacity: 0; transform: translateY(20px); transition: all 1.5s ease 1.5s; }
body.loaded .reveal-hero { opacity: 1; transform: translateY(0); }

/* =========================================
   7. PROYECTOS (Desktop Base)
   ======================================== */
.glass-wrapper {
    position: relative; z-index: 2;
    background-color: rgba(5, 5, 5, 0.9);
    backdrop-filter: blur(40px); -webkit-backdrop-filter: blur(40px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.gallery-section { padding: 14vh 0 14vh; background: transparent; border: none; }
.sec-header { padding: 0 4vw; display: flex; align-items: baseline; gap: 20px; margin-bottom: 0px; padding-bottom: 20px; }
.sec-title { font-size: 1rem; letter-spacing: 0.1em; font-family: var(--font-tech); }

.horizontal-gallery-wrapper { 
    width: 100%; overflow-x: auto; overflow-y: hidden; 
    scrollbar-width: none; padding: 20px 0; 
}
.horizontal-gallery-wrapper::-webkit-scrollbar { display: none; }

.horizontal-track { 
    display: flex; gap: 1.2vw; padding: 0 4vw; width: max-content;
    border-bottom: 1px solid var(--text-muted);
    border-top: 1px solid var(--text-muted);
    background: linear-gradient(var(--text-muted), var(--text-muted)) 0 36vh / 100% 1px no-repeat;
}

.h-card { width: 35vw; min-width: 300px; position: relative; flex-shrink: 0; }

.h-img { 
    overflow: hidden; height: 36vh; width: 100%; margin-bottom: 0px; border-radius: 1px; 
}
.h-img img { 
    display: block; width: 100%; height: 100%; object-fit: cover; 
    filter: brightness(0.85) contrast(1.1) saturate(0.85); 
    transform: scale(1.05); transition: filter 0.6s ease, transform 1s var(--ease-lux); 
}
.h-card:hover img { filter: brightness(1) contrast(1) saturate(1); transform: scale(1); }

.h-info { display: flex; justify-content: space-between; align-items: center; width: 100%; }
.h-info h2 { font-size: 1rem; text-transform: uppercase; font-family: var(--font-main); padding: 2vh 0 2vh; letter-spacing: 0.05rem; }
.h-info span { font-family: var(--font-tech); font-size: 1.1rem; color: var(--text-muted); padding: 2vh 0 2vh; white-space: nowrap; opacity: 0.45; margin-left: 20px; }

.gallery-footer { padding: 60px 4vw 0; display: flex; justify-content: space-between; align-items: flex-end; width: 100%; }
.gf-text { flex: 1; }
.vision-desc { font-family: var(--font-main); font-size: 1.2rem; line-height: 1.2; color: #e6e6e6; max-width: 600px; font-weight: 300 !important; opacity: 0.8; text-align: justify; }
.gf-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 15px; }
.btn-clean { border: 0px solid #ffffffbd; padding: 0px 10px; display: inline-block; width: fit-content; font-family: var(--font-tech); font-size: 0.85rem; letter-spacing: 0.1em; transition: background 0.3s, color 0.3s; }
.btn-clean:hover { background: #63636300; color: #767676; }

/* =========================================
   8. ARCHIVO / ATLAS
   ======================================== */
.atlas-section { padding: 15vh 12vw 10vh; background: #080808; border-top: 1px solid var(--line-faint); position: relative; z-index: 2; }
.atlas-header { display: flex; justify-content: space-between; margin-bottom: 60px; border-bottom: 1px solid var(--line-faint); padding-bottom: 20px; }
.ah-title { font-size: 0.9rem; letter-spacing: 0.2em; font-family: var(--font-tech); }
.ah-meta { font-family: var(--font-tech); font-size: 0.7rem; color: #8d8d8d; }

.atlas-grid { display: flex; flex-direction: column; gap: 120px; }
.a-row { display: flex; gap: 4vw; justify-content: space-between; width: 100%; }

.half-split .a-item { width: calc(50% - 2vw); } 
.a-item-2 { width: calc(40% - 2vw); }
.a-item-3 { width: calc(60% - 2vw); }
.full-width .a-item, .full-width .a-item-2, .full-width .a-item-3 { width: 100%; }

.offset-down { margin-top: 70px; }
.a-item.panoramic img, .a-item-2.panoramic img, .a-item-3.panoramic img { aspect-ratio: 21/9; object-fit: cover; }
.a-item.panoramic-2 img { aspect-ratio: 21/12; object-fit: cover; }

.a-item, .a-item-2, .a-item-3 { position: relative; transition: all 0.8s var(--ease-lux); cursor: pointer; }
.a-item img, .a-item-2 img, .a-item-3 img { width: 100%; display: block; filter: brightness(0.9) contrast(1.1); transition: filter 0.6s ease; }
.a-label { display: block; font-family: var(--font-tech); font-size: 0.8rem; color: #666; margin-top: 10px; letter-spacing: 0.05em; transition: color 0.3s, opacity 0.3s; }

.a-item:hover, .a-item-2:hover, .a-item-3:hover { transform: scale(1.02); z-index: 10; }
.a-item:hover img, .a-item-2:hover img, .a-item-3:hover img { filter: brightness(1) contrast(1); }
.a-item:hover .a-label, .a-item-2:hover .a-label, .a-item-3:hover .a-label { color: #fff; opacity: 1; }

.atlas-grid.has-expanded .a-item:not(.is-expanded),
.atlas-grid.has-expanded .a-item-2:not(.is-expanded),
.atlas-grid.has-expanded .a-item-3:not(.is-expanded) { opacity: 0.1; filter: grayscale(0.2) blur(2px); transform: scale(0.98); pointer-events: none; }
.a-item.is-expanded, .a-item-2.is-expanded, .a-item-3.is-expanded { z-index: 500 !important; filter: brightness(1); transform: scale(1.12) !important; cursor: zoom-out; box-shadow: 0 50px 100px rgba(0,0,0,0.9); }
.atlas-footer { text-align: center; margin-top: 15vh; font-family: var(--font-tech); opacity: 0.2; }

/* =========================================
   9. FOOTER
   ======================================== */
.main-footer { padding: 10vh 4vw; background: #000; border-top: 1px solid #222; display: flex; justify-content: space-between; align-items: flex-start; position: relative; z-index: 2; }
.footer-col { flex: 1; }
.f-brand { font-size: 1.5rem; letter-spacing: 0.1em; font-weight: 400 !important; font-family: var(--font-main); }
.legal-col { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.legal-link { font-family: var(--font-tech); font-size: 0.7rem; color: #666; transition: color 0.3s; }
.legal-link:hover { color: #fff; }
.contact-col { text-align: right; display: flex; flex-direction: column; gap: 20px; }
.f-copy { font-family: var(--font-tech); font-size: 0.8rem; color: #555; padding-right: 10px; }

/* =========================================
   10. ANIMACIONES
   ======================================== */
.reveal-trigger { opacity: 0; transform: translateY(50px); transition: all 1s var(--ease-lux); }
.reveal-trigger.visible { opacity: 1; transform: translateY(0); }
.delay-1 { transition-delay: 0.2s; }


/* =====================================================================
   SISTEMA DE RESPONSIVIDAD AVANZADO (MOBILE ENGINE)
   [Agente 1: Solución Definitiva Carrusel Momentum]
   ===================================================================== */
@media (max-width: 900px) {

    /* --- NAVEGACIÓN Y MENÚ --- */
    .nav-hud { padding: 0 25px; height: 80px; }
    .brand-type { font-size: 0.9rem; }
    
    .desktop-only { display: none !important; }
    .mobile-menu-trigger { 
        display: block; 
        font-family: var(--font-tech);
        font-size: 0.85rem;
        letter-spacing: 0.15em;
        padding: 10px;
        z-index: 9005; 
        cursor: pointer;
        transition: color 0.3s;
    }
    #mobile-menu-overlay.active ~ .nav-hud .mobile-menu-trigger {
        color: #fff; 
    }

    /* --- HERO --- */
    .hero-bg-parallax { background-attachment: scroll; }
    .hero-tech-data { bottom: 20vh; }

    /* --- GALERÍA PROYECTOS (FREE SCROLL & TOUCH FIX) --- */
    .horizontal-gallery-wrapper {
        display: flex;
        overflow-x: auto;
        overflow-y: hidden;
        /* DESACTIVAR SNAP para movimiento libre */
        scroll-snap-type: none !important; 
        /* FLUIDEZ NATIVA */
        scroll-behavior: auto !important; 
        /* MOMENTUM IOS */
        -webkit-overflow-scrolling: touch; 
        touch-action: pan-x;
        padding-bottom: 30px;
        overscroll-behavior-x: contain;
    }

    .horizontal-track {
        gap: 20px; 
        padding: 0 20px; 
        background: none; 
        align-items: flex-start;
        width: max-content;
    }

    .h-card { 
        width: 80vw; 
        scroll-snap-align: none !important; /* NO ALINEACIÓN */
        display: flex; 
        flex-direction: column; 
        flex-shrink: 0;
    }
    
    .h-card::after { content: ''; position: absolute; bottom: 80px; left: 0; width: 100%; height: 0px; background: var(--text-muted); opacity: 0.3; }

    /* FIX CRÍTICO: Bloquear interacción de imagen para permitir scroll instantáneo */
    .h-img img {
        pointer-events: none !important;
        -webkit-user-drag: none;
        user-select: none;
    }

    /* Recorte Vertical */
    .h-img { width: 100%; height: auto; aspect-ratio: 5/4; border-radius: 0; }
    /* El pointer-events none está aplicado arriba al img */
    .h-img img { width: 100%; height: 100%; object-fit: cover; transform: scale(1) !important; }

    /* Centrado Vertical Texto */
    .h-info { height: 55px; display: flex; align-items: center; padding: 0 5px; }
    .h-info h2 { font-size: 0.75rem; line-height: 1.2; padding: 0; margin: 0; margin-right: 10px; }
    .h-info span { font-size: 0.85rem; text-transform: uppercase; padding: 0; margin: 0; margin-left: auto; }

    /* --- GALLERY FOOTER --- */
    .gallery-footer { flex-direction: column; align-items: flex-start; gap: 40px; padding: 40px 20px 0; }
    .vision-desc { font-size: 1.2rem; max-width: 80%; text-align: left; }
    .gf-actions { align-items: flex-start; width: 100%; gap: 20px; }
    .btn-clean { padding-left: 0; }

    /* --- ARCHIVO (ATLAS) MÓVIL --- */
    .atlas-section { padding: 10vh 20px; }
    .atlas-grid { gap: 60px; }
    .a-row { flex-direction: column; gap: 60px; }

    .half-split .a-item, .full-width .a-item, .a-item-2, .a-item-3, .a-item { 
        width: 100% !important; margin-top: 0 !important; 
    }

    .a-item img, .a-item-2 img, .a-item-3 img,
    .a-item.panoramic img, .a-item.panoramic-2 img {
        width: 100%; height: auto; aspect-ratio: 4/5; object-fit: cover;
    }

    /* --- MAIN FOOTER --- */
    .main-footer { flex-direction: column; gap: 50px; padding: 60px 20px; text-align: left; }
    .footer-col { width: 100%; flex: auto; }
    .contact-col { align-items: flex-start; text-align: left; }
    .legal-col { align-items: flex-start; order: 3; }
    .f-brand { font-size: 1.2rem; margin-bottom: 10px; display: block; }
    .f-copy { padding-right: 0; margin-top: 10px; opacity: 0.6; }

    #cursor { display: none !important; }

    /* FIXES ADICIONALES (Nav, Video) */
    body.menu-active .nav-hud { z-index: 9005 !important; }
    body.menu-active .mobile-menu-trigger { color: #ffffff !important; mix-blend-mode: normal !important; }
    #intro-video { width: 100% !important; height: 100% !important; object-fit: cover; position: relative; z-index: 10002; }
}

/* =========================================
   AJUSTES DE VISIBILIDAD (TEXTOS ALTERNATIVOS)
   ======================================== */
.show-mobile { display: none; }
.show-desktop { display: inline; }

@media (max-width: 900px) {
    .sec-header { display: none !important; }
    .show-desktop { display: none; }
    .show-mobile { display: inline; }
}