/* ===========================
   Galerie-Lightbox (gallery-lightbox.js)
   Vollbild mit Zähler, Wischen und Vorschaubildern
   =========================== */

.glb {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    background: rgb(12, 10, 8);
    color: #fff;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    -webkit-user-select: none;
    user-select: none;
}

.glb.is-open {
    opacity: 1;
    visibility: visible;
}

/* Kopfzeile: Zähler + Schließen */
.glb__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px 6px 16px;
    padding-top: max(10px, env(safe-area-inset-top));
    flex: 0 0 auto;
}

.glb__counter {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.03em;
    background: rgba(255, 255, 255, 0.12);
    padding: 5px 12px;
    border-radius: 999px;
}

.glb__close {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.glb button:focus:not(:focus-visible) {
    outline: none;
}

.glb__close:hover,
.glb__close:focus-visible {
    background: rgba(255, 255, 255, 0.25);
}

/* Bildbereich */
.glb__stage {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;
}

.glb__img {
    max-width: calc(100% - 24px);
    max-height: calc(100% - 12px);
    object-fit: contain;
    display: block;
    border-radius: 3px;
    will-change: transform;
    -webkit-user-drag: none;
    pointer-events: none;
}

.glb__img.is-animating {
    transition: transform 0.22s ease-out, opacity 0.22s ease-out;
}

.glb__spinner {
    position: absolute;
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #d0a85c;
    border-radius: 50%;
    animation: glb-spin 0.8s linear infinite;
    display: none;
}

.glb.is-loading .glb__spinner {
    display: block;
}

@keyframes glb-spin {
    to { transform: rotate(360deg); }
}

/* Pfeile: dunkler Kreis mit hellem Rand – auf jedem Hintergrund sichtbar */
.glb__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.85);
    background: rgba(0, 0, 0, 0.6);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 2;
    transition: background 0.2s ease, opacity 0.2s ease;
}

.glb__nav:hover,
.glb__nav:focus-visible {
    background: #d0a85c;
    border-color: #d0a85c;
}

.glb__nav--prev { left: 14px; }
.glb__nav--next { right: 14px; }

.glb__nav[disabled] {
    opacity: 0;
    pointer-events: none;
}

/* Fußbereich: Bildtitel + Vorschaubilder */
.glb__bottom {
    flex: 0 0 auto;
    padding: 6px 0 10px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
}

.glb__caption {
    text-align: center;
    font-size: 15px;
    line-height: 1.35;
    padding: 0 16px 8px;
    min-height: 1.35em;
    color: rgba(255, 255, 255, 0.9);
}

.glb__caption:empty {
    display: none;
}

.glb__thumbs {
    position: relative;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 4px 16px;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
}

.glb__thumbs::-webkit-scrollbar { height: 4px; }
.glb__thumbs::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.3); border-radius: 2px; }

/* Zentriert, solange alle Vorschaubilder passen */
.glb__thumbs::before,
.glb__thumbs::after {
    content: '';
    margin: auto;
}

.glb__thumb {
    flex: 0 0 auto;
    width: 64px;
    height: 48px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 4px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.08);
    cursor: pointer;
    opacity: 0.55;
    transition: opacity 0.2s ease, border-color 0.2s ease;
}

.glb__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

.glb__thumb:hover { opacity: 0.85; }

.glb__thumb.is-active {
    opacity: 1;
    border-color: #d0a85c;
}

/* Bei nur einem Bild: keine Leiste, keine Pfeile */
.glb.is-single .glb__thumbs,
.glb.is-single .glb__nav,
.glb.is-single .glb__counter {
    display: none;
}

@media (max-width: 768px) {
    .glb__nav {
        width: 40px;
        height: 40px;
    }
    .glb__nav--prev { left: 8px; }
    .glb__nav--next { right: 8px; }
    .glb__img {
        max-width: 100%;
    }
    .glb__thumb {
        width: 56px;
        height: 42px;
    }
}

/* Auf Touch-Geräten wird gewischt – Pfeile nur dezent */
@media (hover: none) {
    .glb__nav {
        opacity: 0.75;
    }
}
