/**
 * MMO Recent Episodes - Stylesheet
 * Inspired by noagendashow.net episode grid layout
 * Dark theme matching mmo.show
 */

/* ── Container ── */
.mmo-recent-episodes {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* ── Heading ── */
.mmo-episodes-heading {
    text-align: center;
    font-size: 1.6rem;
    font-weight: 600;
    margin-bottom: 2rem;
    color: #e0e0e0;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

/* ── Grid ── */
.mmo-episodes-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* 3 items */
.mmo-episodes-grid[data-count="3"] {
    grid-template-columns: repeat(3, 1fr);
}

/* 2 items */
.mmo-episodes-grid[data-count="2"] {
    grid-template-columns: repeat(2, 1fr);
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
}

/* 1 item */
.mmo-episodes-grid[data-count="1"] {
    grid-template-columns: 1fr;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
}

/* ── Episode Card ── */
.mmo-episode-card {
    display: block;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.mmo-episode-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.15);
}

/* Active / playing states */
.mmo-episode-card.mmo-is-active {
    border-color: rgba(192, 57, 43, 0.5);
    box-shadow: 0 0 0 1px rgba(192, 57, 43, 0.3);
}

.mmo-episode-card.mmo-is-playing .mmo-episode-play-overlay {
    opacity: 1;
}

.mmo-episode-card.mmo-is-playing .mmo-episode-play-overlay svg {
    /* swap to pause icon via CSS */
}

.mmo-episode-card:focus-within {
    outline: 2px solid #c0392b;
    outline-offset: 2px;
}

/* ── Artwork ── */
.mmo-episode-artwork-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #1a1a1a;
    cursor: pointer;
}

.mmo-episode-artwork-wrap:focus {
    outline: 2px solid #c0392b;
    outline-offset: -2px;
}

.mmo-episode-artwork {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease, filter 0.3s ease;
}

.mmo-episode-card:hover .mmo-episode-artwork {
    transform: scale(1.04);
    filter: brightness(0.7);
}

/* ── Play Overlay ── */
.mmo-episode-play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
    color: #ffffff;
    pointer-events: none;
}

.mmo-episode-play-overlay svg {
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
}

.mmo-episode-card:hover .mmo-episode-play-overlay {
    opacity: 1;
}

/* ── Episode Info ── */
.mmo-episode-info {
    padding: 0.85rem 1rem 1rem;
}

.mmo-episode-date {
    display: block;
    font-size: 0.78rem;
    color: #999;
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 500;
}

.mmo-episode-title {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.35;
    margin: 0;
    color: #e0e0e0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mmo-episode-title-link {
    text-decoration: none;
    color: inherit;
}

.mmo-episode-title-link:hover {
    text-decoration: none;
}

.mmo-episode-title-link:hover .mmo-episode-title {
    color: #ffffff;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.mmo-episode-card:hover .mmo-episode-title {
    color: #ffffff;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Sticky Player Bar
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.mmo-player-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    background: #111111;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.mmo-player-bar.mmo-player-visible {
    transform: translateY(0);
}

.mmo-player-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
}

.mmo-player-artwork {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}

.mmo-player-info {
    flex: 0 1 200px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.mmo-player-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #e0e0e0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mmo-player-date {
    font-size: 0.7rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.mmo-player-controls {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}

.mmo-player-btn {
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    padding: 0.35rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, background 0.15s;
}

.mmo-player-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.mmo-player-playpause {
    color: #fff;
}

.mmo-player-progress-wrap {
    flex: 1;
    min-width: 60px;
    cursor: pointer;
    padding: 0.5rem 0;
}

.mmo-player-progress-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.mmo-player-progress-fill {
    height: 100%;
    background: #c0392b;
    border-radius: 2px;
    width: 0%;
    transition: width 0.2s linear;
}

.mmo-player-progress-wrap:hover .mmo-player-progress-bar {
    height: 6px;
}

.mmo-player-time {
    font-size: 0.72rem;
    color: #888;
    white-space: nowrap;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.mmo-player-close {
    margin-left: 0.25rem;
}

/* ── Browse Archive Link ── */
.mmo-browse-archive {
    text-align: center;
    margin-top: 1.5rem;
}

.mmo-archive-link {
    display: inline-block;
    padding: 0.65rem 2rem;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #e0e0e0;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    text-decoration: none;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.mmo-archive-link:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.4);
    color: #ffffff;
    text-decoration: none;
}

/* ── Error State ── */
.mmo-episodes-error {
    text-align: center;
    padding: 2rem;
    color: #999;
    font-style: italic;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Responsive
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

@media (max-width: 1024px) {
    .mmo-episodes-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }

    .mmo-episodes-grid[data-count="3"] {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .mmo-episodes-grid,
    .mmo-episodes-grid[data-count="3"],
    .mmo-episodes-grid[data-count="2"] {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
        max-width: 100%;
    }

    .mmo-episode-info {
        padding: 0.6rem 0.7rem 0.75rem;
    }

    .mmo-episode-date {
        font-size: 0.7rem;
    }

    .mmo-episode-title {
        font-size: 0.82rem;
    }

    .mmo-episodes-heading {
        font-size: 1.3rem;
    }

    /* Player bar: stack on mobile */
    .mmo-player-inner {
        flex-wrap: wrap;
        gap: 0.4rem;
        padding: 0.5rem 0.75rem;
    }

    .mmo-player-info {
        flex: 1;
        min-width: 0;
    }

    .mmo-player-progress-wrap {
        order: 10;
        flex-basis: 100%;
        padding: 0.2rem 0;
    }

    .mmo-player-time {
        order: 11;
        flex-basis: 100%;
        text-align: center;
        font-size: 0.68rem;
    }
}

@media (max-width: 380px) {
    .mmo-episodes-grid,
    .mmo-episodes-grid[data-count="3"],
    .mmo-episodes-grid[data-count="2"] {
        grid-template-columns: 1fr;
        max-width: 280px;
        margin-left: auto;
        margin-right: auto;
    }
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Light theme override (if needed)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.mmo-recent-episodes.mmo-light .mmo-episodes-heading,
.mmo-recent-episodes.mmo-light .mmo-episode-title {
    color: #1a1a1a;
}

.mmo-recent-episodes.mmo-light .mmo-episode-card {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.1);
}

.mmo-recent-episodes.mmo-light .mmo-episode-card:hover {
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}

.mmo-recent-episodes.mmo-light .mmo-episode-date {
    color: #666;
}

.mmo-recent-episodes.mmo-light .mmo-archive-link {
    color: #333;
    border-color: rgba(0, 0, 0, 0.2);
}
