.hpb-imported-gallery {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 16px !important;
    margin: 1.5rem 0 !important;
}

.hpb-imported-gallery-item {
    min-width: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hpb-imported-gallery-link {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: zoom-in;
    text-decoration: none !important;
}

.hpb-imported-gallery-image {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
    margin: 0;
}

.hpb-imported-gallery-caption {
    margin-top: .45rem;
    font-size: .9em;
    line-height: 1.4;
}

@media (min-width: 640px) {
    .hpb-imported-gallery {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media (min-width: 960px) {
    .hpb-imported-gallery {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
}

body.hpb-gallery-lightbox-open {
    overflow: hidden !important;
}

/* Alte 1.2/1.3-Lightbox-Ziele niemals im normalen Artikel-Flow anzeigen. */
.hpb-lightbox-target,
.hpb-lightbox-popover {
    display: none !important;
}

.hpb-gallery-lightbox[hidden] {
    display: none !important;
}

.hpb-gallery-lightbox {
    position: fixed !important;
    z-index: 2147483000 !important;
    inset: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 24px !important;
    box-sizing: border-box !important;
    background: rgba(0, 0, 0, .92) !important;
}

.hpb-gallery-lightbox__panel {
    position: relative !important;
    z-index: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    width: auto !important;
    max-width: 96vw !important;
    max-height: 94vh !important;
}

.hpb-gallery-lightbox__image {
    display: block !important;
    width: auto !important;
    height: auto !important;
    max-width: 92vw !important;
    max-height: 84vh !important;
    object-fit: contain !important;
    margin: 0 !important;
    box-shadow: 0 8px 40px rgba(0, 0, 0, .55) !important;
}

.hpb-gallery-lightbox__close {
    position: fixed !important;
    z-index: 2 !important;
    top: 18px !important;
    right: 18px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 48px !important;
    height: 48px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 999px !important;
    background: #fff !important;
    color: #111 !important;
    font: 700 34px/1 Arial, sans-serif !important;
    cursor: pointer !important;
    box-shadow: 0 2px 14px rgba(0, 0, 0, .45) !important;
}

.hpb-gallery-lightbox__close:hover,
.hpb-gallery-lightbox__close:focus-visible {
    transform: scale(1.06);
}

.hpb-gallery-lightbox__caption {
    max-width: 92vw !important;
    margin-top: 10px !important;
    padding: 6px 10px !important;
    background: rgba(0, 0, 0, .72) !important;
    color: #fff !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
    text-align: center !important;
}

@media (max-width: 639px) {
    .hpb-gallery-lightbox {
        padding: 12px !important;
    }

    .hpb-gallery-lightbox__image {
        max-width: 96vw !important;
        max-height: 80vh !important;
    }

    .hpb-gallery-lightbox__close {
        top: 10px !important;
        right: 10px !important;
        width: 44px !important;
        height: 44px !important;
    }
}
