/* =========================================================
   Articles page – Blog-style layout (reference-matched)
   ========================================================= */

/* Google Fonts – Inter loaded in header.php */

/* ---- Page scaffold ---- */
body.page-articles {
    background: #fff;
}

.articles-wrap {
    max-width: 1500px;
    margin: 0 auto;
    padding: 130px 24px 80px;
    font-family: 'Inter', Arial, Helvetica, sans-serif;
    color: #1a1a1a;
}

/* =========================================================
   TRENDING SECTION  (hero)
   ========================================================= */
.trending-section {
    margin-bottom: 56px;
}

.articles-title,
.trending-section h2 {
    text-align: center;
    font-size: 32px;
    font-weight: 900;
    letter-spacing: -0.5px;
    margin-bottom: 36px;
}

/* Horizontal featured card */
.trending-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
    margin-bottom: 24px;
}

.trending-card .trending-img {
    width: 100%;
    max-height: 340px;
    min-height: 260px;
    object-fit: cover;
    border-radius: 10px;
    display: block;
}

.trending-meta {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.trending-meta .categories {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #e74c3c;
}

.trending-meta .categories span.sep {
    color: #bbb;
    font-weight: 400;
}

.trending-meta .categories .date {
    font-weight: 400;
    color: #999;
}

.trending-meta .trending-title {
    font-size: 28px;
    line-height: 1.3;
    font-weight: 800;
    letter-spacing: -0.3px;
    color: #111;
}

.trending-meta .trending-title a {
    color: inherit;
    text-decoration: none;
}

.trending-meta .trending-title a:hover {
    color: #e74c3c;
}

.trending-meta .trending-excerpt {
    font-size: 14px;
    line-height: 1.7;
    color: #777;
    font-style: italic;
}

.trending-meta .author-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 4px;
}

.author-row .author-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background: #e0e0e0;
}

.author-row .author-info .author-name {
    font-size: 14px;
    font-weight: 700;
    color: #222;
}

.author-row .author-info .author-role {
    font-size: 12px;
    color: #999;
}

/* Pagination dots */
.trending-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
    min-height: 10px;
}

.trending-dots .dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #d2d2d2;
    transition: background 0.3s;
    cursor: pointer;
}

.trending-dots .dot.active {
    background: #4ecdc4;
}

/* =========================================================
   3-COLUMN ARTICLE GRID
   ========================================================= */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

.blog-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.3s ease, transform 0.25s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
}

.blog-card:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.10);
    transform: translateY(-4px);
}

.blog-card .card-img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    display: block;
}

.blog-card .card-body {
    padding: 20px 18px 22px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.blog-card .card-categories {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 10px;
}

.blog-card .card-categories .cat {
    color: #e74c3c;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 0 1 auto;
}

.blog-card .card-categories .sep {
    color: #ccc;
    flex-shrink: 0;
}

.blog-card .card-categories .date {
    font-weight: 400;
    color: #aaa;
    white-space: nowrap;
    flex-shrink: 0;
}

.blog-card .card-title {
    font-size: 17px;
    line-height: 1.4;
    font-weight: 800;
    color: #111;
    margin-bottom: 10px;
    letter-spacing: -0.2px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.blog-card .card-excerpt {
    font-size: 13px;
    line-height: 1.65;
    color: #888;
    margin-bottom: 0;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.blog-card .card-author {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: auto;
}

.blog-card .card-author .author-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    background: #e0e0e0;
}

.blog-card .card-author .author-name {
    font-size: 13px;
    font-weight: 700;
    color: #222;
}

.blog-card .card-author .author-role {
    font-size: 11px;
    color: #aaa;
}

/* =========================================================
   SEARCH + SORT ROW  (products-page style)
   ========================================================= */
.search-filter-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 32px;
}

.search-filter-row .search {
    flex: 1;
    position: relative;
}

.search-filter-row .search input {
    width: 100%;
    height: 44px;
    padding: 0 14px 0 44px;
    border-radius: 9999px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: #333;
    outline: none;
    transition: border-color 0.2s;
}

.search-filter-row .search input:focus {
    border-color: #aaa;
}

.search-filter-row .search input::placeholder {
    color: #bbb;
}

.search-filter-row .search .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    opacity: 0.4;
    pointer-events: none;
}

/* Sort dropdown (custom, no native select) */
.sort-dropdown {
    position: relative;
}

.sort-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 9999px;
    background: #fff;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    font-family: inherit;
}

.sort-toggle:hover {
    border-color: #1d1d1f;
    color: #1d1d1f;
}

.sort-toggle svg {
    flex-shrink: 0;
}

.sort-toggle .chevron {
    transition: transform 0.25s ease;
    margin-left: 2px;
}

.sort-dropdown.open .sort-toggle {
    border-color: #1d1d1f;
    color: #1d1d1f;
}

.sort-dropdown.open .sort-toggle .chevron {
    transform: rotate(180deg);
}

/* Dropdown menu */
.sort-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    padding: 6px 0;
    z-index: 100;
    animation: sortMenuFadeIn 0.15s ease;
}

.sort-dropdown.open .sort-menu {
    display: block;
}

@keyframes sortMenuFadeIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sort-option {
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    color: #555;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sort-option:hover {
    background: #f5f5f5;
    color: #1d1d1f;
}

.sort-option.active {
    color: #1d1d1f;
    font-weight: 700;
}

.sort-option.active::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #e74c3c;
    flex-shrink: 0;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 960px) {
    .articles-wrap {
        max-width: 94%;
    }

    .trending-card {
        gap: 28px;
    }

    .trending-card .trending-img {
        max-height: 260px;
    }

    .trending-meta .trending-title {
        font-size: 22px;
    }

    .blog-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }
}

@media (max-width: 768px) {
    .articles-wrap {
        padding: 32px 16px 60px;
    }

    .trending-card {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .trending-card .trending-img {
        height: 240px;
    }

    .trending-meta .trending-title {
        font-size: 22px;
    }

    .blog-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .articles-title,
    .trending-section h2 {
        font-size: 26px;
    }
}

@media (max-width: 480px) {
    .trending-card .trending-img {
        height: 200px;
    }

    .trending-meta .trending-title {
        font-size: 20px;
    }

    .blog-card .card-img {
        height: 180px;
    }
}