.gallery-single img {
    max-width: 100%;
    height: auto;
    vertical-align: middle;
}

.gallery-image-modal.modal {
    width: 100%;
    max-width: 1200px;
    padding: 12px;
    text-align: center;
}

.gallery-image-modal__image {
    display: block;
    width: 100%;
    height: calc(100vh - 140px);
    height: calc(100dvh - 140px);
    object-fit: contain;
}

.gallery-image-modal__controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 18px;
    padding-top: 12px;
}

.gallery-image-modal__controls button {
    min-width: 44px;
    min-height: 40px;
    cursor: pointer;
}

.gallery-image-modal__controls button:disabled {
    opacity: .35;
    cursor: default;
}

.gallery-group-text {
    padding: 10px 15px;
    overflow-wrap: anywhere;
}

.gallery-group-description {
    margin: 0;
    white-space: pre-wrap;
}

.gallery-carousel {
    --gallery-peek: 48px;
    max-width: 100%;
}

.gallery-carousel__track {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
}

.gallery-carousel__track::-webkit-scrollbar {
    display: none;
}

.gallery-carousel__slide {
    min-width: 0;
}

.gallery-carousel .gallery-carousel__slide {
    flex: 0 0 var(--gallery-slide-width, calc(100% - var(--gallery-peek)));
    height: var(--gallery-image-height, clamp(220px, 65vw, 520px));
    scroll-snap-align: start;
    scroll-snap-stop: always;
    display: flex;
    align-items: center;
}

.gallery-carousel picture {
    display: flex;
    height: 100%;
    width: 100%;
    align-items: center;
}

.gallery-carousel img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: left center;
}

.gallery-carousel__controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 18px;
    padding: 12px;
}

.gallery-carousel__controls button {
    min-width: 44px;
    min-height: 40px;
    cursor: pointer;
}

.gallery-carousel__controls button:disabled {
    opacity: .35;
    cursor: default;
}

.gallery-carousel__track:focus-visible {
    outline: 2px solid #456fa1;
    outline-offset: -2px;
}

.gallery-edit-list {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 8px 0 16px;
}

.gallery-edit-item {
    flex: 0 0 145px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: #fafafa;
}

.gallery-edit-item img {
    display: block;
    width: 145px;
    height: 115px;
    object-fit: contain;
}

.gallery-edit-item__name {
    display: block;
    overflow-wrap: anywhere;
    font-size: 12px;
    margin: 6px 0;
}

.gallery-edit-item__controls {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.gallery-edit-item button {
    min-height: 32px;
    cursor: pointer;
}

.gallery-photo-form .gallery-form-error {
    white-space: pre-line;
    color: #a00;
}

.gallery-photo-form input[type=file] {
    max-width: 100%;
}

@media (max-width: 480px) {
    .gallery-carousel {
        --gallery-peek: 36px;
    }

}
