/* Sewandgrow — Accessory image preview lightbox.
   Gated by body.sng-compact-addons so the kill-switch also disables this. */

/* Magnifier hint overlay on the thumbnail. The picture wrapper div has no class
   in WAPF's markup; the JS adds `sng-swatch-thumb` to it on enhancement. */
body.sng-compact-addons .wapf-field-multi-image-swatch .sng-swatch-thumb {
    position: relative;
    cursor: zoom-in;
    transition: transform 120ms ease, filter 120ms ease;
    /* The wrapper is a flex item of label; keep its size fixed to the image. */
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
}

body.sng-compact-addons .wapf-field-multi-image-swatch .sng-swatch-thumb::after {
    content: "";
    position: absolute;
    bottom: -3px;
    right: -3px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: #ee8585;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='6.5' cy='6.5' r='3.4' fill='none' stroke='white' stroke-width='1.4'/%3E%3Cline x1='9.2' y1='9.2' x2='12.5' y2='12.5' stroke='white' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 10px 10px;
    box-shadow: 0 0 0 1.5px #fff;
    pointer-events: none; /* clicks pass through to .sng-swatch-thumb */
    opacity: .92;
    transition: opacity 120ms ease, transform 120ms ease;
}

/* Desktop hover: brighten + tiny scale to telegraph tappability */
@media (hover: hover) {
    body.sng-compact-addons .wapf-field-multi-image-swatch .sng-swatch-thumb:hover {
        transform: scale(1.06);
        filter: brightness(1.04);
    }
    body.sng-compact-addons .wapf-field-multi-image-swatch .sng-swatch-thumb:hover::after {
        opacity: 1;
        transform: scale(1.1);
    }
}

/* ============== MODAL ============== */

.sng-img-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.sng-img-modal.is-open {
    display: flex;
    animation: sng-modal-fade .18s ease;
}

@keyframes sng-modal-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.sng-img-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(61, 61, 61, .55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.sng-img-modal__box {
    position: relative;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: sng-modal-pop .22s cubic-bezier(.32, .72, .36, 1.1);
}

@keyframes sng-modal-pop {
    from { opacity: 0; transform: translateY(8px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.sng-img-modal__img-wrap {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #faf7f3;
    padding: 28px 24px 16px;
    min-height: 220px;
    overflow: hidden;
}

.sng-img-modal__img {
    max-width: 100%;
    max-height: calc(80vh - 130px);
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.sng-img-modal__meta {
    flex: 0 0 auto;
    padding: 14px 22px 22px;
    text-align: center;
    border-top: 1px solid #ece8e4;
}

.sng-img-modal__name {
    font-family: 'Poppins', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: #3d3d3d;
    letter-spacing: -.005em;
    line-height: 1.3;
}

.sng-img-modal__code {
    font-family: 'Kalam', 'Poppins', system-ui, sans-serif;
    font-size: 14px;
    font-weight: 400;
    color: #ee8585;
    margin-top: 4px;
    letter-spacing: .03em;
}

.sng-img-modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #faf7f3;
    color: #3d3d3d;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 300;
    line-height: 1;
    z-index: 2;
    transition: background-color .15s ease, color .15s ease, transform .15s ease;
}

.sng-img-modal__close:hover,
.sng-img-modal__close:focus-visible {
    background: #ee8585;
    color: #fff;
    transform: rotate(90deg);
    outline: none;
}

.sng-img-modal__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #fff;
    color: #3d3d3d;
    border: 1.5px solid #ece8e4;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 300;
    line-height: 1;
    z-index: 2;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

.sng-img-modal__nav:hover,
.sng-img-modal__nav:focus-visible {
    background: #ee8585;
    color: #fff;
    border-color: #ee8585;
    outline: none;
}

.sng-img-modal__nav--prev {
    left: -54px;
}

.sng-img-modal__nav--next {
    right: -54px;
}

/* Mobile: arrows tuck inside the modal at the bottom corners */
@media (max-width: 640px) {
    .sng-img-modal {
        padding: 12px;
    }
    .sng-img-modal__box {
        max-height: 96vh;
        border-radius: 14px;
    }
    .sng-img-modal__img {
        max-height: calc(80vh - 160px);
    }
    .sng-img-modal__nav--prev { left: 12px; }
    .sng-img-modal__nav--next { right: 12px; }
    .sng-img-modal__nav {
        bottom: 14px;
        top: auto;
        transform: none;
    }
    .sng-img-modal__meta {
        padding: 12px 60px 18px; /* leave room for nav buttons */
    }
}

/* Lock body scroll when modal open */
body.sng-img-modal-open {
    overflow: hidden;
}
