/* ─────────────────────────────────────────
   WK Product Gallery Widget — gallery.css
   ───────────────────────────────────────── */

.wk-pg-root *,
.wk-pg-root *::before,
.wk-pg-root *::after { box-sizing: border-box; }

.wk-pg-root {
    width: 100%;
    font-family: 'Sofia Pro Medium', 'Sofia Pro', sans-serif;
}
.wk-pg-root button { border: none; cursor: pointer; padding: 0; background: transparent; }
.wk-pg-root img { display: block; width: 100%; height: auto; }

/* ════════════════════════════════════════
   DESKTOP  (> 768 px)
   ════════════════════════════════════════ */
.wk-pg-desktop { display: flex; }
.wk-pg-mobile  { display: none; }

.wk-pg-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    --wk-pg-main-max-h: 700px; /* main_img_max_height, safety cap only */
}

/* ── Gallery: horizontal thumbnail row under the main image ──
   It's always exactly as wide as the main image above it (both are
   100% of the same wrapper) and never spills past that — extra
   thumbs just scroll inside the row instead of wrapping or overflowing.
   Drag left/right to scroll (plus normal wheel/scrollbar/touch). */
.wk-pg-thumbs {
    display: flex;
    flex-direction: row;
    gap: 8px;             /* overridden by Elementor thumb_gap slider */
    width: 100%;
    flex-shrink: 0;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    cursor: grab;
    -webkit-user-select: none;
    user-select: none;
    scroll-behavior: smooth;
}
.wk-pg-thumbs.is-drag-scrolling {
    cursor: grabbing;
    scroll-behavior: auto;
}

.wk-pg-thumbs {
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}
.wk-pg-thumbs::-webkit-scrollbar { height: 4px; }
.wk-pg-thumbs::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }

.wk-pg-thumbs.hide-scrollbar {
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.wk-pg-thumbs.hide-scrollbar::-webkit-scrollbar { display: none; }

.wk-pg-thumb {
    position: relative;
    width: 80px;           /* overridden by Elementor thumbnail_width slider */
    height: auto;
    flex-shrink: 0;
    border-radius: 1.65px;
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    transform: translateY(0) scale(1);
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.2s ease;
}

.wk-pg-thumb::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0) 55%, rgba(0,0,0,0.28) 100%);
    opacity: 0;
    transition: opacity 0.22s ease;
    pointer-events: none;
}

.wk-pg-thumb::before {
    content: '';
    position: absolute;
    top: 5px;
    right: 5px;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    background-color: rgba(255,255,255,0.9);
    background-image:
        radial-gradient(circle, #333 1px, transparent 1.4px),
        radial-gradient(circle, #333 1px, transparent 1.4px),
        radial-gradient(circle, #333 1px, transparent 1.4px),
        radial-gradient(circle, #333 1px, transparent 1.4px);
    background-position: 4px 4px, 10px 4px, 4px 10px, 10px 10px;
    background-repeat: no-repeat;
    background-size: 2px 2px;
    opacity: 0;
    transform: scale(0.7);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
    z-index: 2;
}

.wk-pg-thumb img { display: block; width: 100%; height: auto; object-fit: contain; transition: transform 0.3s ease; }

.wk-pg-thumb:hover,
.wk-pg-thumb:focus-visible {
    transform: translateY(-3px) scale(1.045);
    box-shadow: 0 8px 16px rgba(0,0,0,0.16);
    border-color: #c8860a;
    z-index: 1;
}
.wk-pg-thumb:hover::after,
.wk-pg-thumb:focus-visible::after { opacity: 1; }
.wk-pg-thumb:hover::before,
.wk-pg-thumb:focus-visible::before { opacity: 1; transform: scale(1); }
.wk-pg-thumb:hover img { transform: scale(1.12); }

.wk-pg-thumb.is-active { border-color: #c8860a; box-shadow: 0 0 0 1px #c8860a inset; }
.wk-pg-thumb:focus-visible { outline: 2px solid #c8860a; outline-offset: 2px; }

/* ── RIGHT: single main image.
   No fixed height, no crop, no scroll, no drag of its own — height is
   purely the image's natural size (capped only by the safety max-height).
   The ONLY thing that changes it is picking a thumbnail on the left. ── */
.wk-pg-viewer {
    position: relative;
    width: 100%;
    max-height: var(--wk-pg-main-max-h);
    border-radius: 8px;
    overflow: hidden;
    background-color: #f9f6f1;
    display: flex;
}
.wk-pg-viewer-img {
    display: block;
    width: 100%;
    height: auto;
    max-height: var(--wk-pg-main-max-h);
    object-fit: contain;
    margin: 0 auto;
    transition: opacity 0.2s ease;
}
.wk-pg-viewer-img.is-swapping { opacity: 0; }

/* ════════════════════════════════════════
   MOBILE  (≤ 768 px)
   ════════════════════════════════════════ */
@media (max-width: 768px) {
    .wk-pg-desktop { display: none; }
    .wk-pg-mobile  { display: block; }

    .wk-pg-mobile-main {
        position: relative;
        width: 100%;
        height: auto !important;
        border-radius: 8px;
        overflow: hidden;
        background: #f9f6f1;
        margin-bottom: 12px;
    }
    .wk-pg-mob-main-img {
        display: block;
        width: 100% !important;
        height: auto !important;
        object-fit: initial !important;
        transition: opacity 0.3s ease;
    }
    .wk-pg-mob-main-img.is-fading { opacity: 0; }

    .wk-pg-carousel-wrap { width: 100%; overflow: hidden; }
    .wk-pg-carousel-track {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 2px;
    }
    .wk-pg-carousel-track::-webkit-scrollbar { display: none; }

    .wk-pg-carousel-thumb {
        flex-shrink: 0;
        scroll-snap-align: start;
        width: 72px; height: auto;
        border-radius: 1.65px;
        overflow: hidden;
        border: 2px solid transparent;
        transition: border-color 0.2s;
        background: #f0ece4;
    }
    .wk-pg-carousel-thumb img { display: block; width: 100%; height: auto; object-fit: contain; }
    .wk-pg-carousel-thumb.is-active { border-color: #c8860a; }
}
