
html.mz-lightbox-open,
html.mz-lightbox-open body {
    overflow: hidden;
}


/* =========================================================
   OVERLAY
   ========================================================= */

#mz-lightbox {
    position: fixed;

    inset: 0;

    z-index: 99999;

    display: none;

    grid-template-rows:
        auto
        minmax(0, 1fr)
        auto;

    background:
        rgba(5, 10, 20, .96);

    backdrop-filter:
        blur(8px);

    color: #fff;
}


#mz-lightbox.is-open {
    display: grid;
}


/* =========================================================
   TOP BAR
   ========================================================= */

.mz-lb-topbar {
    position: relative;

    z-index: 5;

    min-height: 64px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;

    padding: 10px 14px;

    box-sizing: border-box;

    border-bottom:
        1px solid rgba(255,255,255,.10);

    background:
        rgba(10,17,30,.84);

    backdrop-filter:
        blur(12px);
}


.mz-lb-info {
    min-width: 0;

    display: flex;
    align-items: center;

    gap: 10px;
}


.mz-lb-counter {
    flex: 0 0 auto;

    color: rgba(255,255,255,.72);

    font-size: 11px;
    font-weight: 800;
}


.mz-lb-caption {
    min-width: 0;

    overflow: hidden;

    color: rgba(255,255,255,.88);

    font-size: 12px;
    font-weight: 650;

    text-overflow: ellipsis;

    white-space: nowrap;
}


/* =========================================================
   TOOLBAR
   ========================================================= */

.mz-lb-toolbar {
    display: flex;
    align-items: center;

    gap: 5px;
}


.mz-lb-tool {
    min-width: 40px;
    height: 40px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 0 11px;

    border:
        1px solid rgba(255,255,255,.12);

    border-radius: 10px;

    background:
        rgba(255,255,255,.08);

    color: #fff;

    font-size: 20px;
    font-weight: 700;

    cursor: pointer;

    transition:
        background .15s ease,
        transform .15s ease;
}


.mz-lb-tool:hover {
    background:
        rgba(255,255,255,.17);

    transform:
        translateY(-1px);
}


.mz-lb-tool-text {
    font-size: 11px;
}


.mz-lb-close {
    margin-left: 4px;

    font-size: 29px;
    font-weight: 300;

    background:
        rgba(239,68,68,.13);
}


/* =========================================================
   STAGE
   ========================================================= */

.mz-lb-stage {
    position: relative;

    min-width: 0;
    min-height: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    overflow: hidden;

    cursor: zoom-in;

    touch-action: none;

    user-select: none;
}


.mz-lb-stage.is-zoomed {
    cursor: grab;
}


.mz-lb-stage.is-dragging {
    cursor: grabbing;
}


.mz-lb-image {
    display: block;

    max-width:
        calc(100vw - 110px);

    max-height:
        calc(100vh - 130px);

    width: auto;
    height: auto;

    object-fit: contain;

    transform-origin:
        center center;

    will-change:
        transform;

    transition:
        opacity .16s ease;

    pointer-events: none;

    -webkit-user-drag: none;
}


.mz-lb-image.is-loading {
    opacity: .2;
}


/* zoom label */

.mz-lb-zoom-indicator {
    position: absolute;

    right: 14px;
    bottom: 14px;

    padding: 5px 9px;

    border-radius: 999px;

    background:
        rgba(0,0,0,.55);

    color:
        rgba(255,255,255,.82);

    font-size: 10px;
    font-weight: 800;

    pointer-events: none;
}


/* =========================================================
   NAVIGATION
   ========================================================= */

.mz-lb-nav {
    position: fixed;

    z-index: 4;

    top: 50%;

    width: 48px;
    height: 64px;

    transform:
        translateY(-50%);

    border: 0;
    border-radius: 14px;

    background:
        rgba(0,0,0,.40);

    color: #fff;

    font-size: 44px;
    font-weight: 200;

    line-height: 1;

    cursor: pointer;

    transition:
        background .15s ease,
        transform .15s ease;
}


.mz-lb-nav:hover {
    background:
        rgba(37,99,235,.80);
}


.mz-lb-prev {
    left: 12px;
}


.mz-lb-next {
    right: 12px;
}


/* =========================================================
   HELP
   ========================================================= */

.mz-lb-help {
    min-height: 34px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0 15px;

    box-sizing: border-box;

    border-top:
        1px solid rgba(255,255,255,.07);

    background:
        rgba(10,17,30,.78);

    color:
        rgba(255,255,255,.48);

    font-size: 9px;

    text-align: center;
}


