
/* --- Unified Custom CSS (Forced via Database) --- */

/* 1. Global Block Tweaks */
:root :where(.has-background) { padding: 10px 15px !important; box-sizing: border-box !important; }
body.single .entry-content .wp-block-heading.has-background,
body.single .entry-content .has-background h1,
body.single .entry-content .has-background h2,
body.single .entry-content .has-background h3,
body.single .entry-content .has-background p {
    font-size: 20px !important;
    padding: 10px 15px !important;
    line-height: 1.3 !important;
    margin-bottom: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* 2. Desktop Layout (80% Content, 100% Header/Footer) */
@media only screen and (min-width: 768px) {

    /* --- Desktop Site Branding Flex Layout --- */
    .site-branding {
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        justify-content: center !important; /* Centered in the header */
        text-align: center !important;
        margin: 0 auto !important;
    }
    .site-branding .custom-logo-link {
        flex: 0 0 auto !important;
        max-width: 150px !important; /* Proper desktop logo size */
        margin: 0 15px 0 0 !important; /* Spacing between logo and title */
        display: block !important;
    }
    .site-branding .custom-logo {
        max-width: 100% !important;
        height: auto !important;
    }
    .site-branding .site-title {
        flex: 0 0 auto !important;
        margin: 0 !important;
        display: block !important;
    }
    .site-branding .site-description {
        flex: 0 0 100% !important; /* Forces description to new line */
        width: 100% !important;
        margin-top: 15px !important;
        margin-bottom: 0 !important;
        display: block !important;
    }

    /* Ensure the outermost wrapper is 100% so headers and footers can stretch full-width */
    body.af-boxed-layout .af-whole-wrapper,
    body.af-wide-layout .af-whole-wrapper {
        width: 100% !important; max-width: 100% !important; margin: 0 auto !important;
    }
    
    /* Shrink ONLY the inner containers to 80% so the content is boxed but backgrounds bleed 100% */
    body .container-wrapper {
        width: 80% !important; max-width: 80% !important; margin: 0 auto !important;
    }
    
    /* Remove vertical gap between breadcrumbs and content so body background doesn't bleed through */
    body .aft-main-breadcrumb-wrapper.container-wrapper {
        margin-bottom: 0 !important;
        padding-bottom: 5px !important;
    }
    body #content.container-wrapper {
        margin-top: 0 !important;
        padding-top: 15px !important;
    }
    
    /* Safely expand the text column without breaking center alignment (fixes single-content-mode-boxed) */
    body.single-content-mode-boxed .af-single-article,
    body.single-content-mode-boxed #primary,
    body.single-content-mode-boxed .entry-content-wrap,
    body.single-content-mode-boxed header.entry-header,
    body.single-content-mode-boxed header.entry-header .read-details,
    body.single-content-mode-boxed .comments-area,
    body.single-content-mode-boxed.full-width-content article.af-single-article .entry-content {
        max-width: 100% !important;
        margin-left: auto !important;
        margin-right: auto !important;
        box-sizing: border-box !important;
    }

    /* Padding for inner text */
    body.single .entry-content.read-details, 
    body.single header.entry-header {
        padding-left: 20px !important; 
        padding-right: 20px !important;
        box-sizing: border-box !important;
    }
    
    body .site-title, body .site-title a { font-size: 26px !important; }
    body.single .entry-title, body.single h1.entry-title { font-size: 28px !important; }
}

/* 3. Mobile Layout (90% Content, 100% Header/Footer) */
@media only screen and (max-width: 767px) {
    /* Outer wrapper 100% */
    body.af-boxed-layout .af-whole-wrapper,
    body.af-wide-layout .af-whole-wrapper {
        width: 100% !important; max-width: 100% !important; margin: 0 auto !important;
    }
    body.af-boxed-layout { padding: 0 !important; margin: 0 !important; }

    /* Inner containers 90% */
    body .container-wrapper {
        width: 90% !important; max-width: 90% !important; margin: 0 auto !important;
    }

    /* Remove vertical gap */
    body .aft-main-breadcrumb-wrapper.container-wrapper {
        margin-bottom: 0 !important;
        padding-bottom: 5px !important;
    }
    body #content.container-wrapper {
        margin-top: 0 !important;
        padding-top: 10px !important;
    }

    /* Fix squished text */
    body.single-content-mode-boxed .af-single-article,
    body.single-content-mode-boxed #primary,
    body.single-content-mode-boxed .entry-content-wrap,
    body.single-content-mode-boxed header.entry-header,
    body.single-content-mode-boxed header.entry-header .read-details,
    body.single-content-mode-boxed .comments-area,
    body.single-content-mode-boxed.full-width-content article.af-single-article .entry-content {
        max-width: 100% !important;
        margin-left: auto !important;
        margin-right: auto !important;
        box-sizing: border-box !important;
    }

    body.single .entry-content-wrap, body.single .entry-content-title-featured-wrap {
        padding-left: 0 !important; padding-right: 0 !important; margin: 0 auto !important;
    }
    body.single .entry-content.read-details, body.single .entry-header {
        padding-left: 10px !important; padding-right: 10px !important; 
        box-sizing: border-box !important;
    }

    body .site-header, body .mid-header-wrapper, body .bottom-header-wrapper, body .top-header-wrapper, body .main-navigation, body .header-layout-centered .mid-header-wrapper {
        padding-top: 5px !important; padding-bottom: 5px !important; min-height: auto !important;
    }
    body .site-header .menu-toggle, body .site-header .search-toggle, body .site-header .dark-mode-toggle {
        padding-top: 5px !important; padding-bottom: 5px !important; margin: 0 !important;
    }

    body .entry-meta, body .entry-meta span, body .entry-meta a, body .entry-meta .author-links &gt; span a, body .entry-meta i, body .entry-header .entry-meta { font-size: 11px !important; }
    body .site-title, body .site-title a { font-size: 18px !important; line-height: 1.2 !important; }
    body.single .entry-title, body.single h1.entry-title { font-size: 22px !important; line-height: 1.3 !important; }
}

/* --- 4. Mobile Site Branding Flex Layout --- */
@media only screen and (max-width: 767px) {
    .site-branding {
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        justify-content: flex-start !important;
        gap: 10px !important;
        padding: 5px !important;
        width: 100% !important;
        text-align: left !important;
    }
    /* Logo on the left */
    .site-branding .custom-logo-link {
        flex: 0 0 60px !important;
        max-width: 60px !important;
        display: block !important;
        margin: 0 !important;
    }
    .site-branding .custom-logo {
        max-width: 100% !important;
        height: auto !important;
    }
    /* Title to the right of the logo */
    .site-branding .site-title {
        flex: 1 1 calc(100% - 75px) !important;
        text-align: left !important;
        margin: 0 !important;
        display: block !important;
    }
    /* Description forced to a new line below both */
    .site-branding .site-description {
        flex: 0 0 100% !important;
        width: 100% !important;
        text-align: left !important;
        margin-top: 5px !important;
        margin-bottom: 0 !important;
        font-size: 13px !important;
        display: block !important;
    }
}
