/* ============================================================================
   COMPOSANT — Visionneuse d’images plein écran
   Utilisée par les pages Éditorial et Éditorial II.
   ============================================================================ */

/* Éditorial (visionneuse) — Visionneuse plein écran */

.lightbox {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: var(--z-lightbox);
    background-color: var(--bg-color);
    justify-content: center;
    align-items: center;
    padding: 40px var(--lb-side);
    touch-action: manipulation;
}

.lightbox.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.lightbox [tabindex="-1"] {
    outline: none;
}

/* Éditorial (visionneuse) — Visionneuse plein écran */

.lightbox-figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: 100%;
}

.lightbox-figure img {
    /*
    Change ici la taille des photos dans la galerie en casde zoom
    max-width: 76vw;
    max-height: 74vh;
    */
    max-width: calc(100vw - 2 * var(--lb-side));
    max-height: 90vh;
    object-fit: contain;
    box-shadow: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.lightbox-caption {
    margin-top: 24px;
    max-width: 70vw;
    text-align: center;
    color: var(--text-color);
    font-size: 0.72rem;
    letter-spacing: 0.35em;
    text-transform: uppercase;
    line-height: 1.8;
    pointer-events: none;
    overflow-wrap: break-word;
}

.lightbox-caption:empty {
    display: none;
}

/* Titre en gras, puis sous-titre (liste des partenaires) plus léger */

.lightbox-title {
    display: block;
    font-weight: 700;
}

.lightbox-subtitle {
    display: block;
    margin-top: 0.7em;
    font-size: 0.85em;
    font-weight: 400;
    color: var(--text-muted-strong);
}

.lightbox-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 32px;
    height: 32px;
    margin: -16px 0 0 -16px;
    border: 2px solid #e5e5e5;
    border-top-color: var(--text-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.lightbox.is-loading .lightbox-loader {
    opacity: 1;
}

.close-lightbox {
    position: absolute;
    top: 20px;
    right: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    padding: 0;
    opacity: 1;
    z-index: 2;
    touch-action: manipulation;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.close-lightbox:focus,
.close-lightbox:focus-visible {
    outline: none;
}

.close-lightbox svg {
    display: block;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 72px;
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    padding: 0;
    opacity: 1;
    user-select: none;
    z-index: 2;
    touch-action: manipulation;
    outline: none;
}

.lightbox-nav:focus,
.lightbox-nav:focus-visible {
    outline: none;
}

/* Éditorial (visionneuse) — Visionneuse plein écran */

.lightbox-nav svg {
    display: block;
}

.lightbox-prev {
    left: 15px;
}

.lightbox-next {
    right: 15px;
}

.tap-zone {
    display: none;
}

@media print {
    .lightbox {
        display: none !important;
    }
}

.close-lightbox:focus-visible, .lightbox-nav:focus-visible {
    outline: 2px solid var(--focus-color);
    outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
    .lightbox-loader {
        animation: none;
    }
    .lightbox-nav, .close-lightbox {
        transition: none;
    }
    .lightbox.active {
        animation: none;
    }
}

@media (max-width: 768px) {
    .lightbox {
        padding: 56px 16px 100px;
    }
    .close-lightbox {
        top: 4px;
        right: 8px;
        width: 44px;
        height: 44px;
        z-index: 4;
    }
    .lightbox-figure img {
        max-width: 92vw;
        max-height: 60vh;
        box-shadow: none;
    }
    .lightbox-caption {
        margin-top: 14px;
        font-size: 0.7rem;
        letter-spacing: 0.25em;
        max-width: 86vw;
    }
    .lightbox-nav {
        top: auto;
        bottom: calc(10px + env(safe-area-inset-bottom, 0px));
        transform: none;
        width: 64px;
        height: 56px;
        z-index: 4;
    }
    .lightbox-prev {
        left: calc(50% - 82px);
    }
    .lightbox-next {
        right: calc(50% - 82px);
    }
    .tap-zone {
        display: block;
        position: absolute;
        top: 56px;
        bottom: 0;
        width: 30vw;
        z-index: 3;
    }
    .tap-prev {
        left: 0;
    }
    .tap-next {
        right: 0;
    }
}

/* Éditorial (visionneuse) — Visionneuse plein écran */

@media (max-height: 480px) {
    .lightbox {
        padding: 48px 14px 92px;
    }
    .lightbox-figure img {
        max-height: 50vh;
    }
    .lightbox-caption {
        margin-top: 8px;
    }
    .tap-zone {
        top: 48px;
    }
    .close-lightbox {
        top: 2px;
    }
}

/* Écran large mais bas (téléphone en paysage) : les flèches restent sur les côtés, la bande blanche aussi */

@media (max-height: 480px) and (min-width: 769px) {
    .lightbox {
        padding-left: var(--lb-side);
        padding-right: var(--lb-side);
    }
}

/* Barre de navigation, logo, sélecteur FR/EN, menu burger */

@media (max-width: 360px) {
    .lightbox-prev {
        left: calc(50% - 70px);
    }
    .lightbox-next {
        right: calc(50% - 70px);
    }
}

.lightbox.active.fly-open { animation: lbBgIn 400ms cubic-bezier(0.33, 0, 0.2, 1) both; }

/* seul le fond se fond : la photo, elle, voyage à pleine opacité (classe gardée jusqu'à la fermeture : sinon l'animation « fadeIn » repartirait) */

.lightbox.is-flying .lightbox-caption,
.lightbox.is-flying .close-lightbox,
.lightbox.is-flying .lightbox-nav { opacity: 0; }

/* Éditorial (visionneuse) — Visionneuse plein écran */

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes lbBgIn {
    from { background-color: rgb(253 255 255 / 0); }
    to   { background-color: rgb(253 255 255); }
}
