
/* =========================================================
   INIZIO CODICE LIGHTBOX
   ========================================================= */

.lightbox {
    position: fixed !important;
    inset: 0 !important;

    z-index: 999999 !important;

    display: none;

    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;

    min-width: 0 !important;
    min-height: 0 !important;

    max-width: none !important;
    max-height: none !important;

    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;

    box-sizing: border-box;

    background: #000;
    color: #fff;

    overflow: hidden;

    --lightbox-control-scale: 1;
}

.lightbox::backdrop {
    background: #000;
    margin: 0;
    padding: 0;
}

.lightbox[open],
.lightbox.fallback-open {
    display: flex;

    align-items: stretch;
    justify-content: stretch;
}


/* contenitore */

.lightbox-content {
    position: relative;

    width: 100%;
    height: 100%;

    min-width: 0;
    min-height: 0;

    margin: 0;
    padding: 0;
    border: 0;

    box-sizing: border-box;

    display: flex;

    align-items: stretch;
    justify-content: stretch;

    overflow: hidden;

    background: #000;
}


/* stage */

.lightbox-stage {
    position: absolute;

    inset: 0;

    width: 100%;
    height: 100%;

    min-width: 0;
    min-height: 0;

    margin: 0;
    padding: 12px;
    border: 0;

    box-sizing: border-box;

    display: flex;

    align-items: center;
    justify-content: center;

    overflow: hidden;

    background: #000;
}


/* foto */

.lightbox-stage img {
    display: block;

    width: auto;
    height: auto;

    max-width: 100%;
    max-height: 100%;

    margin: 0;
    padding: 0;
    border: 0;

    box-sizing: border-box;

    object-fit: contain;

    flex: 0 0 auto;

    align-self: center;

    border-radius: 8px;
}


/* video */

.lightbox-stage video {
    display: block;

    width: auto;
    height: auto;

    max-width: 100%;
    max-height: 100%;

    margin: 0;
    padding: 0;
    border: 0;

    box-sizing: border-box;

    object-fit: contain;

    flex: 0 0 auto;

    align-self: center;

    background: #000;

    border-radius: 8px;
}


/* pdf / html / youtube */

.lightbox-stage iframe {
    display: block;

    width: 100%;
    height: 100%;

    min-width: 0;
    min-height: 0;

    max-width: none;
    max-height: none;

    margin: 0;
    padding: 0;
    border: 0;

    box-sizing: border-box;

    align-self: stretch;

    background: #fff;

    border-radius: 0;
}


/* errore */

.lightbox-error {
    display: flex;

    align-items: center;
    justify-content: center;

    width: 100%;
    height: 100%;

    margin: 0;
    padding: 30px;

    box-sizing: border-box;

    color: #fff;

    text-align: center;
}


/* pulsanti */

