/* Clean reset and system defaults */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
}

body,
html {
    width: 100%;
    background-color: #050505;
    font-family: 'Outfit', sans-serif;
    color: #ffffff;
}

body {
    height: 220vh;
    /* Shorter scroll track for faster scroll transition */
    overflow-x: hidden;
    overflow-y: auto;
    opacity: 0;
    transition: opacity 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}

body.page-no-3d {
    height: auto;
    min-height: 100vh;
}

body.loaded {
    opacity: 1;
}

body.page-exit {
    opacity: 0 !important;
    pointer-events: none;
}

/* Fixed fullscreen Canvas background */
#webgl-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    display: block;
}

/* UI Overlay Layer */
.ui-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 3;
    pointer-events: none;
    /* Let clicks pass through except to visible buttons */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 7rem 3rem 3rem 3rem;
    /* Clear the fixed header */
}

.ui-overlay>* {
    pointer-events: auto;
    /* Enable pointer events on direct header, footer, and titles child containers */
}

/* Integrated Navigation Controls Capsule */
.nav-controls {
    position: fixed;
    bottom: 6rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    background: rgba(10, 10, 10, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.4rem 1rem;
    border-radius: 50px;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    pointer-events: auto;
    z-index: 10;
    transition: all 0.3s ease;
}

/* Hide navigation on contact page and pages without 3D scroll */
.page-contacto .nav-controls,
.page-no-3d .nav-controls {
    display: none !important;
}

.nav-controls:hover {
    border-color: rgba(255, 51, 51, 0.3);
    box-shadow: 0 8px 32px rgba(255, 51, 51, 0.08);
}

.nav-btn {
    background: transparent;
    border: none;
    color: #a3a3a3;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    transition: all 0.3s ease;
}

.nav-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
    transition: transform 0.3s ease;
}

.nav-btn:not(:disabled):hover {
    color: #ff3333;
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(255, 51, 51, 0.2);
}

.btn-prev:hover:not(:disabled) svg {
    transform: translateX(-2px);
}

.btn-next:hover:not(:disabled) svg {
    transform: translateX(2px);
}

.nav-btn:disabled {
    opacity: 0.15;
    cursor: not-allowed;
}

.nav-dots {
    display: flex;
    gap: 0.5rem;
}

/* ---------------------------------
   LIQUID TRANSITION OVERLAY
--------------------------------- */
.transition-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    /* Ignore clicks */
    z-index: 9999;
    /* Always on top */
}

#transition-canvas {
    width: 100%;
    height: 100vh;
    display: block;
}

/* Add Barba JS page exit override if necessary to prevent old CSS conflict */
.page-exit .ui-overlay {
    opacity: 1 !important;
    /* Barba handles transitions now, prevent old fade-out CSS */
}

.dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    cursor: pointer;
    transition: all 0.3s ease;
}

.dot:hover {
    background: rgba(255, 255, 255, 0.6);
}

.dot.active {
    background: #ff3333;
    box-shadow: 0 0 8px rgba(255, 51, 51, 0.8);
    transform: scale(1.2);
}

