/* ─────────────────────────────────────────
   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: 100%; object-fit: cover; }

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

.wk-pg-wrapper {
	width:100%;
	height:100%;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 12px;
    /* Elementor sliders write these three vars — everything else derives from them */
    --wk-pg-main-h: 500px;      /* main_img_height */
    --wk-pg-secondary-h: 250px; /* secondary_img_height */
    --wk-pg-gap: 10px;          /* main_secondary_gap */
}

/* Right stack is clipped to exactly "1 big + 1 small" worth of height —
   pure CSS (calc), correct on first paint, no JS height sync, no flash. */
.wk-pg-stack {
    height: calc(var(--wk-pg-main-h) + var(--wk-pg-gap) + var(--wk-pg-secondary-h)) !important;
    max-height: 100vh;
    overflow-x: hidden !important;
    overflow-y: hidden !important; /* no scroll — drag only, see JS */
}

/* Left thumbs: NOT tied to the stack's height — it sizes to show every
   image. Only scrolls if the full list genuinely doesn't fit the
   viewport; otherwise all thumbnails are visible, no clipping. */
.wk-pg-thumbs {
    height: auto;
    max-height: 100vh;
    overflow-x: hidden !important;
    overflow-y: auto !important;
}

/* ── LEFT: Thumbnail column ── */
.wk-pg-thumbs {
    display: flex;
    flex-direction: column;
    gap: 8px;           /* overridden by Elementor thumb_gap slider */
    width: 125px;       /* overridden by Elementor thumbnail_width slider */
    flex-shrink: 0;
}

/* Scrollbar VISIBLE (default) — thumbs column only, the stack doesn't scroll */
.wk-pg-thumbs {
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}
.wk-pg-thumbs::-webkit-scrollbar { width: 4px; }
.wk-pg-thumbs::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }

/* Scrollbar HIDDEN — when admin toggles off */
.wk-pg-thumbs.hide-scrollbar {
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.wk-pg-thumbs.hide-scrollbar::-webkit-scrollbar { display: none; }

.wk-pg-thumb {
    width: 100%;
    aspect-ratio: 1 / 1;
    flex-shrink: 0;
    border-radius: 1.65px;
    overflow: hidden;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}
.wk-pg-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.25s; }
.wk-pg-thumb:hover img { transform: scale(1.05); }
.wk-pg-thumb.is-active { border-color: #c8860a; }
.wk-pg-thumb:focus-visible { outline: 2px solid #c8860a; outline-offset: 2px; }

/* ── RIGHT: Full image stack — ALL images live here, in order.
   Position 0 (.is-main) is always the big slot; every other position
   is always the small slot. Only the CONTENT at each position changes
   on drag/click — the slot heights never move. Clipped viewport shows
   ~2 slots; there's no scroll here — dragging (or picking a left
   thumb) is the only way to bring another image up. ── */
.wk-pg-stack {
    display: flex;
    flex-direction: column;
    gap: var(--wk-pg-gap);
    width: 100%;
    flex: 1 1 auto;
}

.wk-pg-stack-item {
	height:auto!important;
    position: relative;
    width: 100%;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background-color: #f9f6f1;
    height: var(--wk-pg-secondary-h) !important;
    cursor: grab;
    outline: 3px dashed transparent;
    outline-offset: -3px;
    transition: outline-color 0.15s ease;
}

.wk-pg-stack-item.is-main {
    height: 100%;
}

.wk-pg-stack-item:active { cursor: grabbing; }
.wk-pg-stack-item:focus-visible { outline-color: #c8860a; outline-style: solid; }

.wk-pg-stack-item-img {
    width: 100%; height: 100%!important; object-fit: contain;
    transition: opacity 0.18s ease;
}

/* ════════════════════════════════════════
   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;
        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: 72px;
        border-radius: 1.65px;
        overflow: hidden;
        border: 2px solid transparent;
        transition: border-color 0.2s;
        background: #f0ece4;
    }
    .wk-pg-carousel-thumb img { width: 100%; height: 100%; object-fit: cover; }
    .wk-pg-carousel-thumb.is-active { border-color: #c8860a; }
}

/* ── Drag & Drop states ── */
.wk-pg-thumb {
    cursor: grab;
}
.wk-pg-thumb:active { cursor: grabbing; }
.wk-pg-thumb.is-dragging {
    opacity: 0.4;
}

.wk-pg-stack-item.is-dragging {
    opacity: 0.4;
}

.wk-pg-stack-item.is-drag-over {
    outline-color: #c8860a;
}

/* ═══════════════════════════════════════════════════════════════
   WK Product Gallery — CSS-only patch
   Paste this in Elementor: widget → Advanced → Custom CSS
   (or page/site Custom CSS). No plugin reinstall needed.
   ═══════════════════════════════════════════════════════════════ */

/* 1) Only ever show 2 images on the right (big + small).
      Any extra ones already in the markup are simply hidden —
      still there for drag, just not visible/taking up space. */
.wk-pg-stack-item:nth-child(n+3) {
    display: none !important;
}

/* 2) Shape (not literal px height) — this is what actually makes it
      look the same whether the column renders at 500px or 7000px
      wide. Adjust the two ratios below if you want a different
      proportion (keep the "W / H" format, e.g. 4/5, 16/9, 1/1...). */
.wk-pg-stack-item {
    height: auto !important;
    aspect-ratio: 2 / 1 !important;   /* small slot shape */
}
.wk-pg-stack-item.is-main {
    aspect-ratio: 1 / 1 !important;   /* big slot shape */
}

/* 3) Image always fully fills its slot, no cropping oddities,
      no stretch — consistent at any width. */
.wk-pg-stack-item img,
.wk-pg-stack-item-img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
}

/* 4) Container just wraps its 2 visible children — no fixed height,
      no scroll, no clipping math needed. */
.wk-pg-stack {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
}

/* 5) Left thumbnail column: not tied to the stack's height — shows
      every thumbnail, only scrolls if the list genuinely doesn't
      fit the viewport. */
.wk-pg-thumbs {
    height: auto !important;
    max-height: 100vh !important;
    overflow-y: auto !important;
}