/* Section 9 Wrapper */
.section-9-wrapper {
    background-color: #f3f4f6; /* Matching the light gray background */
    padding: 30px 0;
    margin-bottom: 15px;
}

/* Section Header */
.s9-header {
    border-bottom: 1px solid var(--primary-color);
    margin-bottom: 20px;
    padding-bottom: 5px;
}

.s9-header h2 {
    font-size: 22px;
    font-weight: 700;
    margin: 0;
    color: var(--primary-color);
    position: relative;
    padding-left: 12px;
}

.s9-header h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 18px;
    background-color: var(--primary-color);
}

/* 4-Column Grid */
.s9-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

/* Post Cards */
.s9-post-card {
    display: flex;
    flex-direction: column;
}

.s9-post-image {
    width: 100%;
    margin-bottom: 10px;
}

.s9-post-image img {
    width: 100%;
    height: auto;
    aspect-ratio: 16/10;
    object-fit: cover;
}

.s9-post-content {
    display: flex;
    flex-direction: column;
}

.s9-post-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    line-height: 1.4;
}

.s9-post-title a {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.3s;
}

.s9-post-title a:hover {
    color: var(--primary-color);
}

/* Ad Space */
.s9-ad-space {
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.s9-ad-space img {
    max-width: 100%;
    height: auto;
    display: block;
}

.s9-ad-placeholder {
    width: 100%;
    min-height: 250px;
    background: #e5e7eb;
    border: 1px dashed #9ca3af;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #6b7280;
    text-align: center;
    padding: 20px;
}

.s9-ad-placeholder p {
    margin: 0 0 5px 0;
    font-weight: 600;
}

/* Responsive */
@media (max-width: 1024px) {
    .s9-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .s9-ad-space {
        display: none; /* Hide ad on tablet if space is tight, or make it full width */
    }
}

@media (min-width: 769px) {
    /* Hide the 4th card on PC/Tablet so it doesn't break the layout */
    .s9-post-card:nth-of-type(4) {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .s9-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .s9-ad-space {
        display: flex;
        justify-content: center;
        align-items: center;
        grid-column: span 2; /* Ad takes full width on mobile */
        margin-top: 15px;
        width: 100%;
        text-align: center;
    }
    
    .s9-ad-space a {
        display: inline-block;
        width: 100%;
    }
    
    .s9-ad-space img {
        max-width: 100%;
        height: auto;
        display: inline-block;
        margin: 0 auto;
    }
}
