/**
 * AI Central Link — Astra Container Override
 *
 * WHY THIS FILE EXISTS:
 * Astra's get_header() wraps all template content in:
 *   #content.site-content > .ast-container > #primary.content-area
 *
 * For CPT archive pages, Astra applies blog-archive settings which may
 * constrain #primary to ~67% width (sidebar split). Our template needs
 * #primary to be 100% wide so our own acl-single-body grid takes over.
 *
 * APPROACH:
 * Use WordPress's own body classes (.post-type-archive-ai_tools, etc.)
 * plus our added .acl-cpt-page class to override Astra's container CSS.
 * These body classes are 100% reliable regardless of Astra version.
 *
 * @package    AICentralLink
 * @author     Vinod Rawat <vinod@vertidesk.com>
 * @link       https://vertidesk.com | https://aicentrallink.com
 * @since      0.5.4
 */

/* ════════════════════════════════════════════════════════════════════════════
   STEP 1: Expand .ast-container to full width
   Astra's .ast-container has max-width (default 1200px) and padding.
   We expand it to 100% so our template controls its own width.
   ════════════════════════════════════════════════════════════════════════════ */

.post-type-archive-ai_tools .site-content > .ast-container,
.tax-acl_category .site-content > .ast-container,
.single-ai_tools .site-content > .ast-container,
.acl-cpt-page .site-content > .ast-container,
.acl-cpt-page #content > .ast-container {
    max-width: 100% !important;
    padding-left:  0 !important;
    padding-right: 0 !important;
    width: 100% !important;
}

/* ════════════════════════════════════════════════════════════════════════════
   STEP 2: Make #primary full width
   When Astra detects a sidebar, it sets #primary width to ~67-73%.
   We force it back to 100% since we handle our own sidebar grid.
   ════════════════════════════════════════════════════════════════════════════ */

.post-type-archive-ai_tools #primary,
.post-type-archive-ai_tools #primary.content-area,
.tax-acl_category #primary,
.tax-acl_category #primary.content-area,
.single-ai_tools #primary,
.single-ai_tools #primary.content-area,
.acl-cpt-page #primary,
.acl-cpt-page #primary.content-area {
    width:     100% !important;
    max-width: 100% !important;
    padding-top:    0 !important;
    padding-bottom: 0 !important;
    padding-left:   0 !important;
    padding-right:  0 !important;
    margin: 0 !important;
    float: none !important;
    /* Flex overrides for newer Astra versions */
    flex: 0 0 100% !important;
    -webkit-flex: 0 0 100% !important;
}

/* ════════════════════════════════════════════════════════════════════════════
   STEP 3: Remove padding from main content area
   Astra adds top/bottom padding to .site-main and .entry-content.
   Our template handles its own spacing.
   ════════════════════════════════════════════════════════════════════════════ */

.post-type-archive-ai_tools .site-main,
.tax-acl_category .site-main,
.single-ai_tools .site-main,
.acl-cpt-page .site-main,
.acl-cpt-page main#main {
    padding:  0 !important;
    margin:   0 !important;
}

/* ════════════════════════════════════════════════════════════════════════════
   STEP 4: Hide Astra's #secondary sidebar for our pages
   We render our sidebar inside acl-single-body. Astra's #secondary
   would create a double sidebar or push content.
   ════════════════════════════════════════════════════════════════════════════ */

.post-type-archive-ai_tools #secondary,
.tax-acl_category #secondary,
.single-ai_tools #secondary,
.acl-cpt-page #secondary {
    display: none !important;
}

/* ════════════════════════════════════════════════════════════════════════════
   STEP 5: Handle Astra flex layout (v4.x+)
   Newer Astra uses flex on .ast-container. When #secondary is hidden,
   the flex child #primary needs to fill 100%.
   ════════════════════════════════════════════════════════════════════════════ */

.acl-cpt-page .ast-container {
    display: block !important; /* override flex so #primary fills naturally */
}
/* Alternative: keep flex but make #primary flex-fill */
.acl-cpt-page .ast-container.ast-flex-container {
    display: flex !important;
}
.acl-cpt-page .ast-container.ast-flex-container #primary {
    flex: 1 1 100% !important;
}

/* ════════════════════════════════════════════════════════════════════════════
   STEP 6: Ensure .hentry margin/padding doesn't add extra offset
   Astra adds margin-bottom to .hentry for post spacing. Not needed
   for our full-page templates.
   ════════════════════════════════════════════════════════════════════════════ */

.acl-cpt-page .hentry {
    margin-bottom: 0 !important;
}

/* ════════════════════════════════════════════════════════════════════════════
   STEP 7: Astra separate-container (boxed layout) fix
   If global container is set to "Boxed" (ast-separate-container),
   Astra adds extra outer padding. Override for our pages.
   ════════════════════════════════════════════════════════════════════════════ */

.acl-cpt-page.ast-separate-container .ast-container,
.acl-cpt-page.ast-separate-container #primary {
    padding:    0 !important;
    box-shadow: none !important;
    background: transparent !important;
}
