/* ─────────────────────────────────────────────────────────────
   Educational Videos page
   Card grid inspired by posts.css but with 16:9 YouTube thumbnails
   and click-to-play iframe swap (no autoplay noise on page load).
   ───────────────────────────────────────────────────────────── */

.videos-cover {
    background-color: #FFFFFF;
    color: #222;
    text-align: center;
    padding: 50px 20px 30px;
}

.videos-cover h1 {
    font-size: 3rem;
    margin: 0 0 0.5rem 0;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.videos-cover .subtitle {
    font-size: 1.25rem;
    color: #888;
    margin: 0;
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.5;
}

.videos-cover .channel-link {
    display: inline-block;
    margin-top: 18px;
    padding: 10px 22px;
    background: #FF0033;
    color: #fff;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 999px;
    transition: background 0.2s, transform 0.2s;
}

.videos-cover .channel-link:hover {
    background: #cc0028;
    transform: translateY(-1px);
}

.videos-cover .channel-link .yt-icon {
    display: inline-block;
    width: 18px;
    height: 18px;
    vertical-align: -3px;
    margin-right: 6px;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M21.6 7.2a2.5 2.5 0 0 0-1.8-1.8C18.3 5 12 5 12 5s-6.3 0-7.8.4A2.5 2.5 0 0 0 2.4 7.2C2 8.7 2 12 2 12s0 3.3.4 4.8a2.5 2.5 0 0 0 1.8 1.8C5.7 19 12 19 12 19s6.3 0 7.8-.4a2.5 2.5 0 0 0 1.8-1.8C22 15.3 22 12 22 12s0-3.3-.4-4.8zM10 15V9l5 3-5 3z'/></svg>") no-repeat center / contain;
            mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M21.6 7.2a2.5 2.5 0 0 0-1.8-1.8C18.3 5 12 5 12 5s-6.3 0-7.8.4A2.5 2.5 0 0 0 2.4 7.2C2 8.7 2 12 2 12s0 3.3.4 4.8a2.5 2.5 0 0 0 1.8 1.8C5.7 19 12 19 12 19s6.3 0 7.8-.4a2.5 2.5 0 0 0 1.8-1.8C22 15.3 22 12 22 12s0-3.3-.4-4.8zM10 15V9l5 3-5 3z'/></svg>") no-repeat center / contain;
}

/* ─── Video grid ─────────────────────────────────────────── */
.videos-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 40px 60px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
}

.video-card {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
}

.video-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

/* 16:9 responsive frame that holds either the thumbnail or the iframe */
.video-frame {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 */
    background: #000;
    cursor: pointer;
    overflow: hidden;
}

.video-frame img,
.video-frame iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    object-fit: cover;
}

.video-frame img {
    transition: transform 0.4s ease, filter 0.2s ease;
}

.video-frame:hover img {
    transform: scale(1.03);
    filter: brightness(0.85);
}

/* Play-button overlay on the thumbnail */
.video-frame .play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 68px;
    height: 48px;
    background: rgba(0, 0, 0, 0.75);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    pointer-events: none; /* click target is the frame itself */
}

.video-frame:hover .play-btn {
    background: #FF0033;
}

.video-frame .play-btn::after {
    content: '';
    display: block;
    border-style: solid;
    border-width: 10px 0 10px 16px;
    border-color: transparent transparent transparent #fff;
    margin-left: 4px;
}

/* Duration pill in the corner */
.video-frame .duration {
    position: absolute;
    right: 8px;
    bottom: 8px;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1.3;
    z-index: 1;
}

/* Meta below the frame */
.video-meta {
    padding: 14px 16px 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
    text-align: center;
}

.video-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: #222;
    margin: 0;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-meta .video-sub {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.8rem;
    color: #888;
    margin: 0;
}

/* ─── Fallback: full uploads-playlist embed ─────────────── */
.videos-playlist-fallback {
    max-width: 960px;
    margin: 0 auto 60px;
    padding: 0 20px;
}

.videos-playlist-fallback .frame {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
}

.videos-playlist-fallback iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.videos-playlist-fallback .hint {
    text-align: center;
    color: #888;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.9rem;
    margin: 16px 0 0;
}

/* ─── Empty state ────────────────────────────────────────── */
.videos-empty {
    max-width: 640px;
    margin: 40px auto;
    padding: 30px;
    text-align: center;
    color: #666;
    font-family: 'Montserrat', sans-serif;
}

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 1100px) {
    .videos-page {
        grid-template-columns: repeat(2, 1fr);
        padding: 20px 24px 60px;
    }
}

@media (max-width: 767px) {
    .videos-cover {
        padding: 30px 16px 16px;
    }
    .videos-cover h1 {
        font-size: 2rem;
    }
    .videos-cover .subtitle {
        font-size: 1rem;
    }
    .videos-page {
        grid-template-columns: 1fr;
        gap: 18px;
        padding: 16px 16px 40px;
    }
}
