/* ==========================================================================
   LIGE Artist — visionneuse (agrandir une photo au clic)
   Volontairement neutre : le voile est noir parce qu'une image se regarde sur
   du noir, le reste s'en remet à currentColor et au thème.
   ========================================================================== */

.ligea-zoomable {
    cursor: zoom-in;
}

.ligea-lightbox-open {
    overflow: hidden;
}

.ligea-lightbox {
    position: fixed;
    inset: 0;
    z-index: 100000; /* au-dessus de la barre d'admin, qui est à 99999 */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: clamp(1rem, 4vw, 3rem);
    background: rgba(0, 0, 0, 0.94);
}

.ligea-lightbox[hidden] {
    display: none;
}

.ligea-lightbox__figure {
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    max-width: 100%;
    max-height: 100%;
}

/*
 * Un article de presse scanné se lit de près : il ne doit pas être réduit à la
 * hauteur de l'écran mais pouvoir déborder, quitte à défiler. D'où le scroll
 * sur la figure plutôt qu'un max-height qui rendrait le texte minuscule.
 */
.ligea-lightbox__image {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 8rem);
    width: auto;
    height: auto;
    object-fit: contain;
    background: #000;
}

.ligea-lightbox.is-loading .ligea-lightbox__image {
    opacity: 0.3;
}

.ligea-lightbox__caption {
    color: #f0f0f0;
    font-size: 0.9rem;
    line-height: 1.4;
    text-align: center;
    max-width: 60ch;
    opacity: 0.85;
}

.ligea-lightbox__caption[hidden] {
    display: none;
}

.ligea-lightbox__close,
.ligea-lightbox__nav {
    flex: 0 0 auto;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    line-height: 1;
    transition: background 0.15s ease;
}

.ligea-lightbox__close:hover,
.ligea-lightbox__nav:hover,
.ligea-lightbox__close:focus-visible,
.ligea-lightbox__nav:focus-visible {
    background: rgba(255, 255, 255, 0.22);
}

.ligea-lightbox__close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 2.75rem;
    height: 2.75rem;
    font-size: 1.75rem;
}

.ligea-lightbox__nav {
    width: 3rem;
    height: 3rem;
    font-size: 2rem;
}

.ligea-lightbox__nav[hidden] {
    display: none;
}

.ligea-lightbox__counter {
    position: absolute;
    bottom: 1rem;
    left: 0;
    right: 0;
    margin: 0;
    text-align: center;
    color: #f0f0f0;
    font-size: 0.8rem;
    opacity: 0.6;
}

.ligea-lightbox__counter[hidden] {
    display: none;
}

/*
 * Sur un téléphone, les flèches prendraient la place de l'image : elles passent
 * sous elle, en bas, où le pouce les atteint.
 */
@media (max-width: 600px) {
    .ligea-lightbox {
        flex-wrap: wrap;
        padding: 3.5rem 0.5rem 4.5rem;
    }

    .ligea-lightbox__figure {
        order: -1;
        flex: 1 0 100%;
    }

    .ligea-lightbox__image {
        max-height: calc(100vh - 12rem);
    }
}

/*
 * Le lien qu'ajoutent les gabarits de galerie. Sans display:block il resterait
 * en ligne et la vignette carrée perdrait sa place dans la grille.
 */
.la-gallery-item a {
    display: block;
    width: 100%;
    height: 100%;
    line-height: 0;
}

/*
 * Connecté, WordPress pose sa barre en haut de l'écran. Le bouton Fermer
 * tombait dessous : le clic passait bien - la visionneuse est au-dessus - mais
 * on croyait viser la barre. Il descend sous elle.
 */
body.admin-bar .ligea-lightbox__close {
    top: 3rem;
}

@media screen and (max-width: 782px) {
    body.admin-bar .ligea-lightbox__close {
        top: 3.75rem;
    }
}
