/*=========================================================
 H — VIDÉO
 =========================================================*/

/*---------------------------------------------------------
 H.1 — Conteneur média
 ---------------------------------------------------------*/

.tw-media_cover {
    position: relative;
    display: block;
    width: 100%;
    overflow: hidden;
    border-radius: var(--tw-media_radius);
}

.tw-media_cover .tw-cover-image-link,
.tw-media_cover .tw-cover-image-link img,
.tw-media_cover .tw-cover-image-static,
.tw-media_cover .tw-cover-image-static img {
    display: block;
    width: 100%;
    height: auto;
}

/* Une image zoomable adopte le curseur loupe. */
.tw-cover-image-link_zoom {
    cursor: zoom-in;
}

/* Un lien vers une page conserve le curseur de navigation standard. */
.tw-cover-image-link_page {
    cursor: pointer;
}

/* Une image purement illustrative n'annonce aucune interaction. */
.tw-cover-image-static {
    cursor: default;
}

/*---------------------------------------------------------
 H.2 — Ratio de la zone vidéo
 ---------------------------------------------------------*/

/* Le ratio n'est imposé que lorsqu'il est connu ou explicitement forcé. */
.tw-media_cover_video.tw-video_has-ratio {
    aspect-ratio: var(--tw-video-aspect-ratio);
}

/* Dans un cadre vidéo, le poster remplit exactement le ratio retenu. */
.tw-media_cover_video.tw-video_has-ratio > .tw-cover-image-link,
.tw-media_cover_video.tw-video_has-ratio > .tw-cover-image-static {
    width: 100%;
    height: 100%;
}

.tw-media_cover_video.tw-video_has-ratio > .tw-cover-image-link img,
.tw-media_cover_video.tw-video_has-ratio > .tw-cover-image-static img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Un média portrait reste centré dans sa colonne. */
.tw-media_cover_video.tw-video_orientation-portrait {
    margin-inline: auto;
}

/* Formats portrait usuels : on évite une colonne visuellement trop haute. */
.tw-media_cover_video.tw-video_ratio-3-4 {
    width: min(100%, 540px);
}

.tw-media_cover_video.tw-video_ratio-4-5 {
    width: min(100%, 520px);
}

/* 9/16 ou ratio naturel très vertical : hauteur contenue sur écran large. */
.tw-media_cover_video.tw-video_ratio-9-16,
.tw-media_cover_video.tw-video_ratio-tall {
    width: min(100%, 405px, 42vh);
}

/*---------------------------------------------------------
 H.3 — Couche vidéo sur le poster
 ---------------------------------------------------------*/

.tw-media_cover > .tw-video_cover {
    position: absolute !important;
    inset: 0 !important;
    z-index: 5;
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: inherit;
    pointer-events: none;
}

/*
 * Le poster reste sous la vidéo. Lors d'une lecture en contain, un voile
 * légèrement flouté évite les bandes noires des formats portrait.
 */
.tw-media_cover > .tw-video_local::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    background: rgba(12, 18, 24, .18);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    opacity: 0;
    transition: opacity .25s ease;
    pointer-events: none;
}

.tw-media_cover > .tw-video_local.is-playing::before {
    opacity: 1;
}

/* La vidéo locale remplace progressivement le poster lorsqu'elle joue. */
.tw-media_cover > .tw-video_local video {
    position: absolute;
    inset: 0;
    display: block !important;
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: inherit;
    z-index: 1;
    background: transparent;
    object-fit: contain;
    opacity: 0;
    transition: opacity .30s ease;
}

/* Lorsqu'un ratio est volontairement forcé, la vidéo remplit le cadre. */
.tw-media_cover_video.tw-video_ratio-forced > .tw-video_local video {
    object-fit: cover;
}

.tw-media_cover > .tw-video_local.is-playing video {
    opacity: 1;
}

/*---------------------------------------------------------
 H.4 — Bouton de lecture
 ---------------------------------------------------------*/

.tw-media_cover .tw-video_play {
    position: absolute;
    right: 14px;
    bottom: 14px;
    z-index: 6;

    display: grid;
    place-items: center;

    width: 46px;
    height: 46px;
    padding: 0;

    border: 1px solid rgba(0, 0, 0, .08);
    border-radius: 50%;

    background: rgba(255, 255, 255, .88);
    color: #202426;

    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0, 0, 0, .16);

    pointer-events: auto;
    text-decoration: none;

    transition:
        transform .18s ease,
        background-color .18s ease;
}

.tw-media_cover .tw-video_play:hover,
.tw-media_cover .tw-video_play:focus-visible {
   background: #fff;
    transform: scale(1.04);
}

.tw-media_cover .tw-video_play::before {
    content: "";
    width: 0;
    height: 0;
    transform: translateX(3px);
    border-top: 11px solid transparent;
    border-bottom: 11px solid transparent;
    border-left: 18px solid currentColor;
}

