/* ==========================================================================
   Article Listing Page
   BEM naming: .article-listing, .article-card
   ========================================================================== */

/* --- Page Header --- */
.article-listing__header {
    margin-bottom: 1.25rem;
}

.article-listing__title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 0.25rem;
}

.article-listing__subtitle {
    color: #6c757d;
    font-size: 0.95rem;
    margin-bottom: 0;
}

.article-listing__filter-info {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: #495057;
}

.article-listing__clear-filter {
    color: #dc3545;
    text-decoration: none;
    margin-left: 0.5rem;
    font-size: 0.85rem;
}

.article-listing__clear-filter:hover {
    text-decoration: underline;
    color: #c82333;
}

/* --- Tag Filter Pills --- */
.article-listing__filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e9ecef;
}

.article-listing__filter-pill {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: #495057;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    text-decoration: none;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.article-listing__filter-pill:hover {
    background: #e9ecef;
    color: #212529;
    border-color: #ced4da;
    text-decoration: none;
}

.article-listing__filter-pill--active {
    background: var(--tyre-reviews-blue, #0db1e7);
    color: #fff;
    border-color: var(--tyre-reviews-blue, #0db1e7);
}

.article-listing__filter-pill--active:hover {
    background: var(--tyre-reviews-blue-dark, #0a9bcc);
    color: #fff;
    border-color: var(--tyre-reviews-blue-dark, #0a9bcc);
}

/* --- Results Count --- */
.article-listing__count {
    font-size: 0.85rem;
    color: #6c757d;
    margin-bottom: 1rem;
}

/* --- Article Grid --- */
.article-listing__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

/* --- Article Card --- */
.article-card {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

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

.article-card__link {
    display: flex;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

.article-card__link:hover {
    text-decoration: none;
    color: inherit;
}

/* Card Image */
.article-card__image {
    width: 100%;
    height: 180px;
    overflow: hidden;
    background: #f0f2f5;
    flex-shrink: 0;
}

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

.article-card:hover .article-card__image img {
    transform: scale(1.05);
}

.article-card__image--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e9ecef 0%, #f8f9fa 100%);
}

.article-card__image--placeholder .fa {
    font-size: 2.5rem;
    color: #adb5bd;
}

/* Card Body */
.article-card__body {
    padding: 1rem 1.15rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

/* Badge */
.article-card__badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #fff;
    background: var(--tyre-reviews-blue, #0db1e7);
    border-radius: 4px;
    margin-bottom: 0.5rem;
    align-self: flex-start;
}

/* Title */
.article-card__title {
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a2e;
    line-height: 1.35;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-card:hover .article-card__title {
    color: var(--tyre-reviews-blue, #0db1e7);
}

/* Excerpt */
.article-card__excerpt {
    font-size: 0.85rem;
    color: #6c757d;
    line-height: 1.5;
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
}

/* Meta Footer */
.article-card__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid #f0f2f5;
}

.article-card__date {
    font-size: 0.78rem;
    color: #868e96;
    white-space: nowrap;
}

.article-card__date .fa {
    margin-right: 0.2rem;
}

/* Tags in Card */
.article-card__tags {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.article-card__tag {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    background: #f0f2f5;
    color: #6c757d;
    border-radius: 3px;
    white-space: nowrap;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .article-listing__title {
        font-size: 1.4rem;
    }

    .article-listing__grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .article-card {
        /* Horizontal card on mobile */
    }

    .article-card__link {
        flex-direction: row;
    }

    .article-card__image {
        width: 120px;
        height: auto;
        min-height: 120px;
    }

    .article-card__image--placeholder {
        width: 120px;
    }

    .article-card__image--placeholder .fa {
        font-size: 1.5rem;
    }

    .article-card__body {
        padding: 0.75rem;
    }

    .article-card__title {
        font-size: 0.9rem;
        -webkit-line-clamp: 2;
        margin-bottom: 0.3rem;
    }

    .article-card__excerpt {
        font-size: 0.8rem;
        -webkit-line-clamp: 2;
        margin-bottom: 0.5rem;
    }

    .article-card__meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
        padding-top: 0.5rem;
    }

    .article-card__tags {
        justify-content: flex-start;
    }

    .article-listing__filters {
        gap: 0.35rem;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 0.75rem;
    }

    .article-listing__filters::-webkit-scrollbar {
        display: none;
    }

    .article-listing__filter-pill {
        font-size: 0.75rem;
        padding: 0.3rem 0.7rem;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .article-listing__grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
