/* ==========================================================
   Sun Stories – Product Gallery
   ========================================================== */

.ssc-product-gallery {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    width: 100%;
    max-width: 100%;
}

/* ── Thumbnails column ────────────────────────────────── */

.ssc-gallery-thumbs-wrap {
    flex-shrink: 0;
    width: 80px;
    max-height: 540px;
    overflow: hidden;
    position: relative;
    margin-left: -96px;
}

.ssc-gallery-thumbs {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    max-height: 540px;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE / Edge */
    scroll-behavior: smooth;
}

.ssc-gallery-thumbs::-webkit-scrollbar {
    display: none; /* Chrome / Safari */
}

.ssc-gallery-thumb {
    flex-shrink: 0;
    width: 80px !important;
    padding: 0 !important;
    border: 1px solid #f5f5f5 !important;
    border-radius: 0 !important;
    overflow: hidden;
    cursor: pointer !important;
    background: #e8e8e878 !important;
    opacity: 0.7;
    transition: opacity 0.3s ease, border-color 0.3s ease !important;
    aspect-ratio: 4 / 5;
}

.ssc-gallery-thumb.active {
    opacity: 1;
}

.ssc-gallery-thumb:hover {
    opacity: 1;
}

.ssc-gallery-thumb img {
    width: 100%;
    height: 100% !important;
    object-fit: cover;
    display: block;
    border-radius: 0 !important;
}

/* ── Main image area ──────────────────────────────────── */

.ssc-gallery-main {
    flex: 1;
    min-width: 0;
    position: relative;
    overflow: hidden;
    aspect-ratio: 4 / 5;
    /* background: #f5f5f5; */
}

.ssc-gallery-main-track {
    position: relative;
    width: 100%;
    height: 100%;
}

.ssc-gallery-slide {
    position: absolute;
    inset: 0;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
    pointer-events: none;
}

.ssc-gallery-slide.active {
    transform: translateY(0);
    pointer-events: auto;
}

.ssc-gallery-slide.exit-up {
    transform: translateY(-100%);
}

.ssc-gallery-slide.exit-down {
    transform: translateY(100%);
}

.ssc-gallery-slide img {
    width: 100%;
    height: 100% !important;
    object-fit: cover;
    display: block;
}

/* ── Mobile responsive ────────────────────────────────── */

@media (max-width: 768px) {
    /* Force Elementor's shortcode widget chain (scoped to the gallery wrapper)
       to flow normally and size to content. Without this, the widget +
       widget-container collapse to 0 height even though .elementor-shortcode
       itself has height. */
    #sunstories_product_gallery_wrapper .elementor-widget-shortcode,
    #sunstories_product_gallery_wrapper .elementor-widget-shortcode > .elementor-widget-container,
    #sunstories_product_gallery_wrapper .elementor-widget-shortcode .elementor-shortcode {
        display: block !important;
        position: static !important;
        height: auto !important;
        min-height: 0;
        width: 100%;
    }

    .ssc-product-gallery {
        flex-direction: column;
        gap: 0;
        aspect-ratio: auto;
        display: block; /* take it out of flex on mobile entirely */
    }

    .ssc-gallery-thumbs-wrap {
        display: none;
    }

    .ssc-gallery-main {
        flex: none;
        display: block;
        width: 100%;
        height: 0; /* height comes from padding-top */
        aspect-ratio: auto;
        padding-top: 125%; /* 4:5 ratio */
        touch-action: pan-y;
    }

    .ssc-gallery-main-track {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
    }

}
