/* Main Grid Layout */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)); /* Three equal columns */
    gap: 2rem;
    margin-top: 2rem;
    width: 100%;
}

/* Article Card Styling */
.article-card {
    border: 1px solid #eee;
    padding: 1rem;
    border-radius: 8px;
    transition: transform 0.2s;
    display: flex;
    flex-direction: column;
    height: 100%;
    box-sizing: border-box;
    width: 100%;
    min-width: 0; /* Prevent content from expanding card */
    overflow: hidden; /* Keep content contained */
}

.article-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Image Styling */
.article-image {
    display: block;
    height: 200px;
    overflow: hidden;
    margin-bottom: 1rem;
    border-radius: 4px;
}

.article-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.article-card:hover .article-image img {
    transform: scale(1.03);
}

/* Text Content Styling */
.article-title {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
    font-weight: bold;
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.article-meta {
    margin: 0.5rem 0;
    display: flex;
    justify-content: space-between;
    color: #666;
    font-size: 0.9rem;
}

.article-links {
    margin-top: auto;
}

.article-links a {
    display: inline-block;
    color: #2271b1;
    text-decoration: none;
    font-size: 0.9rem;
    word-break: break-all;
}

.article-links a:hover {
    text-decoration: underline;
}

/* Filter Styling */
.article-filters {
    margin: 2rem 0;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}

.article-filters select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    min-width: 150px;
}

.article-filters button {
    padding: 0.5rem 1rem;
    background: #2271b1;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.article-filters button:hover {
    background: #135e96;
}

.article-meta .year {
    display: block;
    font-size: 0.9em;
    color: #666;
    margin-top: 5px;
}

.article-meta .year:before {
    content: "Year: ";
    font-weight: bold;
}

/* Responsive Adjustments */
@media (max-width: 1024px) {
    .articles-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    
    .article-title {
        white-space: normal;
    }
}

@media (max-width: 600px) {
    .articles-grid {
        grid-template-columns: minmax(0, 1fr);
    }
    
    .article-filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .article-filters select,
    .article-filters button {
        width: 100%;
    }
}

/* Utility Classes */
.article-card > * {
    margin-bottom: 0.5rem;
}

.article-card > *:last-child {
    margin-bottom: 0;
}