.ra-gallery {
    container: ra-gallery / inline-size;
    min-width: 0;
    margin: 1.5rem 0;
    color: inherit;
}

.ra-gallery__heading {
    display: flex;
    align-items: center;
    gap: .65rem;
    margin-bottom: 1rem;
}

.ra-gallery .ra-gallery__title {
    margin: 0;
    color: inherit;
    font-size: 1.25rem;
    line-height: 1.35;
    font-weight: 750;
}

.ra-gallery .ra-gallery__items {
    display: grid;
    grid-template-columns: repeat(var(--ra-gallery-columns, 2), minmax(0, 1fr));
    gap: 1rem;
    padding: 0;
    margin: 0;
    list-style: none;
}

.ra-gallery .ra-gallery__item {
    min-width: 0;
    margin: 0;
    padding: 0;
}

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

.ra-gallery .ra-gallery__image-link {
    position: relative;
    display: block;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    color: inherit;
    background: var(--bs-tertiary-bg, #f5f4f1);
    border-radius: .6rem;
    cursor: zoom-in;
}

.ra-gallery .ra-gallery__image-link img {
    display: block;
    width: 100%;
    height: 100%;
    margin: 0;
    border-radius: 0;
    object-fit: cover;
    transition: transform .2s ease;
}

.ra-gallery--natural .ra-gallery__image-link {
    aspect-ratio: auto;
}

.ra-gallery--natural .ra-gallery__image-link img {
    height: auto;
}

.ra-gallery__zoom-hint {
    position: absolute;
    right: .65rem;
    bottom: .65rem;
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    color: #fff;
    background: rgba(0, 0, 0, .65);
    border-radius: 50%;
}

.ra-gallery__image-link:hover img {
    transform: scale(1.025);
}

.ra-gallery :is(a, button):focus-visible {
    outline: 3px solid var(--bs-danger, #c1272d);
    outline-offset: 3px;
}

.ra-gallery--compact {
    padding: 1rem;
    background: var(--bs-tertiary-bg, #f5f4f1);
    border: 1px solid var(--bs-border-color, #e5e2df);
    border-radius: .75rem;
}

.ra-gallery--compact .ra-gallery__items {
    gap: .6rem;
}

.ra-gallery--compact .ra-gallery__title {
    font-size: 1.05rem;
}

.ra-gallery--compact .ra-gallery__image-link {
    border-radius: .25rem;
}

.ra-gallery--compact .ra-gallery__zoom-hint {
    width: 1.65rem;
    height: 1.65rem;
    right: .35rem;
    bottom: .35rem;
    font-size: .75rem;
}

.ra-gallery__all {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: .4rem;
    width: 100%;
    margin-top: 1rem;
    padding: .8rem;
    color: var(--bs-danger-text-emphasis, #9b1c23);
    background: transparent;
    border: 1px solid var(--bs-danger-border-subtle, #ddabae);
    border-radius: .35rem;
    font-size: .9rem;
    font-weight: 700;
}

.ra-gallery__all:hover {
    background: var(--bs-danger-bg-subtle, #f8d7da);
    border-color: var(--bs-danger, #c1272d);
}

.ra-gallery--carousel .ra-gallery__items {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
}

.ra-gallery--carousel .ra-gallery__item {
    flex: 0 0 100%;
    scroll-snap-align: start;
}

.ra-gallery--carousel .ra-gallery__image-link {
    aspect-ratio: 16 / 9;
}

.ra-gallery .swiper-initialized .ra-gallery__items {
    gap: 0;
    overflow: visible;
}

.ra-gallery .swiper-initialized .ra-gallery__item {
    flex: none;
}

.ra-gallery__navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

.ra-gallery__navigation button,
.ra-gallery-lightbox button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    min-width: 2.75rem;
    min-height: 2.75rem;
    padding: .5rem;
    color: inherit;
    background: transparent;
    border: 1px solid currentColor;
    border-radius: .5rem;
}

.ra-gallery__navigation button:disabled {
    opacity: .35;
}

.ra-gallery__pagination {
    width: auto !important;
    color: inherit;
    font-variant-numeric: tabular-nums;
}

.ra-gallery-lightbox {
    width: calc(100vw - 2rem);
    max-width: 1440px;
    height: calc(100dvh - 2rem);
    max-height: none;
    padding: 1rem;
    color: #fff;
    background: #16171a;
    border: 0;
    border-radius: .75rem;
    overflow: hidden;
}

.ra-gallery-lightbox::backdrop {
    background: rgba(0, 0, 0, .86);
}

.ra-gallery-lightbox[open] {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.ra-gallery-lightbox__toolbar,
.ra-gallery-lightbox__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
}

.ra-gallery-lightbox__caption {
    min-width: 0;
    margin: 0;
    color: #fff;
    font-size: 1rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.ra-gallery-lightbox__actions {
    display: flex;
    gap: .5rem;
}

.ra-gallery-lightbox__stage {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 0;
    overflow: auto;
}

.ra-gallery-lightbox__image {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.ra-gallery-lightbox.is-zoomed .ra-gallery-lightbox__stage {
    display: block;
}

.ra-gallery-lightbox.is-zoomed .ra-gallery-lightbox__image {
    max-width: none;
    max-height: none;
}

.ra-gallery-lightbox button:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 3px;
}

.ra-gallery-lightbox button:disabled {
    opacity: .35;
}

html.ra-gallery-lightbox-open {
    overflow: hidden;
}

@container ra-gallery (max-width: 900px) {
    .ra-gallery .ra-gallery__items {
        grid-template-columns: repeat(var(--ra-gallery-medium-columns, 3), minmax(0, 1fr));
    }
}

@container ra-gallery (max-width: 600px) {
    .ra-gallery .ra-gallery__items {
        grid-template-columns: repeat(var(--ra-gallery-small-columns, 2), minmax(0, 1fr));
    }
}

@container ra-gallery (max-width: 260px) {
    .ra-gallery .ra-gallery__items {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 575.98px) {
    .ra-gallery-lightbox {
        width: calc(100vw - 1rem);
        height: calc(100dvh - 1rem);
        padding: .65rem;
    }

    .ra-gallery-lightbox__toolbar {
        align-items: flex-start;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ra-gallery__image-link img {
        transition: none;
    }
}
