/*
 * My YouTube Channel - Styled to match landing page design
 */

/* =============================================
   SECTION HEADER  (wrap your shortcode with:
   <div class="ytc-latest-section">
     <div class="ytc-latest-header">
       <h2>LATEST VIDEOS</h2>
       <a href="/youtube">VIEW ALL VIDEOS →</a>
     </div>
     [youtube_channel ...]
   </div>
   ============================================= */

.ytc-latest-section {
    width: 100%;
    padding: 2rem 0;
}

.ytc-latest-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.ytc-latest-header h2 {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #1a1a1a;
    margin: 0;
    padding: 0;
}

.ytc-latest-header a {
    font-size: 0.75rem;
    font-weight: 600;
    color: #c8a04a;
    text-decoration: none;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.ytc-latest-header a:hover {
    text-decoration: underline;
}

/* =============================================
   MAIN GRID CONTAINER
   ============================================= */

.youtube_channel {
    box-sizing: border-box !important;
    float: none !important;
    display: grid !important;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* =============================================
   INDIVIDUAL VIDEO CONTAINER
   ============================================= */

.youtube_channel .ytc_video_container {
    float: none !important;
    position: relative;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent;
    border-radius: 0;
    overflow: visible;
    transition: none;
}

/* Limit to 4 videos only — scoped to the latest videos section */
.ytc-latest-section .youtube_channel .ytc_video_container:nth-child(n+5) {
    display: none;
}

/* =============================================
   THUMBNAIL
   ============================================= */

.youtube_channel .ytc_thumb {
    display: block;
    position: relative;
    overflow: hidden;
    background: #1a1a1a;
    border: none !important;
    margin: 0 !important;
    border-radius: 3px;
}

/* Thumbnail background image span */
.youtube_channel .ytc_thumb > span {
    display: block;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 */
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    position: relative;
    transition: opacity 0.25s ease;
}

.youtube_channel .ytc_thumb:hover > span {
    opacity: 0.85;
    transform: none; /* no scale - matches flat design */
}

/* =============================================
   PLAY BUTTON — hidden by default, subtle on hover
   ============================================= */

/* Override the plugin's default play PNG */
.youtube_channel .ytc_thumb > span:before {
    content: '' !important;
    display: block !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 42px !important;
    height: 42px !important;
    margin: 0 !important;
    padding: 0 !important;
    background-color: rgba(0, 0, 0, 0.7) !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='white' d='M8 5v14l11-7z'/%3E%3C/svg%3E") !important;
    background-size: 20px !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    border-radius: 50% !important;
    opacity: 0;
    transition: opacity 0.2s ease !important;
    z-index: 3 !important;
    box-shadow: none !important;
    cursor: pointer;
}

.youtube_channel .ytc_thumb:hover > span:before {
    opacity: 1 !important;
}

/* =============================================
   DURATION BADGE — bottom right of thumbnail
   ============================================= */

.youtube_channel .ytc_thumb > span:after {
    content: attr(data-duration);
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(0, 0, 0, 0.82);
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1;
    padding: 3px 5px;
    border-radius: 2px;
    letter-spacing: 0.02em;
    z-index: 2;
    pointer-events: none;
}

/* =============================================
   TITLE (shown below thumbnail)
   ============================================= */

.youtube_channel .ytc_title {
    margin: 0 !important;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.35;
    color: #1a1a1a;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s ease;
    letter-spacing: 0;
}

.youtube_channel .ytc_title_below {
    padding: 0.5rem 0 0 0;
}

.youtube_channel .ytc_title_above {
    padding: 0 0 0.4rem 0;
}

.youtube_channel .ytc_video_container:hover .ytc_title {
    color: #c8a04a;
}

/* Title as a link */
.youtube_channel .ytc_title a {
    color: inherit;
    text-decoration: none;
}

.youtube_channel .ytc_title a:hover {
    color: #c8a04a;
}

/* =============================================
   DESCRIPTION / META TEXT
   ============================================= */

.youtube_channel .ytc_description {
    font-size: 0.7rem;
    color: #888888;
    line-height: 1.4;
    margin-top: 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* =============================================
   TITLE INSIDE THUMBNAIL (if used)
   ============================================= */

.youtube_channel .ytc_title_inside {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, transparent 100%);
    color: #ffffff;
    padding: 1.5rem 0.6rem 0.6rem;
    margin: 0;
    font-size: 0.78rem;
    font-weight: 600;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    z-index: 2;
}

/* =============================================
   FOOTER / CHANNEL LINK — hide it
   ============================================= */

.youtube_channel .ytc_link {
    display: none !important;
}

/* =============================================
   CLEARFIX
   ============================================= */

.youtube_channel + .clearfix {
    display: none;
}

/* =============================================
   ASPECT RATIO OVERRIDES
   ============================================= */

.youtube_channel .ytc_thumb.ar16_9,
.youtube_channel .ytc_thumb.ar16_9 > span {
    padding-bottom: 56.25%;
}

.youtube_channel .ytc_thumb.ar4_3,
.youtube_channel .ytc_thumb.ar4_3 > span {
    padding-bottom: 75%;
}

/* =============================================
   RESPONSIVE — override inline widths
   ============================================= */

.youtube_channel.responsive .ytc_video_container {
    width: auto !important;
}

/* =============================================
   ERROR MESSAGE
   ============================================= */

.youtube_channel p.ytc_error {
    color: #cc0000;
    font-size: 0.85rem;
    grid-column: 1 / -1;
}

/* =============================================
   RESPONSIVE BREAKPOINTS
   ============================================= */

/* Tablet: 2 columns */
@media only screen and (max-width: 1100px) {
    .youtube_channel {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .youtube_channel .ytc_video_container:nth-child(n+5) {
        display: none;
    }
}

/* Large mobile: 2 columns */
@media only screen and (max-width: 600px) {
    .youtube_channel {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .youtube_channel .ytc_title {
        font-size: 0.75rem;
    }
}

/* Small mobile: 1 column */
@media only screen and (max-width: 380px) {
    .youtube_channel {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

/* =============================================
   PLAYLISTS SECTION — home page tiles
   ============================================= */

.ytc-playlists-section {
    padding: 0;
    margin: 0;
}

/* Reuse the same header style as Latest Videos */
.ytc-playlists-section .ytc-latest-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

/* 4 equal columns, same tight gap as latest videos */
.ytc-playlists-section .wp-block-columns {
    gap: 12px !important;
    margin: 0 !important;
}

.ytc-playlists-section .wp-block-column {
    margin: 0 !important;
}

/* Playlist tile — cover block */
.ytc-playlist-tile {
    border-radius: 3px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.ytc-playlist-tile:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.ytc-playlist-tile img {
    transition: transform 0.3s ease;
}

.ytc-playlist-tile:hover img {
    transform: scale(1.04);
}

/* Inner text container — sits at bottom left */
.ytc-playlist-tile .wp-block-cover__inner-container {
    padding: 0.75rem !important;
    width: 100%;
}

/* Playlist name */
.ytc-playlist-title {
    font-size: 0.85rem !important;
    font-weight: 700 !important;
    line-height: 1.3 !important;
    margin: 0 0 0.2rem 0 !important;
    color: #ffffff !important;
}

.ytc-playlist-title a {
    color: #ffffff !important;
    text-decoration: none !important;
}

.ytc-playlist-tile:hover .ytc-playlist-title a {
    color: #c8a04a !important;
}

/* Video count badge */
.ytc-playlist-count {
    font-size: 0.7rem !important;
    font-weight: 600 !important;
    color: rgba(255, 255, 255, 0.8) !important;
    margin: 0 !important;
    letter-spacing: 0.03em;
}

/* Responsive */
@media only screen and (max-width: 768px) {
    .ytc-playlists-section .wp-block-columns {
        flex-wrap: wrap !important;
    }
    .ytc-playlists-section .wp-block-column {
        flex-basis: calc(50% - 6px) !important;
        min-width: calc(50% - 6px) !important;
    }
}

@media only screen and (max-width: 480px) {
    .ytc-playlists-section .wp-block-column {
        flex-basis: 100% !important;
        min-width: 100% !important;
    }
}

/* =============================================
   PLAYLIST PAGE — full video grid
   Shows all videos, 4 columns (not limited to 6)
   ============================================= */

.ytc-playlist-page .youtube_channel {
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
}

/* No nth-child limit on playlist pages */
.ytc-playlist-page .youtube_channel .ytc_video_container {
    display: block !important;
}

@media only screen and (max-width: 1100px) {
    .ytc-playlist-page .youtube_channel {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media only screen and (max-width: 600px) {
    .ytc-playlist-page .youtube_channel {
        grid-template-columns: repeat(2, 1fr);
    }
}
