:root {
    --primary-green: #006400;
    --secondary-yellow: #FFD700;
    --text-white: #FFFFFF;
    --bg-light: #F4F4F4;
    --text-dark: #333333;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    width: 100%;
    padding: 20px;
    box-sizing: border-box;
}

.grid-item {
    background-color: #fff;
    border: 1px solid #ddd;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    height: 250px; /* Match ad banner height */
    width: 300px; /* Match ad banner width */
    display: flex;
    flex-direction: column;
}

.grid-item img {
    width: 300px; /* Fixed width to match ad banner */
    height: 150px; /* Reduced height to fit within 250px total */
    object-fit: cover;
}

.grid-item h2 {
    font-size: 16px; /* Reduced for better fit */
    margin: 5px 10px;
    color: var(--primary-green);
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    display: block;
}

.grid-item h2 a {
    color: inherit;
    text-decoration: none;
    font-size: 14px;

}

.grid-item h2 a:hover {
    color: var(--secondary-yellow);
}

.grid-item .grid-meta {
    font-size: 11px; /* Reduced for better fit */
    margin: 0 10px 10px;
    color: #666;
    text-align: center;
}

.ad-slot {
    grid-column: span 1;
    width: 300px; /* Ensure consistency */
    height: 250px;
}

.ad-slot div {
    width: 300px;
    height: 250px;
    background-color: #e0e0e0;
    text-align: center;
    line-height: 250px;
    color: #555;
}

.pagination {
    margin-top: 20px;
    text-align: center;
}

.pagination a, .pagination span {
    margin: 0 5px;
    padding: 5px 10px;
    background: var(--primary-green);
    color: var(--text-white);
    text-decoration: none;
}

.pagination a:hover {
    background: var(--secondary-yellow);
    color: var(--text-dark);
}

@media (max-width: 768px) {
    .grid-container {
        padding: 10px;
    }
    .grid-item {
        width: 100%; /* Full width on mobile */
        height: auto; /* Adjust height dynamically */
    }
    .grid-item img {
        width: 100%;
        height: 150px; /* Maintain aspect ratio */
    }
}