/* ── BSS Gallery widget grid (mirrors .gallery-category-list-item rules) ── */

.gallery-category-list-widget {
    list-style: none;
    padding: 0;
    margin: 0;
    width: 100%;
}

.gallery-category-list-widget::after {
    content: '';
    display: block;
    clear: both;
}

.gallery-category-list-item-widget {
    float: left;
    box-sizing: border-box;
    padding: 0 10px;
    width: 20%;
    min-height: 220px;
}

.gallery-category-list-item-widget img {
    width: 100%;
    height: auto;
    display: block;
}

@media screen and (max-width: 1279px) {
    .gallery-category-list-item-widget { width: 25%; }
}

@media screen and (max-width: 959px) {
    .gallery-category-list-item-widget { width: 33.333%; }
}

@media screen and (max-width: 767px) {
    .gallery-category-list-item-widget { width: 50%; }
}

@media screen and (max-width: 479px) {
    .gallery-category-list-item-widget { width: 100%; }
}

/* ── CMS image gallery ─────────────────────────────────────────────────── */

/*
 * Convert legacy float-left div galleries into a flex row.
 * Inline `style="float:left"` requires !important overrides.
 */
.cms-content .cms-gallery-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 1rem;
    clear: both;
}

.cms-content .cms-gallery-row > div {
    float: none !important;
    padding: 0 !important;
    flex: 0 1 auto;
    min-width: 0;
}

.cms-content .cms-gallery-row img {
    display: block;
    width: 100%;
    height: auto;
    cursor: zoom-in;
}

.cms-content .cms-gallery-row table {
    width: auto !important;
}

.cms-content .cms-gallery-row td {
    padding: 0;
}

/* ── Lightbox overlay ──────────────────────────────────────────────────── */

.cms-lb {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, .88);
    align-items: center;
    justify-content: center;
}

.cms-lb.open {
    display: flex;
}

.cms-lb__img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 2px;
}

.cms-lb__close {
    position: absolute;
    top: 16px;
    right: 20px;
    font-size: 2rem;
    line-height: 1;
    color: #fff;
    background: none;
    border: none;
    cursor: pointer;
    opacity: .8;
}

.cms-lb__close:hover {
    opacity: 1;
}

.cms-lb__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2.5rem;
    line-height: 1;
    color: #fff;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0 12px;
    opacity: .7;
    user-select: none;
}

.cms-lb__nav:hover {
    opacity: 1;
}

.cms-lb__prev { left: 8px; }
.cms-lb__next { right: 8px; }

.cms-lb__counter {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, .7);
    font-size: .85rem;
}
