.vvpg {
    --vvpg-desktop-height: 520px;
    --vvpg-radius: 8px;
    --vvpg-border: #ececec;
    --vvpg-thumb-size: 76px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 0 0 20px;
}

/* Hide the native WooCommerce gallery only when our replacement is present. */
body.vvpg-active-gallery.single-product .woocommerce-product-gallery {
    display: none !important;
}

.vvpg *,
.vvpg *::before,
.vvpg *::after {
    box-sizing: border-box;
}

.vvpg__stage {
    position: relative;
    width: 100%;
    height: var(--vvpg-desktop-height);
    min-height: 280px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid var(--vvpg-border);
    border-radius: var(--vvpg-radius);
    outline: none;
}

.vvpg__stage:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 3px;
}

.vvpg__image-button {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0 !important;
    border-radius: inherit;
    background: transparent !important;
    box-shadow: none !important;
    appearance: none;
    -webkit-appearance: none;
    overflow: hidden;
    cursor: zoom-in;
}

.vvpg__image-frame {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 8px;
    overflow: hidden;
}

.vvpg__main-image {
    display: block;
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    object-position: center center;
    margin: 0 auto !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 4px;
    box-shadow: none !important;
    transform: scale(1);
    transform-origin: 50% 50%;
    transition: transform 180ms ease-out, opacity 140ms ease;
    user-select: none;
    -webkit-user-drag: none;
    will-change: transform;
}

.vvpg__main-image.vvpg__main-image--switching {
    opacity: .35;
}

@media (hover: hover) and (pointer: fine) {
    .vvpg__image-button.vvpg__image-button--zooming .vvpg__main-image {
        transition: transform 70ms linear;
    }
}

.vvpg__arrow {
    position: absolute;
    top: 50%;
    z-index: 4;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    margin: 0;
    border: 0 !important;
    border-radius: 999px !important;
    background: rgba(20, 20, 20, .46) !important;
    color: #fff !important;
    box-shadow: none !important;
    transform: translateY(-50%);
    cursor: pointer;
    opacity: .9;
    transition: background 150ms ease, opacity 150ms ease;
}

.vvpg__arrow:hover,
.vvpg__arrow:focus-visible {
    background: rgba(20, 20, 20, .78) !important;
    opacity: 1;
}

.vvpg__arrow--prev { left: 12px; }
.vvpg__arrow--next { right: 12px; }
.vvpg__arrow[hidden] { display: none !important; }

.vvpg__zoom-hint {
    position: absolute;
    z-index: 3;
    top: 12px;
    right: 12px;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 2px 10px rgba(0,0,0,.10);
    pointer-events: none;
}

.vvpg__zoom-hint svg {
    width: 20px;
    height: 20px;
    fill: #1d1d1f;
}

.vvpg__thumbs {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin-top: 14px;
    padding: 0 1px 4px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    overscroll-behavior-inline: contain;
}

.vvpg__thumb {
    flex: 0 0 var(--vvpg-thumb-size);
    width: var(--vvpg-thumb-size);
    height: var(--vvpg-thumb-size);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 4px !important;
    border: 1px solid #e2e2e2 !important;
    border-radius: 5px !important;
    background: #fff !important;
    box-shadow: none !important;
    cursor: pointer;
    opacity: .78;
    transition: border-color 140ms ease, opacity 140ms ease, box-shadow 140ms ease;
}

.vvpg__thumb:hover,
.vvpg__thumb:focus-visible,
.vvpg__thumb[aria-current="true"] {
    opacity: 1;
    border-color: #777 !important;
}

.vvpg__thumb[aria-current="true"] {
    box-shadow: inset 0 0 0 1px #777 !important;
}

.vvpg__thumb img {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    object-position: center;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 3px;
    box-shadow: none !important;
    pointer-events: none;
}

/* Lightbox */
.vvpg-lightbox-open {
    overflow: hidden !important;
}

.vvpg-lightbox {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, .90);
    opacity: 0;
    visibility: hidden;
    transition: opacity 160ms ease, visibility 160ms ease;
}

.vvpg-lightbox.is-open {
    opacity: 1;
    visibility: visible;
}

.vvpg-lightbox__image {
    display: block;
    max-width: min(94vw, 1600px) !important;
    max-height: 90vh !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 4px;
    box-shadow: 0 16px 60px rgba(0,0,0,.32) !important;
}

.vvpg-lightbox__close,
.vvpg-lightbox__nav {
    position: absolute;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 999px !important;
    background: rgba(255,255,255,.14) !important;
    color: #fff !important;
    box-shadow: none !important;
    cursor: pointer;
}

.vvpg-lightbox__close {
    top: 18px;
    right: 18px;
    width: 44px;
    height: 44px;
    font-size: 30px;
    line-height: 1;
}

.vvpg-lightbox__nav {
    top: 50%;
    width: 46px;
    height: 46px;
    transform: translateY(-50%);
    font-size: 24px;
}

.vvpg-lightbox__nav--prev { left: 18px; }
.vvpg-lightbox__nav--next { right: 18px; }
.vvpg-lightbox__nav[hidden] { display: none !important; }

.vvpg-lightbox__close:hover,
.vvpg-lightbox__close:focus-visible,
.vvpg-lightbox__nav:hover,
.vvpg-lightbox__nav:focus-visible {
    background: rgba(255,255,255,.26) !important;
}

@media (max-width: 980px) {
    .vvpg__stage {
        height: min(56vw, 470px);
        min-height: 360px;
    }
}

@media (max-width: 767px) {
    .vvpg {
        --vvpg-thumb-size: 66px;
    }

    .vvpg__stage {
        height: min(105vw, 430px);
        min-height: 320px;
    }

    .vvpg__image-frame {
        padding: 6px;
    }

    .vvpg__arrow {
        width: 34px;
        height: 34px;
    }

    .vvpg__arrow--prev { left: 8px; }
    .vvpg__arrow--next { right: 8px; }

    .vvpg__zoom-hint {
        width: 34px;
        height: 34px;
        top: 8px;
        right: 8px;
    }

    .vvpg-lightbox {
        padding: 12px;
    }

    .vvpg-lightbox__close {
        top: 10px;
        right: 10px;
    }

    .vvpg-lightbox__nav--prev { left: 8px; }
    .vvpg-lightbox__nav--next { right: 8px; }
}

@media (hover: none), (pointer: coarse) {
    .vvpg__zoom-hint {
        display: none;
    }

    .vvpg__image-button {
        cursor: pointer;
    }
}

@media (prefers-reduced-motion: reduce) {
    .vvpg__main-image,
    .vvpg__arrow,
    .vvpg__thumb,
    .vvpg-lightbox {
        transition: none !important;
    }
}
