/*
 Theme Name:   GeneratePress Child
 Theme URI:    https://generatepress.com
 Description:  Default GeneratePress child theme
 Author:       Tom Usborne
 Author URI:   https://tomusborne.com
 Template:     generatepress
 Version:      0.1
*/

a {
    text-decoration: none;
}

/* Tách biệt Header và Body bằng đổ bóng (Box-shadow) */
.site-header {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); /* Bóng đổ rất nhạt và mềm */
    position: relative; /* Bắt buộc để bóng đè lên phần nội dung bên dưới */
    z-index: 100;
}

/* (Tuỳ chọn) Nếu bạn có dùng tính năng Sticky Navigation của GeneratePress Premium thì thêm dòng này */
.main-navigation.is_stuck {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* Container bọc ngoài cùng - Giới hạn độ rộng tối đa để không bị vỡ trên màn hình quá to */
.custom-home-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Hiển thị dạng Grid */
.custom-post-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

/* Định dạng thẻ bài viết (Card) */
.grid-item {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    border: 1px solid #f0f0f0;
}

.grid-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.12);
}

.widget-area .widget, .separate-containers .inside-article {
    padding: 15px;
}

.entry-content p {
    text-align: justify;
}

/* Ảnh đại diện */
.grid-post-thumbnail img {
    width: 100%;
    height: 240px;
    object-fit: cover; /* Đảm bảo ảnh không bị méo */
    display: block;
    transition: transform 0.5s ease;
}

.grid-item:hover .grid-post-thumbnail img {
    transform: scale(1.05); /* Hiệu ứng zoom nhẹ ảnh khi hover */
}

.grid-post-thumbnail {
    overflow: hidden;
}

/* Nội dung bài viết */
.grid-post-content {
    padding: 24px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.grid-post-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 12px;
    line-height: 1.4;
}

.grid-post-title a {
    color: #222222;
    text-decoration: none;
    transition: color 0.2s ease;
}

.grid-post-title a:hover {
    color: #0073aa; /* Thay đổi mã màu này theo tông màu chủ đạo của blog */
}

.grid-post-meta {
    font-size: 0.85rem;
    color: #888888;
    margin-bottom: 15px;
    font-weight: 500;
}

.grid-post-excerpt {
    color: #555555;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 0;
    flex-grow: 1;
}

/* --- TRANG TRÍ TIÊU ĐỀ CHÍNH --- */
.home-section-title {
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    color: #333333;
    margin-bottom: 40px;
    text-transform: uppercase;
    position: relative;
}

/* Thêm một đường kẻ gạch chân nhỏ màu cam (giống logo của bạn) cho tiêu đề thêm điểm nhấn */
.home-section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background-color: #e85038; /* Thay mã màu này nếu bạn muốn màu khác */
    margin: 15px auto 0;
}

/* --- XỬ LÝ TIÊU ĐỀ BÀI VIẾT TỐI ĐA 2 DÒNG --- */
.grid-post-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 12px;
    line-height: 1.4;
    
    /* Thiết lập chiều cao tối thiểu bằng 2 dòng (1.4 * 2 = 2.8) để các block không bị so le khi có bài tiêu đề ngắn 1 dòng */
    min-height: 2.8em; 
    
    /* Cắt chữ thành 2 dòng, có dấu 3 chấm */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- XỬ LÝ MÔ TẢ ĐỒNG ĐỀU TỐI ĐA 3 DÒNG --- */
