/* [lma_gallery] — rangées justifiées (à la Google Photos) + lightbox */

.lma-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 2rem 0;
}

.lma-gallery-item {
    position: relative;
    display: block;
    flex-grow: calc(var(--w) / var(--h) * 100);
    flex-basis: calc(var(--w) / var(--h) * 12rem);
    aspect-ratio: var(--w) / var(--h);
    overflow: hidden;
    border-radius: 4px;
    background: #f0ede8;
}

.lma-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease, opacity 0.35s ease;
}

.lma-gallery-item:hover img,
.lma-gallery-item:focus-visible img {
    transform: scale(1.03);
    opacity: 0.92;
}

/* Empêche la dernière rangée de s'étirer démesurément */
.lma-gallery::after {
    content: "";
    flex-grow: 1000000;
}

@media (max-width: 600px) {
    .lma-gallery-item {
        flex-basis: calc(var(--w) / var(--h) * 8rem);
    }
}

/* ---- Lightbox ---- */

.lma-lightbox {
    position: fixed;
    inset: 0;
    z-index: 100001; /* au-dessus du header fixe du thème (100000) */
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 10, 10, 0.92);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.lma-lightbox.is-open {
    opacity: 1;
    pointer-events: auto;
}

.lma-lightbox img {
    max-width: min(92vw, 1400px);
    max-height: 88vh;
    object-fit: contain;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
    border-radius: 4px;
}

.lma-lightbox-btn {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease;
}

.lma-lightbox-btn:hover,
.lma-lightbox-btn:focus-visible {
    background: rgba(255, 255, 255, 0.28);
}

.lma-lightbox-close {
    top: 18px;
    right: 18px;
}

.lma-lightbox-prev {
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
}

.lma-lightbox-next {
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
}

.lma-lightbox-counter {
    position: absolute;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.85rem;
    letter-spacing: 0.08em;
}

@media (max-width: 600px) {
    .lma-lightbox-prev { left: 8px; }
    .lma-lightbox-next { right: 8px; }
    .lma-lightbox img { max-width: 96vw; }
}
