/* Screenshot lightbox (product pages). Markup + behavior: src/partials/lightbox.html */

#platform-preview img { cursor: zoom-in; }

.lb {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: none;
    background: rgba(0, 0, 0, 0.9);
}
.lb.open { display: block; }

/* The scroll pane holds the image; it scrolls when the image is taller or wider than the window. */
.lb-scroll {
    position: absolute;
    inset: 0;
    overflow: auto;
    /* Equal top/bottom padding (room for the controls) keeps a short image centered in the window itself. */
    padding: 56px 16px;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
}

/* Fit: the whole image fits inside the window, never wider than the window or its native width (no
   upscaling blur) and never taller than the window (112px = the pane's 56px top + bottom padding).
   Without the height cap, a square screenshot at full window width is taller than the window. */
/* margin:auto centers the image both ways when it is smaller than the pane. When it is larger the auto
   margins collapse to zero, so it starts at the top-left and scrolls (unlike justify-content:center,
   which would push the top of a tall image out of reach). */
.lb-img {
    display: block;
    flex: none;
    margin: auto;
    width: auto;
    height: auto;
    max-width: min(100%, var(--lb-native, 1440px));
    max-height: calc(100vh - 112px);
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    cursor: zoom-in;
}

/* Zoom: wider than the window on purpose; the pane scrolls/pans. */
.lb.zoomed .lb-img {
    width: max(175%, min(var(--lb-native, 1440px), 250%));
    max-width: none;
    max-height: none;
    cursor: zoom-out;
}

.lb-close {
    position: fixed;
    top: 10px;
    right: 18px;
    z-index: 2;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.85);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}
.lb-close:hover { background: rgba(255, 255, 255, 0.25); color: #fff; }

.lb-hint {
    position: fixed;
    top: 20px;
    left: 0;
    right: 0;
    text-align: center;
    pointer-events: none;
    padding: 0 72px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
}

.lb-count {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 2;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    font-variant-numeric: tabular-nums;
}

.lb-nav {
    position: fixed;
    top: 50%;
    z-index: 2;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border: 0;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
}
.lb-nav:hover { background: rgba(255, 255, 255, 0.3); }
.lb-nav svg { width: 24px; height: 24px; }
.lb-prev { left: 14px; }
.lb-next { right: 14px; }

/* a page with only one screenshot has nothing to browse */
.lb.single .lb-nav,
.lb.single .lb-count { display: none; }

@media (max-width: 640px) {
    .lb-nav { width: 40px; height: 40px; }
    .lb-nav svg { width: 20px; height: 20px; }
    .lb-prev { left: 8px; }
    .lb-next { right: 8px; }
}
