/* ============================================================
   Block: エピソード一覧（acf/episode-list）
   ============================================================ */

.cv-episode {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin: 1.5em 0;
}

.cv-episode__card {
    display: grid;
    gap: 8px 18px;
    padding: 14px 16px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;

    grid-template-columns: 1fr 320px;
    grid-template-areas:
        "head     video"
        "synopsis video";
}

.cv-episode__card.is-no-video {
    grid-template-columns: 1fr;
    grid-template-areas:
        "head"
        "synopsis";
}

.cv-episode__head {
    grid-area: head;
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}

/* h3 タグだが、本文 h3 の装飾（下線/マージン/疑似要素）は引き継がない */
.post_content h3.cv-episode__title,
.cv-episode__title {
    margin: 0;
    padding: 0;
    background: none;
    border: none;
    border-radius: 0;
    font-size: 1.05em;
    font-weight: 700;
    color: #1f2937;
    line-height: 1.4;
}

.post_content h3.cv-episode__title::before,
.post_content h3.cv-episode__title::after,
.cv-episode__title::before,
.cv-episode__title::after {
    content: none;
    display: none;
    background: none;
    border: none;
}

.cv-episode__duration {
    font-size: .8em;
    color: #6b7280;
    line-height: 1;
    padding: 3px 8px;
    background: #f3f4f6;
    border-radius: 999px;
    white-space: nowrap;
}

.cv-episode__synopsis {
    grid-area: synopsis;
    font-size: .9em;
    color: #374151;
    line-height: 1.7;
    align-self: start;
}

.cv-episode__video {
    grid-area: video;
    aspect-ratio: 16 / 9;
    width: 100%;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}

/* サムネボタン: クリックでモーダル再生 */
button.cv-episode__thumb {
    position: relative;
    padding: 0;
    border: 0;
    cursor: pointer;
    display: block;
}

.cv-episode__thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* 予告バッジ: サムネ左上に常時表示（本編との誤認防止） */
.cv-episode__badge {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 3px 9px;
    background: rgba(0, 0, 0, .72);
    color: #fff;
    font-size: .72em;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: .08em;
    border-radius: 4px;
    pointer-events: none;
}

.cv-episode__playbtn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(0, 0, 0, .4);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transition: background .15s ease, transform .15s ease;
}

.cv-episode__playbtn svg {
    margin-left: 2px; /* 三角を視覚的に中央に */
}

.cv-episode__thumb:hover .cv-episode__playbtn,
.cv-episode__thumb:focus-visible .cv-episode__playbtn {
    background: rgba(252, 35, 72, .9);
    transform: translate(-50%, -50%) scale(1.08);
}

/* ----- YouTube モーダル（共通：JS が body 末尾に挿入） ----- */
dialog.cv-yt-modal {
    /* inset: 0 + margin: auto で水平・垂直ともに viewport 中央へ */
    inset: 0;
    margin: auto;
    border: 0;
    padding: 0;
    background: transparent;
    width: min(92vw, 1200px);
    max-height: 92vh;
    color: #fff;
    overflow: visible;
}

dialog.cv-yt-modal::backdrop {
    background: rgba(0, 0, 0, .85);
}

.cv-yt-modal__iframe-wrap {
    position: relative;
    aspect-ratio: 16 / 9;
    width: 100%;
    background: #000;
}

.cv-yt-modal__iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

.cv-yt-modal__close {
    position: absolute;
    top: -40px;
    right: 0;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.cv-yt-modal__close:hover,
.cv-yt-modal__close:focus-visible {
    color: #fc2348;
}

/* SP: 1列。タイトル → 動画 → あらすじ の順 */
@media (max-width: 768px) {
    .cv-episode__card {
        grid-template-columns: 1fr;
        grid-template-areas:
            "head"
            "video"
            "synopsis";
        gap: 10px;
    }
}
