/* ==========================================================================
   1. General Post Styling (Shared across both layouts)
   ========================================================================== */
.news-grid-item {
    background-size: cover;
    background-position: left center; /* Keeps images anchored to the center-left */
    background-repeat: no-repeat;
    position: relative;
    display: flex;
    align-items: flex-start;
    padding: 30px;
    box-sizing: border-box;
}

.news-grid-content {
    background: #ffffff;
    padding: 20px 25px;
    max-width: 80%;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.news-category {
    display: block;
    color: #0066cc;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.news-title {
    margin: 0 0 15px 0;
    font-size: 22px;
    line-height: 1.3;
}

.news-title a {
    color: #333;
    text-decoration: none;
}

.news-date {
    color: #888;
    font-size: 14px;
}

/* ==========================================================================
   2. Standard Repeating Grid Layout ([custom_news_grid])
   ========================================================================== */
.news-grid-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Two equal columns */
    gap: 20px;
    margin-bottom: 30px;
}

/* Force EVERY item in the standard grid to be a perfect square */
.news-grid-wrapper .news-grid-item {
    aspect-ratio: 1 / 1;
    overflow: hidden; 
}

/* ==========================================================================
   3. Hero Top Grid Layout ([custom_news_hero])
   ========================================================================== */
.news-hero-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

/* Force the top 2 items to be perfect squares */
.news-hero-wrapper .news-grid-item:nth-child(1),
.news-hero-wrapper .news-grid-item:nth-child(2) {
    aspect-ratio: 1 / 1;
    overflow: hidden; 
}

/* Force the 3rd item to span full width */
.news-hero-wrapper .news-grid-item:nth-child(3) {
    grid-column: 1 / -1; 
    height: 400px; 
    background-position: right center; /* Focuses the wide banner to the right */
}

/* Keep the white box on the left side of the full-width item */
.news-hero-wrapper .news-grid-item:nth-child(3) .news-grid-content {
    max-width: 50%; 
}

/* ==========================================================================
   4. Load More Button
   ========================================================================== */
.news-grid-load-more-container {
    text-align: center;
    margin-bottom: 40px;
}

#news-grid-load-more {
    padding: 12px 30px;
    background: #0066cc;
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.3s;
}

#news-grid-load-more:hover {
    background: #004c99;
}

#news-grid-load-more:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* ==========================================================================
   5. Unified Mobile Responsiveness (Applies to both grids)
   ========================================================================== */
@media (max-width: 768px) {
    
    /* --- Standard Grid Mobile --- */
    .news-grid-wrapper {
        grid-template-columns: 1fr; /* Stack into a single column */
    }
    
    .news-grid-wrapper .news-grid-item {
        aspect-ratio: auto; /* Turn off the perfect square on mobile */
        height: 300px;      /* Set a reasonable, fixed height for mobile rectangles */
    }
    
    /* --- Hero Grid Mobile --- */
    .news-hero-wrapper {
        grid-template-columns: 1fr;
    }
    
    .news-hero-wrapper .news-grid-item:nth-child(1),
    .news-hero-wrapper .news-grid-item:nth-child(2) {
        aspect-ratio: auto; 
        height: 300px;      
    }

    .news-hero-wrapper .news-grid-item:nth-child(3) {
        grid-column: 1 / -1; 
        height: 300px; 
        background-position: left center; /* Reset focus for mobile */
    }

    /* --- Shared Mobile Adjustments --- */
    .news-grid-content,
    .news-hero-wrapper .news-grid-item:nth-child(3) .news-grid-content {
        max-width: 95%;
        padding: 15px 20px;
    }
}