* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f9f9f9;
}

.blog-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Hero Section */
.blog-hero {
    background: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)), 
    url('https://images.unsplash.com/photo-1566073771259-6a8506099945?ixlib=rb-4.0.3&auto=format&fit=crop&w=1200&q=80');
    background-size: cover;
    background-position: center;
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: white;
    border-radius: 10px;
    margin-bottom: 30px;
}

.hero-content h1 {
    font-size: 3rem;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.hero-content p {
    font-size: 1.2rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Category Menu */
.category-menu {
    background-color: #1a3c2d;
    border-radius: 8px;
    margin-bottom: 30px;
    padding: 15px 0;
}

.category-menu ul {
    display: flex;
    justify-content: center;
    list-style: none;
    flex-wrap: wrap;
}

.category-menu li {
    margin: 0 15px;
}

.category-link {
    color: white;
    text-decoration: none;
    font-weight: 500;
    padding: 8px 15px;
    border-radius: 20px;
    transition: all 0.3s ease;
}

.category-link:hover, .category-link.active {
    background-color: #fff;
    color: #1a3c2d;
}

/* Blog Posts */
.blog-posts h2 {
    font-size: 2rem;
    color: #1a3c2d;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
}

.posts-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
    align-items: stretch;
}

.blog-post {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    min-height: 450px;
    position: relative;
}

.blog-post:hover {
    transform: translateY(-5px);
}

.post-image {
    height: 200px;
    overflow: hidden;
    flex-shrink: 0;
}

.post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.blog-post:hover .post-image img {
    transform: scale(1.05);
}

.post-content {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.post-content::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: linear-gradient(to bottom, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 100%);
    pointer-events: none;
}

.post-meta {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.post-title {
    font-size: 1.4rem;
    margin-bottom: 10px;
    color: #1a3c2d;
}

.post-sub {
    font-size: 1.1rem;
    margin: 15px 0 8px;
    color: #2c5aa0;
}

.post-excerpt {
    font-size: 1rem;
    margin-bottom: 15px;
    color: #555;
    flex-grow: 1;
    overflow: hidden;
    position: relative;
    max-height: 300px;
}

.post-excerpt p {
    margin-bottom: 10px;
}

/* For posts without images, add some top padding */
.blog-post:not(.post-with-image) .post-content {
    padding-top: 30px;
}

/* Read More button styling */
.read-more {
    display: inline-block;
    padding: 8px 16px;
    background-color: #1a3c2d;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 500;
    transition: all 0.3s ease;
    margin-top: auto;
    z-index: 2;
    align-self: flex-start;
    cursor: pointer;
    border: none;
}

.read-more:hover {
    background-color: #2c5b46;
}

/* Expanded post styling */
.blog-post.expanded {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-width: 800px;
    max-height: 80vh;
    height: auto !important;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.blog-post.expanded .post-content {
    max-height: none !important;
    overflow: visible !important;
    height: auto !important;
}

.blog-post.expanded .post-content::after {
    display: none;
}

.blog-post.expanded .post-excerpt {
    margin-bottom: 15px;
    max-height: none !important;
    overflow: visible !important;
}

.blog-post.expanded .post-excerpt::after {
    display: none;
}

.blog-post.expanded .post-image{
    flex-shrink: 0;
}

/* Overlay for when a post is expanded */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 999;
    display: none;
}

.overlay.active {
    display: block;
}

/* Close button for expanded view */
.close-expanded {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #1a3c2d;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 11;
    font-size: 20px;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    border: none;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 30px;
}

.pagination button {
    background-color: #fff;
    border: 1px solid #ddd;
    color: #1a3c2d;
    padding: 8px 16px;
    margin: 0 4px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.pagination button:hover {
    background-color: #1a3c2d;
    color: white;
}

.pagination button.active {
    background-color: #1a3c2d;
    color: white;
    border-color: #1a3c2d;
}

/* Responsive Design */
@media (max-width: 768px) {
    .posts-container {
        grid-template-columns: 1fr;
    }

    .category-menu ul {
        flex-direction: column;
        align-items: center;
    }

    .category-menu li {
        margin: 5px 0;
    }

    .hero-content h1 {
        font-size: 2.2rem;
    }
    
    .blog-post.expanded {
        width: 95%;
        max-height: 90vh;
    }
}

/* For posts with images */
.post-with-image .post-content {
    max-height: 300px;
    overflow: hidden;
}

.blog-post:not(.post-with-image).expanded {
    min-height: auto; /* Ensure minimum height for text-only posts */
    height: auto !important;
}

.blog-post.expanded .read-more {
    display: none;
}