.rbt-photo-gallery {
    --rbt-gallery-gap: 12px;
    --rbt-gallery-control: #172b21;
    min-width: 0;
}

.rbt-gallery-frame {
    position: relative;
}

.rbt-gallery-track {
    position: relative;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: calc((100% - var(--rbt-gallery-gap) - var(--rbt-gallery-gap)) / 3);
    gap: var(--rbt-gallery-gap);
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    border-radius: 10px;
}

.rbt-gallery-track::-webkit-scrollbar {
    display: none;
}

.rbt-gallery-slide {
    position: relative;
    min-width: 0;
    overflow: hidden;
    scroll-snap-align: start;
    border-radius: 10px;
    background: #edf3ee;
}

.rbt-photo-gallery .rbt-gallery-photo {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.rbt-photo-gallery .rbt-gallery-control {
    box-sizing: border-box;
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    margin: 0;
    padding: 0;
    border: 1px solid rgb(255 255 255 / 65%);
    border-radius: 50%;
    background: rgb(23 43 33 / 90%);
    color: #fff;
    text-decoration: none;
    cursor: pointer;
    transition: opacity .18s ease, background-color .18s ease;
}

.rbt-photo-gallery .rbt-gallery-control:hover {
    background: var(--rbt-gallery-control);
    color: #fff;
}

.rbt-photo-gallery .rbt-gallery-control:focus-visible,
.rbt-gallery-track:focus-visible {
    outline: 2px solid #f0b74f;
    outline-offset: -3px;
}

.rbt-gallery-controls[hidden],
.rbt-photo-gallery .rbt-gallery-control[hidden],
.rbt-gallery-lightbox:not([open]) {
    display: none;
}

.rbt-gallery-prev,
.rbt-gallery-next,
.rbt-gallery-pause,
.rbt-gallery-zoom,
.rbt-lightbox-prev,
.rbt-lightbox-next {
    position: absolute;
    z-index: 1;
}

.rbt-gallery-prev,
.rbt-gallery-next,
.rbt-lightbox-prev,
.rbt-lightbox-next {
    inset-block-start: 50%;
    transform: translateY(-50%);
}

.rbt-gallery-prev,
.rbt-lightbox-prev {
    inset-inline-start: 8px;
}

.rbt-gallery-next,
.rbt-lightbox-next {
    inset-inline-end: 8px;
}

.rbt-gallery-pause {
    inset-block-end: 8px;
    inset-inline-start: 8px;
}

.rbt-gallery-zoom {
    right: 8px;
    bottom: 8px;
}

.rbt-gallery-arrow {
    width: 11px;
    height: 11px;
    border: solid currentColor;
    border-width: 0 2px 2px 0;
    transform: translateX(-2px) rotate(-45deg);
}

:is(.rbt-gallery-prev, .rbt-lightbox-prev) .rbt-gallery-arrow,
:is(.rbt-gallery-next, .rbt-lightbox-next):dir(rtl) .rbt-gallery-arrow {
    transform: translateX(2px) rotate(135deg);
}

:is(.rbt-gallery-prev, .rbt-lightbox-prev):dir(rtl) .rbt-gallery-arrow {
    transform: translateX(-2px) rotate(-45deg);
}

.rbt-gallery-pause span {
    width: 10px;
    height: 13px;
    border-inline: 3px solid currentColor;
}

.rbt-gallery-pause[data-paused] span {
    width: 0;
    height: 0;
    margin-left: 3px;
    border: 7px solid transparent;
    border-left: 10px solid currentColor;
    border-right: 0;
}

.rbt-gallery-zoom span {
    position: relative;
    width: 15px;
    height: 15px;
    margin: -3px 3px 0 0;
    border: 2px solid currentColor;
    border-radius: 50%;
}

.rbt-gallery-zoom span::after {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 7px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    transform: rotate(45deg);
    transform-origin: left center;
    content: '';
}

.rbt-gallery-lightbox[open] {
    box-sizing: border-box;
    display: grid;
    gap: 8px;
    width: min(1100px, calc(100% - 20px));
    max-width: none;
    max-height: calc(100dvh - 20px);
    margin: auto;
    padding: 10px;
    overflow: auto;
    border: 1px solid #40544a;
    border-radius: 12px;
    background: #101d16;
    color: #fff;
}

.rbt-gallery-lightbox::backdrop {
    background: rgb(9 16 12 / 90%);
}

.rbt-lightbox-close {
    justify-self: end;
    font: 28px/1 system-ui, sans-serif;
}

.rbt-lightbox-body {
    position: relative;
    display: grid;
    min-height: 80px;
    place-items: center;
}

.rbt-photo-gallery .rbt-lightbox-image {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: calc(100dvh - 132px);
    border-radius: 6px;
    object-fit: contain;
}

.rbt-lightbox-count {
    margin: 0;
    color: #edf3ee;
    font-size: 14px;
    text-align: center;
}

@media (min-width: 768px) and (hover: hover) {
    .rbt-gallery-frame:not(:hover):not(:focus-within) .rbt-gallery-controls .rbt-gallery-control,
    .rbt-gallery-slide:not(:hover):not(:focus-within) .rbt-gallery-zoom {
        opacity: 0;
    }
}

@media (min-width: 768px) {
    .rbt-gallery-track:has(> .rbt-gallery-slide:only-child) {
        grid-auto-columns: 100%;
    }

    .rbt-gallery-track:has(> .rbt-gallery-slide:nth-child(2):last-child) {
        grid-auto-columns: calc((100% - var(--rbt-gallery-gap)) / 2);
    }
}

@media (max-width: 767px) {
    .rbt-gallery-track {
        grid-auto-columns: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .rbt-photo-gallery .rbt-gallery-control {
        transition: none;
    }
}
