/* Podwright — Frontend Player
   Warm broadcast / editorial aesthetic */

.podwright-player-wrap {
    --pw-ink:        #1C1814;
    --pw-ink-soft:   #5C5248;
    --pw-ink-mute:   #9C9288;
    --pw-paper:      #FBF8F3;
    --pw-paper-2:    #F3EEE6;
    --pw-line:       #E4DED5;
    --pw-line-2:     #D4CEC5;
    --pw-amber:      #D07A10;
    --pw-amber-deep: #B8680C;
    --pw-amber-soft: rgba(208, 122, 16, 0.12);
    --pw-amber-glow: rgba(208, 122, 16, 0.28);
    --pw-radius:     16px;
    --pw-radius-sm:  10px;

    max-width: 720px;
    margin: 2.25rem 0;
}

.podwright-player {
    position: relative;
    margin: 0;
    padding: 0;
    background: var(--pw-paper);
    border: 1px solid var(--pw-line);
    border-radius: var(--pw-radius);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.7) inset,
        0 12px 40px rgba(28, 24, 20, 0.07);
    overflow: hidden;
    font-family: Georgia, "Times New Roman", Times, serif;
    color: var(--pw-ink);
    -webkit-font-smoothing: antialiased;
    isolation: isolate;
}

/* Footer links under the player */
.podwright-player__links {
    margin: 10px 2px 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--pw-ink-soft);
}

.podwright-player__links-label {
    color: var(--pw-ink-mute);
    margin-right: 4px;
}

.podwright-player__link {
    color: var(--pw-amber-deep);
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
    transition: color 0.15s ease;
}

.podwright-player__link:hover,
.podwright-player__link:focus-visible {
    color: var(--pw-amber);
}

.podwright-player__links-sep {
    margin: 0 0.35em;
    color: var(--pw-ink-mute);
    text-decoration: none;
}

/* Subtle paper grain */
.podwright-player::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.35;
    z-index: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.45'/%3E%3C/svg%3E");
    mix-blend-mode: multiply;
}

.podwright-player__inner {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 0;
    min-height: 140px;
}

/* Artwork */
.podwright-player__art {
    position: relative;
    background: var(--pw-paper-2);
    border-right: 1px solid var(--pw-line);
    min-height: 140px;
}

.podwright-player__art img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    inset: 0;
}

.podwright-player__art-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--pw-ink-mute);
    background:
        radial-gradient(circle at 30% 30%, var(--pw-amber-soft), transparent 60%),
        var(--pw-paper-2);
}

.podwright-player__art-fallback svg {
    width: 40px;
    height: 40px;
    opacity: 0.55;
}

/* Body */
.podwright-player__body {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 18px 22px 16px;
    gap: 14px;
    min-width: 0;
}

.podwright-player__meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.podwright-player__eyebrow {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--pw-amber);
}

.podwright-player__dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--pw-amber);
    box-shadow: 0 0 0 3px var(--pw-amber-soft);
    flex-shrink: 0;
}

.podwright-player__title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 400;
    letter-spacing: -0.02em;
    line-height: 1.25;
    color: var(--pw-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.podwright-player__sub {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 12.5px;
    color: var(--pw-ink-mute);
    line-height: 1.4;
}

/* Controls row */
.podwright-player__controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.podwright-player__btn {
    appearance: none;
    border: none;
    background: transparent;
    color: var(--pw-ink-soft);
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    transition: color 0.15s ease, background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
    flex-shrink: 0;
}

.podwright-player__btn:hover {
    color: var(--pw-ink);
}

.podwright-player__btn:focus-visible {
    outline: 2px solid var(--pw-amber);
    outline-offset: 2px;
}

.podwright-player__btn--play {
    width: 44px;
    height: 44px;
    background: var(--pw-amber);
    color: #fff;
    box-shadow: 0 6px 18px var(--pw-amber-glow);
}

.podwright-player__btn--play:hover {
    background: var(--pw-amber-deep);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 10px 24px var(--pw-amber-glow);
}

.podwright-player__btn--play:active {
    transform: translateY(0);
}

.podwright-player__btn--play svg {
    width: 18px;
    height: 18px;
}

.podwright-player__btn--skip {
    width: 32px;
    height: 32px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--pw-ink-soft);
    border: 1px solid var(--pw-line-2);
    background: rgba(255, 255, 255, 0.5);
}

.podwright-player__btn--skip:hover {
    border-color: var(--pw-amber);
    color: var(--pw-amber);
    background: var(--pw-amber-soft);
}

