/* ============================================================================
   PAGE — Éditorial
   Galerie en colonnes, photos en grand format, panneau verrouillé.
   ============================================================================ */

#gallery-container {
    display: none;
}

#gallery-container.active-section {
    display: block;
}

.masonry-grid {
    display: grid;                                           /* colonnes et lignes de 4 px : voir layoutGallery (js/*.js) */
    grid-auto-flow: row dense;                               /* (les photos sont placées une à une par layoutGallery : colonne et lignes explicites) */
    align-items: start;
    column-gap: var(--gallery-gap);
    max-width: 1920px;
    margin: 0 auto calc(-1 * var(--gallery-gap));            /* la dernière photo compte déjà l'écart du bas : on le retire */
}

/* Éditorial (main et sections : toutes) — Zone de contenu et galerie en colonnes */

.masonry-item {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    background: #f6f6f6;
    aspect-ratio: 4 / 5;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
}

.masonry-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0;
    transition: opacity 0.25s ease;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.masonry-item img.loaded {
    opacity: 1;
}

/* Éditorial (galerie) — Panneau qui verrouille la suite de la galerie (flèche vers le bas,
   deux messages « Afficher plus de photos » | « Découvrir ma Méthode ») */

.gallery-lock {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 1920px;
    margin: var(--gallery-gap) auto 0;
    transition: opacity var(--move-time) ease, transform var(--move-time) cubic-bezier(0.33, 0, 0.2, 1);   /* garder GALLERY_UNLOCK_MS de js/*.js ~ égal */
}

.gallery-lock.is-opening {
    opacity: 0;
    transform: translateY(5vh);           /* la barre descend en s'effaçant */
    pointer-events: none;
}

/* « prefers-reduced-motion » : on garde le fondu, sans déplacement */

@media (prefers-reduced-motion: reduce) {
    .gallery-lock {
        transition-duration: var(--move-time) !important;
    }
    .gallery-lock.is-opening {
        transform: none;
    }
}

.gallery-lock-arrow {
    display: flex;
    margin: 0;
    padding: 4px 12px;
    background: none;
    border: 0;
    color: var(--text-color);
    cursor: pointer;
    touch-action: manipulation;
    transition: transform 0.35s ease;
}

.gallery-lock-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    margin-top: 6px;
}

.gallery-lock-btn {
    position: relative;
    display: inline-block;
    padding: 0.55em 0 0.55em 1.15em;
    margin: 0 0 0 1.15em;
    background: none;
    border: 0;
    border-radius: 0;
    color: var(--text-color);
    font-family: var(--font-home);
    font-size: 0.95rem;
    font-weight: 400;
    line-height: 1.2;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-appearance: none;
    appearance: none;
}

.gallery-lock-btn:first-child {
    padding-left: 0;
    margin-left: 0;
}

/* Barre « | » fine entre les deux messages */

.gallery-lock-btn + .gallery-lock-btn::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 1px;
    height: 0.95em;
    transform: translateY(-50%);
    background: var(--text-color);
}

/* Souligné fin qui se déploie au survol */

.gallery-lock-btn::after {
    content: '';
    position: absolute;
    left: 1.15em;
    right: 0;
    bottom: 0.2em;
    height: 1px;
    background: var(--text-color);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.35s ease;
}

.gallery-lock-btn:first-child::after {
    left: 0;
}

@media (hover: hover) {
    .gallery-lock-btn:hover::after {
        transform: scaleX(1);
    }
    .gallery-lock-arrow:hover {
        transform: translateY(3px);
    }
}

.gallery-lock-btn:focus-visible,
.gallery-lock-arrow:focus-visible {
    outline: 2px solid var(--focus-color);
    outline-offset: 2px;
}

.gallery-lock-btn:focus-visible::after {
    transform: scaleX(1);
}

/* Mobile : les deux messages l'un sous l'autre, sans barre */

@media (max-width: 768px) {
    .gallery-lock-actions {
        flex-direction: column;
    }
    .gallery-lock-btn,
    .gallery-lock-btn:first-child {
        padding-left: 0;
        margin-left: 0;
        font-size: 0.85rem;
    }
    .gallery-lock-btn + .gallery-lock-btn::before {
        display: none;
    }
    .gallery-lock-btn::after,
    .gallery-lock-btn:first-child::after {
        left: 0;
    }
}

@media print {
    .masonry-item {
        break-inside: avoid;
    }
}

/* Éditorial (main et sections : toutes) — Zone de contenu et galerie en colonnes */

@media (prefers-reduced-motion: reduce) {
    .masonry-item img {
        transition: none;
    }
}

/* ==========================================================================
   Éditorial : ouverture animée de la visionneuse (plus d'effet au survol ni au clic maintenu sur les photos)
   - au relâchement du clic, js/*.js (openLightbox) déplace et agrandit la photo de la grille jusqu'à sa place dans la visionneuse
     (400 ms) ; pendant ce déplacement (.is-flying) le titre, la description et les boutons sont à 0 %, puis ils apparaissent
     de 0 à 100 % en 200 ms
   ========================================================================== */

.masonry-item.lb-source-hidden img { visibility: hidden; }

@keyframes shimmer {
    from { transform: translateX(-100%); }
    to { transform: translateX(100%); }
}
