/* ========================================
   HEADER GLOBAL - PEGASUS
======================================== */

#masthead {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: transparent;
    backdrop-filter: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 15px 0;
    box-shadow: none;
}

#masthead.scrolled {
    position: fixed;
    top: 20px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: 85%;
    max-width: 95%;
    background: rgba(36, 54, 41, .9);
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(36, 54, 41, .3);
    box-shadow: 0 8px 32px #24362926, 0 2px 8px #0000001a;
    padding: 12px 30px;
    border-radius: 1rem;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    align-items: center;
    padding: 20px 20px 20px 20px;
    gap: 20px;
    transition: all 0.4s ease;
}

#masthead.scrolled .header-container {
    max-width: none;
    margin: 0;
    padding: 0 20px;
    gap: 25px;
}

.site-branding {
    justify-self: start;
}

.logo-container {
    display: flex;
    align-items: center;
}

.site-logo {
    width: 100%;
    height: 70px;
    object-fit: contain;
    transition: all 0.4s ease;
}

#masthead.scrolled .site-logo {
    width: 150px;
    height: auto;
}

/* NAVEGACIÓN DESKTOP */
.main-navigation {
    justify-self: center;
    display: flex;
    align-items: center;
}

.navigation-wrapper {
    display: flex;
}

#primary-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 35px;
    transition: all 0.4s ease;
}

.main-navigation li {
    margin: 0;
}

.main-navigation a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    padding: 8px 0;
    position: relative;
}

.main-navigation a:hover {
    color: #d4b896;
}

.main-navigation a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: #d4b896;
    transition: width 0.3s ease;
}

.main-navigation a:hover::after {
    width: 100%;
}

/* BOTÓN CTA */
.header-cta {
    justify-self: end;
    display: flex;
    align-items: center;
}

.cta-button {
    background: linear-gradient(135deg, #e0d3c3 0%, #d4b896 100%);
    color: #2c4a3d;
    padding: 12px 22px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid #d4b896;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    letter-spacing: 0.5px;
    box-shadow: 
        0 4px 15px rgba(212, 184, 150, 0.2),
        0 2px 8px rgba(0, 0, 0, 0.1);
}

.cta-button:hover {
    background: transparent;
    color: #d4b896;
    text-decoration: none;
    transform: translateY(-3px) scale(1.02);
    border-color: #d4b896;
    box-shadow: 
        0 8px 25px rgba(212, 184, 150, 0.4),
        0 4px 16px rgba(0, 0, 0, 0.15);
}

/* MENÚ HAMBURGUESA - OCULTO EN DESKTOP */
.menu-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    gap: 4px;
    z-index: 1003;
    position: relative;
}

.hamburger-line {
    width: 25px;
    height: 3px;
    background: white;
    border-radius: 2px;
    transition: all 0.3s ease;
    display: block;
}

/* ANIMACIÓN HAMBURGUESA -> X */
.menu-toggle.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.menu-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* OVERLAY MENÚ MÓVIL - OCULTO POR DEFECTO */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(44, 74, 61, 0.98);
    backdrop-filter: blur(20px);
    z-index: 1002;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-100%);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-menu-overlay.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.mobile-menu-content {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
}

.mobile-menu-close {
    position: absolute;
    top: 30px;
    right: 30px;
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1004;
}

.mobile-menu-items {
    list-style: none;
    margin: 0;
    padding: 0;
    text-align: center;
}

.mobile-menu-items li {
    margin: 20px 0;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.6s ease;
}

.mobile-menu-overlay.show .mobile-menu-items li {
    transform: translateY(0);
    opacity: 1;
}

/* Animación escalonada */
.mobile-menu-overlay.show .mobile-menu-items li:nth-child(1) { transition-delay: 0.1s; }
.mobile-menu-overlay.show .mobile-menu-items li:nth-child(2) { transition-delay: 0.2s; }
.mobile-menu-overlay.show .mobile-menu-items li:nth-child(3) { transition-delay: 0.3s; }
.mobile-menu-overlay.show .mobile-menu-items li:nth-child(4) { transition-delay: 0.4s; }
.mobile-menu-overlay.show .mobile-menu-items li:nth-child(5) { transition-delay: 0.5s; }

.mobile-menu-items a {
    color: white;
    font-size: 1.8rem;
    font-weight: 600;
    text-decoration: none;
    padding: 15px 30px;
    border-radius: 10px;
    transition: all 0.3s ease;
    display: block;
    min-width: 200px;
    border: 2px solid transparent;
}

.mobile-menu-items a:hover {
    background: rgba(212, 184, 150, 0.2);
    color: #d4b896;
    transform: translateY(-2px) scale(1.05);
    border-color: rgba(212, 184, 150, 0.3);
    box-shadow: 0 8px 25px rgba(212, 184, 150, 0.2);
}

