#Lightbox{
    overscroll-behavior: contain;
    border: none;
    padding: 0;
    position: fixed;
    width: 100vw;
    height: 100vh;
    transition: opacity .25s;
    pointer-events: none;
    overflow: hidden;
    --swipe-x: 0;
    &:not([open]){
        /*display:none;*/
        opacity: 0;
        transition: opacity 0s; /* <- quick fade out, otherwise ugly */
    }

    &[open]{
        opacity: 1;
        pointer-events: all;
    }

    &:where([data-fflightbox-loading]){
        figure{
            opacity: 0;
        }
    }


    /* stacked icons (https://dev.to/vanaf1979/css-grid-stacking-elements-55me)*/
    display:grid;
    justify-content: center;
    >*{
        grid-area: 1 / 1;
    }
    &::backdrop{
        overflow: hidden; /* Needed to make this a scroll container */
        overscroll-behavior: contain;
        background-color:rgba(255,255,255,1);
    }

    >figure{
        /*background-color:var(--color-accent);*/
        display: flex;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        max-width: var(--content-width);
        max-height: calc(100vh - var(--ch-big-text) - var(--ch-big-text));
        transition: opacity .2s ease-in-out;
        >img{
            display: block;
            width: 100%;
            /*height: 100%;*/
            height: calc(100% - 2rem);
            object-fit: contain;
            object-position: center;
            /*filter: brightness(0) saturate(100%) invert(10%) sepia(95%) saturate(6061%) hue-rotate(249deg) brightness(98%) contrast(144%);*/
            margin-bottom: 1rem;
            transform: translateX(calc(var(--swipe-x) * 1px));
            opacity: clamp(0, calc(1 - abs(var(--swipe-x)) / 100), 1);
        }

        &:has(img:not([src])){
            visibility: hidden;
        }


        >figcaption,
        >.pagination{
            /*line-height: 1.173913043478261rem;*/
            line-height: 1rem;
        }

        >figcaption{
            font-size: 0.69565rem; /*16*/
            &:empty{
                display:none;
            }
        }

        >.pagination{
            display: flex;
            gap:.2rem;
            font-size: 0.69565rem; /*16*/
        }
    }

    .ui-nav {
        position: fixed;
        width: 100vw;
        justify-self: center;
        align-self: center;

        height: 0;
        .btn-previous,
        .btn-next{
            transform:translateY(-50%);
            position:absolute;
            left:0;
            top: 0;
            height: 100vh;
            width: 50%;
            display:flex;
            align-items: center;
        }
        .btn-next{
            left:auto;
            right:0;
            justify-content: end;
        }
    }
    &:not(.--has-group) .ui-nav{
        display:none
    }

    .ui-close {
        height: 0;
        top:var(--ch-big-text);
        width: 100vw;
        justify-self: center;
        position: fixed;
        z-index: 1;
        .btn-close{
            position:absolute;
            right:-1rem;
            top:-1rem;
            display: flex;
            padding: 1rem;
        }
    }

    .btn {
        margin: 0;
        padding: 0;
        border: none;
        background: none;
        font: inherit;
        color: inherit;
        outline: none;
        cursor: pointer;
        >img{
            width:100%;
            height:auto;
        }
    }

    @media (max-width: 900px) {

        .ui-close {
            top: 19px;
            right: 16px;
        }

        .ui-nav>.btn {
            -webkit-tap-highlight-color: transparent;
            > span {
                display: none;
            }
        }

        .btn img {
            width: 28px;
            height: 28px;
        }
    }

}
