/* Visionneuse d'images (lightbox.js) : modale plein écran, image toujours contenue dans l'écran. */
.lightbox-link {
    display: block;
    cursor: zoom-in;
}
.lightbox-link:focus-visible {
    outline: 3px solid var(--orange);
    outline-offset: 3px;
    border-radius: var(--radius-card);
}
html:has(dialog.lightbox[open]) {
    overflow: hidden;
}
dialog.lightbox {
    box-sizing: border-box;
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
    margin: 0;
    padding: var(--space-4);
    border: 0;
    background: transparent;
    color: #fff;
}
dialog.lightbox[open] {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--space-3);
}
dialog.lightbox::backdrop {
    background: rgb(0 0 0 / 0.88);
}
.lightbox__figure {
    display: grid;
    justify-items: center;
    gap: var(--space-3);
    min-width: 0;
    margin: 0;
}
.lightbox__img {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 8rem);
    max-height: calc(100dvh - 8rem);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: var(--radius-card);
}
.lightbox__caption {
    text-align: center;
    font-size: 0.875rem;
}
.lightbox__btn {
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    padding: 0;
    border: 1px solid rgb(255 255 255 / 0.4);
    border-radius: 50%;
    background: rgb(0 0 0 / 0.5);
    color: #fff;
    font: 400 2rem/1 sans-serif;
    cursor: pointer;
}
.lightbox__btn:hover {
    background: rgb(255 255 255 / 0.2);
}
.lightbox__btn:focus-visible {
    outline: 3px solid var(--orange);
    outline-offset: 2px;
}
.lightbox__btn[hidden] {
    display: none;
}
.lightbox__close {
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
    z-index: 1;
}
@media (max-width: 640px) {
    /* Petit écran : l'image prend toute la largeur, les flèches passent en bas. */
    dialog.lightbox[open] {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: minmax(0, 1fr) auto;
        align-content: center;
    }
    .lightbox__figure {
        grid-column: 1 / -1;
        grid-row: 1;
    }
    .lightbox__nav--prev {
        grid-row: 2;
        justify-self: start;
    }
    .lightbox__nav--next {
        grid-row: 2;
        grid-column: 2;
        justify-self: end;
    }
    .lightbox__img {
        max-height: calc(100dvh - 9rem);
    }
}