.lightbox button {
    position: absolute;
    z-index: 100;

    display: flex;

    align-items: center;
    justify-content: center;

    box-sizing: border-box;

    width: 4%;
    height: auto;

    aspect-ratio: 1 / 1;

    margin: 0;
    padding: 0;
    border: 0;
    outline: 0;

    cursor: pointer;

    appearance: none;
    -webkit-appearance: none;

    font-family: inherit;
    line-height: 1;

    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.lightbox button:focus,
.lightbox button:active {
    outline: 0;
}

.lightbox button:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

.lightbox button svg {
    display: block;

    width: 50%;
    height: 50%;

    min-width: 0;
    min-height: 0;

    pointer-events: none;
}


/* chiudi — x bianca con contorno nero */

.lightbox-close {
    top: 16px;
    right: 16px;

    background: transparent;
    color: #fff;

    transform: scale(var(--lightbox-control-scale));
    transform-origin: center;
}

.lightbox-close svg {
    display: block;

    width: 50%;
    height: 50%;

    fill: none;

    stroke: #fff;
    stroke-width: 2.5;

    stroke-linecap: round;
    stroke-linejoin: round;

    filter:
        drop-shadow(1px 0 0 #000)
        drop-shadow(-1px 0 0 #000)
        drop-shadow(0 1px 0 #000)
        drop-shadow(0 -1px 0 #000);
}

.lightbox-close svg path {
    stroke: #fff;
    stroke-width: 2.5;

    stroke-linecap: round;
    stroke-linejoin: round;
}


/* precedente */

.lightbox-prev {
    top: 50%;
    left: 16px;

    border-radius: 50%;

    background: rgba(40, 40, 40, 0.9);
    color: #fff;

    transform:
        translateY(-50%)
        scale(var(--lightbox-control-scale));

    transform-origin: center;
}


/* successivo */

.lightbox-next {
    top: 50%;
    right: 16px;

    border-radius: 50%;

    background: rgba(40, 40, 40, 0.9);
    color: #fff;

    transform:
        translateY(-50%)
        scale(var(--lightbox-control-scale));

    transform-origin: center;
}


/* frecce */

.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(70, 70, 70, 0.95);
}

.lightbox-prev:active,
.lightbox-next:active {
    background: rgba(55, 55, 55, 0.95);
}

.lightbox-prev svg,
.lightbox-next svg {
    fill: none;

    stroke: #fff;
    stroke-width: 2.2;

    stroke-linecap: round;
    stroke-linejoin: round;
}

.lightbox.single .lightbox-prev,
.lightbox.single .lightbox-next {
    display: none;
}


/* animazione */

.lightbox[open],
.lightbox.fallback-open {
    animation: lightbox-fade-in 180ms ease-out;
}

.lightbox[open] .lightbox-content,
.lightbox.fallback-open .lightbox-content {
    animation: lightbox-content-in 180ms ease-out;
}

@keyframes lightbox-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes lightbox-content-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}



/* =========================================================
   FINE CODICE LIGHTBOX
   ========================================================= */





/* =========================================================
   =========================================================
   MOBILE - INIZIO CODICE PER MOBILE
   =========================================================
   ========================================================= */




@media screen and (max-width: 767px) {


/* =========================================================
   INIZIO CODICE LIGHTBOX
   ========================================================= */


    /* lightbox */

    .lightbox {
        inset: 0 !important;

        width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important;

        min-width: 0 !important;
        min-height: 0 !important;

        max-width: none !important;
        max-height: none !important;

        margin: 0 !important;
        padding: 0 !important;
    }

    /* contenitore */

    .lightbox-content {
        width: 100%;
        height: 100%;

        margin: 0;
        padding: 0;
    }

    /* stage */

    .lightbox-stage {
        inset: 0;

        width: 100%;
        height: 100%;

        margin: 0;
        padding: 12px;
    }

    /* foto */

    /* video */

    /* pdf / html / youtube */

    /* errore */

    /* pulsanti */

    .lightbox-close {
        top: 8px;
        right: 8px;
    }

    .lightbox-prev {
        left: 8px;
    }

    .lightbox-next {
        right: 8px;
    }

    .lightbox button {
        width: 48px;
        height: 48px;
        aspect-ratio: auto;
    }

    .lightbox button svg {
        width: 22px;
        height: 22px;

        min-width: 22px;
        min-height: 22px;
    }

    /* chiudi — x bianca con contorno nero */

    .lightbox-close svg {
        width: 22px;
        height: 22px;

        stroke-width: 2.5;

        filter:
            drop-shadow(1px 0 0 #000)
            drop-shadow(-1px 0 0 #000)
            drop-shadow(0 1px 0 #000)
            drop-shadow(0 -1px 0 #000);
    }

    .lightbox-close svg path {
        stroke: #fff;
        stroke-width: 2.5;

        stroke-linecap: round;
        stroke-linejoin: round;
    }

    /* riduzione movimento */

    @media (prefers-reduced-motion: reduce) {

        .lightbox[open],
        .lightbox.fallback-open,
        .lightbox[open] .lightbox-content,
        .lightbox.fallback-open .lightbox-content {
            animation: none;
        }
    }



/* =========================================================
   FINE CODICE LIGHTBOX
   ========================================================= */

}
