.store-image-popup {
    position: fixed;
    inset: 0;
    z-index: 2147481000;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: clamp(12px, 4vw, 40px);
    background: rgba(15, 23, 42, .66);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    opacity: 0;
    visibility: hidden;
    overflow: auto;
    overscroll-behavior: contain;
    transition: opacity .28s ease, visibility .28s ease;
}

.store-image-popup *,
.store-image-popup *::before,
.store-image-popup *::after {
    box-sizing: border-box;
}

.store-image-popup.is-open {
    opacity: 1;
    visibility: visible;
}

.store-image-popup__dialog {
    position: relative;
    width: min(100%, var(--store-popup-width, 720px));
    max-width: min(100%, calc(100vw - 24px));
    max-height: calc(100dvh - clamp(24px, 8vw, 80px));
    margin: auto;
    line-height: 0;
    transform: translate3d(0, 16px, 0) scale(.98);
    transition: transform .32s cubic-bezier(.22, 1, .36, 1);
}

.store-image-popup.is-open .store-image-popup__dialog {
    transform: translate3d(0, 0, 0) scale(1);
}

.store-image-popup__image {
    display: block;
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: calc(100dvh - clamp(24px, 8vw, 80px));
    border-radius: clamp(14px, 2vw, 22px);
    object-fit: contain;
    box-shadow: 0 28px 80px rgba(15, 23, 42, .32);
}

.store-image-popup__close {
    position: absolute;
    top: -14px;
    right: -14px;
    z-index: 2;
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: #fff;
    color: #111827;
    font-size: 20px;
    line-height: 1;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .2);
    cursor: pointer;
    transition: transform .18s ease, background-color .18s ease;
}

.store-image-popup__close:hover {
    background: #f8fafc;
    transform: scale(1.06);
}

.store-image-popup__close:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--primary-color, #2563eb) 35%, transparent);
    outline-offset: 3px;
}

html.store-popup-open,
body.store-popup-open {
    overflow: hidden;
    overscroll-behavior: none;
}

body.store-popup-open {
    touch-action: none;
}

@media (max-width: 767.98px) {
    .store-image-popup {
        padding: max(10px, env(safe-area-inset-top, 0px))
                 max(10px, env(safe-area-inset-right, 0px))
                 max(10px, env(safe-area-inset-bottom, 0px))
                 max(10px, env(safe-area-inset-left, 0px));
        align-items: center;
        justify-content: center;
    }

    .store-image-popup__dialog {
        width: min(100%, calc(100vw - 20px)) !important;
        max-width: calc(100vw - 20px) !important;
        max-height: calc(100dvh - 20px);
        transform: none;
    }

    .store-image-popup.is-open .store-image-popup__dialog {
        transform: none;
    }

    .store-image-popup__image {
        width: 100% !important;
        height: auto !important;
        max-width: 100% !important;
        max-height: calc(100dvh - 20px);
        border-radius: 14px;
    }

    .store-image-popup__close {
        top: 8px;
        right: 8px;
        width: 40px;
        height: 40px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .store-image-popup,
    .store-image-popup__dialog {
        transition: none;
    }
}
