/*
 * Media card sizing matched to YouTube's rich grid.
 *
 * Reference measurements taken from youtube.com at a 1149px viewport:
 *   grid 1030px / 3 columns / 16px column gap
 *   card 327.3 x 284.1, thumbnail 327.3 x 184.1 (16:9), radius 12px
 *   avatar 36px, title 16/22 w500 #0f0f0f (2 lines), 13px below thumbnail
 *   channel 14/20 w400 #606060, views + date 14/20 w400 #606060
 *   duration badge 12/18 w500
 *
 * The grid uses auto-fill with a 310px minimum, which is how YouTube decides
 * its column count, so the breakpoints follow automatically. Our content
 * container is wider than YouTube's, so cards land slightly larger (352px at
 * a 1149px viewport); that is intentional.
 *
 * Applies to every wrapping card listing: homepage, browse, search, files,
 * channel tabs and Live TV. Horizontal carousels are excluded via :not()
 * below - turning those into grids would stack them into multiple rows, and
 * they are deliberately smaller than main-grid cards.
 */

/* Shared exclusion list, repeated on each rule because CSS cannot alias a
 * selector. Keep these four in sync if you add another carousel class. */

/* === GRID: replaces the flex + percentage-width layout === */
ul.fileThumbs.big:has(> li.vs-column.fourths):not(.related-carousel):not(.suggested-list):not(.playlist-items):not(.swiper-wrapper) {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)) !important;
    column-gap: 16px !important;
    row-gap: 40px !important;
}

/* The list also carries .clearfix, whose ::before/::after would each eat a
 * grid cell and push the first card out of column one. */
ul.fileThumbs.big:has(> li.vs-column.fourths):not(.related-carousel):not(.suggested-list):not(.playlist-items):not(.swiper-wrapper)::before,
ul.fileThumbs.big:has(> li.vs-column.fourths):not(.related-carousel):not(.suggested-list):not(.playlist-items):not(.swiper-wrapper)::after {
    display: none !important;
    content: none !important;
}

ul.fileThumbs.big:not(.related-carousel):not(.suggested-list):not(.playlist-items):not(.swiper-wrapper) > li.vs-column.fourths {
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
    transform: none !important;
}

/* === THUMBNAIL === */
ul.fileThumbs.big:not(.related-carousel):not(.suggested-list):not(.playlist-items):not(.swiper-wrapper) > li.vs-column.fourths figure.effect-smallT {
    border-radius: 12px !important;
    margin-bottom: 12px !important;
}

/* Skipped where the figure carries an inline padding-top ratio hack (see
 * class.files.php ~1088): there the image is absolutely positioned, so
 * height:auto would collapse it. Those figures are already 16:9. */
ul.fileThumbs.big:not(.related-carousel):not(.suggested-list):not(.playlist-items):not(.swiper-wrapper) > li.vs-column.fourths figure.effect-smallT:not([style*="padding-top"]) img.mediaThumb {
    width: 100% !important;
    aspect-ratio: 16 / 9 !important;
    height: auto !important;
    object-fit: cover !important;
}

ul.fileThumbs.big:not(.related-carousel):not(.suggested-list):not(.playlist-items):not(.swiper-wrapper) > li.vs-column.fourths .time-lenght {
    font-size: 12px !important;
    line-height: 18px !important;
    font-weight: 500 !important;
}

/* === TITLE === */
ul.fileThumbs.big:not(.related-carousel):not(.suggested-list):not(.playlist-items):not(.swiper-wrapper) > li.vs-column.fourths .media-meta h3 {
    margin-top: 0 !important;
    font-size: 16px !important;
    line-height: 22px !important;
    font-weight: 500 !important;
    max-height: 44px !important;
    overflow: hidden !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
}

ul.fileThumbs.big:not(.related-carousel):not(.suggested-list):not(.playlist-items):not(.swiper-wrapper) > li.vs-column.fourths .media-meta h3,
ul.fileThumbs.big:not(.related-carousel):not(.suggested-list):not(.playlist-items):not(.swiper-wrapper) > li.vs-column.fourths .media-meta h3 a {
    color: #0f0f0f !important;
}

/* === CHANNEL NAME, VIEWS AND PUBLISH DATE === */
ul.fileThumbs.big:not(.related-carousel):not(.suggested-list):not(.playlist-items):not(.swiper-wrapper) > li.vs-column.fourths .channel_name,
ul.fileThumbs.big:not(.related-carousel):not(.suggested-list):not(.playlist-items):not(.swiper-wrapper) > li.vs-column.fourths .views-number {
    font-size: 14px !important;
    line-height: 20px !important;
    font-weight: 400 !important;
    color: #606060 !important;
}

/* === AVATAR: already 36px, only align it with the title === */
ul.fileThumbs.big:not(.related-carousel):not(.suggested-list):not(.playlist-items):not(.swiper-wrapper) > li.vs-column.fourths .media-user-avatar img {
    width: 36px !important;
    height: 36px !important;
    margin: 0 12px 0 0 !important;
}

ul.fileThumbs.big:not(.related-carousel):not(.suggested-list):not(.playlist-items):not(.swiper-wrapper) > li.vs-column.fourths .media-details {
    align-items: flex-start !important;
}

/* === DARK THEME === */
body.dark ul.fileThumbs.big:not(.related-carousel):not(.suggested-list):not(.playlist-items):not(.swiper-wrapper) > li.vs-column.fourths .media-meta h3,
body.dark ul.fileThumbs.big:not(.related-carousel):not(.suggested-list):not(.playlist-items):not(.swiper-wrapper) > li.vs-column.fourths .media-meta h3 a {
    color: #f1f1f1 !important;
}

body.dark ul.fileThumbs.big:not(.related-carousel):not(.suggested-list):not(.playlist-items):not(.swiper-wrapper) > li.vs-column.fourths .channel_name,
body.dark ul.fileThumbs.big:not(.related-carousel):not(.suggested-list):not(.playlist-items):not(.swiper-wrapper) > li.vs-column.fourths .views-number {
    color: #aaa !important;
}