/* Le bouton local utilise une icône explicite Play / Replay. */
.tw-media_cover .tw-video_local .tw-video_play-local {
    display: none;
}

.tw-media_cover .tw-video_local .tw-video_play-local::before {
    display: none;
}

.tw-media_cover .tw-video_local .tw-video_play-local .material-symbols-outlined {
    font-size: clamp(25px, 4vw, 30px);
    line-height: 1;
}

/* Le bouton réapparaît si l'autoplay est refusé ou lorsque la vidéo est terminée. */
.tw-media_cover .tw-video_local.is-manual .tw-video_play-local,
.tw-media_cover .tw-video_local.is-ended .tw-video_play-local {
    display: grid;
}

.tw-media_cover .tw-video_local.is-playing .tw-video_play-local {
    display: none;
}

/* À la fin, la vidéo s'efface pour retrouver le poster de l'image à la une. */
.tw-media_cover > .tw-video_local.is-ended video {
    opacity: 0;
}

/* Commande sonore discrète, uniquement visible pendant la lecture. */
.tw-media_cover .tw-video_sound {
    position: absolute;
    right: clamp(10px, 2vw, 16px);
    bottom: clamp(10px, 2vw, 16px);
    z-index: 7;
    display: none;
    place-items: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(20, 24, 26, .72);
    color: #fff;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 5px 16px rgba(0, 0, 0, .20);
    transition: background-color .18s ease, transform .18s ease;
}

.tw-media_cover .tw-video_local.is-playing .tw-video_sound {
    display: grid;
}

.tw-media_cover .tw-video_sound:hover,
.tw-media_cover .tw-video_sound:focus-visible {
    background: rgba(20, 24, 26, .90);
    transform: scale(1.05);
}

.tw-media_cover .tw-video_play .material-symbols-outlined {
    font-size: 24px;
}


/* Arrêt volontaire : retour au poster et désactivation de l'autoplay. */
.tw-media_cover .tw-video_stop {
    position: absolute;
    right: clamp(60px, calc(2vw + 50px), 66px);
    bottom: clamp(10px, 2vw, 16px);
    z-index: 7;
    display: none;
    place-items: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(20, 24, 26, .72);
    color: #fff;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 5px 16px rgba(0, 0, 0, .20);
    transition: background-color .18s ease, transform .18s ease;
}

.tw-media_cover .tw-video_local.is-playing .tw-video_stop {
    display: grid;
}

.tw-media_cover .tw-video_stop:hover,
.tw-media_cover .tw-video_stop:focus-visible {
    background: rgba(20, 24, 26, .90);
    transform: scale(1.05);
}

.tw-media_cover .tw-video_stop .material-symbols-outlined {
    font-size: 22px;
    line-height: 1;
}

/* Agrandissement plein écran des vidéos locales sur les pages terminales. */
.tw-media_cover .tw-video_expand {
    position: absolute;
    right: clamp(110px, calc(2vw + 100px), 116px);
    bottom: clamp(10px, 2vw, 16px);
    z-index: 7;
    display: none;
    place-items: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(20, 24, 26, .72);
    color: #fff;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 5px 16px rgba(0, 0, 0, .20);
    transition: background-color .18s ease, transform .18s ease;
}

.tw-media_cover .tw-video_local.is-playing .tw-video_expand {
    display: grid;
}

.tw-media_cover .tw-video_expand:hover,
.tw-media_cover .tw-video_expand:focus-visible {
    background: rgba(20, 24, 26, .90);
    transform: scale(1.05);
}

.tw-media_cover .tw-video_expand .material-symbols-outlined {
    font-size: 22px;
    line-height: 1;
}

/*---------------------------------------------------------
 H.5 — Lecteur dans la popup TWAL
 ---------------------------------------------------------*/

.tw-popup_video .tw-popup_inner {
    padding: 2.5rem 1.2rem 1.2rem;
}

.tw-popup_video .tw-popup_title {
    margin: 0 2.8rem 1rem 0;
    font-size: clamp(1rem, 2vw, 1.35rem);
}

.tw-video_popup-frame {
    position: relative;
    width: 100%;
    aspect-ratio: var(--tw-video-aspect-ratio, 16 / 9);
    overflow: hidden;
    border-radius: .7rem;
    background: #000;
}

.tw-video_popup-frame.tw-video_orientation-portrait {
    margin-inline: auto;
}

.tw-video_popup-frame.tw-video_ratio-3-4 {
    width: min(100%, 540px);
}

.tw-video_popup-frame.tw-video_ratio-4-5 {
    width: min(100%, 520px);
}

.tw-video_popup-frame.tw-video_ratio-9-16 {
    width: min(100%, 405px, 49.5vh);
}

.tw-video_popup-poster {
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    filter: blur(6px);
    transform: scale(1.02);
    opacity: .42;
    pointer-events: none;
}

