/* ==========================================================================
 ISAE Blog - Transparency & Fixed Background (Final Clean Integration)
 ========================================================================== */

/* 1. Fondo Global Fijo de Placas Solares */
body.isae-blog-optimized,
body.isae-corporate-redesign {
    background-image: url('../images/hero-bg.jpg') !important;
    background-size: cover !important;
    background-position: center top !important;
    background-attachment: fixed !important;
    background-color: #0f172a !important;
    /* Fallback oscuro */
    margin: 0;
    padding: 0;
}

/* 2. Cabecera Transparente Fija (Sticky) */
header#masthead,
.site-header,
.ast-primary-header-bar,
.ast-header-break-point .main-header-bar {
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0) 100%) !important;
    border: none !important;
    box-shadow: none !important;
    position: fixed !important;
    /* Cambiado de absolute a fixed */
    top: 0;
    left: 0;
    width: 100%;
    z-index: 10000;
    transition: all 0.4s ease-in-out !important;
    /* Animación de scroll */
}

/* Estado de la cabecera al hacer scroll añadido por JS (Enfoque UI Avanzado) */
body.isae-scrolled header#masthead,
body.isae-scrolled .site-header,
body.isae-scrolled .ast-primary-header-bar,
body.isae-scrolled .main-header-bar {
    background: rgba(18, 12, 10, 0.98) !important;
    /* Marrón-negro casi sólido para contraste impecable */
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.4) !important;
}

/* Reducimos el logo para hacer la barra sticky más delgada, muy limpio */
body.isae-scrolled .custom-logo-link img {
    max-width: 60px !important;
    /* Muy pequeño y elegante al bajar para encajar perfecto en la barra */
}

/* Reducir altura general de la cabecera al hacer scroll (como en main.css is-sticky) */
body.isae-scrolled .ast-primary-header-bar .ast-builder-grid-row {
    height: 75px !important;
    /* Más delgado al hacer scroll */
    padding: 0 60px !important;
    /* Mantenemos margen izquierdo y derecho */
}

body.isae-scrolled .main-header-menu>.menu-item>a {
    padding: 15px 20px !important;
    /* Mantenemos el padding unificado */
}

/* Reducimos un poco el padding al hacer scroll para que no quite tanta pantalla */
body.isae-scrolled .ast-builder-grid-row {
    padding-top: 10px !important;
    padding-bottom: 10px !important;
    transition: all 0.3s ease;
}

/* Quitamos cualquier posible máscara o fondo blanco del contenedor de Astra */
.site,
#page {
    background: transparent !important;
    background-color: transparent !important;
}

/* 3. Menú (Mimetizando exactamente el tema original: Blanco, Elegante, Extensión web) */
.main-header-menu>.menu-item>a {
    color: #ffffff !important;
    font-weight: 400 !important;
    /* Peso visual de la web original */
    text-transform: uppercase !important;
    letter-spacing: 1.2px;
    font-size: 0.8125rem;
    /* ~13px just like main.css line 2848 */
    text-shadow: none !important;
    /* Sin sombras para coincidir con la estetica original limpia */
    padding: 15px 20px !important;
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1) !important;
    display: inline-block !important;
    /* Requisito CSS para que transform scale funcione en enlaces */
}

.main-header-menu>.menu-item>a:hover {
    color: #ffffff !important;
    /* Mantenemos el blanco a petición del usuario */
    transform: scale(1.15) !important;
    /* Efecto zoom de acercamiento inmersivo */
}

/* Y cuando hacemos scroll sobre el fondo oscuro, que el texto se mantenga igual pero sin afectar padding original */
body.isae-scrolled .main-header-menu>.menu-item>a {
    color: #ffffff !important;
}

/* Mostrar el branding para que se vea el logo, pero ocultar el texto del título si estuviera activado */
.site-branding {
    display: flex !important;
    align-items: center;
}

.site-title,
.site-description {
    display: none !important;
}