/* ========================================
   RESPONSIVE MÓVIL
======================================== */
@media (max-width: 768px) {
    /* Header móvil */
    #masthead {
        padding: 8px 0;
    }
    
    .header-container {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0 15px;
        gap: 15px;
        grid-template-columns: none; /* Desactivar grid en móvil */
    }
    
    .site-branding {
        order: 1;
        justify-self: flex-start;
        flex: 0 0 auto; /* evita que el logo se estire y se mantiene a la izquierda */
    }
    
    .site-logo {
        width: 80px;
        height: 80px;
    }
    
    /* Navegación se centra y contiene el hamburger */
    .main-navigation {
        order: 2;
        justify-self: flex-end;
        margin-left: auto;
        display: flex;               /* asegura layout flex en mobile */
        align-items: center;         /* alinea verticalmente el hamburger */
        flex: 1 1 auto;              /* toma el espacio disponible */
        justify-content: flex-end;   /* empuja el contenido al extremo derecho */
    }
    
    /* Ocultar navegación desktop por defecto */
    .navigation-wrapper {
        display: none !important;
    }
    
    /* MENÚ MÓVIL - MOSTRAR CUANDO TIENE CLASE 'show' */
    #primary-menu {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: rgba(44, 74, 61, 0.98);
        backdrop-filter: blur(20px);
        z-index: 1002;
        display: none; /* Oculto por defecto */
        flex-direction: column;
        justify-content: center;
        align-items: center;
        list-style: none;
        margin: 0;
        padding: 0;
        opacity: 0;
        visibility: hidden;
        transform: translateY(-100%);
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    /* Mostrar el menú cuando tenga la clase 'show' */
    #primary-menu.show {
        display: flex !important;
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
    
    #primary-menu li {
        margin: 20px 0;
        transform: translateY(20px);
        opacity: 0;
        transition: all 0.6s ease;
    }
    
    /* Animación escalonada de los elementos del menú */
    #primary-menu.show li {
        transform: translateY(0);
        opacity: 1;
    }
    
    #primary-menu.show li:nth-child(1) { transition-delay: 0.1s; }
    #primary-menu.show li:nth-child(2) { transition-delay: 0.2s; }
    #primary-menu.show li:nth-child(3) { transition-delay: 0.3s; }
    #primary-menu.show li:nth-child(4) { transition-delay: 0.4s; }
    #primary-menu.show li:nth-child(5) { transition-delay: 0.5s; }
    
    #primary-menu a {
        color: white !important;
        font-size: 1.8rem !important;
        font-weight: 600;
        text-decoration: none;
        padding: 15px 30px;
        border-radius: 10px;
        transition: all 0.3s ease;
        display: block;
        min-width: 200px;
        text-align: center;
        border: 2px solid transparent;
    }
    
    #primary-menu a:hover {
        background: rgba(212, 184, 150, 0.2) !important;
        color: #d4b896 !important;
        transform: translateY(-2px) scale(1.05);
        border-color: rgba(212, 184, 150, 0.3);
        box-shadow: 0 8px 25px rgba(212, 184, 150, 0.2);
    }
    
    #primary-menu a::after {
        display: none; /* Ocultar el underline en móvil */
    }
    
    /* Mostrar botón hamburguesa a la derecha */
    .menu-toggle {
        display: flex !important;
        margin-left: auto; /* empuja el botón hamburguesa al extremo derecho */
    }
    
    /* Ocultar CTA en móvil */
    .header-cta {
        display: none;
    }
    
    /* Header scrolled en móvil */
    #masthead.scrolled {
        top: 10px;
        max-width: 95%;
        border-radius: 40px;
        padding: 8px 15px;
    }
    
    #masthead.scrolled .header-container {
        gap: 10px;
        padding: 0 15px;
    }
    
    #masthead.scrolled .site-logo {
        width: auto;
        height: 40px;
    }

    /* Ocultar la X del overlay en mobile para evitar duplicado con la X del hamburguesa */
    .mobile-menu-close {
        display: none !important;
    }
}

@media (max-width: 480px) {
    .site-logo {
        width: 70px;
        height: 70px;
    }
    
    .mobile-menu-items a {
        font-size: 1.5rem;
    }
}

/* Página de inicio específicos */
.page-template-page-inicio #masthead {
    position: fixed;
    background: transparent;
    box-shadow: none;
}

.page-template-page-inicio #masthead.scrolled {
    position: fixed;
    background: rgba(44, 74, 61, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 50px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    top: 20px;
    padding: 10px 20px;
}