/* Adaptación para tablet y celular. */

/* =========================================================
   COLBIOMEDICA DOCS
   ADAPTACIÓN RESPONSIVE Y ESCALADO DEL VISOR

   La hoja se escala según el ancho disponible.
   No se reduce para intentar mostrar toda su altura.
========================================================= */


/* =========================================================
   ESCALA PREDETERMINADA
========================================================= */

:root {
    --escala-hoja-visor: 0.90;
}


/* =========================================================
   ESCALADO VISUAL DE LA HOJA A4
========================================================= */

/*
   La propiedad zoom modifica tanto el tamaño visual como el
   espacio ocupado por la hoja.

   La escala se define exclusivamente mediante el ancho de la
   pantalla. Si la hoja supera la altura visible, el usuario
   podrá recorrerla verticalmente.
*/

.visor-ficha .pagina-ficha {
    zoom: var(--escala-hoja-visor);
}


/* =========================================================
   ESCALA EN COMPUTADORES
========================================================= */

/*
   Computadores compactos y portátiles.
   Se considera el espacio ocupado por el menú lateral.
*/

@media (min-width: 981px) and (max-width: 1250px) {

    :root {
        --escala-hoja-visor: 0.82;
    }

}


/*
   Computadores de tamaño medio.
*/

@media (min-width: 1251px) and (max-width: 1500px) {

    :root {
        --escala-hoja-visor: 0.96;
    }

}


/*
   Monitores de escritorio amplios.
*/

@media (min-width: 1501px) and (max-width: 1799px) {

    :root {
        --escala-hoja-visor: 1.08;
    }

}


/*
   Monitores grandes.
*/

@media (min-width: 1800px) {

    :root {
        --escala-hoja-visor: 1.18;
    }

}


/* =========================================================
   PANTALLAS CON MENÚ LATERAL
========================================================= */

@media (min-width: 981px) {

    .visor-ficha {
        align-items: flex-start;
        justify-content: center;

        min-height:
            calc(
                100vh
                - var(--alto-barra-superior)
                - var(--alto-navegacion-inferior)
            );

        padding:
            22px
            30px
            46px;

        overflow-x: auto;
        overflow-y: auto;
    }

}


/* =========================================================
   TABLET HORIZONTAL
========================================================= */

@media (max-width: 1100px) and (min-width: 981px) {

    :root {
        --escala-hoja-visor: 0.82;
    }

}


/* =========================================================
   TABLET
========================================================= */

@media (max-width: 980px) {

    :root {
        --escala-hoja-visor: 0.92;
    }

    .ficha-app {
        display: block;
    }

    .menu-paginas {
        position: relative;

        width: 100%;
        height: auto;
        min-height: 0;

        padding:
            14px
            16px;
    }

    .menu-paginas__marca {
        padding-bottom: 10px;
        margin-bottom: 10px;
    }

    .menu-paginas__titulo {
        margin-bottom: 8px;
    }

    .menu-paginas nav {
        display: flex;
        gap: 8px;

        padding-bottom: 4px;

        overflow-x: auto;

        overscroll-behavior-inline: contain;
    }

    .boton-pagina {
        flex:
            0
            0
            225px;
    }

    .menu-paginas__pie {
        display: none;
    }

    .visor-ficha {
        align-items: flex-start;
        justify-content: center;

        min-height: auto;

        padding:
            24px
            16px
            40px;

        overflow-x: auto;
        overflow-y: visible;
    }

}


/* =========================================================
   TABLET VERTICAL Y CELULAR GRANDE
========================================================= */