.grid-post-excerpt {
    color: #555555;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 0;
    flex-grow: 1;
    
    /* Cắt chữ thành 3 dòng, giúp thẻ luôn đồng đều chiều cao */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==================================================
   CSS MỚI: SHORTCODE DẠNG GRID 1 CỘT (ẢNH TRÊN, CHỮ DƯỚI)
================================================== */

.eboi-shortcode-title {
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 20px;
    color: #e85038; 
    border-bottom: 2px solid #eaeaea;
    padding-bottom: 10px;
}

/* Grid 1 cột */
.eboi-shortcode-grid {
    display: grid;
    grid-template-columns: 1fr; /* Mặc định 1 cột */
    gap: 20px; /* Khoảng cách giữa các bài */
}

/* Kiểu dáng từng item trong shortcode */
.sc-grid-item {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 6px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.sc-grid-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.sc-grid-thumb img {
    width: 100%;
    height: 180px; /* Chiều cao cố định cho ảnh */
    object-fit: cover;
    display: block;
}

.sc-grid-content {
    padding: 15px;
}

.sc-grid-title {
    margin: 0;
    font-size: 1rem;
    line-height: 1.5;
    font-weight: 600;
}

.sc-grid-title a {
    color: #333;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Giới hạn 2 dòng */
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s ease;
}

.sc-grid-title a:hover {
    color: #e85038;
}


/* ==================================================
   CSS MỚI: BÀI VIẾT LIÊN QUAN DƯỚI CÙNG (2 CỘT)
================================================== */
.eboi-related-posts {
    margin-top: 60px;
    padding-top: 30px;
    border-top: 2px solid #eaeaea;
}

.related-title {
    font-size: 1.5rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 25px;
    color: #333;
    position: relative;
}

.related-title::after {
    content: '';
    display: block;
    width: 50px;
    height: 3px;
    background-color: #e85038;
    margin-top: 10px;
}

/* Lưới 2 cột cho bài liên quan */
.related-post-grid-2col {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
}

.related-item {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    border: 1px solid #f0f0f0;
    transition: all 0.3s ease;
}

.related-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.related-thumb img {
    width: 100%;
    height: 220px; /* Chiều cao ảnh */
    object-fit: cover;
    display: block;
}

.related-content {
    padding: 20px;
}

.related-post-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.4;
}

.related-post-title a {
    color: #222;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Cắt tiêu đề 2 dòng */
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s ease;
}

.related-post-title a:hover {
    color: #0073aa;
}

/* ==================================================
   CSS CHO BÀI VIẾT GỢI Ý TRÊN TRANG 404 (3 CỘT - CHỐNG LỆCH)
================================================== */
.custom-404-posts {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #eaeaea; 
}

.custom-404-title {
    font-size: 1.25rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 25px;
    color: #333;
    position: relative;
}

.custom-404-title::after {
    content: '';
    display: block;
    width: 50px;
    height: 3px;
    background-color: #ECECEB; 
    margin-top: 10px;
}

/* Lưới 3 cột */
.custom-post-grid-404 {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* Đổi thành 3 cột */
    gap: 20px; 
}

/* Kiểu dáng từng thẻ bài viết - Bổ sung Flexbox để ép thẻ cao bằng nhau */
.grid-item-404 {
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #f0f0f0;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column; /* Sắp xếp ảnh và chữ theo cột dọc */
}

.grid-item-404:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
}

.grid-404-thumb img {
    width: 100%;
    height: 160px; /* Giảm chiều cao ảnh một chút để cân đối với 3 cột */
    object-fit: cover;
    display: block;
}

.grid-404-content {
    padding: 15px;
    flex-grow: 1; /* Chiếm toàn bộ không gian còn lại giúp các thẻ đẩy nhau cân bằng */
    display: flex;
    flex-direction: column;
}

.grid-404-post-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.5;
    
    /* ÉP CHIỀU CAO TIÊU ĐỀ: 1.5 (line-height) x 2 dòng = 3em */
    min-height: 3em; 
}

.grid-404-post-title a {
    color: #222;
    text-decoration: none;
    
    /* Giới hạn text 2 dòng và có 3 chấm */
    display: -webkit-box;
    -webkit-line-clamp: 2; 
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s ease;
}

/* ==================================================
   CSS TRANG DANH MỤC (TIÊU ĐỀ & MÔ TẢ)
================================================== */
.custom-cat-header {
    text-align: center;
    margin-bottom: 50px;
    max-width: 960px; /* Giới hạn độ rộng để text không bị kéo quá dài gây mỏi mắt */
    margin-left: auto;
    margin-right: auto;
}

