/* Превью видео вместо сразу подгружаемого плеера.
   Плеер подключается только после клика — до этого запросов к Google нет. */

.yt-facade {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    display: block;
    cursor: pointer;
    background: #000;
    overflow: hidden;
}

/* обёртка WordPress уже задаёт пропорции 16:9 через :before,
   поэтому фасад растягивается по ней так же, как это делал iframe */
.wp-block-embed__wrapper { position: relative; }

.yt-facade__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border: 0;
    transition: opacity .25s ease;
}

.yt-facade:hover .yt-facade__img { opacity: .82; }

.yt-facade__play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 68px;
    height: 48px;
    padding: 0;
    border: 0;
    border-radius: 14px;
    background: rgba(18, 18, 18, .78);
    cursor: pointer;
    transition: background .2s ease, transform .2s ease;
}

.yt-facade:hover .yt-facade__play {
    background: #f00;
    transform: translate(-50%, -50%) scale(1.06);
}

/* треугольник play */
.yt-facade__play::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-42%, -50%);
    border-style: solid;
    border-width: 10px 0 10px 17px;
    border-color: transparent transparent transparent #fff;
}

.yt-facade__play:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 3px;
}

/* подпись с названием ролика */
.yt-facade__title {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 12px 14px 26px;
    background: linear-gradient(rgba(0, 0, 0, .72), rgba(0, 0, 0, 0));
    color: #fff;
    font-size: 14px;
    line-height: 1.35;
    text-align: left;
    pointer-events: none;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

@media (max-width: 480px) {
    .yt-facade__play { width: 56px; height: 40px; }
    .yt-facade__play::before { border-width: 8px 0 8px 14px; }
    .yt-facade__title { font-size: 12px; padding: 9px 11px 20px; }
}