/* Header styling */
.header {
    position: fixed;
    top: 0;
    left: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    height: 8vh;
    background: rgba(255, 255, 255, 1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 0.5px solid rgba(0, 0, 0, 0.01);
    padding: 1.2rem 3rem;
    z-index: 10001;
}

.logo {
    display: flex;
    position: relative;
    z-index: 10005; /* Asegura que el logo quede por encima del menú móvil (10000) */
}

.logo img {
    height: auto;
    width: 140px; 
    object-fit: contain;
    transition: all 0.3s ease;
}

.nav-menu {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-item {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #a3a3a3;
    text-decoration: none;
    position: relative;
    padding: 0.4rem 0;
    transition: color 0.3s ease, transform 0.3s ease;
}

.nav-item:hover {
    color: #ffffff;
    transform: translateY(-1px);
}

.nav-item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: #ff3333;
    transition: width 0.3s ease;
}

.nav-item:hover::after,
.nav-item.active::after {
    width: 100%;
}

.nav-item.active {
    color: #ff3333;
    text-shadow: 0 0 8px rgba(255, 51, 51, 0.4);
}

/* Cinematic Titles */
.cinematic-titles {
    position: relative;
    max-width: 500px;
    margin-top: auto;
    margin-bottom: auto;
}

.title-wrapper {
    position: absolute;
    bottom: 0;
    left: 0;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s cubic-bezier(0.25, 1, 0.5, 1), transform 0.8s cubic-bezier(0.25, 1, 0.5, 1);
    pointer-events: none;
}

.title-wrapper.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Home Content Standard Block */
.home-content {
    position: relative;
    z-index: 10;
    pointer-events: auto;
    padding: 15vh 5% 100px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.content-block {
    background: rgba(10, 10, 10, 0.5);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 3rem;
    border-radius: 20px;
    max-width: 800px;
    margin: 0 auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.content-block h1 {
    font-family: 'Playfair Display', serif;
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 1rem;
    color: #ffffff;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.95);
}

.label {
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.3em;
    color: #ff3333;
    display: block;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

h2 {
    font-family: 'Playfair Display', serif;
    font-size: 3rem;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 1rem;
    color: #ffffff;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.95), 0 2px 6px rgba(0, 0, 0, 0.95);
}

p {
    font-size: 0.95rem;
    font-weight: 300;
    color: #eeeeee;
    line-height: 1.6;
    letter-spacing: 0.02em;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9), 0 1px 3px rgba(0, 0, 0, 0.95);
}

/* Footer layout */
.footer {
    position: fixed;
    bottom: 3rem;
    left: 3rem;
    width: calc(100vw - 6rem);
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 10002;
    pointer-events: auto;
}

.certificados-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    pointer-events: auto;
}

.certificado-logo {
    height: 35px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0px 2px 4px rgba(0, 0, 0, 0.5));
}

/* Dynamic Scroll Progress Bar */
.progress-bar-container {
    width: 200px;
    height: 2px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 1px;
    overflow: hidden;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background-color: #ff3333;
    box-shadow: 0 0 8px rgba(255, 51, 51, 0.8);
    transition: width 0.1s ease-out;
}

.coordinates {
    font-family: monospace;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.4);
}

/* Social Icons */
.social-icons {
    display: flex;
    gap: 1.2rem;
    align-items: center;
    pointer-events: auto;
}

.social-icons a {
    color: #ffffff;
    opacity: 0.85;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.8));
    margin-top: -10PX;
}

.social-icons a:hover {
    opacity: 1;
    transform: translateY(-3px) scale(1.1);
    filter: drop-shadow(0 5px 12px rgba(0, 0, 0, 0.95));
    color: #ff3333;
}

.social-icons svg {
    width: 30px;
    height: 20%;
    fill: currentColor;
}

/* Animations */
@keyframes scrollMouse {
    0% {
        opacity: 1;
        top: 6px;
    }

    100% {
        opacity: 0;
        top: 20px;
    }
}

/* Responsiveness */
@media (max-width: 768px) {
    .ui-overlay {
        padding: 1.5rem;
    }

    h2 {
        font-size: 2.2rem;
    }

    .progress-bar-container {
        width: 100px;
    }

    .coordinates {
        display: none;
    }

    body.page-contacto .footer {
        padding: 0;
    }

    .contact-section {
        padding: 5rem 1.5rem 1rem 1.5rem;
    }

    .footer {
        position: fixed;
        bottom: 1.5rem;
        left: 1.5rem;
        width: calc(100vw - 3rem);
        flex-direction: column;
        gap: 1rem;
        height: auto;
        align-items: center;
        justify-content: center;
    }

    .certificados-container {
        gap: 1rem;
        flex-wrap: wrap;
    }

    .certificado-logo {
        height: 28px;
    }
}

/* ---------------------------------
   CONTACT PAGE SPECIFICS
--------------------------------- */
body.page-contacto #webgl-canvas {
    opacity: 0 !important;
    pointer-events: none;
}

