.gallery {
    max-width: 600px;
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px;
    margin: 16px 0;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;

    /* === Скрываем полосу прокрутки === */
    scrollbar-width: none;          /* Firefox */
    -ms-overflow-style: none;       /* старый Edge / IE */
}
.gallery-wrapper .gallery-arrow {
    display: none;
}
.gallery-wrapper.has-scroll .gallery-arrow {
    display: block;
}

@media (max-width: 640px) {
    .gallery-wrapper.has-scroll .gallery-arrow {
        width: 30px;
        height: 30px;
        font-size: 14px;
        line-height: 30px;
    }
}
/* Chrome / Safari / Opera */
.gallery::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}
/* ===== Каждый элемент ===== */
.gallery-item {
    flex: 0 0 auto;                /* не сжимать, не растягивать */
    height: 200px;                 /* фиксированная высота, чтобы строка была ровной */
    border-radius: 6px;
    overflow: hidden;
    background: #f0f0f0;
    box-sizing: border-box;
}

.gallery-item a {
    display: block;
    width: 100%;
    height: 100%;
    line-height: 0;
}

.gallery-item img.gallery-img {
    display: block;
    width: auto;                   /* ширина — по пропорции */
    height: 100%;                  /* высота — по контейнеру */
    max-width: none;               /* не ограничиваем, иначе сожмётся */
    object-fit: cover;             /* заполняем ячейку, обрезая лишнее */
    transition: transform 0.2s;
}

.gallery-item a:hover img.gallery-img {
    transform: scale(1.03);
}

.gallery-wrapper {
    position: relative;
    max-width: 600px;
    margin: 16px 0;
}

.gallery-wrapper .gallery {
    margin: 0;
    max-width: 100%;
}

.gallery-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    font-size: 18px;
    line-height: 36px;
    text-align: center;
    cursor: pointer;
    z-index: 2;
    padding: 0;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.gallery-arrow:hover { background: rgba(0, 0, 0, 0.75); }
.gallery-arrow.prev { left: 6px; }
.gallery-arrow.next { right: 6px; }
.gallery-arrow[disabled] { opacity: 0.25; cursor: default; }

@media (max-width: 640px) {
    .gallery-arrow { width: 30px; height: 30px; font-size: 14px; line-height: 30px; }
}

/* ===== Мобильная версия ===== */
@media (max-width: 640px) {
    .gallery {
        max-width: 100%;
        gap: 6px;
        padding: 4px 4px 6px;
    }
    .gallery-item {
        height: 150px;             /* ниже на мобильном */
    }
}