/* Episode headers follow the podcast series' square-cover composition. */
.episode-transcript-section { margin-top: 24px; border-top: 1px solid #333; border-bottom: 0; }
.episode-transcript-document > summary { padding: 16px 0; cursor: pointer; }
.episode-transcript-document > summary::marker { color: #bcbcbc; }
.episode-transcript-document > summary h2 { display: inline; margin: 0; font: 1rem/1 var(--vixen-heading, sans-serif); color: inherit; overflow-wrap: anywhere; letter-spacing: -0.04em !important; }
.episode-transcript-document > summary:focus-visible { outline: 2px solid #bcbcbc; outline-offset: 4px; }
.episode-transcript-copy { max-width: 78ch; padding-bottom: 20px; font: 1rem/1.75 var(--vixen-body, sans-serif); overflow-wrap: anywhere; }
.episode-transcript-copy p { margin: 0 0 1.25em; font: inherit; color: inherit; letter-spacing: 0; }
.episode-transcript-copy .episode-transcript-disclaimer { color: #ababab; font-size: .875rem; }

body :is(.episode-podcast-header, .ps-hero) .episode-actions-menu { position: absolute; top: 0; right: 0; z-index: 300; margin-left: 0; flex-shrink: 0; }
body :is(.episode-podcast-header, .ps-hero) .episode-actions-menu > summary {
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; box-sizing: border-box;
    padding: 0; border: 1px solid #fff; border-radius: 50%;
    background: transparent; color: #fff; cursor: pointer; list-style: none;
}
.episode-actions-menu > summary::-webkit-details-marker { display: none; }
.episode-actions-menu > summary svg { width: 18px; height: 18px; fill: currentColor; }
body :is(.episode-podcast-header, .ps-hero) .episode-actions-menu > summary:is(:hover, :focus-visible),
body :is(.episode-podcast-header, .ps-hero) .episode-actions-menu[open] > summary { background: #fff; color: #111; }
body :is(.episode-podcast-header, .ps-hero) .episode-actions-popup {
    position: fixed; top: 12px; left: 12px; z-index: 1500;
    width: 250px; max-width: calc(100vw - 40px); padding: 6px;
    border: 1px solid #555; border-radius: 14px;
    background: rgba(25, 25, 25, .8); box-shadow: 0 12px 32px #0007; text-align: left;
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    overflow-y: auto; overscroll-behavior: contain;
}
body :is(.episode-podcast-header, .ps-hero) .episode-actions-popup > :is(button, a) {
    display: flex; align-items: center; justify-content: flex-start; gap: 10px;
    width: 100%; min-height: 44px; box-sizing: border-box;
    padding: 12px; margin: 0; border: 0; border-radius: 8px;
    font: 1rem/1.25 var(--vixen-body); text-align: left; text-decoration: none;
    background: transparent; color: #fff; cursor: pointer;
}
body :is(.episode-podcast-header, .ps-hero) .episode-actions-popup > :is(button, a):is(:hover, :focus-visible) { background: #333; color: #fff; }
body :is(.episode-podcast-header, .ps-hero) .episode-share-status {margin:4px 12px 8px;color:#fff;font: .85rem/1.3 var(--vixen-body)}
body :is(.episode-podcast-header, .ps-hero) .episode-actions-popup svg { width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
/* Account state updates replace the favorite button's text, so keep its icon in CSS. */
body .episode-podcast-header .episode-actions-popup > .nova-favorite-button::before {
    content: ''; width: 20px; height: 20px; flex-shrink: 0; background: currentColor;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m12 3 2.8 5.7 6.2.9-4.5 4.4 1.1 6.2-5.6-3-5.6 3 1.1-6.2L3 9.6l6.2-.9Z' fill='none' stroke='black' stroke-width='1.7' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.episode-mobile-only { display: none; }
.episode-portraits { display: none; }
@media (min-width: 761px) {
    .episode-podcast-header ~ .article-related-section .article-related-inline-card:has(.article-related-play) {
        grid-template-columns: clamp(69px, 10vw, 150px) minmax(0, 1fr) 55px;
        padding-right: 12px;
    }
    .episode-podcast-header ~ .article-related-section .article-related-inline-media { grid-column: 1; grid-row: 1; }
    .episode-podcast-header ~ .article-related-section .article-related-inline-body { grid-column: 2; grid-row: 1; }
    .episode-podcast-header ~ .article-related-section .article-related-play { grid-column: 3; grid-row: 1; justify-self: center; }
    .episode-podcast-header ~ .article-related-section .article-related-grid > :nth-child(n + 6) { display: none; }
}
body .episode-detail.episode-podcast-header {
    position: relative;
    display: grid;
    grid-template-columns: 28% minmax(0, 1fr);
    align-items: center;
    gap: 6%;
    min-height: 350px;
    padding: 15px 2% 20px 0;
    border-radius: 0 0 28px 28px;
    background: transparent;
    color: #fff;
}
.episode-podcast-header .episode-detail-media { min-width: 0; align-self: start; }
body .episode-podcast-header .episode-detail-media > .episode-favorite-actions {justify-content:flex-end;margin:18px 0 0;flex-wrap:wrap}
body .episode-podcast-header .episode-detail-info > .nova-account-actions {display:flex;align-items:center;gap:12px}
body .episode-podcast-header .nova-account-actions > .episode-transcript-btn {border-radius:999px;font-size:.85rem;gap:8px}
body .episode-podcast-header .nova-account-actions > .episode-podcast-link {border-radius:999px;white-space:nowrap;margin-left:auto}
body .episode-podcast-header .episode-cover {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 15px;
    box-shadow: 0 10px 24px #0004;
}
body .episode-podcast-header .episode-detail-info { min-width: 0; }
body .episode-podcast-header .episode-detail-info h1 { color: #fff; overflow-wrap: anywhere; margin-bottom: 20px; }
body .episode-podcast-header .episode-meta,
body .episode-podcast-header .episode-meta a { color: #ababab; }
body .episode-podcast-header .episode-meta { margin: 0 0 18px; }
body .episode-podcast-header .episode-summary {
    font: 1rem/1.35 var(--vixen-body);
    color: #fff;
    margin: 0 0 30px;
}
body .episode-podcast-header .btn-play-large {
    width: auto;
    margin: 0;
    padding: 14px 20px;
    border-radius: 12px;
    background: #111;
    color: #fff !important;
    font: 1.3rem/1.1 var(--vixen-heading);
    letter-spacing: -0.04em !important;
}
body .episode-podcast-header .btn-play-large:hover { background: #333; }
body .episode-podcast-header .nova-account-actions { margin-top: 18px; flex-wrap: wrap; }
.episode-podcast-header .episode-cast { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: end; gap: clamp(8px, 1vw, 14px); min-width: 0; margin-left: auto; padding: 0 0 0 12px; }
.episode-podcast-header .episode-cast-link { position: relative; display: grid; place-items: center; flex: none; width: clamp(50px, 4vw, 64px); height: clamp(50px, 4vw, 64px); border-radius: 50%; color: #fff; text-decoration: none; cursor: pointer; transition: transform .26s ease; }
.episode-podcast-header .episode-cast-link img,
.episode-podcast-header .episode-cast-initial { display: block; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; background: #e8e8e8; color: #111; }
.episode-podcast-header .episode-cast-initial { display: grid; place-items: center; font: 2rem/1 var(--vixen-heading); }
.episode-podcast-header .episode-cast-name { position: absolute; bottom: calc(100% + 12px); left: 50%; width: max-content; max-width: 190px; text-align: center; font: clamp(.78rem, 1vw, 1.2rem)/1.08 var(--vixen-heading); opacity: 0; pointer-events: none; transform: translate(-50%, 8px); transition: opacity .22s ease, transform .26s ease; }
.episode-podcast-header .episode-cast-name::after { content: ""; position: absolute; top: calc(100% + 5px); left: 50%; border: 6px solid transparent; border-top-color: #fff; transform: translateX(-50%); }
.episode-podcast-header .episode-cast-link:is(:hover, :focus-visible) { transform: translateY(-12px); }
.episode-podcast-header .episode-cast-link:is(:hover, :focus-visible) .episode-cast-name { opacity: 1; transform: translate(-50%, 0); }
.episode-podcast-header .episode-cast-link:focus-visible { outline: 3px solid #fff; outline-offset: 5px; }
body .episode-podcast-header .nova-account-actions > :is(button, a) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    box-sizing: border-box;
    margin: 0;
    padding: 12px 18px;
    font: 1rem/1.1 var(--vixen-heading);
    letter-spacing: -0.04em !important;
}
body .episode-podcast-header :is(.nova-favorite-button, .nova-favorites-page-button, .episode-transcript-btn) {
    color: #fff;
    background: transparent;
    border: 1px solid #fff;
}
body .episode-podcast-header .episode-transcript { color: #111; background: #fff; }
body .episode-podcast-header .nova-account-actions > .btn-play-large { min-width: 160px; max-width: 100%; }
body .episode-podcast-header .nova-account-actions > .nova-favorites-page-button {
    transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}
body .episode-podcast-header .nova-account-actions > .nova-favorites-page-button:is(:hover, :focus-visible) {
    background: var(--nova-link-hover, #bcbcbc);
    border-color: var(--nova-link-hover, #bcbcbc);
    color: #111;
    text-decoration: none;
}
body .episode-podcast-header .nova-account-actions > .episode-podcast-link { margin-left: auto; }
body .episode-podcast-header :focus-visible { outline: 2px solid #555; outline-offset: 4px; }
body .episode-podcast-header .episode-secondary-actions {display:flex; flex-wrap:wrap; align-items:center; gap:12px; margin-top:24px}
body .episode-podcast-header .episode-secondary-actions > :is(button,a) {display:inline-flex; align-items:center; justify-content:center; gap:8px; min-height:44px; margin:0; padding:12px 18px; border:1px solid #fff; border-radius:999px; background:transparent; color:#fff; font:1rem/1.1 var(--vixen-heading); text-decoration:none; cursor:pointer; transition:background-color .2s ease,border-color .2s ease,transform .2s ease; letter-spacing: -0.04em !important; }
body .episode-podcast-header .episode-secondary-actions > :is(button,a):is(:hover,:focus-visible) {background:#fff; border-color:var(--nova-link-hover,#bcbcbc); color:#111; transform:translateY(-2px)}
body .episode-podcast-header .episode-secondary-actions svg {width:22px; height:22px; flex-shrink:0; margin:0}
body .episode-podcast-header .episode-secondary-actions .episode-transcript-btn {order:0}
body .episode-podcast-header .episode-favorite-actions {display:flex;align-items:center;gap:8px;margin-left:auto}
body .episode-podcast-header .episode-favorite-actions > :is(button,a) {display:inline-flex;align-items:center;justify-content:center;gap:5px;min-height:30px;margin:0;padding:7px 11px;border-radius:999px;font:500 .7rem/1.2 var(--vixen-heading);white-space:nowrap; letter-spacing: -0.04em !important; }
body .episode-podcast-header .episode-favorite-actions > :is(button,a):is(:hover,:focus-visible) {background:#fff;color:#111}
@media(max-width:760px) {body .episode-podcast-header .episode-favorite-actions {margin-left:0;justify-content:center;flex-wrap:wrap;order:4} body .episode-podcast-header .episode-favorite-actions > :is(button,a) {min-height:44px}}
@media(prefers-reduced-motion:reduce) {body .episode-podcast-header .episode-secondary-actions > :is(button,a) {transition:none} body .episode-podcast-header .episode-secondary-actions > :is(button,a):is(:hover,:focus-visible) {transform:none}}
@media (min-width: 761px) {
    body .episode-detail.episode-podcast-header {align-items:start}
    body .episode-podcast-header .episode-detail-media > .episode-favorite-actions {align-self:flex-end}
    body .episode-podcast-header .episode-detail-info {display:flex;flex-direction:column;align-self:stretch}
    body .episode-podcast-header .episode-detail-info > .nova-account-actions {margin-top:auto;padding-top:10px}
    .episode-podcast-header .episode-mobile-only { display: inline; }
    .episode-podcast-header .episode-meta-desktop,
    .episode-podcast-header .episode-play-label { display: none; }
    body .episode-podcast-header .episode-meta { display: flex; flex-wrap: wrap; gap: 4px 24px; }
    body .episode-podcast-header .nova-account-actions > .nova-favorite-button { margin-left: auto; }
    body .episode-podcast-header .nova-account-actions > .btn-play-large {
        min-width: 165px;
        min-height: 48px;
        padding: 12px 26px;
        gap: 14px;
        border-radius: 999px;
        background: #fff;
        color: #000 !important;
        font: 1.1rem/1.2 var(--vixen-body);
        white-space: nowrap;
    }
    body .episode-podcast-header .nova-account-actions > .btn-play-large:hover { background: #fff; }
}
@media (max-width: 1100px) {
    body .episode-detail.episode-podcast-header { grid-template-columns: 30% minmax(0, 1fr); min-height: 0; }
}
@media (max-width: 600px) {
    body .episode-detail.episode-podcast-header { grid-template-columns: minmax(0, 1fr); padding: 24px; gap: 24px; }
    .episode-podcast-header .episode-detail-media { width: 55%; justify-self: center; }
}
@media (max-width: 760px) {
    .episode-podcast-header .episode-cast { display: none; }
    .episode-portraits { display: block; margin: 48px 0; }
    .episode-portraits h2 { margin: 0 0 24px; font: clamp(2rem, 8vw, 3rem)/1 var(--vixen-heading); color: #fff; letter-spacing: -0.04em; }
    .episode-portraits-list { display: flex; flex-wrap: wrap; justify-content: flex-start; width: 100%; gap: 8px; padding: 0; }
    .episode-portraits-link { display: flex; flex-direction: column; align-items: center; flex: none; width: min(20vw, 76px); min-height: 106px; color: #fff; text-align: center; text-decoration: none; }
    .episode-portraits-link img,
    .episode-portraits-initial { display: block; width: clamp(50px, 13vw, 68px); height: clamp(50px, 13vw, 68px); border-radius: 50%; object-fit: cover; background: #e8e8e8; color: #111; }
    .episode-portraits-initial { display: grid; place-items: center; font: 2rem/1 var(--vixen-heading); }
    .episode-portraits-name { width: 100%; margin-top: 8px; font: 700 .7rem/1.1 var(--vixen-body); white-space: normal; overflow-wrap: anywhere; }
    .episode-portraits-link:focus-visible { outline: 3px solid #fff; outline-offset: 5px; }
    .episode-podcast-header .episode-cast { grid-column: 1 / -1; grid-row: 2; justify-content: center; width: 100%; margin: 0; padding: 20px 0 0; gap: 8px; }
    .episode-podcast-header .episode-cast-link { display: flex; flex-direction: column; justify-content: flex-start; width: min(21vw, 76px); height: auto; min-height: 106px; border-radius: 0; text-align: center; }
    .episode-podcast-header .episode-cast-link img,
    .episode-podcast-header .episode-cast-initial { width: clamp(50px, 13vw, 68px); height: clamp(50px, 13vw, 68px); order: 1; }
    .episode-podcast-header .episode-cast-name { position: static; order: 2; width: 100%; max-width: none; margin-top: 8px; font: 700 .7rem/1.1 var(--vixen-body); opacity: 1; transform: none; white-space: normal; }
    .episode-podcast-header .episode-cast-name::after { display: none; }
    .episode-podcast-header .episode-cast-link:is(:hover, :focus-visible) { transform: none; }
    .episode-podcast-header .episode-cast-link:is(:hover, :focus-visible) .episode-cast-name { transform: none; }
    .episode-podcast-header ~ .article-related-section .article-related-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
        align-items: stretch;
    }
    .episode-podcast-header ~ .article-related-section .article-related-card-body h4 {
        font-size: 1rem;
        line-height: 1.05;
        overflow-wrap: anywhere;
    }
    body .episode-detail.episode-podcast-header {
        position: relative;
        grid-template-columns: minmax(0, 1fr);
        padding: 22px 0 0;
        gap: 20px;
        border-radius: 0;
        background: transparent;
        color: #fff;
    }
    .episode-podcast-header .episode-detail-media { width: 62%; justify-self: center; }
    body .episode-podcast-header .episode-cover { border-radius: 22px; box-shadow: none; }
    body .episode-podcast-header .episode-detail-info { display: flex; flex-direction: column; text-align: center; }
    body .episode-podcast-header .episode-detail-media > .episode-favorite-actions {justify-content:center;gap:8px}
    body .episode-podcast-header .episode-detail-info > .nova-account-actions {display:grid;grid-template-columns:48px minmax(0,1fr) 48px;align-items:center;gap:8px}
    body .episode-podcast-header .nova-account-actions > .episode-podcast-link {margin-left:0}
    body .episode-podcast-header .episode-meta {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 4px 28px;
        margin: 0 0 16px;
        font-size: .95rem;
    }
    body .episode-podcast-header .episode-meta,
    body .episode-podcast-header .episode-meta a { color: #aaa; }
    .episode-podcast-header .episode-mobile-only { display: inline; }
    .episode-podcast-header .episode-meta-desktop,
    .episode-podcast-header .episode-play-label { display: none; }
    body .episode-podcast-header .episode-detail-info h1 {
        color: #fff;
        font-size: clamp(1.4rem, 7.5vw, 3rem);
        line-height: .98;
        margin: 0;
    }
    body .episode-podcast-header .nova-account-actions {
        display: grid;
        grid-template-columns: auto auto;
        justify-content: center;
        gap: 32px 8px;
        margin: 24px 0;
        order: 1;
    }
    body .episode-podcast-header .nova-account-actions > :is(button, a) {
        padding: 10px 12px;
        min-width: 0;
        min-height: 36px;
        border-radius: 999px;
        font-size: clamp(.65rem, 2.65vw, 1rem);
        color: #fff;
    }
    body .episode-podcast-header .nova-account-actions > .btn-play-large {
        grid-column: 2;
        justify-self: center;
        min-width: 165px;
        min-height: 48px;
        gap: 14px;
        padding: 12px 26px;
        background: #ddd;
        color: #111 !important;
        font: 1.1rem/1.2 var(--vixen-body);
        white-space: nowrap;
    }
    body .episode-podcast-header .nova-account-actions > .episode-podcast-link { grid-column: 1; grid-row: 2; margin: 0; }
    body .episode-podcast-header .nova-account-actions > .nova-favorite-button { grid-column: 1; grid-row: 2; }
    body .episode-podcast-header .nova-account-actions > .nova-favorites-page-button:not(.episode-podcast-link) { grid-column: 2; grid-row: 2; }
    body .episode-podcast-header .episode-secondary-actions {order:3; justify-content:center; gap:8px; margin:0 0 20px}
    body .episode-podcast-header .episode-secondary-actions > :is(button,a) {color:#fff; padding:10px 12px; font-size:clamp(.75rem,2.9vw,1rem)}
    body .episode-podcast-header .episode-summary { display: block; order: 2; text-align: left; color: #fff; margin: 0 0 30px; line-height: 1.35; }
    body .episode-podcast-header .episode-transcript-btn { order: 3; color: #fff; }
    body .episode-podcast-header .episode-transcript { order: 4; }
    body .episode-podcast-header .episode-actions-menu {position:absolute;top:0;right:0;margin-left:0}
}
@media (prefers-reduced-motion: reduce) {
    .episode-podcast-header .episode-cast-link,
    .episode-podcast-header .episode-cast-name { transition: none; }
    .episode-podcast-header .episode-cast-link:is(:hover, :focus-visible) { transform: none; }
}

/* Keep the menu clear of episode metadata and the series editor control. */
body .episode-podcast-header .episode-meta { padding-right: 48px; }
body .ps-hero .episode-actions-menu { top: 18px; right: max(18px, calc((100vw - var(--vixen-content)) / 2)); }
body .ps-hero .ps-edit { right: calc(max(18px, (100vw - var(--vixen-content)) / 2) + 48px); }
@media (max-width: 760px) {
    body .ps-hero .episode-actions-menu { right: 20px; }
    body .ps-hero .ps-edit { right: 68px; }
}