@media (max-width: 760px) {

    :root {
        --escala-hoja-visor: 0.90;
    }

    .barra-superior {
        position: relative;

        align-items: flex-start;
        flex-direction: column;

        min-height: auto;

        padding:
            14px
            16px;
    }

    .barra-superior__producto {
        width: 100%;
    }

    .barra-superior__producto strong {
        white-space: normal;
    }

    .barra-superior__acciones {
        width: 100%;

        justify-content: flex-start;

        padding-bottom: 3px;

        overflow-x: auto;
    }

    .barra-superior__acciones .boton {
        flex:
            0
            0
            auto;

        min-height: 40px;
    }

    .panel-busqueda {
        position: relative;
        top: auto;

        padding:
            14px
            16px;
    }

    .panel-busqueda__controles {
        grid-template-columns: 1fr;
    }

    .visor-ficha {
        align-items: flex-start;
        justify-content: center;

        width: 100%;

        padding:
            16px
            8px
            32px;

        overflow-x: auto;
        overflow-y: visible;
    }

    .navegacion-inferior {
        position: relative;

        grid-template-columns:
            1fr
            1fr;

        gap: 8px;

        min-height: auto;

        padding:
            12px
            16px;
    }

    .navegacion-inferior__indicador {
        grid-column:
            1
            /
            -1;

        grid-row: 1;

        text-align: center;
    }

    .navegacion-inferior .boton {
        width: 100%;
    }

}


/* =========================================================
   CELULARES ENTRE 481 PX Y 520 PX
========================================================= */

@media (min-width: 481px) and (max-width: 520px) {

    :root {
        --escala-hoja-visor: 0.62;
    }

}


/* =========================================================
   CELULARES ENTRE 421 PX Y 480 PX
========================================================= */

@media (min-width: 421px) and (max-width: 480px) {

    :root {
        --escala-hoja-visor: 0.56;
    }

}


/* =========================================================
   CELULARES ENTRE 391 PX Y 420 PX
========================================================= */

@media (min-width: 391px) and (max-width: 420px) {

    :root {
        --escala-hoja-visor: 0.50;
    }

}


/* =========================================================
   CELULARES
========================================================= */

@media (max-width: 520px) {

    .menu-paginas {
        padding: 12px;
    }

    .boton-pagina {
        flex-basis: 205px;
        min-height: 58px;
    }

    .barra-superior__acciones {
        display: grid;

        grid-template-columns:
            1fr
            1fr;

        overflow: visible;
    }

    .barra-superior__acciones .boton {
        width: 100%;

        padding-inline: 10px;
    }

    .barra-superior__acciones .boton:last-child {
        grid-column:
            1
            /
            -1;
    }

    .visor-ficha {
        justify-content: center;

        width: 100%;

        padding:
            12px
            4px
            28px;

        overflow-x: auto;
        overflow-y: visible;
    }

}


/* =========================================================
   CELULARES PEQUEÑOS
========================================================= */

@media (max-width: 390px) {

    :root {
        --escala-hoja-visor: 0.46;
    }

    .visor-ficha {
        padding-right: 2px;
        padding-left: 2px;
    }

}


/* =========================================================
   CELULARES MUY PEQUEÑOS
========================================================= */

@media (max-width: 350px) {

    :root {
        --escala-hoja-visor: 0.41;
    }

}


/* =========================================================
   ORIENTACIÓN HORIZONTAL EN DISPOSITIVOS MÓVILES
========================================================= */

@media (
    max-width: 980px
) and (
    orientation: landscape
) and (
    max-height: 600px
) {

    /*
       No se modifica la escala por la altura.

       Se conserva la escala correspondiente al ancho del
       dispositivo y se permite desplazamiento vertical.
    */

    .menu-paginas {
        display: none;
    }

    .barra-superior {
        flex-direction: row;
        align-items: center;
    }

    .visor-ficha {
        align-items: flex-start;

        min-height:
            calc(
                100vh
                - var(--alto-barra-superior)
                - var(--alto-navegacion-inferior)
            );

        overflow-x: auto;
        overflow-y: auto;
    }

}


/* =========================================================
   ACCESIBILIDAD
========================================================= */

@media (prefers-reduced-motion: reduce) {

    .pagina-ficha.visible {
        animation: none;
    }

    .boton-pagina,
    .boton {
        transition: none;
    }

}

/* =========================================================
   NAVEGACIÓN PAGINADA EN TABLET Y CELULAR
   Muestra una sola hoja a la vez sin modificar escritorio.
========================================================= */