/* 1. Resetear el contenedor principal del header para que ocupe el 100% real de la pantalla */
.ast-primary-header-bar .site-primary-header-wrap,
.ast-primary-header-bar .ast-builder-grid-row-container,
.ast-primary-header-bar .ast-builder-grid-row-container-inner {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Ajuste del layout del header para separar logo (izq) y menú (der o centro) */
.ast-primary-header-bar .ast-builder-grid-row {
    display: flex;
    justify-content: flex-start;
    /* Logo siempre a la izquierda */
    align-items: center;
    width: 100%;
    padding: 0 40px !important;
    height: 110px;
    max-width: 100% !important;
    margin: 0;
    transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

/* Permitir que el contenedor del menú ocupe el espacio restante y alinee a la derecha/centro, arreglando el colapso */
.ast-primary-header-bar .site-header-primary-section-right {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    /* Centramos el menú dentro del área restante */
    padding-right: 90px;
    /* Compensación visual equitativa frente al logo de 90px de la izquierda para tener centro matemático */
}

/* Refuerzo para forzar que los enlaces de menú recuperen su forma horizontal (rompimos esto con el absolute) */
.main-navigation,
.ast-builder-menu-1 {
    display: flex !important;
    flex-direction: row !important;
    position: relative !important;
    left: auto !important;
    transform: none !important;
}

/* Quitar los márgenes internos de alineación por defecto de Astra */
.ast-builder-layout-element.site-header-focus-item {
    margin-top: 0;
}

/* Mimetizar tamaño exacto de logo original */
.custom-logo-link img {
    max-width: 90px !important;
    /* Reducido drásticamente a tamaño boutique */
    width: auto !important;
    height: auto !important;
    transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1) !important;
    display: block;
}

/* 4. Contenedor de Contenido */
.isae-corporate-redesign-container {
    padding: 140px 20px 80px;
    /* Margen externo sobre la foto (140px push down) */
    width: 100%;
    box-sizing: border-box;
    margin: 0 auto;
}

.isae-content-wrapper {
    max-width: 1300px;
    margin: 0 auto;
    padding: 60px 20px;
    /* Sin padding masivo para el contenedor transparente */
    background: transparent;
    /* Ahora el contenedor es invisible dejando ver las nubes */
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 60px;
    /* Hueco transparente por donde asoma la foto */
    border: none;
    box-shadow: none;
}

/* ¡Desactivar el corsé estrecho de Astra para las noticias individuales!
   Liberamos el 100% del ancho para poder controlarlo nosotros con nuestra propia caja. */
body.single-post .site-content .ast-container,
body.single-post.ast-narrow-container .site-content .ast-container {
    max-width: 100% !important;
}

/* Envoltorio de la noticia (Mismo ancho exacto que Noticias + Sidebar en el inicio) */
.isae-single-wrapper {
    max-width: 1240px;
    /* Este es el ancho maestro de Astra para pantallas grandes */
    width: 95%;
    /* Margen de seguridad vital para que respire en móviles y tablets */
    margin: 0 auto;
    padding: 60px 0px;
}

/* Diseño de los elementos dentro de la caja blanca (Panel Izquierdo - Noticias) */
.isae-post-item {
    border: 1px solid #1f2937 !important;
    border-radius: 16px;
    /* Tarjeta de noticia individual redonda */
    padding: 40px;
    /* Más aire interno como la caja grande */
    margin-bottom: 40px;
    overflow: hidden;
    background: #ffffff;
    /* Caja blanca solo en las tarjetas */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.isae-post-item:last-child {
    margin-bottom: 0 !important;
}

.isae-post-content {
    padding: 25px 0 0 0;
    /* Quitar el padding inferior sobrante para que cierre ajustado */
}

/* Suavizar esquinas de las imágenes principales de los posts */
.isae-post-thumbnail img {
    border-radius: 12px;
    /* Esquinas redondeadas en las fotos grandes */
    width: 100%;
    height: auto;
    display: block;
}

.isae-post-title {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 15px;
    color: #000000;
}

.isae-post-title a {
    color: inherit;
    text-decoration: none;
}

/* Título de la vista de Noticia Individual */
.single-title {
    font-size: 2.2rem;
    margin-top: 25px;
    margin-bottom: 25px;
}

/* Cuerpo del texto de la Noticia Individual */
.isae-post-body {
    font-size: 1rem;
    line-height: 1.8;
    color: #333333;
}

.isae-post-body p {
    margin-bottom: 20px;
}

.isae-post-meta {
    font-size: 0.8rem;
    color: #f7a827;
    /* Naranja para metadatos como en el original */
    margin-bottom: 10px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 1px;
}

.isae-post-meta span {
    margin-right: 15px;
}

/* =========================================
   BARRA LATERAL (SIDEBAR)
   ========================================= */
.isae-sidebar {
    background: transparent;
    /* El lado derecho de los menus ya no es un bloque blanco */
    border: none;
    border-radius: 0;
    padding: 0;
    height: fit-content;
}

.isae-widget {
    background: #ffffff;
    /* Fijo el rectángulo blanco solo a los sub-módulos */
    border: 1px solid #1f2937;
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 30px;
    /* Separación transparente entre sub-menús */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.isae-widget:last-child {
    margin-bottom: 0;
}

.isae-widget-title {
    font-size: 1rem;
    font-weight: 800;
    text-transform: uppercase;
    color: #000000;
    margin-bottom: 25px;
    letter-spacing: 0.5px;
}

/* Categorias */
.isae-widget ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.isae-widget ul li {
    padding: 12px 0;
    border-bottom: 1px solid #eeeeee;
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: #666666;
}

.isae-widget ul li:last-child {
    border-bottom: none;
}

.isae-widget ul li a {
    color: #666666;
    text-decoration: none;
}

.isae-widget ul li a:hover {
    color: #f7a827;
}

/* Publicaciones Recientes */
.recent__item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 20px;
}

.recent__image {
    width: 70px;
    height: 70px;
    min-width: 70px;
    margin-right: 15px;
    overflow: hidden;
    border-radius: 8px;
    /* Esquinas redondeadas también en las miniaturas pequeñas */
}

.recent__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.recent__content {
    flex: 1;
}

.recent__content a {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #000000;
    text-decoration: none;
    line-height: 1.4;
    margin-bottom: 5px;
}

.recent__content a:hover {
    color: #f7a827;
}

.recent__date {
    font-size: 0.75rem;
    color: #f7a827;
}

/* 5. Footer Integrado */
footer.site-footer,
footer.site-footer .site-below-footer-wrap,
footer.site-footer .ast-builder-grid-row-container-inner,
footer.site-footer .site-footer-section,
footer.site-footer .ast-builder-layout-element {
    background: transparent !important;
    background-color: transparent !important;
    color: #ffffff !important;
    border: none !important;
}

footer.site-footer {
    padding: 60px 0;
}

@media (max-width: 900px) {
    .isae-content-wrapper {
        grid-template-columns: 1fr;
        padding: 30px 20px;
    }

    .main-header-menu {
        background: rgba(0, 0, 0, 0.95) !important;
        padding: 20px;
    }
}

/* Buscador por fechas (Archives Dropdown) */
.isae-widget select {
    width: 100%;
    padding: 15px 15px;
    /* Aumentar relleno para que no se corte el texto por debajo */
    height: auto;
    /* Asegurar que la caja crece según su contenido interno */
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 0.95rem;
    color: #475569;
    background-color: #f8fafc;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
    text-transform: capitalize;
    /* Fuerza siempre a que febrero -> Febrero */
}

.isae-widget select:focus {
    border-color: #f7a827;
    box-shadow: 0 0 0 2px rgba(247, 168, 39, 0.2);
}