/* --- A. TWENTY SEVENTEEN FIXES (Mobile Alignment) --- */

/* Fixes Featured Image alignment on mobile (prioritizes top of 2000x1200 image) */
@media screen and (max-width: 768px) {
    .custom-header-media img, 
    .has-header-image .custom-header-media video,
    .has-featured-image .post-thumbnail img {
        object-position: center top !important; 
        background-position: center top !important;
        height: auto !important; 
        width: 100% !important;
    }
}


/* --- B. GALLERY COLUMNS, CENTERING & FINAL FIXES --- */

@media screen and (min-width: 769px) {
    
    /* CRITICAL FIX: Overrides theme sidebar reservation and centers content */
    .site-content-contain {
        max-width: 100% !important; /* Forces the container to use full available width */
        margin: 0 !important;        /* Removes default left/right margins */
        padding: 0 10px !important;  /* Adds back small margin for neatness */
        box-sizing: border-box !important;
    }
    
    /* 1. Force the inner content wrapper to center on the page */
    .wrap {
        max-width: 1200px !important; 
        margin-left: auto !important;
        margin-right: auto !important;
    }


    /* 2. Menu Alignment (Condensing and Centering) */
    .navigation-top .wrap {
        max-width: 1200px !important;
        width: auto !important; 
        margin: 0 auto !important; 
        justify-content: center !important; 
    }
    
    /* 3. Tighten Menu Link Spacing */
    .navigation-top a {
        padding-left: 5px !important; 
        padding-right: 5px !important;
    }

    /* 4. Force 3-Column Gallery Layout (Flexbox) */
    .foogallery-container.responsive {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: flex-start !important; 
        margin-left: -1px !important;
        margin-right: -1px !important;
    }

    /* 5. Target Individual Gallery Items (Sets 33.33% Width and tightens gap) */
    .foogallery-container.responsive > .fg-item {
        width: 33.33% !important; 
        padding: 1px !important; 
        box-sizing: border-box !important;
    }
}
/* Final Tablet Fix: Force 2 Columns ONLY up to 1024px */

@media screen and (min-width: 481px) and (max-width: 1024px) {

    /* 1. Targets the gallery items in the tablet size range */
    .foogallery-container.responsive > .fg-item {
        width: 50% !important; /* Forces items to take up exactly half the width */
        float: left !important;
        display: block !important; /* Ensures the items behave as clean blocks */
        box-sizing: border-box !important;
        padding: 5px !important; 
    }

    /* 2. Ensures the gallery container is ready for the columns */
    .foogallery-container.responsive {
        display: flex !important;
        flex-wrap: wrap !important;
        margin-left: -5px !important; 
        margin-right: -5px !important;
    }
}
}