/* =========================================================
   AESPL SINGLE PRODUCT - PRODUCT GALLERY
========================================================= */


/* =========================================================
   PRODUCT GALLERY
========================================================= */

.aespl-product-gallery {
    width: 100%;
    min-width: 0;
}


/* =========================================================
   GALLERY INNER
========================================================= */

.aespl-gallery-inner {
    display: grid;

    grid-template-columns:
        66px
        minmax(0, 1fr);

    gap: 14px;

    width: 100%;

    align-items: start;

    min-width: 0;
}


/* =========================================================
   THUMBNAIL GALLERY
========================================================= */

.aespl-gallery-thumbnails {
    display: flex;

    flex-direction: column;

    gap: 9px;

    width: 66px;

    /*
     * JS will set this custom property to the exact
     * rendered height of the main image.
     */
    height: var(--aespl-gallery-height, auto);

    min-height: 0;

    overflow-y: auto;
    overflow-x: hidden;

    padding: 0;
    margin: 0;

    box-sizing: border-box;

    /*
     * Hide scrollbar while keeping scrolling active.
     */
    scrollbar-width: none;

    -ms-overflow-style: none;

    overscroll-behavior: contain;

    scroll-behavior: smooth;
}


/* Chrome / Edge / Safari */

.aespl-gallery-thumbnails::-webkit-scrollbar {
    width: 0 !important;
    height: 0 !important;
    display: none !important;
}

.aespl-gallery-thumbnails::-webkit-scrollbar-track {
    background: transparent !important;
}

.aespl-gallery-thumbnails::-webkit-scrollbar-thumb {
    background: transparent !important;
    border: 0 !important;
}


/* =========================================================
   THUMBNAIL ITEM
========================================================= */

.aespl-gallery-thumb {
    position: relative;

    width: 62px;
    height: 62px;

    min-width: 62px;
    min-height: 62px;

    flex: 0 0 62px;

    box-sizing: border-box;

    padding: 3px;

    margin: 0;

    background: #fff;

    /*
     * Equal border on every side.
     */
    border: 1px solid #d6dfdb;

    border-radius: 5px;

    outline: none;

    cursor: pointer;

    overflow: hidden;

    appearance: none;

    -webkit-appearance: none;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.2s ease;
}

.aespl-gallery-thumb:hover {
    border-color: #7d9b91;
}

.aespl-gallery-thumb:focus {
    outline: none;
}

.aespl-gallery-thumb:focus-visible {
    outline: 2px solid #0c604f;
    outline-offset: 2px;
}

.aespl-gallery-thumb.is-active {
    border-color: #0c604f;

    box-shadow:
        0 0 0 1px #0c604f;
}

.aespl-gallery-thumb img {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: cover;

    border: 0;

    border-radius: 3px;

    pointer-events: none;
}


/* =========================================================
   MAIN GALLERY
========================================================= */

.aespl-gallery-main {
    position: relative;

    width: 100%;

    min-width: 0;
}


/* =========================================================
   MAIN IMAGE FRAME
========================================================= */

.aespl-gallery-image-wrap {
    position: relative;

    width: 100%;

    aspect-ratio: 1 / 1;

    background: #fafaf7;

    /*
     * Professional subtle border.
     */
    border: 1px solid #dce3df;

    /*
     * Rounded corners.
     */
    border-radius: 10px;

    overflow: hidden;

    box-sizing: border-box;
}

#aespl-main-product-image {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: contain;

    border: 0;

    border-radius: 9px;

    cursor: zoom-in;

    user-select: none;

    -webkit-user-drag: none;

    transition:
        opacity 0.2s ease,
        transform 0.3s ease;
}


/* =========================================================
   GALLERY ARROWS
========================================================= */

.aespl-gallery-arrow {
    position: absolute;

    top: 50%;

    transform: translateY(-50%);

    width: 38px;
    height: 38px;

    border: none;

    border-radius: 50%;

    background: rgba(255, 255, 255, 0.96);

    color: #174c41;

    display: flex;

    align-items: center;
    justify-content: center;

    padding: 0;

    cursor: pointer;

    box-shadow:
        0 2px 10px rgba(0, 0, 0, 0.08);

    z-index: 3;

    transition:
        background 0.2s ease,
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.aespl-gallery-arrow:hover {
    background: #fff;

    transform:
        translateY(-50%)
        scale(1.05);

    box-shadow:
        0 3px 12px rgba(0, 0, 0, 0.10);
}

.aespl-gallery-arrow:focus {
    outline: none;
}

.aespl-gallery-arrow span {
    display: block;

    font-size: 30px;

    line-height: 1;

    font-weight: 300;
}

.aespl-gallery-prev {
    left: 12px;
}

.aespl-gallery-next {
    right: 12px;
}


/* =========================================================
   FULLSCREEN BUTTON
========================================================= */

.aespl-gallery-fullscreen {
    position: absolute;

    right: 12px;
    bottom: 12px;

    width: 35px;
    height: 35px;

    border: none;

    border-radius: 5px;

    background: rgba(255, 255, 255, 0.94);

    color: #174c41;

    display: flex;

    align-items: center;
    justify-content: center;

    padding: 0;

    cursor: pointer;

    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.08);

    z-index: 3;

    transition:
        background 0.2s ease,
        transform 0.2s ease;
}

.aespl-gallery-fullscreen:hover {
    background: #fff;

    transform: scale(1.04);
}

