/*
Theme Name: Modern Blog Theme (AIO & Mobile Optimized)
Theme URI: https://yourwebsite.com
Author: Your Name
Author URI: https://yourwebsite.com
Description: A modern, modular, high-performance, and SEO-optimized blog theme. Features a swipeable compact mobile UI, deep Rank Math SEO integration, and robust anti-spam security.
Version: 1.0.0
Text Domain: modern-blog
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: blog, news, responsive-layout, seo-optimized, accessibility-ready, custom-colors, custom-logo, translation-ready
*/

:root {
    --primary-color: #1d4ed8;
    --text-main: #111827;
    --text-muted: #6b7280;
    --bg-main: #ffffff;
    --bg-box: #f3f4f6;
    --radius-lg: 16px;
    --radius-sm: 8px;
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 10px 30px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
    background-color: var(--bg-main);
    line-height: 1.6;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary-color);
    text-decoration: none;
}

/* Container */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header */
.site-header {
    padding: 20px 0;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 40px;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-title {
    margin: 0;
    font-size: 24px;
    font-weight: 800;
}

.site-title a {
    color: var(--text-main);
}

/* Typography */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 24px;
}

.section-title {
    font-size: 24px;
    font-weight: 800;
    margin: 0;
}

.see-all-link {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
}

/* Home Layouts */
.home-top-section {
    display: grid;
    grid-template-columns: 4fr 6fr;
    /* Chuyển % thành fr để tính cả gap */
    gap: 32px;
    margin-bottom: 60px;
    align-items: stretch;
    /* Đảm bảo chiều cao 2 khối bằng nhau */
}

.home-body-section {
    display: grid;
    grid-template-columns: 7fr 3fr;
    gap: 40px;
}

/* Post Card (Grid) */
.post-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.modern-card {
    overflow: hidden;
    transition: var(--transition);
}

.modern-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-soft);
}

.modern-card .card-thumbnail img {
    width: 100%;
    height: auto;
    aspect-ratio: 16/9;
    object-fit: cover;
    border-radius: var(--radius-lg);
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-muted);
    margin: 12px 0 8px;
}

.meta-cat {
    color: var(--text-muted);
}

.meta-date {
    display: flex;
    align-items: center;
    gap: 4px;
}

.modern-card .card-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 8px;
    line-height: 1.3;
    color: var(--text-main);
}

.modern-card .card-excerpt {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Trending List Box */
.trending-box {
    padding: 24px;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100%;
    box-sizing: border-box;
}

.modern-list-item .list-link {
    display: flex;
    gap: 16px;
    align-items: center;
}

.list-thumbnail {
    background: #d1d5db;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.list-thumbnail img {
    width: 100px;
    height: 70px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.modern-list-item .list-title {
    font-size: 15px;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
    color: var(--text-main);
}

/* Hero Post */
.modern-hero-post {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    height: 100%;
    min-height: 400px;
    background: #e5e7eb;
}

.hero-thumbnail,
.hero-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

.hero-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
}

.hero-content {
    position: absolute;
    bottom: 0;
    left: 0;
    padding: 32px;
    color: #fff;
    width: 100%;
    box-sizing: border-box;
}

.hero-meta {
    font-size: 13px;
    margin-bottom: 12px;
    color: rgba(255, 255, 255, 0.8);
}

.hero-title {
    font-size: 32px;
    font-weight: 800;
    margin: 0;
    line-height: 1.2;
    color: #fff;
}

/* ------------------------------------- */
/* Accessibility & Mobile Overrides      */
/* ------------------------------------- */
@media (max-width: 992px) {

    .home-top-section,
    .home-body-section {
        grid-template-columns: 1fr;
    }

    .post-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .modern-hero-post {
        min-height: 350px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }

    .modern-hero-post {
        max-width: 100vw;
        overflow: hidden;
        min-height: 250px;
        /* Thu nhỏ ảnh bài viết nổi bật trên mobile */
    }

    /* Horizontal Swipe for Trending Box */
    .trending-box {
        max-width: 100vw;
        overflow: hidden;
        flex-direction: row;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
        padding: 8px;
        margin-right: -16px;
        padding-right: 16px;
    }

    .trending-box::-webkit-scrollbar {
        display: none;
    }

    .trending-box .modern-list-item {
        flex: 0 0 85%;
        scroll-snap-align: start;
    }

    /* Tối ưu Trending Box Mobile (Left image, Right text) */
    .trending-box .list-link {
        flex-direction: row;
        align-items: center;
        gap: 12px;
    }

    .list-thumbnail {
        width: 80px;
        flex-shrink: 0;
    }

    .list-thumbnail img {
        width: 80px;
        height: 80px;
        object-fit: cover;
    }

    .modern-list-item .list-title {
        font-size: 14px;
    }

    .list-content {
        flex: 1;
        min-width: 0;
    }

    /* Mặc định: Lưới 1 cột to cho các trang danh mục (Category, Archive) */
    .post-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 24px;
    }

    /* Độc lập: Lưới 2 cột nhỏ gọn CHỈ dành riêng cho 'Tin mới nhất' ở Trang chủ */
    #main-post-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    #main-post-grid .modern-card .card-title {
        font-size: 14px;
        line-height: 1.4;
        margin-bottom: 4px;
    }
    
    #main-post-grid .modern-card .card-meta {
        font-size: 11px;
    }

    /* Swipe Carousel cho danh sách bài liên quan/mới nhất */
    .mobile-swipe-container {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
        padding-bottom: 8px;
        margin-right: -16px;
        padding-right: 16px;
    }
    
    .mobile-swipe-container::-webkit-scrollbar {
        display: none;
    }
    
    .mobile-swipe-container .modern-card {
        flex: 0 0 85%;
        scroll-snap-align: start;
    }
}