/* === Scroll-Lock: Seite dahinter nicht scrollbar === */
html:has(body.lb-disable-scrolling),
body.lb-disable-scrolling {
    overflow: hidden !important;
}

/* === Hintergrund === */
#lightboxOverlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 9999;
    background: rgba(0, 0, 0, .75);
    display: none;
}

/* === Box: mittig, passt sich dem Inhalt an === */
#lightbox {
    position: fixed;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%);
    z-index: 10000;
    width: fit-content;
    max-width: 95vw;
    max-height: 95dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--background-color);
    color: #000;
    text-align: left;
    line-height: normal;
    outline: none;
}

#lightbox .lb-outerContainer {
    position: relative;
    width: auto !important;
    height: auto !important;
}

/* outer paddings */
#lightbox .lb-outerContainer {
    padding: 0 50px;
}
#lightbox .lb-dataContainer {
    padding: 0 50px 50px;
}

/* Pfeile oben, Bild darunter */
#lightbox .lb-container {
    display: flex;
    flex-direction: column;
    padding-top: 70px;
}

#lightbox .lb-image {
    display: block;
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: calc(95dvh - 280px) !important;
    margin: 0 auto;
    object-fit: contain;
    border: 0;
}

/* === Buttons === */
#lightbox .lb-nav button,
#lightbox .lb-close {
    display: grid;
    place-items: center;
    padding: 0;
    border: none;
    cursor: pointer;
}
#lightbox button:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 3px;
}

/* Pfeile: über dem Bild, rechtsbündig */
#lightbox .lb-nav {
    order: -1;
    display: flex !important;
    justify-content: flex-end;
    gap: 10px;
    width: auto !important;
    height: auto !important;
    margin-bottom: 20px;
}
#lightbox .lb-nav button {
    width: 70px !important;
    height: 70px !important;
    border-radius: 50%;
    background: var(--primary-color);
    color: var(--bg-primary-text-color);
    transition: all .3s ease;
}
#lightbox .lb-nav button:hover,
#lightbox .lb-nav button:focus-visible {
    background: #ffffff;
    color: var(--primary-color);
}

/* Close: weißes Quadrat oben rechts in der Box */
#lightbox .lb-close {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 1;
    width: 60px;
    height: 60px;
    background: #fff;
}

/* === Ladeanzeige === */
#lightbox .lb-loader {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    text-align: center;
}
#lightbox .lb-cancel {
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 3px solid var(--primary-color);
    border-top-color: transparent;
    border-radius: 50%;
    animation: lb-spin .8s linear infinite;
}
@keyframes lb-spin { to { transform: rotate(360deg); } }

/* === Bildunterschrift === */
#lightbox .lb-dataContainer {
    width: auto !important;
    contain: inline-size; /* so breit wie die Box, macht sie aber nicht breiter */
}
#lightbox .lb-data,
#lightbox .lb-details,
#lightbox .lb-caption {
    display: block;
    float: none;
    width: auto;
    margin: 0;
    padding: 0;
    font-weight: normal;
}
#lightbox .lb-data { padding-top: 14px; }

#lightbox .lb-caption {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}
#lightbox .lb-caption hr {
    width: 50%;
    margin-left: 0;
    border-color: var(--border-color);
}


#lightbox .lb-caption p {
    padding: 0;
    font-family: Lato, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;
}
#lightbox .lb-desc { font-size: 15px; }
#lightbox .lb-copy {
    border-left: 1px solid var(--border-color);
    font-size: .7222222222rem;
    line-height: .8888888889rem;
    padding-left: 10px !important;
}
#lightbox .lb-number { display: none !important; }

/* === Mobile === */
@media (max-width: 600px) {
    /*#lightbox .lb-nav button { width: 48px !important; height: 48px !important; }*/
    #lightbox .lb-image { max-height: calc(95dvh - 40px) !important; }
}

/*@media (min-width: 1115px) and (max-width: 1639.98px) {*/
@media (max-width: 1639.98px) {
    /* outer paddings */
    #lightbox .lb-outerContainer {
        padding: 0 30px;
    }
    #lightbox .lb-dataContainer {
        padding: 0 30px 30px;
    }

    #lightbox .lb-container {
        display: flex;
        flex-direction: column;
        padding-top: 55px;
    }

    #lightbox .lb-close {
        width: 40px;
        height: 40px;
    }

    #lightbox .lb-nav {
        margin-bottom: 45px;
    }

    #lightbox .lb-nav button {
        width: 45px !important;
        height: 45px !important;
        font-size: 16px;
    }

    #lightbox {
        top: 50% !important;
        left: 0 !important;
        right: 0;
        margin: 0 auto;
        transform: translateY(-50%);
    }
}

