/*
 * YouTube embed (youtube-embed.js): a 16:9 box that the still link, and on the live page the player, fill.
 * Selectors go through [data-youtube-embed] so theme rules for links and images do not resize them.
 */
[data-youtube-embed] {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #1f1f1f;
}

[data-youtube-embed] > .youtube-embed__link,
[data-youtube-embed] > .youtube-embed__player {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    margin: 0;
    border: 0;
}

[data-youtube-embed] .youtube-embed__still {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
}

/* Play button on the still; also resets a theme's link underline drawn with ::after. */
[data-youtube-embed] > .youtube-embed__link::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 68px;
    height: 48px;
    margin: -24px 0 0 -34px;
    border: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 68 48'%3E%3Cpath fill='%23f00' d='M66.5 7.7a8.5 8.5 0 0 0-6-6C55.3.3 34 .3 34 .3s-21.3 0-26.5 1.4a8.5 8.5 0 0 0-6 6C.1 13 .1 24 .1 24s0 11 1.4 16.3a8.5 8.5 0 0 0 6 6C12.7 47.7 34 47.7 34 47.7s21.3 0 26.5-1.4a8.5 8.5 0 0 0 6-6C67.9 35 67.9 24 67.9 24s0-11-1.4-16.3z'/%3E%3Cpath fill='%23fff' d='M45 24 27 14v20z'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* No video chosen yet: the builder shows a hint instead of the still, the live page leaves the box out. */
[data-youtube-embed] > .youtube-embed__link:is([href^="#"], [href=""]) .youtube-embed__still {
    visibility: hidden;
}

[data-youtube-embed] > .youtube-embed__link:is([href^="#"], [href=""])::after {
    content: "Kies een video onder Inhoud › Video";
    inset: 0;
    width: auto;
    height: auto;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: none;
    color: #fff;
    font-size: 15px;
    text-align: center;
}

body:not(.preview-body) [data-youtube-embed]:has(> .youtube-embed__link:is([href^="#"], [href=""])) {
    display: none;
}
