/* Podcast: Spotify-style show and episode pages with a sticky player. Builds on site.css tokens. */

.podcast { --show-color: rgb(75, 91, 255); }

/* ---------- Header: cover-colour wash fading into the page ---------- */

.podcast-hero {
    padding: clamp(3rem, 8vw, 5.5rem) 0 clamp(2rem, 5vw, 3rem);
    background: linear-gradient(to bottom,
        color-mix(in srgb, var(--show-color) 55%, var(--bg)) 0%,
        color-mix(in srgb, var(--show-color) 18%, var(--bg)) 70%,
        var(--bg) 100%);
}

.podcast-hero__inner {
    display: flex;
    align-items: flex-end;
    gap: clamp(1.25rem, 4vw, 2.5rem);
    max-width: 64rem;
}

.podcast-hero__cover {
    display: grid;
    place-items: end start;
    flex: none;
    width: clamp(9rem, 26vw, 15rem);
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: var(--radius-lg);
    box-shadow: 0 1.25rem 3rem rgba(15, 12, 21, 0.3);
}

.podcast-hero__cover span {
    padding: 1rem;
    font-family: var(--font-display);
    font-size: clamp(1rem, 2.6vw, 1.5rem);
    font-weight: 900;
    line-height: 0.95;
    letter-spacing: -0.04em;
    text-transform: uppercase;
    color: #fff;
}

.podcast-hero__text {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: 0;
}

.podcast-hero__eyebrow {
    font-size: var(--text-sm);
    font-weight: 600;
}

.podcast-hero__title {
    font-size: clamp(2.25rem, 7vw, 5.5rem);
    overflow-wrap: anywhere;
}

.podcast-hero__byline { font-size: 0.95rem; }
.podcast-hero__byline strong { font-weight: 600; }
.podcast-hero__byline a { font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Body ---------- */

.podcast-body {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    max-width: 64rem;
}

.podcast-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.podcast-heading {
    font-size: var(--text-lg);
    font-weight: 600;
    letter-spacing: -0.02em;
}

.podcast-about {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-width: 44rem;
    color: var(--muted);
}

.podcast-about .podcast-heading,
.podcast-about__tagline { color: var(--ink); }

.podcast-notes { display: flex; flex-direction: column; gap: 1rem; max-width: 44rem; }

.podcast-soon {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: clamp(2rem, 5vw, 3rem);
    border-radius: var(--radius-xl);
    background: var(--surface-2);
    color: var(--muted);
}

.podcast-soon__title {
    font-size: clamp(1.75rem, 4.5vw, 2.75rem);
    color: var(--ink);
}

/* ---------- Play buttons ---------- */

.podcast-play,
.episode-play,
.player__toggle {
    display: grid;
    place-items: center;
    flex: none;
    padding: 0;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 150ms var(--ease-out), background 150ms ease-out;
}

.podcast-play svg,
.episode-play svg,
.player__toggle svg { grid-area: 1 / 1; }

/* Each play button holds both icons; .is-playing swaps them. */
.icon-pause,
.is-playing > .icon-play { display: none; }
.is-playing > .icon-pause { display: block; }

.podcast-play {
    width: 3.5rem;
    height: 3.5rem;
    background: var(--lime);
    color: var(--ink);
    box-shadow: 0 0.5rem 1.5rem rgba(15, 12, 21, 0.18);
}

.podcast-play svg { width: 1.6rem; height: 1.6rem; }
.podcast-play:hover { transform: scale(1.05); }
.podcast-play:active { transform: scale(0.97); }

.episode-play {
    width: 2.5rem;
    height: 2.5rem;
    background: var(--ink);
    color: var(--ink-inverse);
}

.episode-play svg { width: 1.1rem; height: 1.1rem; }
.episode-play:hover { transform: scale(1.06); }

.podcast-play:focus-visible,
.episode-play:focus-visible,
.player button:focus-visible,
.player input:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

.episode-soon {
    flex: none;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-pill);
    background: var(--surface-2);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--muted);
    white-space: nowrap;
}

/* ---------- Episode list ---------- */

.episode-list {
    margin: -1rem 0 0;
    padding: 0;
    list-style: none;
}

.episode-row {
    position: relative;
    display: flex;
    align-items: center;
    gap: clamp(0.9rem, 2.5vw, 1.5rem);
    padding: 1.1rem 0.75rem;
    border-bottom: 1px solid var(--surface-2);
    border-radius: var(--radius-lg);
    transition: background 150ms ease-out;
}

.episode-row:hover,
.episode-row.is-current { background: var(--surface-1); }

.episode-row__cover {
    flex: none;
    width: clamp(4rem, 12vw, 6.5rem);
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 0.6rem;
}

.episode-row__text {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1;
    min-width: 0;
}

.episode-row__title {
    font-size: var(--text-base);
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* The whole row is clickable through the title link. */
.episode-row__title a::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
}

.episode-row__title a:hover { text-decoration: underline; }
.episode-row.is-current .episode-row__title { color: var(--accent); }

