/**
 * BLOG CSS - FIXED RESPONSIVE FEATURED POST LAYOUT
 * Preserves original layout while fixing mobile responsive issues
 */

/* ==========================================
   BLOG HERO SECTION - PROPER STYLING
   ========================================== */

.hero {
    min-height: 60vh;
    display: flex;
    align-items: center;
    padding: 120px 60px 80px;
    background: linear-gradient(135deg, var(--background-cream) 0%, var(--background-gray) 100%);
    position: relative;
}

.hero-container {
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 80px;
    align-items: center;
}

.breadcrumb {
    grid-column: 1 / -1;
}

.hero .hero-content {
    grid-column: 1 / -1;
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
    opacity: 1;
    transform: translateY(0);
    transition: all 0.6s ease;
}

.hero .hero-content.loaded {
    opacity: 1;
    transform: translateY(0);
}

.hero .hero-title {
    font-family: 'Josefin Sans', sans-serif;
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 600;
    color: var(--text-dark, #2c3e50);
    margin-bottom: 20px;
    line-height: 1.2;
    text-align: center;
}

.hero .title-emphasis {
    color: var(--primary-teal, #0f5f5f);
    position: relative;
}

.hero .hero-subtitle {
    font-family: 'Inter', sans-serif;
    font-size: clamp(1.1rem, 2.5vw, 1.25rem);
    color: var(--text-medium, #555);
    line-height: 1.6;
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

/* Responsive overrides */
@media (max-width: 768px) {
    .hero {
        min-height: 50vh;
        padding: 90px 30px 60px;
    }

    .hero-container {
        grid-template-columns: 1fr;
        gap: 50px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .hero {
        min-height: 45vh;
        padding: 80px 20px 40px;
    }
    
    .hero-container {
        gap: 40px;
    }
}

/* ==========================================
   SEARCH AND FILTER SECTION
   ========================================== */

.search-section {
    background: white;
    padding: 40px 0;
    border-bottom: 1px solid var(--border-light, #e8e8e8);
}

.search-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    text-align: center;
}

.search-box {
    position: relative;
    display: inline-block;
    margin-bottom: 25px;
}

.search-input {
    width: 400px;
    max-width: 100%;
    padding: 15px 50px 15px 20px;
    border: 2px solid var(--border-light, #e8e8e8);
    border-radius: 25px;
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    background: white;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-teal, #0f5f5f);
    box-shadow: 0 0 0 3px rgba(15, 95, 95, 0.1);
}

.search-icon {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    color: var(--text-light, #666);
    pointer-events: none;
}

.category-filter {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

.filter-btn {
    padding: 12px 24px;
    border: 2px solid var(--border-light, #e8e8e8);
    background: white;
    color: var(--text-medium, #555);
    border-radius: 25px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    border-color: var(--primary-teal, #0f5f5f);
    color: var(--primary-teal, #0f5f5f);
}

.filter-btn.active {
    background: var(--primary-teal, #0f5f5f);
    border-color: var(--primary-teal, #0f5f5f);
    color: white;
}

/* ==========================================
   BLOG POSTS SECTION
   ========================================== */

.blog-posts {
    background: var(--cream-bg, #faf8f5);
    padding: 60px 0;
    min-height: 60vh;
}

.blog-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
    margin-bottom: 50px;
}

/* ==========================================
   POST CARDS - FIXED RESPONSIVE LAYOUT
   ========================================== */

.post-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    position: relative;
    border: 1px solid transparent;
    display: flex;
    flex-direction: column;
}

/* Clickable card styles */
.clickable-card {
    cursor: pointer;
    transition: all 0.3s ease;
}

/* Hover effects for clickable cards */
.clickable-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.15);
    border-color: var(--primary-teal, #0f5f5f);
}

/* ==========================================
   FEATURED POST - RESPONSIVE LAYOUT FIX
   ========================================== */

/* Desktop and Tablet - Horizontal Layout (Image Left, Content Right) */
.featured-post {
    grid-column: span 2; /* Take up 2 columns on larger screens */
    flex-direction: row; /* Horizontal layout */
    min-height: 400px;
}

.featured-post .post-image {
    flex: 1;
    min-height: 400px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    transition: transform 0.3s ease;
}

/* Add gradient overlay for featured posts */
.featured-post .post-image::after {
    content: '';
    position: absolute;
    top: 0;
    right: -1px; /* Extend slightly to prevent gaps */
    bottom: 0;
    left: 0;
    background: linear-gradient(
        to right,
        transparent 0%,
        transparent 50%,
        rgba(255, 255, 255, 0.6) 80%,
        rgba(255, 255, 255, 0.9) 95%,
        rgba(255, 255, 255, 1) 100%
    );
    pointer-events: none;
    z-index: 1;
}

.featured-post .post-content {
    flex: 1;
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Featured post hover effect */
.clickable-card.featured-post:hover {
    transform: translateY(-6px);
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.2);
}

/* ==========================================
   REGULAR POST CARDS
   ========================================== */

.post-card:not(.featured-post) .post-image {
    height: 250px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    transition: transform 0.3s ease;
}

/* Add white gradient fade for regular posts */
.post-card:not(.featured-post) .post-image::after {
    content: '';
    position: absolute;
    bottom: -1px; /* Extend slightly to prevent gaps */
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(255, 255, 255, 0.2) 30%,
        rgba(255, 255, 255, 0.6) 70%,
        rgba(255, 255, 255, 0.9) 90%,
        rgba(255, 255, 255, 1) 100%
    );
    pointer-events: none;
    z-index: 1;
}

/* Optional: Subtle image zoom on hover */
.clickable-card:hover .post-image {
    transform: scale(1.02);
}

.post-category {
    position: absolute;
    top: 15px;
    left: 15px;
    background: var(--primary-teal, #0f5f5f);
    color: white;
    padding: 6px 12px;
    border-radius: 15px;
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 2; /* Above gradient overlay */
}

.featured-badge {
    background: var(--accent-orange, #d4742a);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 15px;
    display: inline-block;
    align-self: flex-start;
    z-index: 2; /* Above gradient overlay */
    position: relative;
}

.post-content {
    padding: 30px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    color: var(--text-light, #666);
    flex-wrap: wrap;
}

.post-date {
    display: flex;
    align-items: center;
    gap: 5px;
}

.post-title {
    font-family: 'Josefin Sans', sans-serif;
    font-size: clamp(1.3rem, 2.5vw, 1.6rem);
    font-weight: 600;
    color: var(--text-dark, #2c3e50);
    line-height: 1.3;
    margin-bottom: 15px;
    transition: color 0.3s ease;
}

.featured-post .post-title {
    font-size: clamp(1.8rem, 3vw, 2.2rem);
}

.post-excerpt {
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    color: var(--text-medium, #555);
    line-height: 1.6;
    margin-bottom: 20px;
    flex-grow: 1;
}

/* Read more styling for clickable cards */
.clickable-card .read-more {
    color: var(--primary-teal, #0f5f5f);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    margin-top: auto;
    transition: color 0.3s ease;
    pointer-events: none;
}

/* Change read-more color on card hover */
.clickable-card:hover .read-more {
    color: var(--secondary-teal, #005a8b);
}

/* Focus styles for accessibility */
.clickable-card:focus {
    outline: 3px solid var(--primary-teal, #0f5f5f);
    outline-offset: 2px;
}

/* Smooth transitions for all card elements */
.clickable-card .post-title,
.clickable-card .post-excerpt,
.clickable-card .post-image {
    transition: all 0.3s ease;
}

/* Make sure the entire card area is clickable */
.clickable-card {
    display: flex;
    text-decoration: none;
    color: inherit;
}

/* Override any existing link styles within cards */
.clickable-card * {
    color: inherit;
    text-decoration: none;
}

/* ==========================================
   PAGINATION
   ========================================== */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 40px;
}

.pagination-btn {
    padding: 12px 20px;
    border: 2px solid var(--border-light, #e8e8e8);
    background: white;
    color: var(--text-medium, #555);
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 45px;
    text-align: center;
}

.pagination-btn:hover {
    border-color: var(--primary-teal, #0f5f5f);
    color: var(--primary-teal, #0f5f5f);
}

.pagination-btn.active {
    background: var(--primary-teal, #0f5f5f);
    border-color: var(--primary-teal, #0f5f5f);
    color: white;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==========================================
   UI STATES
   ========================================== */

.loading,
.empty-state,
.error-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-medium, #555);
}

.loading {
    font-family: 'Inter', sans-serif;
    font-size: 18px;
}

.empty-state h3,
.error-state h3 {
    font-family: 'Josefin Sans', sans-serif;
    font-size: 24px;
    color: var(--text-dark, #2c3e50);
    margin-bottom: 10px;
}

.empty-state p,
.error-state p {
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    color: var(--text-medium, #555);
    margin-bottom: 20px;
}

.error-state {
    color: #e74c3c;
}

/* Data source indicator */
.data-source-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    z-index: 1000;
    opacity: 0.8;
    pointer-events: none;
    font-family: 'Inter', sans-serif;
}

/* ==========================================
   ANIMATIONS
   ========================================== */

.fade-in-element {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease;
}

.fade-in-element.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Blog-specific fade animation to avoid conflicts with core.js */
.blog-fade-element {
    opacity: 0 !important;
    transform: translateY(30px) !important;
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
}

.blog-fade-element.is-visible {
    opacity: 1 !important;
    transform: translateY(0) !important;
}

/* Staggered animation delays */
.fade-in-element:nth-child(1) { transition-delay: 0.1s; }
.fade-in-element:nth-child(2) { transition-delay: 0.2s; }
.fade-in-element:nth-child(3) { transition-delay: 0.3s; }
.fade-in-element:nth-child(4) { transition-delay: 0.4s; }
.fade-in-element:nth-child(5) { transition-delay: 0.5s; }
.fade-in-element:nth-child(6) { transition-delay: 0.6s; }

/* ==========================================
   RESPONSIVE DESIGN - FIXED BREAKPOINTS
   ========================================== */

/* Large Tablet Styles */
@media (max-width: 1024px) {
    .posts-grid {
        grid-template-columns: 1fr;
    }

    .featured-post {
        grid-column: span 1; /* Take up only 1 column on tablets */
    }
}

/* Tablet Styles */
@media (max-width: 768px) {


    .hero-container,
    .search-container,
    .blog-container {
        padding: 0 15px;
    }

    .search-input {
        width: 100%;
        max-width: 400px;
    }

    .category-filter {
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 10px;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .category-filter::-webkit-scrollbar {
        display: none;
    }

    .filter-btn {
        white-space: nowrap;
        flex-shrink: 0;
    }

    .posts-grid {
        grid-template-columns: 1fr;
        gap: 25px;
    }

    /* FEATURED POST - VERTICAL LAYOUT ON TABLETS */
    .featured-post {
        flex-direction: column;
        min-height: auto;
    }

    .featured-post .post-image {
        height: 300px;
        flex: none;
    }

    /* Update gradient for vertical layout */
    .featured-post .post-image::after {
        bottom: -1px; /* Extend slightly to prevent gaps */
        right: 0; /* Reset right positioning for vertical layout */
        background: linear-gradient(
            to bottom,
            transparent 0%,
            transparent 50%,
            rgba(255, 255, 255, 0.6) 80%,
            rgba(255, 255, 255, 0.9) 95%,
            rgba(255, 255, 255, 1) 100%
        );
    }

    .featured-post .post-content {
        flex: none;
        padding: 30px;
    }

    .post-content {
        padding: 20px;
    }

    .pagination {
        flex-wrap: wrap;
        gap: 8px;
    }

    .pagination-btn {
        padding: 10px 16px;
        font-size: 13px;
    }
}

/* Mobile Styles */
@media (max-width: 480px) {


    .search-section {
        padding: 30px 0;
    }

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

    .posts-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    /* FEATURED POST - MOBILE OPTIMIZATION */
    .featured-post {
        flex-direction: column;
        min-height: auto;
    }

    .featured-post .post-image {
        height: 250px;
        flex: none;
    }

    /* Maintain vertical white gradient for mobile */
    .featured-post .post-image::after {
        bottom: -1px; /* Extend slightly to prevent gaps */
        right: 0; /* Reset right positioning for mobile layout */
        background: linear-gradient(
            to bottom,
            transparent 0%,
            transparent 50%,
            rgba(255, 255, 255, 0.6) 80%,
            rgba(255, 255, 255, 0.9) 95%,
            rgba(255, 255, 255, 1) 100%
        );
    }

    .featured-post .post-content {
        flex: none;
        padding: 20px;
    }

    .featured-post .post-title {
        font-size: clamp(1.4rem, 4vw, 1.8rem);
    }

    .post-content {
        padding: 15px;
    }

    .search-input {
        padding: 12px 40px 12px 15px;
        font-size: 14px;
    }

    .filter-btn {
        padding: 10px 18px;
        font-size: 13px;
    }

    .data-source-indicator {
        bottom: 15px;
        right: 15px;
        font-size: 11px;
        padding: 6px 10px;
    }

    .post-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

/* ==========================================
   ACCESSIBILITY IMPROVEMENTS
   ========================================== */

@media (prefers-reduced-motion: reduce) {
    .hero-content {
        opacity: 1 !important;
        transform: translateY(0) !important;
        transition: none !important;
    }

    .clickable-card,
    .filter-btn,
    .pagination-btn,
    .search-input,
    .fade-in-element,
    .hero-content,
    .post-image {
        transition: none !important;
        animation: none !important;
    }

    .clickable-card:hover {
        transform: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .post-card {
        border: 2px solid var(--text-dark, #2c3e50);
    }

    .clickable-card:hover {
        border-color: var(--primary-teal, #0f5f5f);
        border-width: 3px;
    }
}

/* ==========================================
   PRINT STYLES
   ========================================== */

@media print {
    .search-section,
    .pagination,
    .data-source-indicator {
        display: none;
    }

    .post-card {
        box-shadow: none;
        border: 1px solid #ccc;
        page-break-inside: avoid;
        margin-bottom: 20px;
    }

    .clickable-card:hover {
        transform: none;
        box-shadow: none;
    }

    .featured-post {
        flex-direction: column;
    }
}