.wrap {
    max-width: 1024px;
    margin: 32px auto;
    padding: 0 16px;
}

.product_imgs_slider_with_thmbs {
    --gap: 6px;
    --radius: 14px;
    --shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    --arrow: rgba(0, 0, 0, 0.5);
    --arrowHover: #111;
}

.pgallery {
    display: grid;
    gap: var(--gap);
}

.pgallery-viewport {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    touch-action: pan-y;           /* ← По подразбиране: вертикален скрол е разрешен */
    -webkit-overflow-scrolling: touch;
    user-select: none;
    cursor: grab;
}
.pgallery-viewport.horizontal-drag {
    touch-action: none !important; /* ← Само при хоризонтален драг – блокираме страницата */
    cursor: grabbing;
}
.pgallery-track {
    display: flex;
    height: 100%;
    will-change: transform;
}

@media (max-width: 767px) {
    .pgallery-viewport { min-height: 62vw; }
}

.pgallery-slide {
    margin: 0;
    flex: 0 0 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

.pgallery-slide img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    pointer-events: none;

    /* iOS drag/flick prevention */
    -webkit-user-drag: none;
    user-select: none;
}

.pgallery-thumbs {
    padding-top: 4px;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: var(--gap);
}

.pgallery-thumb {
    all: unset;
    position: relative;
    cursor: pointer;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid transparent;
    background: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
    transition:
        box-shadow 0.2s ease,
        transform 0.15s ease,
        background 0.2s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.pgallery-thumb span {
    display: block;
    width: 100%;
    aspect-ratio: 1/1;
}
.pgallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.pgallery-thumb.is-active,
.pgallery-thumb:focus-visible {
    background:
        linear-gradient(#fff 0 0) padding-box,
        linear-gradient(135deg, var(--article-sel1-color), var(--article-sel2-color), var(--article-sel3-color)) border-box;
}
.pgallery-thumb.is-active {
    box-shadow:
        0 0 0 0 rgba(0, 0, 0, 0),
        0 6px 16px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}
.pgallery-thumb:hover:not(.is-active) {
    background:
        linear-gradient(#fff 0 0) padding-box,
        linear-gradient(135deg, var(--article-sel1-color) 0%, var(--article-sel2-color) 50%, var(--article-sel3-color) 100%) border-box;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: scale(1.05);
    opacity: 1;
}
@media (hover: none) {
    .pgallery-thumb:active:not(.is-active) {
        background:
            linear-gradient(#fff 0 0) padding-box,
            linear-gradient(135deg, var(--article-sel1-color) 0%, var(--article-sel2-color) 50%, var(--article-sel3-color) 100%) border-box;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        transform: scale(0.95);
    }
}

.pgallery-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.33);
    display: grid;
    place-items: center;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
    z-index: 10;
    pointer-events: auto;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;

    /* arrow color via currentColor */
    color: color-mix(in srgb, var(--arrow) 85%, transparent);
}
.pgallery-arrow:hover { color: var(--arrowHover); }

.pgallery-arrow svg path { fill: currentColor; }

.pgallery-arrow.left { left: 7px; }
.pgallery-arrow.right { right: 7px; }
