/* Product page photo gallery: the main image plus a thumbnail strip.
 * Markup (any product page; behaviour in assets/js/product-gallery.js):
 *   <div class="pp-images pp-gallery" data-pp-gallery>
 *     <div class="pp-image-main"><img src width height> + prev / next buttons</div>
 *     <div class="pp-gallery-thumbs"><button data-pp-gallery-thumb data-full data-alt>...</div>
 *     <p class="pp-gallery-status" data-pp-gallery-status aria-live="polite"></p>
 *   </div>
 * Builds on .pp-image-main in product-page.css. */

/* Square box whatever the photo: no layout shift when the photo changes. */
.pp-gallery .pp-image-main img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    margin: 0 auto;
}

/* Horizontal swipes belong to the gallery; vertical ones still scroll the page. */
.pp-gallery .pp-image-main {
    touch-action: pan-y;
    -webkit-user-select: none;
    user-select: none;
}

.pp-gallery-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 26px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease, background 0.2s ease;
}
.pp-gallery-arrow.prev { left: 10px; }
.pp-gallery-arrow.next { right: 10px; }
.pp-gallery-arrow:hover { background: rgba(139, 92, 246, 0.8); }
.pp-gallery-arrow:focus-visible { opacity: 1; outline: 2px solid #fbbf24; outline-offset: 2px; }
.pp-gallery .pp-image-main:hover .pp-gallery-arrow { opacity: 1; }
/* No hover on touch screens: keep the arrows visible, quieter. */
@media (hover: none) {
    .pp-gallery-arrow { opacity: 0.75; width: 40px; height: 40px; font-size: 24px; }
}

.pp-gallery-thumbs {
    display: flex;
    gap: 10px;
    margin: 14px 0 0;
    padding: 4px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
}

.pp-gallery-thumb {
    flex: 0 0 64px;
    width: 64px;
    height: 64px;
    padding: 4px;
    border: 2px solid rgba(139, 92, 246, 0.25);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    cursor: pointer;
    scroll-snap-align: start;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.pp-gallery-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 8px;
}
.pp-gallery-thumb:hover { border-color: rgba(139, 92, 246, 0.6); }
.pp-gallery-thumb[aria-current="true"] {
    border-color: #8B5CF6;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
}
.pp-gallery-thumb:focus-visible { outline: 2px solid #fbbf24; outline-offset: 2px; }

@media (max-width: 480px) {
    .pp-gallery-thumbs { gap: 8px; }
    .pp-gallery-thumb { flex-basis: 56px; width: 56px; height: 56px; }
}

.pp-gallery-status {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}
