/* ═══════════════════════════════════════════════════════════════════════════
   FAÇADE VIDÉO — « clic pour charger » (RGPD)

   La façade remplace l'iframe YouTube jusqu'au clic du visiteur. Elle doit
   occuper exactement la place que prendra l'iframe, sinon la page saute au
   moment de la lecture.

   Deux modes :
   - .video-embed--fill  → le parent impose déjà une taille (aspect-ratio ou
     padding-bottom) ; la façade se colle dessus en absolu ;
   - défaut              → la façade impose elle-même un 16/9.
   ═══════════════════════════════════════════════════════════════════════════ */

.video-embed {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #14100c;
}

.video-embed--fill {
    position: absolute;
    inset: 0;
    aspect-ratio: auto;
    height: 100%;
}

.video-embed__trigger {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    margin: 0;
    border: 0;
    background: none;
    cursor: pointer;
    /* Astra pose un min-height et un padding sur les <button> : on neutralise. */
    min-height: 0;
    border-radius: inherit;
}

.video-embed__poster {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease, filter 0.4s ease;
}

.video-embed__trigger:hover .video-embed__poster,
.video-embed__trigger:focus-visible .video-embed__poster {
    transform: scale(1.03);
    filter: brightness(0.88);
}

/* Repli sans vignette locale : un dégradé, JAMAIS img.youtube.com — cette URL
   transmettrait l'IP du visiteur exactement comme l'iframe. */
.video-embed--no-poster {

    background: linear-gradient(135deg, #2b2119 0%, #4a382a 60%, #6b5540 100%);
}

.video-embed__play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    /* ⚠️ Taille explicite obligatoire : un SVG inline s'effondre à width:0
       dans un conteneur flex avec Astra. */
    width: 84px;
    height: 60px;
    display: block;
    pointer-events: none;
    transition: transform 0.25s ease;
}

.video-embed__play svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* Pastille de lecture : un <rect rx> plutôt qu'un tracé à la main. Le premier
   essai reprenait le chemin de YouTube avec des coordonnées hors viewBox
   (-2 et 70 pour un « 0 0 68 48 »), donc rognées à plat sur les côtés. */
.video-embed__play-bg {
    fill: #1a1a1a;
    fill-opacity: 0.82;
    transition: fill 0.25s ease, fill-opacity 0.25s ease;
}

.video-embed__trigger:hover .video-embed__play,
.video-embed__trigger:focus-visible .video-embed__play {
    transform: translate(-50%, -50%) scale(1.08);
}

.video-embed__trigger:hover .video-embed__play-bg,
.video-embed__trigger:focus-visible .video-embed__play-bg {
    fill: #cc0000;
    fill-opacity: 1;
}

.video-embed__trigger:focus-visible {
    outline: 3px solid #fff;
    outline-offset: -4px;
}

/* ── Information avant le clic ─────────────────────────────────────────────
   Elle est légalement porteuse : c'est elle qui fait du clic un consentement
   éclairé. Sa forme est libre, mais elle doit être accessible AVANT le clic —
   d'où une pastille toujours visible, qui déplie la phrase complète.
   ⚠️ Pastille dépliable au clic et pas seulement au survol : sur mobile, une
   info-bulle au survol n'existe pas. */
.video-embed__info {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin: 0;
    padding: 5px 10px;
    min-height: 0;
    border: 0;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.55);
    color: #f5f1ec;
    font-size: 0.72rem;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: background 0.2s ease;
}

.video-embed__info:hover,
.video-embed__info:focus-visible {
    background: rgba(0, 0, 0, 0.82);
}

.video-embed__info-icon {
    /* ⚠️ Taille explicite : un SVG inline s'effondre à width:0 dans un
       conteneur flex avec Astra. */
    width: 13px;
    height: 13px;
    flex: 0 0 auto;
}

.video-embed__notice {
    position: absolute;
    top: 44px;
    right: 10px;
    z-index: 2;
    max-width: min(260px, calc(100% - 20px));
    margin: 0;
    padding: 9px 12px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.86);
    color: #f5f1ec;
    font-size: 0.74rem;
    line-height: 1.4;
    text-align: left;
    pointer-events: none;
    /* Masquée sans être retirée de l'arbre d'accessibilité tant qu'elle est
       référencée par aria-controls. */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}

.video-embed__info:hover ~ .video-embed__notice,
.video-embed__info:focus-visible ~ .video-embed__notice,
.video-embed__info[aria-expanded="true"] ~ .video-embed__notice {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

@media (max-width: 600px) {
    .video-embed__play {
        width: 62px;
        height: 44px;
    }
    .video-embed__info {
        top: 8px;
        right: 8px;
        font-size: 0.68rem;
        padding: 4px 8px;
    }
    .video-embed__notice {
        top: 38px;
        right: 8px;
        font-size: 0.7rem;
    }
}
