/*
 * Homepage Styles - Compact Layout
 */

/* Base Styles */
:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --bg-light: #f9fafb;
    --radius-sm: 4px;
    --radius-md: 8px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --transition: all 0.2s ease;
}

/* Container */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Typography */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: #fff;
}

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

a:hover {
    color: var(--primary-hover);
}

/* Category Blocks */
.category-blocks {
    padding: 30px 0;
}

.category-block {
    margin-bottom: 40px;
    background: #fff;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: var(--transition);
}

.category-block:last-child {
    margin-bottom: 0;
}

.category-block:hover {
    box-shadow: var(--shadow-md);
}

/* Category Header */
.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
}

.category-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    line-height: 1.3;
}

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

.view-all {
    font-size: 14px;
    font-weight: 500;
    color: var(--primary-color);
}

/* Category Content */
.category-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding: 20px;
}

/* Featured Post */
.featured-post {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.featured-post .post-thumbnail {
    position: relative;
    padding-top: 66.67%; /* 3:2 aspect ratio */
    margin-bottom: 12px;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.featured-post .post-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.featured-post:hover .post-thumbnail img {
    transform: scale(1.03);
}

.featured-post .post-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.featured-post .post-title {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
}

.featured-post .post-title a {
    color: var(--text-primary);
}

.featured-post .post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.post-meta .post-date,
.post-meta .post-category,
.post-meta .post-read-time {
    display: flex;
    align-items: center;
    gap: 4px;
}

.post-meta .post-category a {
    color: var(--primary-color);
    font-weight: 500;
}

.post-meta .icon {
    display: inline-flex;
    font-size: 12px;
}

.featured-post .post-excerpt {
    margin-top: auto;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary);
}

/* Small Posts */
.small-posts {
    display: grid;
    grid-template-rows: repeat(3, 1fr);
    gap: 15px;
}

.small-post {
    display: flex;
    gap: 12px;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.small-post:hover {
    background-color: var(--bg-light);
}

.small-post .post-thumbnail {
    flex: 0 0 100px;
    height: 80px;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.small-post .post-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.small-post:hover .post-thumbnail img {
    transform: scale(1.05);
}

.small-post .post-content {
    flex: 1;
    min-width: 0; /* Prevent flex item from overflowing */
}

.small-post .post-title {
    margin: 0 0 6px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
}

.small-post .post-title a {
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.small-post .post-meta {
    font-size: 11px;
}

/* Responsive Styles */
@media (max-width: 991px) {
    .category-content {
        grid-template-columns: 1fr;
    }
    
    .small-posts {
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: auto;
    }
    
    .small-post {
        flex-direction: column;
    }
    
    .small-post .post-thumbnail {
        flex: 0 0 150px;
        width: 100%;
        height: 100px;
    }
}

@media (max-width: 767px) {
    .small-posts {
        grid-template-columns: 1fr;
    }
    
    .small-post {
        flex-direction: row;
    }
    
    .small-post .post-thumbnail {
        flex: 0 0 80px;
        height: 60px;
    }
}

@media (max-width: 479px) {
    .category-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .view-all {
        align-self: flex-end;
    }
}

/* Hero Section (Keep existing hero styles but make more compact) */
.blog-hero {
    margin: 0 0 30px;
    background-color: var(--bg-light);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.hero-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 20px;
}

.hero-image {
    position: relative;
    padding-top: 56.25%;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.hero-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.hero-content {
    padding: 0;
}

.hero-content .post-category {
    display: inline-block;
    margin-bottom: 10px;
    padding: 4px 10px;
    background-color: var(--primary-color);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-decoration: none;
}

.hero-content .post-title {
    margin: 0 0 12px;
    font-size: 20px;
    line-height: 1.3;
}

.hero-content .post-meta {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--text-muted);
}

.hero-content .post-excerpt {
    margin-bottom: 16px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-secondary);
}

.read-more {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    background-color: var(--primary-color);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
}

.read-more:hover {
    background-color: var(--primary-hover);
    color: white;
}

/* Responsive Hero */
@media (min-width: 768px) {
    .hero-container {
        grid-template-columns: 1fr 1fr;
        padding: 30px;
    }
    
    .hero-content {
        padding: 0 0 0 20px;
    }
    
    .hero-content .post-title {
        font-size: 24px;
    }
}

/* ==========================================================================
   LATEST POSTS - Compact Layout
   ========================================================================== */
.latest-posts {
    padding: 2.5rem 0;
    background-color: #fff;
}

.latest-posts .section-title {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    color: var(--text-color);
    font-weight: 700;
    position: relative;
    padding-bottom: 0.75rem;
}

.latest-posts .section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 3px;
    background-color: var(--primary-color);
    border-radius: 2px;
}

/* Posts Grid */
.latest-posts .posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Post Card */
.latest-posts .post-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid #eee;
}

.latest-posts .post-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

/* Thumbnail */
.latest-posts .post-thumbnail {
    position: relative;
    padding-top: 62.5%; /* 16:10 Aspect Ratio */
    overflow: hidden;
}

.latest-posts .post-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.latest-posts .post-card:hover .post-thumbnail img {
    transform: scale(1.05);
}

/* Post Content */
.latest-posts .post-content {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.latest-posts .post-category {
    display: inline-block;
    margin-bottom: 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-decoration: none;
    transition: color 0.2s ease;
}

.latest-posts .post-category:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.latest-posts .post-title {
    font-size: 1rem;
    margin: 0 0 0.75rem;
    line-height: 1.4;
    font-weight: 600;
}

/* Line clamping with fallback */
.latest-posts .post-title a {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.2s ease;
    
    /* Modern solution with good browser support */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    
    /* Fallback for other browsers */
    display: -moz-box;
    -moz-box-orient: vertical;
    -moz-line-clamp: 2;
    
    /* Standard property */
    display: -ms-flexbox;
    -ms-line-clamp: 2;
    -ms-box-orient: vertical;
    
    /* Final standard */
    display: block;
    line-clamp: 2;
    box-orient: vertical;
    
    /* Fallback properties */
    max-height: 3em; /* Adjust based on line-height */
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
    
    /* Ensure text doesn't overflow */
    word-wrap: break-word;
    word-break: break-word;
}

.latest-posts .post-title a:hover {
    color: var(--primary-color);
}

.latest-posts .post-meta {
    display: flex;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    gap: 0.75rem;
}

.latest-posts .post-date {
    color: var(--text-muted);
}

.latest-posts .post-read-time {
    display: flex;
    align-items: center;
    color: var(--text-muted);
}

.latest-posts .post-read-time .icon {
    margin-right: 0.25rem;
    font-size: 0.85em;
    line-height: 1;
    opacity: 0.8;
}

.latest-posts .post-excerpt {
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.5;
    margin-bottom: 0.5rem;
    
    /* Modern solution with good browser support */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    
    /* Fallback for other browsers */
    display: -moz-box;
    -moz-box-orient: vertical;
    -moz-line-clamp: 3;
    
    /* Standard property */
    display: -ms-flexbox;
    -ms-line-clamp: 3;
    -ms-box-orient: vertical;
    
    /* Final standard */
    display: block;
    line-clamp: 3;
    box-orient: vertical;
    
    /* Fallback properties */
    max-height: 4.5em; /* Adjust based on line-height */
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
    
    /* Ensure text doesn't overflow */
    word-wrap: break-word;
    word-break: break-word;
}

/* Load More Button */
.latest-posts .load-more-container {
    text-align: center;
    margin-top: 2.5rem;
}

.latest-posts .load-more-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.7rem 2rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    min-width: 220px;
    height: 46px;
}

.latest-posts .load-more-button:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.latest-posts .load-more-button:active {
    transform: translateY(0);
}

.latest-posts .load-more-button:disabled {
    background-color: #e0e0e0;
    color: #9e9e9e;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Responsive Adjustments */
@media (max-width: 1024px) {
    .latest-posts .posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .latest-posts {
        padding: 2rem 0;
    }
    
    .latest-posts .posts-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
    
    .latest-posts .section-title {
        font-size: 1.5rem;
        margin-bottom: 1.25rem;
    }
    
    .latest-posts .load-more-button {
        width: 100%;
        max-width: 280px;
    }
}