.episode-row__desc {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 0.9rem;
    line-height: 1.45;
    color: var(--muted);
}

/* Keep the play button above the row's stretched link. */
.episode-row .episode-play,
.episode-row .episode-soon { position: relative; z-index: 1; }

.episode-meta {
    display: flex;
    flex-wrap: wrap;
    font-size: var(--text-sm);
    color: var(--muted);
}

.episode-meta > * + *::before { content: "·"; margin: 0 0.45rem; }

/* Animated bars next to the episode that's playing, like Spotify. */
.equaliser {
    display: none;
    align-items: flex-end;
    gap: 2px;
    width: 0.85rem;
    height: 0.8rem;
    margin-right: 0.5rem;
    vertical-align: -0.05em;
}

.equaliser span {
    flex: 1;
    height: 100%;
    background: currentColor;
    border-radius: 1px;
    transform-origin: bottom;
    animation: equalise 900ms ease-in-out infinite alternate;
}

.equaliser span:nth-child(2) { animation-delay: -300ms; animation-duration: 700ms; }
.equaliser span:nth-child(3) { animation-delay: -600ms; animation-duration: 1100ms; }

@keyframes equalise {
    from { transform: scaleY(0.25); }
    to   { transform: scaleY(1); }
}

.episode-row.is-current .equaliser { display: inline-flex; }
.episode-row.is-current:not(.is-playing) .equaliser span { animation-play-state: paused; }

/* ---------- Sticky player ---------- */

html.has-player body { padding-bottom: 5.5rem; }

.player {
    position: fixed;
    left: 0.75rem;
    right: 0.75rem;
    bottom: 0.75rem;
    z-index: 150;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) minmax(0, 1fr);
    align-items: center;
    gap: 1rem;
    padding: 0.6rem 1rem 0.6rem 0.6rem;
    border-radius: var(--radius-lg);
    background: var(--ink);
    color: var(--ink-inverse);
    box-shadow: 0 1rem 2.5rem rgba(15, 12, 21, 0.35);
    animation: player-in 360ms var(--ease-out);
}

@keyframes player-in {
    from { transform: translateY(120%); }
    to   { transform: none; }
}

.player__now {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.player__cover {
    flex: none;
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 0.5rem;
    object-fit: cover;
}

.player__info { min-width: 0; }

.player__title,
.player__show {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.player__title { font-size: 0.9rem; font-weight: 600; }
.player__title:hover { text-decoration: underline; }
.player__show { font-size: var(--text-sm); color: rgba(252, 251, 251, 0.6); }

.player__center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
}

.player__controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.player__skip,
.player__speed {
    padding: 0.25rem 0.4rem;
    border: 0;
    border-radius: var(--radius-pill);
    background: none;
    color: rgba(252, 251, 251, 0.75);
    font: inherit;
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    transition: color 150ms ease-out;
}

.player__skip:hover,
.player__speed:hover { color: #fff; }

.player__toggle {
    width: 2.5rem;
    height: 2.5rem;
    background: var(--ink-inverse);
    color: var(--ink);
}

.player__toggle svg { width: 1.2rem; height: 1.2rem; }
.player__toggle:hover { transform: scale(1.06); }

.player__progress {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    font-size: 0.7rem;
    font-variant-numeric: tabular-nums;
    color: rgba(252, 251, 251, 0.6);
}

.player__seek {
    --progress: 0%;
    flex: 1;
    height: 4px;
    margin: 0;
    border-radius: 2px;
    background: linear-gradient(to right, var(--lime) var(--progress), rgba(252, 251, 251, 0.25) var(--progress));
    appearance: none;
    cursor: pointer;
}

.player__seek::-webkit-slider-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    appearance: none;
}

.player__seek::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border: 0;
    border-radius: 50%;
    background: #fff;
}

.player__end { display: flex; justify-content: flex-end; }

/* Phones: cover, title and play button in one row; the seek bar runs along the bottom edge. */
@media (max-width: 767px) {
    html.has-player body { padding-bottom: 5rem; }

    .player {
        left: 0.5rem;
        right: 0.5rem;
        bottom: 0.5rem;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 0.5rem;
        padding: 0.5rem 0.75rem 0.85rem 0.5rem;
    }

    .player__cover { width: 2.75rem; height: 2.75rem; }
    .player__center { display: contents; }
    .player__controls { gap: 0.4rem; }
    .player__end { display: none; }

    .player__progress {
        position: absolute;
        left: 0.75rem;
        right: 0.75rem;
        bottom: 0.35rem;
        width: auto;
    }

    .player__time { display: none; }
    .player__seek { height: 3px; }

    .podcast-hero__inner { flex-direction: column; align-items: flex-start; }
    .episode-row { padding-left: 0; padding-right: 0; }
    .episode-row:hover { background: none; }
}

/* site.css gives every img display:block, which would override [hidden]. */
.player [hidden] { display: none; }