.tw-video_popup-frame::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background: rgba(8, 12, 16, .20);
    pointer-events: none;
}

.tw-video_popup-frame iframe,
.tw-video_popup-frame video,
.tw-video_popup-frame .wp-video,
.tw-video_popup-frame .wp-video-shortcode {
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    border: 0;
    position: relative;
    z-index: 2;
    background: transparent;
    object-fit: contain;
}

.tw-video_popup-stop {
    position: absolute;
    right: 1rem;
    bottom: 4rem;
    z-index: 4;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(20, 24, 26, .76);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 5px 16px rgba(0, 0, 0, .24);
}

.tw-video_popup-stop:hover,
.tw-video_popup-stop:focus-visible {
    background: rgba(20, 24, 26, .94);
}

.tw-video_popup-stop .material-symbols-outlined {
    font-size: 24px;
    line-height: 1;
}

/* La popup locale utilise tout l'écran et respecte le ratio natif de la vidéo. */
.tw-popup_video-local .tw-popup_dialog,
.tw-popup_video-local .tw-popup_inner,
.tw-popup_video-local .tw-popup_content {
    background: #101214;
}

.tw-popup_video-local .tw-popup_inner {
    min-height: 100vh;
    padding: 2rem;
    display: grid;
    place-items: center;
}

.tw-popup_video-local .tw-popup_title {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.tw-popup_video-local .tw-popup_content {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
}

.tw-popup_video-local .tw-video_popup-frame,
.tw-popup_video-local .tw-video_popup-frame.tw-video_orientation-portrait,
.tw-popup_video-local .tw-video_popup-frame.tw-video_ratio-3-4,
.tw-popup_video-local .tw-video_popup-frame.tw-video_ratio-4-5,
.tw-popup_video-local .tw-video_popup-frame.tw-video_ratio-9-16 {
    width: 100%;
    height: calc(100dvh - 4rem);
    max-width: 100%;
    max-height: calc(100dvh - 4rem);
    aspect-ratio: auto;
    border-radius: 0;
    background: #000;
}

.tw-popup_video-local .tw-popup_close {
    color: #fff;
    background: rgba(255, 255, 255, .14);
}

@media (max-width: 600px) {
	  .tw-media_cover .tw-video_play {
        right: 10px;
        bottom: 10px;
        width: 44px;
        height: 44px;
    }

    .tw-media_cover .tw-video_play .material-symbols-outlined {
        font-size: 22px;
    }
    .tw-popup_video .tw-popup_inner {
        padding: 2.4rem .6rem .6rem;
    }

    .tw-popup_video .tw-popup_title {
        margin-left: .6rem;
    }

    /*
     * Sur une page terminale éditoriale, le mobile suit le ratio du média.
     * Les sources plus verticales que 3/4 sont plafonnées à 3/4 par PHP.
     */
    .tw-editorial-featured-media_video {
        aspect-ratio: var(--tw-terminal-mobile-aspect-ratio, 16 / 9);
        width: 100%;
        margin-inline: auto;
    }


    /* Même règle pour le média principal d'une page terminale standard. */
    .tw-terminal-standard-media.tw-video_has-ratio {
        aspect-ratio: var(--tw-terminal-mobile-aspect-ratio, var(--tw-video-aspect-ratio, 16 / 9));
    }

    .tw-terminal-standard-media.tw-video_orientation-portrait,
    .tw-terminal-standard-media.tw-video_ratio-3-4,
    .tw-terminal-standard-media.tw-video_ratio-4-5,
    .tw-terminal-standard-media.tw-video_ratio-9-16,
    .tw-terminal-standard-media.tw-video_ratio-tall {
        width: 100%;
        max-width: 100%;
    }

    .tw-popup_video-local .tw-popup_inner {
        min-height: 100dvh;
        padding: 2.5rem .5rem .5rem;
    }

    .tw-popup_video-local .tw-video_popup-frame,
    .tw-popup_video-local .tw-video_popup-frame.tw-video_orientation-portrait,
    .tw-popup_video-local .tw-video_popup-frame.tw-video_ratio-3-4,
    .tw-popup_video-local .tw-video_popup-frame.tw-video_ratio-4-5,
    .tw-popup_video-local .tw-video_popup-frame.tw-video_ratio-9-16 {
        height: calc(100dvh - 3rem);
        max-height: calc(100dvh - 3rem);
    }

    /* Sur smartphone le portrait peut occuper davantage de hauteur utile. */
    .tw-media_cover_video.tw-video_ratio-9-16,
    .tw-media_cover_video.tw-video_ratio-tall {
        width: min(100%, 405px, 49.5vh);
    }
}

@media (prefers-reduced-motion: reduce) {
    .tw-media_cover > .tw-video_local video {
        transition: none;
    }
}