/* The full-screen picture viewer on blog posts (static/js/lightbox.js, the
   <dialog class="lb"> in templates/blog_detail.html). Hand-written with lb-
   class names, so it needs no Tailwind build. The viewer is dark in both
   themes, like a photo viewer. */

[data-lightbox] img.lb-zoomable {
    cursor: zoom-in;
}

/* The page behind stays still while the viewer is open. */
html:has(dialog.lb[open]) {
    overflow: hidden;
}

.lb {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: rgb(10 12 16 / 0.94);
    color: #fff;
}

.lb::backdrop {
    background: transparent;
}

.lb-stage {
    position: absolute;
    inset: 0;
    overflow: hidden;
    touch-action: none;   /* pinching and dragging are handled by lightbox.js */
    cursor: zoom-out;
}

.lb-stage.is-zoomed {
    cursor: grab;
}

.lb-stage.is-dragging {
    cursor: grabbing;
}

.lb-img {
    position: absolute;
    top: 0;
    left: 0;
    max-width: none;
    max-height: none;
    transform-origin: 0 0;
    user-select: none;
    -webkit-user-drag: none;
    cursor: inherit;
}

.lb-stage:not(.is-zoomed) .lb-img {
    cursor: zoom-in;
}

@media (prefers-reduced-motion: no-preference) {
    .lb-img.is-animating {
        transition: transform 0.2s ease;
    }
}

.lb-bar {
    position: absolute;
    top: max(0.75rem, env(safe-area-inset-top));
    inset-inline-end: max(0.75rem, env(safe-area-inset-right));
    display: flex;
    gap: 0.5rem;
}

.lb-btn {
    display: grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    border: 1px solid rgb(255 255 255 / 0.3);
    border-radius: 9999px;
    background: rgb(0 0 0 / 0.55);
    color: #fff;
    cursor: pointer;
}

.lb-btn:hover {
    background: rgb(0 0 0 / 0.8);
}

.lb-btn:focus-visible {
    outline: 3px solid #83d6b3;
    outline-offset: 2px;
}

.lb-btn svg {
    width: 1.25rem;
    height: 1.25rem;
}
