/*
 * Category archive redesign - is_category() pages only, never loaded
 * elsewhere (see the conditional enqueue in functions.php). Removes the
 * category "hero" (title + sibling-categories band) and the "Popular
 * Posts" sidebar via inc/category-archive.php; this file just expands the
 * article grid's own column to fill the row it used to share with that
 * sidebar, and adds breathing room now that the hero above it is gone.
 *
 * The grid's card styling itself is untouched - it's TagDiv Composer's
 * own tdb_loop output, already a reasonable card grid with its own "Load
 * more" pagination; only the surrounding layout changed here, plus (below)
 * the per-row card count, forced from Composer's own configured 3-per-row
 * to 4-per-row.
 */

/*
 * Removing the sidebar column doesn't change this column's own width -
 * it's still governed by its td-pb-span9 class (~75%, sized for sharing
 * the row with the span3 sidebar that's now gone) - so it's forced to
 * fill the row here instead. :has(.tdb_loop) scopes this to the column
 * actually containing the article grid (confirmed unique on this page),
 * not any other td-pb-span9 column elsewhere.
 */
.vc_column.td-pb-span9:has(.tdb_loop) {
    width: 100% !important;
}

/* Breathing room now that the hero (title + sibling-categories band)
   above the grid is gone. */
.tdc-row:has(.tdb_loop) {
    margin-top: 40px;
}

@media (max-width: 767px) {
    .tdc-row:has(.tdb_loop) {
        margin-top: 24px;
    }
}

/*
 * 4 cards per row instead of Composer's own configured 3 ("modules_on_row"
 * set to 33.33% in the block's own settings - not editable from the child
 * theme without database access, so overridden here). tdi_NN regenerates
 * every Composer save, so this targets the stable .tdb_loop class instead
 * - !important since the block's own per-card width comes from an inline
 * <style> tag with equal selector specificity, and (being later in the
 * document than this stylesheet) would otherwise win on source order
 * alone. .tdb_module_rec (a "featured/wide" card variant) is forced to
 * the same width too, so every card stays uniform at 4-per-row regardless
 * of whether a given grid happens to feature one.
 */
.tdb_loop .td_module_wrap:not(.tdb_module_rec),
.tdb_loop .tdb_module_rec {
    width: 25% !important;
}

@media (min-width: 768px) and (max-width: 1018px) {
    .tdb_loop .td_module_wrap:not(.tdb_module_rec),
    .tdb_loop .tdb_module_rec {
        width: 50% !important;
    }
}

@media (max-width: 767px) {
    .tdb_loop .td_module_wrap:not(.tdb_module_rec),
    .tdb_loop .tdb_module_rec {
        width: 100% !important;
    }
}
