/* css/blog.css */

.blog-page {
    padding-bottom: 50px;
}

.blog-hero-section {
    background-color: var(--light-gray);
    padding: 100px 20px;
    text-align: center;
    border-bottom: 1px solid #ddd;
}

.blog-hero-section h1 {
    font-size: 3rem;
    color: var(--secondary-color);
    margin-bottom: 10px;
}

.blog-hero-section p {
    font-size: 1.2rem;
    color: var(--dark-gray);
}

.blog-posts {
    padding: 80px 0;
}

.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 40px;
}

.blog-card {
    background-color: var(--white);
    border-radius: 10px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

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

.blog-card img {
    width: 100%;
    height: 220px; /* กำหนดความสูงคงที่สำหรับรูปภาพปก */
    object-fit: cover; /* ครอปรูปให้เต็มพื้นที่ */
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
}

.blog-card .card-content {
    padding: 25px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.blog-card h3 {
    font-size: 1.6rem;
    margin-bottom: 10px;
    color: var(--secondary-color);
}

.blog-card .post-meta {
    font-size: 0.95rem;
    color: var(--dark-gray);
    margin-bottom: 15px;
}

.blog-card p {
    font-size: 1rem;
    color: var(--dark-gray);
    line-height: 1.7;
    margin-bottom: 20px;
    flex-grow: 1;
}

.blog-card .btn {
    align-self: flex-start; /* จัดปุ่มให้อยู่ซ้าย */
}

/* Full Blog Post Content */
.full-blog-post {
    padding: 80px 0;
    border-top: 1px solid #eee;
    margin-top: 50px;
}

.full-blog-post:first-of-type {
    margin-top: 0;
    border-top: none;
}

.full-blog-post h2 {
    font-size: 2.8rem;
    margin-bottom: 15px;
    color: var(--secondary-color);
    text-align: center;
}

.full-blog-post .post-meta-full {
    font-size: 1rem;
    color: var(--dark-gray);
    text-align: center;
    margin-bottom: 30px;
}

.full-blog-post .post-image {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    margin: 0 auto 40px auto;
}

.full-blog-post h3 {
    font-size: 2rem;
    margin-top: 40px;
    margin-bottom: 20px;
    color: var(--primary-color);
}

.full-blog-post p {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 20px;
    text-align: justify; /* จัดข้อความให้เท่ากันสองฝั่ง */
}

.full-blog-post p strong {
    color: var(--secondary-color);
}

.full-blog-post ul {
    list-style-type: disc;
    margin-left: 30px;
    margin-bottom: 20px;
    font-size: 1.1rem;
    line-height: 1.8;
}

.full-blog-post li {
    margin-bottom: 8px;
}

.full-blog-post pre {
    background-color: #f0f4f7;
    border: 1px solid #e0e6eb;
    border-left: 5px solid var(--primary-color);
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
    overflow-x: auto; /* สำหรับโค้ดที่ยาวเกิน */
}

.full-blog-post code {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.95rem;
    color: #333;
}

.full-blog-post .btn {
    display: block;
    width: fit-content;
    margin: 50px auto 0 auto;
}

/* Responsive adjustments */
@media (max-width: 992px) {
    .blog-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
    .blog-card img {
        height: 180px;
    }
    .blog-card h3 {
        font-size: 1.5rem;
    }
    .full-blog-post h2 {
        font-size: 2.2rem;
    }
    .full-blog-post h3 {
        font-size: 1.8rem;
    }
    .full-blog-post p, .full-blog-post ul, .full-blog-post pre {
        font-size: 1rem;
    }
}

@media (max-width: 768px) {
    .blog-hero-section h1 {
        font-size: 2.5rem;
    }
    .blog-hero-section p {
        font-size: 1rem;
    }
    .blog-grid {
        grid-template-columns: 1fr; /* Stack on mobile */
    }
    .blog-card img {
        height: 200px;
    }
    .full-blog-post h2 {
        font-size: 2rem;
    }
    .full-blog-post h3 {
        font-size: 1.5rem;
    }
}