body.page-contacto {
    background-image: radial-gradient(circle at center, #1a1a1a 0%, #050505 100%);
}

/* Eliminamos el padding muerto del overlay solo en Contacto */
body.page-contacto .ui-overlay {
    padding: 0 !important;
}

/* El footer está posicionado de forma fija */
body.page-contacto .footer {
    padding: 0;
}

.contact-section {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-top: 25PX;

    /* Expande la zona de scroll a todo el espacio disponible */
    flex-grow: 1;
    height: 0;
    overflow-y: auto;
    pointer-events: auto;

    /* El padding ahora vive aquí adentro, haciendo que toda el área sea "scrollable" */
    padding: 7rem 3rem 1rem 3rem;
}

.contact-wrapper {
    display: flex;
    flex-direction: row;
    width: 100%;
    max-width: 1100px;
    background: rgba(20, 20, 20, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    margin: auto;
    overflow: hidden;
}

.contact-form-side {
    flex: 1;
    padding: 2rem;
}

.contact-info-side {
    flex: 0.85;
    background: rgba(0, 0, 0, 0.4);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    border-left: 1px solid rgba(255, 255, 255, 0.05);
}

.contact-title {
    font-family: 'Playfair Display', serif;
    font-size: 2.4rem;
    color: #fff;
    margin-bottom: 0.5rem;
    text-align: left;
}

.contact-subtitle {
    text-align: left;
    color: #a3a3a3;
    font-size: 0.9rem;
    margin-bottom: 1.2rem;
}

.glass-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.form-group.half-width {
    width: calc(50% - 0.6rem);
}

.glass-form label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #808080;
    margin-bottom: 0.4rem;
    font-weight: 600;
}

.glass-form input,
.glass-form textarea {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.7rem;
    border-radius: 8px;
    color: #fff;
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.glass-form input:focus,
.glass-form textarea:focus {
    outline: none;
    border-color: #ff3333;
    background: rgba(255, 51, 51, 0.05);
    box-shadow: 0 0 15px rgba(255, 51, 51, 0.2);
}

.submit-btn {
    width: 100%;
    padding: 0.9rem;
    background: #ff3333;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 0.5rem;
}

.submit-btn:hover {
    background: #e62e2e;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(255, 51, 51, 0.35);
}

/* Contact Info Side */
.contact-info-list {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    margin-bottom: 2rem;
}

.info-item {
    display: flex;
    flex-direction: column;
}

.info-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #ff3333;
    margin-bottom: 0.3rem;
    font-weight: 800;
}

.info-text {
    color: #e0e0e0;
    font-size: 0.9rem;
    line-height: 1.5;
    font-weight: 300;
}

.contact-map-container {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
}

.map-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #fff;
    margin-bottom: 0.2rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
}

.map-subtitle {
    font-size: 0.65rem;
    color: #ff3333;
    letter-spacing: 1px;
    margin-bottom: 0.8rem;
    font-weight: 600;
}

.contact-map {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.contact-map img {
    width: 80%;
    max-height: 100%;
    object-fit: contain;
    opacity: 0.8;
}

@media (max-width: 1366px),
(max-height: 800px) {
    .contact-section {
        padding: 2rem 1rem 1rem 1rem;
    }

    .contact-wrapper {
        max-width: 950px;
    }

    .contact-form-side,
    .contact-info-side {
        padding: 1.5rem;
    }

    .contact-title {
        font-size: 2rem;
    }

    .contact-subtitle {
        font-size: 0.85rem;
        margin-bottom: 1rem;
    }

    .glass-form {
        gap: 0.7rem;
    }

    .glass-form input,
    .glass-form textarea {
        padding: 0.6rem;
        font-size: 0.9rem;
    }

    .contact-info-list {
        gap: 0.8rem;
        margin-bottom: 1rem;
    }

    .contact-map-container {
        padding: 0.5rem;
    }

    .contact-map img {
        max-height: 150px;
    }
}

@media (max-width: 900px) {
    .contact-wrapper {
        flex-direction: column;
    }

    .contact-info-side {
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.05);
    }

    .form-group.half-width {
        width: 100%;
    }

    .contact-section {
        height: auto;
        padding-bottom: 3rem;
    }
}

/* ---------------------------------
   MOBILE MENU & OVERLAY
--------------------------------- */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    width: 30px;
    height: 30px;
    cursor: pointer;
    z-index: 10005;
    pointer-events: auto;
}

.hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background-color: #a3a3a3;
    transition: all 0.3s ease;
}

.hamburger.active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }
    
    .nav-menu {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background-color: #ffffff; /* White to match transition */
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 2.5rem;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.4s ease;
        z-index: 10000;
    }
    
    .nav-menu.active {
        opacity: 1;
        pointer-events: auto;
    }
    
    .nav-item {
        font-size: 1.5rem;
        color: #333333;
        transition: opacity 0.3s ease, color 0.3s ease;
    }
    
    .nav-menu.fading-out .nav-item {
        opacity: 0 !important;
        transition: opacity 0.1s ease;
    }
    
    /* Nav-controls capsule: pills only, top positioned */
    .nav-controls {
        bottom: auto;
        top: 10vh;
        padding: 0.4rem 0.8rem;
    }
    
    .logo img {
        width: 170px;
    }
    
    .nav-controls .nav-btn {
        display: none !important;
    }
}