.aespl-gallery-fullscreen:focus {
    outline: none;
}

.aespl-expand-icon {
    font-size: 19px;

    line-height: 1;
}


/* =========================================================
   MOBILE IMAGE COUNTER
========================================================= */

.aespl-gallery-counter {
    display: none;
}


/* =========================================================
   LIGHTBOX
========================================================= */

.aespl-image-lightbox {
    position: fixed;

    inset: 0;

    z-index: 999999;

    display: none;

    align-items: center;
    justify-content: center;

    padding: 35px;

    background: rgba(8, 28, 24, 0.94);
}

.aespl-image-lightbox.is-open {
    display: flex;
}

#aespl-lightbox-image {
    max-width: min(90vw, 1000px);

    max-height: 88vh;

    object-fit: contain;

    user-select: none;

    -webkit-user-drag: none;
}

.aespl-lightbox-close,
.aespl-lightbox-prev,
.aespl-lightbox-next {
    position: absolute;

    border: 0;

    background: rgba(255, 255, 255, 0.1);

    color: #fff;

    cursor: pointer;

    display: flex;

    align-items: center;
    justify-content: center;

    padding: 0;
}

.aespl-lightbox-close {
    top: 18px;
    right: 20px;

    width: 42px;
    height: 42px;

    border-radius: 50%;

    font-size: 28px;
}

.aespl-lightbox-prev,
.aespl-lightbox-next {
    top: 50%;

    transform: translateY(-50%);

    width: 45px;
    height: 45px;

    border-radius: 50%;

    font-size: 34px;
}

.aespl-lightbox-prev {
    left: 22px;
}

.aespl-lightbox-next {
    right: 22px;
}


/* =========================================================
   TABLET - GALLERY
========================================================= */

@media (max-width: 1024px) {

    .aespl-gallery-inner {
        grid-template-columns:
            62px
            minmax(0, 1fr);

        gap: 12px;
    }

    .aespl-gallery-thumbnails {
        width: 62px;
    }

    .aespl-gallery-thumb {
        width: 58px;
        height: 58px;

        min-width: 58px;
        min-height: 58px;

        flex-basis: 58px;
    }

}


/* =========================================================
   MOBILE - GALLERY
========================================================= */

@media (max-width: 767px) {

    .aespl-gallery-inner {
        display: flex;

        flex-direction: column-reverse;

        gap: 9px;
    }

    .aespl-gallery-main {
        width: 100%;
    }

    .aespl-gallery-image-wrap {
        width: 100%;

        aspect-ratio: 1 / 1;

        border-radius: 8px;
    }


    /* -----------------------------------------
       Mobile Thumbnails
    ----------------------------------------- */

    .aespl-gallery-thumbnails {
        display: flex;

        flex-direction: row;

        width: 100%;

        height: auto !important;

        max-height: none;

        overflow-x: auto;

        overflow-y: hidden;

        gap: 7px;

        padding: 0 0 3px;

        margin: 0;

        scrollbar-width: none;

        -ms-overflow-style: none;

        overscroll-behavior-x: contain;

        scroll-behavior: smooth;
    }

    .aespl-gallery-thumbnails::-webkit-scrollbar {
        display: none !important;

        width: 0 !important;

        height: 0 !important;
    }

    .aespl-gallery-thumb {
        width: 58px;
        height: 58px;

        min-width: 58px;
        min-height: 58px;

        flex: 0 0 58px;
    }


    /* -----------------------------------------
       Gallery Arrows
    ----------------------------------------- */

    .aespl-gallery-arrow {
        width: 34px;
        height: 34px;
    }

    .aespl-gallery-arrow span {
        font-size: 26px;
    }

    .aespl-gallery-prev {
        left: 8px;
    }

    .aespl-gallery-next {
        right: 8px;
    }


    /* -----------------------------------------
       Fullscreen
    ----------------------------------------- */

    .aespl-gallery-fullscreen {
        right: 8px;

        bottom: 8px;

        width: 32px;
        height: 32px;
    }


    /* -----------------------------------------
       Image Counter
    ----------------------------------------- */

    .aespl-gallery-counter {
        position: absolute;

        right: 12px;
        bottom: 12px;

        display: block;

        padding: 4px 8px;

        border-radius: 12px;

        background: rgba(0, 0, 0, 0.48);

        color: #fff;

        font-size: 10px;

        pointer-events: none;
    }


    /* -----------------------------------------
       Lightbox
    ----------------------------------------- */

    .aespl-image-lightbox {
        padding: 20px;
    }

    #aespl-lightbox-image {
        max-width: 94vw;
        max-height: 82vh;
    }

    .aespl-lightbox-prev,
    .aespl-lightbox-next {
        width: 38px;
        height: 38px;

        font-size: 28px;
    }

    .aespl-lightbox-prev {
        left: 10px;
    }

    .aespl-lightbox-next {
        right: 10px;
    }

    .aespl-lightbox-close {
        top: 10px;
        right: 10px;

        width: 38px;
        height: 38px;

        font-size: 24px;
    }

}


/* =========================================================
   SMALL MOBILE - GALLERY
========================================================= */

@media (max-width: 420px) {

    .aespl-gallery-thumb {
        width: 52px;
        height: 52px;

        min-width: 52px;
        min-height: 52px;

        flex-basis: 52px;
    }

}