.hbs-gallery {
    width: 100%;
    max-width: 100%;
    margin: 1.5rem 0;
}

.hbs-gallery__stage {
    position: relative;
}

.hbs-gallery__figure {
    display: none;
    margin: 0;
}

.hbs-gallery__figure.is-active {
    display: block;
}

.hbs-gallery__open {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: zoom-in;
}

.hbs-gallery__image {
    display: block;
    width: 100%;
    height: auto;
}

.hbs-gallery__copyright-overlay {
    position: absolute;
    right: .75rem;
    bottom: .75rem;
    padding: .35rem .55rem;
    background: rgba(0, 0, 0, .55);
    color: #fff;
    font-size: .875rem;
    line-height: 1.2;
    border-radius: .25rem;
    pointer-events: none;
}

.hbs-gallery__meta {
    margin-top: .5rem;
    font-size: .95rem;
    line-height: 1.45;
}

.hbs-gallery__meta-title {
    font-weight: 700;
}

.hbs-gallery__meta-credits {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem .8rem;
    margin-top: .35rem;
    font-size: .875rem;
    opacity: .85;
}

.hbs-gallery__thumbs-wrap {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-top: .75rem;
}

.hbs-gallery__thumbs {
    display: flex;
    gap: .5rem;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: .25rem 0;
    flex: 1 1 auto;
}

.hbs-gallery__thumb {
    flex: 0 0 auto;
    padding: 0;
    border: 2px solid transparent;
    background: transparent;
    cursor: pointer;
    opacity: .72;
}

.hbs-gallery__thumb.is-active {
    border-color: currentColor;
    opacity: 1;
}

.hbs-gallery__thumb img {
    display: block;
    width: 140px;
    height: 90px;
    object-fit: cover;
}

.hbs-gallery__thumb-scroll {
    flex: 0 0 auto;
    width: 2rem;
    height: 2rem;
    border: 1px solid currentColor;
    background: transparent;
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
}

.hbs-gallery__count {
    margin-top: .4rem;
    font-size: .875rem;
    opacity: .75;
    text-align: right;
}

.hbs-gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .92);
    color: #fff;
}

.hbs-gallery-lightbox.is-open {
    display: flex;
}

.hbs-gallery-lightbox__image {
    max-width: 92vw;
    max-height: 82vh;
    object-fit: contain;
}

.hbs-gallery-lightbox__caption {
    position: absolute;
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    text-align: center;
    font-size: .95rem;
}

.hbs-gallery-lightbox__close,
.hbs-gallery-lightbox__prev,
.hbs-gallery-lightbox__next {
    position: absolute;
    border: 0;
    background: rgba(0, 0, 0, .45);
    color: #fff;
    cursor: pointer;
}

.hbs-gallery-lightbox__close {
    top: 1rem;
    right: 1rem;
    width: 2.5rem;
    height: 2.5rem;
    font-size: 2rem;
}

.hbs-gallery-lightbox__prev,
.hbs-gallery-lightbox__next {
    top: 50%;
    transform: translateY(-50%);
    width: 3rem;
    height: 4rem;
    font-size: 3rem;
    opacity: .55;
}

.hbs-gallery-lightbox__prev:hover,
.hbs-gallery-lightbox__next:hover {
    opacity: 1;
}

.hbs-gallery-lightbox__prev {
    left: 1rem;
}

.hbs-gallery-lightbox__next {
    right: 1rem;
}

@media (max-width: 640px) {
    .hbs-gallery__thumb img {
        width: 96px;
        height: 64px;
    }

    .hbs-gallery__thumb-scroll {
        display: none;
    }

    .hbs-gallery-lightbox__prev,
    .hbs-gallery-lightbox__next {
        width: 2.5rem;
        background: transparent;
    }
}
