/**
 * TurnKey Directories — Per-theme compatibility overrides
 *
 * Added in v2.15.0. Loaded conditionally by class-turnkeydir-public.php only when
 * TURNKEYDIR_Theme_Compatibility::needs_compat_stylesheet() returns true — i.e.
 * NOT on Kadence (TurnkeyDir's base CSS is tuned for Kadence; saving bytes there)
 * and not when the admin has explicitly opted in via the Compatibility tab.
 *
 * Each block is scoped to BOTH a theme body class (tkd-theme-{slug}) AND a
 * TurnkeyDir route class (body.tkd-listing-page, body.tkd-directory-page) so
 * nothing here ever fires on a theme's own pages — only on TurnkeyDir-rendered
 * content. That mirrors ReadKit's per-theme architecture.
 *
 * Theme list (mirrors TURNKEYDIR_Theme_Compatibility::OPTIMIZED_THEMES):
 *   kadence, astra, generatepress, hello-elementor, hello-biz,
 *   blocksy, neve, oceanwp, divi, avada, storefront,
 *   twentytwentythree, twentytwentyfour, twentytwentyfive
 *
 * Most themes work with TurnkeyDir's base CSS now (v2.14.51 broke the
 * [class*="sidebar"] regression that was hiding bodies on Astra/OceanWP).
 * Profiles below are intentionally conservative — add rules here only as
 * real breakage is reported on specific themes. The body classes are
 * emitted regardless so future fixes only need a CSS edit, not a code
 * change.
 *
 * @package TurnKey Directories
 * @since   2.15.0
 */

/* ============================================
   ASTRA
   ============================================ */
/* Astra wraps content in .ast-container inside .site-content with the
   "ast-separate-container" boxed layout. v2.14.51's wildcard cleanup
   already lets TurnkeyDir's content render correctly inside Astra. These rules
   are belt-and-braces: make sure Astra's box-shadow/border on the
   content card doesn't visually clip TurnkeyDir's edge-to-edge listing image. */
body.tkd-theme-astra.tkd-listing-page .ast-separate-container .ast-article-single,
body.tkd-theme-astra.tkd-listing-page .ast-separate-container .site-content {
    padding-left: 0 !important;
    padding-right: 0 !important;
}
@media (max-width: 768px) {
    body.tkd-theme-astra.tkd-listing-page .ast-container,
    body.tkd-theme-astra.tkd-directory-page .ast-container {
        max-width: 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
}

/* ============================================
   GENERATEPRESS
   ============================================ */
/* GeneratePress uses .site .grid-container.grid-parent.site-content with
   container padding. On TurnkeyDir pages we want full-width. */
@media (max-width: 768px) {
    body.tkd-theme-generatepress.tkd-listing-page .grid-container,
    body.tkd-theme-generatepress.tkd-listing-page .site-content,
    body.tkd-theme-generatepress.tkd-directory-page .grid-container,
    body.tkd-theme-generatepress.tkd-directory-page .site-content {
        max-width: 100% !important;
        padding: 0 !important;
    }
}

/* ============================================
   HELLO ELEMENTOR / HELLO BIZ
   ============================================ */
/* Minimal themes designed for Elementor; usually no overrides needed.
   Placeholder for future bug reports. */

/* ============================================
   BLOCKSY
   ============================================ */
/* Blocksy uses .ct-container with CSS variables for sizing. */
@media (max-width: 768px) {
    body.tkd-theme-blocksy.tkd-listing-page .ct-container,
    body.tkd-theme-blocksy.tkd-directory-page .ct-container {
        max-width: 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
}

/* ============================================
   NEVE
   ============================================ */
/* Neve uses .container, .nv-single-page-wrap, .nv-content-wrap. */
@media (max-width: 768px) {
    body.tkd-theme-neve.tkd-listing-page .nv-single-page-wrap,
    body.tkd-theme-neve.tkd-listing-page .nv-content-wrap,
    body.tkd-theme-neve.tkd-directory-page .nv-single-page-wrap,
    body.tkd-theme-neve.tkd-directory-page .nv-content-wrap {
        max-width: 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
}

/* ============================================
   OCEANWP
   ============================================ */
/* OceanWP uses #main, #content-wrap, .container. v2.14.51's wildcard
   fix already unblocks OceanWP (the "no-sidebar" body class was matching
   the broad [class*="sidebar"] selector). */
@media (max-width: 768px) {
    body.tkd-theme-oceanwp.tkd-listing-page #content-wrap,
    body.tkd-theme-oceanwp.tkd-listing-page .container,
    body.tkd-theme-oceanwp.tkd-directory-page #content-wrap,
    body.tkd-theme-oceanwp.tkd-directory-page .container {
        max-width: 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
}

/* ============================================
   DIVI
   ============================================ */
/* Divi wraps page content in .et_pb_section / .et_pb_row with their
   own padding. Override on TurnkeyDir pages so the listing fills the column. */
body.tkd-theme-divi.tkd-listing-page #main-content,
body.tkd-theme-divi.tkd-listing-page #left-area,
body.tkd-theme-divi.tkd-directory-page #main-content,
body.tkd-theme-divi.tkd-directory-page #left-area {
    padding-left: 0 !important;
    padding-right: 0 !important;
}
@media (max-width: 768px) {
    body.tkd-theme-divi.tkd-listing-page .et_pb_section,
    body.tkd-theme-divi.tkd-listing-page .et_pb_row,
    body.tkd-theme-divi.tkd-directory-page .et_pb_section,
    body.tkd-theme-divi.tkd-directory-page .et_pb_row {
        padding: 0 !important;
        max-width: 100% !important;
    }
}

/* ============================================
   AVADA / FUSION
   ============================================ */
/* Avada (Fusion) uses .fusion-row, #main, #content with fixed widths. */
body.tkd-theme-avada.tkd-listing-page #main,
body.tkd-theme-avada.tkd-listing-page .fusion-row,
body.tkd-theme-avada.tkd-directory-page #main,
body.tkd-theme-avada.tkd-directory-page .fusion-row {
    max-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* ============================================
   STOREFRONT
   ============================================ */
/* WooCommerce default theme. Uses .col-full, .site-main. */
@media (max-width: 768px) {
    body.tkd-theme-storefront.tkd-listing-page .col-full,
    body.tkd-theme-storefront.tkd-listing-page .site-main,
    body.tkd-theme-storefront.tkd-directory-page .col-full,
    body.tkd-theme-storefront.tkd-directory-page .site-main {
        max-width: 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
}

/* ============================================
   TWENTY TWENTY-THREE / TWENTY-FOUR / TWENTY-FIVE (WordPress core block themes)
   ============================================ */
/* Block themes use FSE markup (wp-site-blocks, wp-block-group). They tend
   to honor wide-alignment cleanly; placeholders kept for future tuning. */

/* ============================================
   PAGE BUILDERS (independent of theme)
   Body class: tkd-builder-{elementor|divi|fusion|beaver|breakdance|bricks|wpbakery|brizy}
   ============================================ */
/* Elementor: .elementor-section, .elementor-container. Most TurnkeyDir pages
   aren't built with Elementor (they use TurnkeyDir's PHP template), but the
   builder may be active on other pages and leak global CSS variables. */
body.tkd-builder-elementor.tkd-listing-page .elementor-section,
body.tkd-builder-elementor.tkd-directory-page .elementor-section {
    padding: 0 !important;
}
