/* Tier-1 click-to-zoom lightbox. Paired with js/imagezoom.js. */

/* Eligible images invite the click (only inside the zoom-enabled containers). */
.post-article img,
.gallery-image-area img {
    cursor: zoom-in;
}

.imgzoom-overlay {
    position: fixed;
    inset: 0;
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2vmin;
    background: rgba(0, 0, 0, 0.85);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    cursor: zoom-out;
}

.imgzoom-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Fill the viewport box and let object-fit scale the image UP (or down) to fit while preserving
   aspect ratio. Using max-width/height alone only shrinks oversized images — it never enlarges a
   source that's already at/below its on-page size, which is why small images "didn't zoom". Note:
   detail is capped by the SOURCE resolution — upscaling a small image makes it bigger but softer. */
.imgzoom-img {
    width: 92vw;
    height: 92vh;
    object-fit: contain;
    transform: scale(0.96);
    transition: transform 0.2s ease;
}

.imgzoom-overlay.show .imgzoom-img {
    transform: scale(1);
}

/* Gallery images: shown at native size, capped SMALLER than blog images (which fill the viewport) so
   high-res store images don't dominate the screen. Tune the two caps below to taste. Note: a cap only
   shrinks oversized images — it never enlarges a genuinely small (e.g. 256p) source, which stays at
   its native size (crisp, but small). */
.imgzoom-overlay.is-gallery .imgzoom-img {
    width: auto;
    height: auto;
    max-width: 60vw;
    max-height: 72vh;
}

/* Gallery prev/next arrows + counter (shown only in gallery mode). */
.imgzoom-prev,
.imgzoom-next {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 1.4rem;
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    cursor: pointer;
}

.imgzoom-prev { left: 1rem; }
.imgzoom-next { right: 1rem; }

.imgzoom-prev:hover,
.imgzoom-next:hover {
    background: rgba(255, 255, 255, 0.2);
}

.imgzoom-counter {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 0.9rem;
    background: rgba(0, 0, 0, 0.5);
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    pointer-events: none; /* clicks pass through to the backdrop → close */
}

.imgzoom-close {
    position: fixed;
    top: 1rem;
    right: 1.25rem;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    line-height: 1;
    font-size: 1.75rem;
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    cursor: pointer;
}

.imgzoom-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Prevent the page behind the lightbox from scrolling while it's open. */
body.imgzoom-lock {
    overflow: hidden;
}