/* =========================================================
   FULLSCREEN
   ========================================================= */

#mz-lightbox:fullscreen {
    width: 100vw;
    height: 100vh;
}


/* =========================================================
   TABLET
   ========================================================= */

@media (max-width: 850px) {

    .mz-lb-caption {
        display: none;
    }


    .mz-lb-tool-text {
        min-width: 38px;

        padding: 0 8px;

        font-size: 9px;
    }


    .mz-lb-image {
        max-width:
            calc(100vw - 80px);
    }

}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 600px) {

    .mz-lb-topbar {
        min-height: 58px;

        padding:
            8px
            7px;
    }


    .mz-lb-info {
        display: none;
    }


    .mz-lb-toolbar {
        width: 100%;

        justify-content: center;

        gap: 3px;
    }


    .mz-lb-tool {
        min-width: 37px;
        height: 38px;

        padding: 0 7px;

        border-radius: 9px;

        font-size: 18px;
    }


    .mz-lb-tool-text {
        font-size: 8px;
    }


    /*
     * En móvil ocultamos rotar izquierda:
     * una sola rotación sigue disponible
     * y liberamos espacio.
     */

    .mz-lb-tool[
        data-action="rotate-left"
    ] {
        display: none;
    }


    .mz-lb-image {
        max-width:
            calc(100vw - 18px);

        max-height:
            calc(100vh - 115px);
    }


    .mz-lb-nav {
        top: auto;
        bottom: 48px;

        width: 42px;
        height: 42px;

        transform: none;

        border-radius: 50%;

        font-size: 31px;
    }


    .mz-lb-prev {
        left: 12px;
    }


    .mz-lb-next {
        right: 12px;
    }


    .mz-lb-help {
        min-height: 28px;

        font-size: 8px;
    }

}



/* =========================================================
   MATEMATICAZ LIGHTBOX 2.1
   MAGNIFIER + FOCUS
   ========================================================= */


/* Botones activos */

.mz-lb-tool.is-active {
    border-color: #60a5fa;

    background:
        linear-gradient(
            145deg,
            #2563eb,
            #4f46e5
        );

    color: #fff;

    box-shadow:
        0 0 0 2px
        rgba(96,165,250,.18);
}


/* =========================================================
   MAGNIFIER
   ========================================================= */

.mz-lb-magnifier {
    position: absolute;

    z-index: 6;

    width: 190px;
    height: 190px;

    opacity: 0;

    transform:
        translate(
            -50%,
            -50%
        )
        scale(.94);

    border:
        4px solid
        rgba(255,255,255,.96);

    border-radius: 50%;

    background-color: #fff;

    background-repeat:
        no-repeat;

    box-shadow:
        0 18px 55px
        rgba(0,0,0,.45),
        0 0 0 1px
        rgba(37,99,235,.35);

    pointer-events: none;

    transition:
        opacity .12s ease,
        transform .12s ease;
}


.mz-lb-magnifier::after {
    content: "";

    position: absolute;

    inset: 50% auto auto 50%;

    width: 18px;
    height: 18px;

    transform:
        translate(-50%,-50%);

    border:
        1px solid
        rgba(37,99,235,.65);

    border-radius: 50%;
}


.mz-lb-magnifier.is-visible {
    opacity: 1;

    transform:
        translate(
            -50%,
            -50%
        )
        scale(1);
}


/* =========================================================
   FOCUS / SPOTLIGHT
   ========================================================= */

.mz-lb-focus-layer {
    position: absolute;

    inset: 0;

    z-index: 5;

    opacity: 0;

    pointer-events: none;

    --mz-focus-x: 50%;
    --mz-focus-y: 50%;
    --mz-focus-size: 165px;

    background:
        radial-gradient(
            circle
            var(--mz-focus-size)
            at
            var(--mz-focus-x)
            var(--mz-focus-y),

            transparent 0%,
            transparent 58%,

            rgba(
                2,
                6,
                23,
                .18
            )
            70%,

            rgba(
                2,
                6,
                23,
                .88
            )
            100%
        );

    transition:
        opacity .16s ease;
}


.mz-lb-focus-layer.is-active {
    opacity: 1;
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 600px) {

    .mz-lb-magnifier {
        width: 138px;
        height: 138px;

        border-width: 3px;
    }


    .mz-lb-focus-layer {
        --mz-focus-size:
            115px;
    }

}