@media screen and (max-width: 980px) {

    body.modo-paginado-movil {
        overflow-x: hidden;
    }

    body.modo-paginado-movil .visor-ficha {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;

        width: 100%;
        height: auto;
        min-height: 0;

        overflow-x: auto;
        overflow-y: visible;

        overscroll-behavior-x: contain;
        -webkit-overflow-scrolling: touch;
    }

    body.modo-paginado-movil
    .visor-ficha
    .pagina-ficha {
        flex: 0 0 auto;

        margin-right: auto;
        margin-left: auto;

        scroll-margin-top: 12px;
    }

    body.modo-paginado-movil
    .visor-ficha
    .pagina-ficha[hidden] {
        display: none !important;
    }

    body.modo-paginado-movil
    .visor-ficha
    .pagina-ficha.visible {
        display: block;
    }

    .menu-paginas nav,
    .menu-paginas__navegacion {
        scroll-behavior: smooth;
        scroll-snap-type: x proximity;

        -webkit-overflow-scrolling: touch;
    }

    .boton-pagina {
        scroll-snap-align: center;
        touch-action: manipulation;
    }

    .navegacion-inferior__boton {
        touch-action: manipulation;
    }

}


@media screen and (max-width: 760px) {

    /*
       La barra conserva todas sus funciones, pero reduce
       espacios para que el documento aparezca antes.
    */

    .barra-superior {
        gap: 12px;

        padding:
            12px
            14px;
    }

    .barra-superior__metadatos {
        margin-top: 2px;
    }

    .barra-superior__acciones {
        gap: 8px;
    }

    .menu-paginas {
        padding:
            10px
            12px
            12px;
    }

    .menu-paginas__marca {
        padding-bottom: 8px;
        margin-bottom: 8px;
    }

    .menu-paginas__encabezado {
        margin-bottom: 8px;
    }

    body.modo-paginado-movil .visor-ficha {
        gap: 0;

        padding:
            14px
            4px
            24px;
    }

    body.modo-paginado-movil
    .visor-ficha
    .pagina-ficha {
        scroll-margin-top: 8px;
    }

}


@media screen and (max-width: 520px) {

    /*
       El menú permanece horizontal, pero ocupa menos alto
       y cada tarjeta deja ver mejor la siguiente opción.
    */

    .boton-pagina {
        flex-basis: 178px;
        min-height: 54px;
    }

    .boton-pagina__texto small {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /*
       Buscar y pantalla completa comparten la primera fila.
       Descargar PDF conserva toda la segunda fila.
       El control de zoom permanece operativo debajo.
    */

    .barra-superior__acciones {
        gap: 8px;
    }

    .control-zoom {
        max-width: 100%;
    }

    .navegacion-inferior {
        padding:
            10px
            12px
            14px;
    }

    .navegacion-inferior__indicador {
        margin-bottom: 2px;
    }

    body.modo-paginado-movil .visor-ficha {
        padding:
            12px
            2px
            22px;
    }

}


@media screen and (max-width: 420px) {

    .boton-pagina {
        flex-basis: 168px;
    }

    body.modo-paginado-movil .visor-ficha {
        padding-right: 0;
        padding-left: 0;
    }

}

/* =========================================================
   CORRECCIÓN DEL ISOTIPO EN TABLET Y CELULAR
   Conserva la misma proporción y apariencia de escritorio.
========================================================= */

@media screen and (max-width: 980px) {

    .menu-paginas__insignia {
        display: flex;
        align-items: center;
        justify-content: center;

        flex: 0 0 38px;

        width: 38px;
        min-width: 38px;
        max-width: 38px;

        height: 38px;
        min-height: 38px;
        max-height: 38px;

        padding: 0;

        background: transparent !important;
        border: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;

        overflow: visible;
    }

    .menu-paginas__insignia img {
        display: block;

        width: auto !important;
        max-width: 38px !important;

        height: auto !important;
        max-height: 38px !important;

        aspect-ratio: auto;

        object-fit: contain !important;
        object-position: center !important;

        background: transparent !important;
        border: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;

        transform: none !important;

        flex: 0 0 auto;
    }

}


@media screen and (max-width: 390px) {

    .menu-paginas__insignia {
        flex-basis: 36px;

        width: 36px;
        min-width: 36px;
        max-width: 36px;

        height: 36px;
        min-height: 36px;
        max-height: 36px;
    }

    .menu-paginas__insignia img {
        max-width: 36px !important;
        max-height: 36px !important;
    }

}