/*
 BIOHACKING 360 LABS
 SCREEN-HEIGHT-01B

 Header permanente.
 Alturas adaptativas de secciones.
 Respeta contenido y componentes existentes.
*/

:root {
    --bh-sticky-header-height: 88px;
}

/*
 HEADER PERMANENTE

 Se mantiene en la parte superior cuando
 la barra de anuncios se desplaza fuera
 de la pantalla.
*/

html body header {
    position:sticky !important;
    top:0 !important;
    z-index:5000 !important;
    background:#FFFFFF !important;
    isolation:isolate;
    overflow:visible !important;
    box-shadow:
        0 4px 18px rgba(18,47,85,.07);
}

/*
 Mantener menu y selector por encima del
 resto del contenido cuando estan abiertos.
*/

html body header .wrap.header-inner {
    overflow:visible !important;
}

html body header .language-switch {
    position:relative;
}

html body header .language-switch[open] {
    z-index:5010 !important;
}

html body header .language-switch
.language-menu {
    z-index:5011 !important;
}

/*
 ALTURA DE LAS SECCIONES

 Utilizar minimo de una pantalla disponible.
 No imponer max-height ni overflow:hidden
 a secciones que puedan crecer.
*/

html body #investigacion,
html body #nosotros,
html body #catalogo,
html body #faq,
html body #contacto {
    min-height:
      calc(100vh - var(--bh-sticky-header-height)) !important;
    min-height:
      calc(100dvh - var(--bh-sticky-header-height)) !important;

    box-sizing:border-box;
    height:auto;
    max-height:none;
}

/*
 Navegacion por anclas:
 evitar ocultar los titulos debajo del header.
*/

html body #inicio,
html body #investigacion,
html body #nosotros,
html body #catalogo,
html body #faq,
html body #contacto {
    scroll-margin-top:
      var(--bh-sticky-header-height);
}

/*
 FOOTER

 No ocupa forzosamente una pantalla;
 mantiene el diseño blanco existente.
*/

html body footer {
    height:auto;
    min-height:0;
    max-height:none;
}

/*
 TABLET
*/

@media(max-width:991px) {
    :root {
        --bh-sticky-header-height:80px;
    }
}

/*
 CELULAR

 El hero conserva el sistema MOBILE-HERO-02
 y su altura actual.

 Las otras secciones ocupan al menos
 el espacio restante de pantalla.
*/

@media(max-width:760px) {
    :root {
        --bh-sticky-header-height:76px;
    }

    html body header {
        top:0 !important;
    }

    html body #investigacion,
    html body #nosotros,
    html body #catalogo,
    html body #faq,
    html body #contacto {
        min-height:
          calc(100svh - var(--bh-sticky-header-height)) !important;
        min-height:
          calc(100dvh - var(--bh-sticky-header-height)) !important;

        height:auto !important;
        max-height:none !important;
        overflow:visible;
    }

    /*
     Nunca limitar el alto del contenido FAQ.
     Las respuestas abiertas pueden ampliar
     naturalmente la seccion.
    */

    html body #faq details[open] {
        height:auto;
        max-height:none;
    }
}

@media(max-width:380px) {
    :root {
        --bh-sticky-header-height:76px;
    }
}

/* ==========================================================
   BH_SCREEN_HEIGHT_01E

   ALINEACION VERTICAL ADAPTATIVA
   - Calculada desde el borde inferior del header.
   - Sin recortes de contenido.
   - Hero existente sin modificaciones.
   ========================================================== */

/*
 Todas las secciones utilizan el espacio visible
 disponible bajo el encabezado permanente.
*/

html body :is(
    #investigacion,
    #nosotros,
    #catalogo,
    #faq,
    #contacto
) {
    display:flex !important;
    flex-direction:column !important;
    justify-content:center !important;

    min-height:
      calc(
        100vh -
        var(--bh-sticky-header-height,76px)
      ) !important;

    min-height:
      calc(
        100dvh -
        var(--bh-sticky-header-height,76px)
      ) !important;

    height:auto !important;
    max-height:none !important;

    box-sizing:border-box !important;
    overflow:visible !important;
}

/*
 El contenedor mantiene sus propias columnas:
 investigación conserva sus fotos y panel;
 nosotros conserva su grid;
 FAQ conserva su fotografía y preguntas.
*/

html body :is(
    #investigacion,
    #nosotros,
    #catalogo,
    #faq,
    #contacto
) > .wrap {
    flex:0 0 auto;
    min-width:0;
    max-width:var(--bh-content-max,1400px);
    margin-top:0;
    margin-bottom:0;
}

/*
 FAQ:
 al abrir una pregunta aumenta naturalmente
 la altura requerida, sin ocultar su respuesta.
*/

html body #faq details[open] {
    max-height:none !important;
}

/*
 MOBILE / TABLET VERTICAL
*/

@media(max-width:760px) {

    /*
     Espaciado vertical compacto, sin comprimir
     el contenido ni recortar fotografías.
    */

    html body :is(
        #investigacion,
        #nosotros,
        #catalogo,
        #faq,
        #contacto
    ) {
        padding-top:
          clamp(20px,4dvh,42px) !important;

        padding-bottom:
          clamp(20px,4dvh,42px) !important;

        justify-content:center !important;
    }

    /*
     El contenido ancho usa los márgenes
     globales existentes.
    */

    html body :is(
        #investigacion,
        #nosotros,
        #catalogo,
        #faq,
        #contacto
    ) > .wrap {
        min-height:0 !important;
    }

    /*
     Las imágenes conservan su proporción.
    */

    html body #nosotros
    .bh-editorial-media img,
    html body #faq
    .bh-faq-photo img {
        max-width:100%;
    }
}

/*
 DISPOSITIVOS BAJOS

 Si el contenido supera una pantalla,
 la sección crece en lugar de ocultarlo.
*/

@media(max-width:760px) and (max-height:700px) {

    html body :is(
        #investigacion,
        #nosotros,
        #catalogo,
        #faq,
        #contacto
    ) {
        padding-top:18px !important;
        padding-bottom:18px !important;
    }
}
