/* ── Overlay plein écran ── */
#bf-overlay {
    display: none;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: rgba(0, 0, 0, 0.65);
    z-index: 100000000;
    box-sizing: border-box;
}

#bf-overlay.open {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

/* ── Popup : s'adapte à la taille de l'image, centré par flexbox ── */
#bf-popup {
    position: relative !important;
    display: inline-block;
    width: auto !important;
    max-width: 92vw !important;
    margin: 0 !important;
    -webkit-transform: none;
    transform: none;
    animation: bf-fadein 0.3s ease;
}

@keyframes bf-fadein {
    from { opacity: 0; transform: scale(0.92); }
    to   { opacity: 1; transform: scale(1); }
}

/* ── Bouton fermer X ── */
#bf-close {
    position: absolute !important;
    top: -12px;
    right: -12px;
    width: 32px;
    height: 32px;
    background: #000 !important;
    border: 2px solid #fff !important;
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    color: #fff !important;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    transition: transform 0.15s, background 0.15s;
    z-index: 2;
}

#bf-close:hover {
    background: #333 !important;
    transform: scale(1.1);
}

/* ── Image : prend toute la place, pas de marge ── */
#bf-link {
    display: block;
    text-decoration: none;
}

#bf-img {
    display: block;
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 85vh;
    max-height: 85dvh;
    margin: 0 auto;
    border-radius: 12px;
    object-fit: contain;
}

/* ── Mobile ── */
@media (max-width: 600px) {
    #bf-popup {
        max-width: 90vw !important;
    }

    #bf-close {
        top: -10px;
        right: -10px;
        width: 28px;
        height: 28px;
        font-size: 18px;
    }

    #bf-img {
        border-radius: 10px;
    }
}