/* Progress */
.podwright-player__progress-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.podwright-player__scrubber {
    position: relative;
    height: 6px;
    background: var(--pw-paper-2);
    border: 1px solid var(--pw-line);
    border-radius: 99px;
    cursor: pointer;
    overflow: hidden;
}

.podwright-player__scrubber-fill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0%;
    background: linear-gradient(90deg, var(--pw-amber), #E8962A);
    border-radius: 99px;
    pointer-events: none;
    transition: width 0.08s linear;
}

.podwright-player__scrubber-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    margin: 0;
    padding: 0;
}

.podwright-player__times {
    display: flex;
    justify-content: space-between;
    font-family: "SF Mono", "Cascadia Code", Consolas, monospace;
    font-size: 11px;
    color: var(--pw-ink-mute);
    letter-spacing: 0.02em;
    tabular-nums: true;
    font-variant-numeric: tabular-nums;
}

/* Hidden native media element */
.podwright-player__media {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Video mode: show the video frame */
.podwright-player--video .podwright-player__media {
    position: relative;
    width: 100%;
    height: auto;
    margin: 0;
    clip: auto;
    overflow: visible;
    display: block;
    background: #0a0908;
    max-height: 360px;
}

.podwright-player--video .podwright-player__inner {
    grid-template-columns: 1fr;
}

.podwright-player--video .podwright-player__art {
    display: none;
}

.podwright-player--video .podwright-player__body {
    border-top: 1px solid var(--pw-line);
}

/* Playing state pulse on art */
.podwright-player.is-playing .podwright-player__dot {
    animation: pwPlayerPulse 1.6s ease-out infinite;
}

@keyframes pwPlayerPulse {
    0%   { box-shadow: 0 0 0 3px var(--pw-amber-soft); }
    70%  { box-shadow: 0 0 0 10px rgba(208, 122, 16, 0); }
    100% { box-shadow: 0 0 0 3px rgba(208, 122, 16, 0); }
}

/* Loading */
.podwright-player.is-loading .podwright-player__btn--play {
    opacity: 0.7;
}

/* Responsive */
@media (max-width: 560px) {
    .podwright-player__inner {
        grid-template-columns: 1fr;
    }

    .podwright-player__art {
        border-right: none;
        border-bottom: 1px solid var(--pw-line);
        min-height: 0;
        aspect-ratio: 16 / 7;
    }

    .podwright-player__body {
        padding: 16px 16px 14px;
    }

    .podwright-player__title {
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .podwright-player__controls {
        flex-wrap: wrap;
    }

    .podwright-player__progress-wrap {
        order: 3;
        flex-basis: 100%;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .podwright-player.is-playing .podwright-player__dot {
        animation: none;
    }
    .podwright-player__btn--play,
    .podwright-player__scrubber-fill {
        transition: none;
    }
}

/* ═══════════════════════════════════════════════
   STANDALONE POPUP WINDOW
═══════════════════════════════════════════════ */

html:has(body.podwright-standalone) {
    height: 100%;
}

body.podwright-standalone {
    margin: 0;
    min-height: 100%;
    background:
        radial-gradient(ellipse at 20% 0%, rgba(208, 122, 16, 0.08), transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(28, 24, 20, 0.04), transparent 45%),
        #F7F5F1;
    color: #1C1814;
    font-family: Georgia, "Times New Roman", Times, serif;
    -webkit-font-smoothing: antialiased;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px 18px;
    box-sizing: border-box;
}

.podwright-standalone__shell {
    width: 100%;
    max-width: 640px;
}

.podwright-standalone__header {
    margin-bottom: 18px;
    text-align: left;
}

.podwright-standalone__show {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #D07A10;
    margin-bottom: 8px;
}

.podwright-standalone__heading {
    margin: 0;
    font-size: clamp(1.35rem, 3vw, 1.75rem);
    font-weight: 400;
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: #1C1814;
}

.podwright-player-wrap--standalone {
    margin: 0;
    max-width: none;
}

.podwright-player--standalone {
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.7) inset,
        0 18px 50px rgba(28, 24, 20, 0.1);
}

.podwright-standalone__close {
    margin: 18px 2px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 13px;
    color: #9C9288;
}

.podwright-standalone__close a,
.podwright-standalone__close-btn {
    color: #5C5248;
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.podwright-standalone__close a:hover,
.podwright-standalone__close-btn:hover {
    color: #D07A10;
}