.custom-cat-title {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: #333;
    text-transform: uppercase;
}

.cat-desc-wrapper {
    position: relative;
    padding: 0 15px;
}

.cat-desc-content {
    color: #555;
    font-size: 1.05rem;
    line-height: 1.6;
    text-align: justify; /* Căn đều 2 bên */
    
    /* Thuật toán cắt giới hạn đúng 5 dòng */
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Gỡ giới hạn dòng khi class "expanded" được thêm vào bởi JS */
.cat-desc-content.expanded {
    -webkit-line-clamp: unset;
}

/* Định dạng Nút bấm hiển thị xanh lá điệp với theme */
.cat-desc-toggle {
    background: none;
    border: none;
    color: #27ae60; 
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 15px;
    padding: 5px 15px;
    transition: color 0.2s ease;
    display: inline-block;
}

.cat-desc-toggle:hover {
    color: #1e8449;
}

.cat-desc-toggle .arr {
    font-size: 0.75rem;
    margin-left: 5px;
    vertical-align: middle;
}

/* ==================================================
   CSS LƯỚI BÀI VIẾT DANH MỤC (GRID 4 CỘT)
================================================== */
.custom-cat-grid-4col {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 25px;
    margin-bottom: 50px;
}

.cat-item {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #f0f0f0;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.cat-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.08);
}

.cat-thumb img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

.cat-content {
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.cat-post-title {
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.4;
    margin: 0 0 10px 0;
    min-height: 2.8em; /* Giữ khung luôn đều 2 dòng */
}

.cat-post-title a {
    color: #222;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s ease;
}

.cat-post-title a:hover {
    color: #27ae60;
}

.cat-post-excerpt {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ==================================================
   BỔ SUNG RESPONSIVE (ĐIỆN THOẠI/TABLET) CHO LƯỚI TRANG CHỦ
================================================== */
/* Màn hình máy tính bảng (Tablet) - Chuyển về 2 cột */
@media (max-width: 1024px) {
    .custom-post-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }
    .custom-post-grid-404 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Màn hình điện thoại (Mobile) - Chuyển về 1 cột */
@media (max-width: 768px) {
    .custom-post-grid {
        grid-template-columns: 1fr; /* Ép hiển thị 1 cột */
        gap: 20px;
    }
    
    .custom-home-container {
        padding: 30px 15px; /* Giảm lề 2 bên để tối ưu không gian đọc */
    }
    
    .home-section-title {
        font-size: 1.5rem; /* Thu nhỏ tiêu đề chính một chút cho cân đối với màn hình nhỏ */
        margin-bottom: 25px;
    }
    
    .grid-post-thumbnail img {
        height: 200px; /* Hạ bớt chiều cao ảnh trên mobile cho gọn */
    }
    
    /* Responsive: Chuyển về 1 cột trên điện thoại */
    .related-post-grid-2col {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    /* Chuyển về 1 cột khi xem trên điện thoại (Mobile Responsive) */
    .custom-post-grid-404 {
        grid-template-columns: 1fr;
    }

    /* (Tuỳ chọn) Nếu bạn muốn màn hình to hiển thị 2 cột cho đẹp thay vì 1 cột quá dài */
    .eboi-shortcode-grid {
        grid-template-columns: repeat(2, 1fr); 
    }
    
    /* Hiệu ứng Mobile cho Shortcode */
    .list-thumb img {
        width: 70px;
        height: 55px;
    }
}

/* Responsive để không bị vỡ giao diện trên iPad và Mobile */
@media (max-width: 1100px) {
    .custom-cat-grid-4col {
        grid-template-columns: repeat(3, 1fr);
        margin-left: 15px;
        margin-right: 15px;
    }
}

@media (max-width: 850px) {
    .custom-cat-grid-4col {
        grid-template-columns: repeat(2, 1fr);
        margin-left: 15px;
        margin-right: 15px;
    }
}

@media (max-width: 550px) {
    .custom-cat-grid-4col {
        grid-template-columns: 1fr;
        margin-left: 15px;
        margin-right: 15px;
    }
}