/**
 * CPT Isolation Layer - Extracted from style.css
 * 
 * PURPOSE: All Astra theme overrides for full-width CPTs
 * CHANGE: Modified to only affect .site-content (not header/footer)
 * 
 * @package Gateway_College
 * @since 2.0.0
 */

/* ==============================================
   ASTRA OVERRIDES - Content Area Only
   Same rules as original style.css
   Modified: .ast-container ¡ú .site-content .ast-container
   ============================================== */

/* Remove Astra default spacing */
.gateway-full-width .content-area,
.gateway-full-width .site-main {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Remove header bottom margin only */
.gateway-full-width .site-header {
    margin-bottom: 0 !important;
}

.gateway-full-width .ast-main-header-wrap {
    margin-bottom: 0 !important;
}

/* Hide default Astra post/page title */
.gateway-full-width .entry-header {
    display: none !important;
}

/* Prevent horizontal scroll */
.gateway-full-width {
    overflow-x: hidden;
}

/* Override Astra's width restrictions - CONTENT ONLY */
.gateway-full-width .site-content #primary {
    width: 100% !important;
    max-width: none !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Remove sidebar padding - CONTENT ONLY */
.gateway-full-width.ast-right-sidebar .site-content #primary,
.gateway-full-width.ast-left-sidebar .site-content #primary,
.gateway-full-width.ast-no-sidebar .site-content #primary {
    padding-right: 0 !important;
    padding-left: 0 !important;
}

/* Site-main no restrictions */
.gateway-full-width .site-main {
    width: 100% !important;
    max-width: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* CRITICAL CHANGE: Only affect .ast-container in .site-content */
.gateway-full-width .site-content .ast-container {
    max-width: none !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Archive/Listing pages support */
.gateway-full-width.archive .site-main,
.gateway-full-width.post-type-archive .site-main {
    padding: 0 !important;
}

.gateway-full-width .ast-post-format-standard {
    padding: 0 !important;
}

/* ==============================================
   TRANSPARENT HEADER SUPPORT
   ============================================== */

/* Remove spacing for site content */
.gateway-full-width .site-content,
.gateway-full-width.ast-theme-transparent-header .site-content,
.gateway-full-width.transparent-header .site-content {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

/* Remove spacing from primary - CONTENT ONLY */
.gateway-full-width .site-content #primary,
.gateway-full-width.ast-theme-transparent-header .site-content #primary,
.gateway-full-width.transparent-header .site-content #primary,
.gateway-full-width.ast-separate-container .site-content #primary, 
.gateway-full-width.ast-separate-container.ast-left-sidebar .site-content #primary, 
.gateway-full-width.ast-separate-container.ast-right-sidebar .site-content #primary {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Remove spacing from main element */
.gateway-full-width .site-main,
.gateway-full-width .site-main > *:first-child,
.gateway-full-width .site-main > section:first-child {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Override Astra's header spacing classes */
.gateway-full-width .ast-separate-container .ast-article-single,
.gateway-full-width .ast-separate-container .ast-article-post {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Override dynamic header spacing */
.gateway-full-width .entry-content {
    margin-top: 0 !important;
}

/* Above Header */
.gateway-full-width .ast-above-header {
    margin-bottom: 0 !important;
}

.gateway-full-width .ast-header-break-point .ast-above-header {
    margin-bottom: 0 !important;
}

/* Header wrapper */
.gateway-full-width .main-header-bar-wrap {
    margin-bottom: 0 !important;
}

/* Remove margin from separate-container - CONTENT ONLY */
.gateway-full-width.ast-separate-container .site-content #primary,
.gateway-full-width.ast-separate-container.ast-left-sidebar .site-content #primary,
.gateway-full-width.ast-separate-container.ast-right-sidebar .site-content #primary {
    margin: 0 !important;
    padding: 0 !important;
}

/* Desktop overrides - CONTENT ONLY */
@media (min-width: 993px) {
    .gateway-full-width.ast-separate-container .site-content #primary,
    .gateway-full-width.ast-separate-container.ast-left-sidebar .site-content #primary,
    .gateway-full-width.ast-separate-container.ast-right-sidebar .site-content #primary {
        margin: 0 !important;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        padding: 0 !important;
    }
    
    body.gateway-full-width.ast-separate-container .site-content #primary,
    body.gateway-full-width.ast-separate-container.ast-left-sidebar .site-content #primary,
    body.gateway-full-width.ast-separate-container.ast-right-sidebar .site-content #primary {
        margin: 0 !important;
        padding: 0 !important;
    }
}

/* Force no sidebar */
.gateway-full-width #secondary {
    display: none !important;
}

.gateway-full-width.ast-right-sidebar .site-content #primary,
.gateway-full-width.ast-left-sidebar .site-content #primary {
    width: 100% !important;
}

/* Override content width - CONTENT ONLY */
.gateway-full-width .site-content > .ast-container {
    max-width: none !important;
    padding: 0 !important;
}

.gateway-full-width .site-content {
    max-width: none !important;
    margin-bottom: 0 !important;
}

/* Mobile responsive fixes */
@media (max-width: 768px) {
    .gateway-full-width .site-content #primary {
        padding: 0 !important;
    }
    
    .gateway-full-width .site-main {
        padding: 0 !important;
    }
}

/* ==============================================
   ULTIMATE OVERRIDE - Highest Priority
   CONTENT ONLY
   ============================================== */

@media (min-width: 993px) {
    body.gateway-full-width.ast-separate-container .site-content #primary,
    body.gateway-full-width.ast-separate-container.ast-left-sidebar .site-content #primary,
    body.gateway-full-width.ast-separate-container.ast-right-sidebar .site-content #primary,
    body.single-course.ast-separate-container .site-content #primary,
    body.single-course.ast-separate-container.ast-left-sidebar .site-content #primary,
    body.single-course.ast-separate-container.ast-right-sidebar .site-content #primary {
        margin: 0 !important;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        padding: 0 !important;
    }
}

body.gateway-full-width.ast-separate-container .site-content #primary,
body.gateway-full-width.ast-separate-container.ast-left-sidebar .site-content #primary,
body.gateway-full-width.ast-separate-container.ast-right-sidebar .site-content #primary,
body.single-course.ast-separate-container .site-content #primary,
body.single-course.ast-separate-container.ast-left-sidebar .site-content #primary,
body.single-course.ast-separate-container.ast-right-sidebar .site-content #primary {
    margin: 0 !important;
    padding: 0 !important;
}

/* ==============================================
   CPT SCOPE CONTAINER
   Reusable isolation layer for all CPTs
   ============================================== */

.cpt-scope {
    display: block;
    width: 100%;
    isolation: isolate;
}