/**
 * Latest Blog Posts Section - Homepage
 * Brand Color: #2491EB
 *
 * @package Filmarium_Town
 */

/* ==========================================================================
   Section Container
   ========================================================================== */

.filmarium-latest-posts {
    padding: 40px 0;
    background: #ffffff;
    position: relative;
    overflow: hidden;
}

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

/* ==========================================================================
   Section Header
   ========================================================================== */

.latest-posts-header {
    text-align: center;
    margin-bottom: 30px;
}

.latest-posts-header .section-title {
    font-size: 42px;
    font-weight: 700;
    color: #212529;
    margin-bottom: 15px;
    position: relative;
    display: inline-block;
}

.latest-posts-header .section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, #2491EB 0%, #1a73c2 100%);
    border-radius: 2px;
}

.latest-posts-header .section-subtitle {
    font-size: 18px;
    color: #6c757d;
    margin-top: 20px;
    font-weight: 400;
}

/* ==========================================================================
   Blog Posts Grid
   ========================================================================== */

.latest-posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-bottom: 30px;
}

/* ==========================================================================
   Individual Post Card
   ========================================================================== */

.latest-post-card {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.latest-post-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(36, 145, 235, 0.15);
}

/* Thumbnail */
.latest-post-thumbnail {
    position: relative;
    width: 100%;
    padding-top: 66.67%; /* 3:2 aspect ratio */
    overflow: hidden;
    background: #f8f9fa;
}

.latest-post-thumbnail a {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

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

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

/* Category Badge */
.latest-post-category {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 2;
    display: inline-block !important;
    background: none !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    box-shadow: none !important;
    max-width: fit-content !important;
    width: auto !important;
    height: auto !important;
}

/* Remove any pseudo-elements from parent */
.latest-post-category::before,
.latest-post-category::after {
    display: none !important;
    content: none !important;
}

/* Remove all WordPress default category styling */
.latest-post-category > *:not(a) {
    display: none !important;
}

.latest-post-category a,
.latest-post-card .latest-post-category a,
.filmarium-latest-posts .latest-post-category a,
.latest-posts-grid .latest-post-category a {
    display: inline-block !important;
    background: linear-gradient(135deg, #2491EB 0%, #1a73c2 100%) !important;
    color: #ffffff !important;
    padding: 6px 16px !important;
    border-radius: 20px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 2px 8px rgba(36, 145, 235, 0.3) !important;
    line-height: 1.4 !important;
    white-space: nowrap !important;
    width: auto !important;
    height: auto !important;
    float: none !important;
    position: relative !important;
}

/* Remove any pseudo-elements from link */
.latest-post-category a::before,
.latest-post-category a::after {
    display: none !important;
    content: none !important;
}

.latest-post-category a:hover,
.latest-post-card .latest-post-category a:hover,
.filmarium-latest-posts .latest-post-category a:hover {
    background: linear-gradient(135deg, #1a73c2 0%, #2491EB 100%) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(36, 145, 235, 0.4) !important;
    color: #ffffff !important;
}

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

/* Meta Information */
.latest-post-meta {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 15px;
    font-size: 14px;
    color: #6c757d;
}

.latest-post-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.latest-post-meta i {
    color: #2491EB;
    font-size: 14px;
}

/* Hide duplicate modified date (keep only published date) */
.latest-post-meta .updated:not(.published) {
    display: none !important;
}

/* Post Title */
.latest-post-title {
    margin-bottom: 15px;
    flex-grow: 0;
}

.latest-post-title a {
    font-size: 20px;
    font-weight: 700;
    color: #212529;
    text-decoration: none;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.3s ease;
}

.latest-post-title a:hover {
    color: #2491EB;
}

/* Post Excerpt */
.latest-post-excerpt {
    font-size: 15px;
    color: #6c757d;
    line-height: 1.6;
    margin-bottom: 20px;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Read More Link */
.latest-post-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #2491EB;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    margin-top: auto;
}

.latest-post-link i {
    font-size: 14px;
    transition: transform 0.3s ease;
}

.latest-post-link:hover {
    color: #1a73c2;
}

.latest-post-link:hover i {
    transform: translateX(5px);
}

/* ==========================================================================
   View All Posts Button
   ========================================================================== */

.latest-posts-footer {
    text-align: center;
    margin-top: 20px;
}

.view-all-posts-btn {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, #2491EB 0%, #1a73c2 100%);
    color: #ffffff;
    padding: 16px 40px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(36, 145, 235, 0.3);
    border: 2px solid transparent;
}

.view-all-posts-btn i {
    font-size: 16px;
    transition: transform 0.3s ease;
}

.view-all-posts-btn:hover {
    background: #ffffff;
    color: #2491EB;
    border-color: #2491EB;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(36, 145, 235, 0.4);
}

.view-all-posts-btn:hover i {
    transform: translateX(5px);
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

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

    .latest-posts-header .section-title {
        font-size: 36px;
    }

    .latest-posts-header .section-subtitle {
        font-size: 16px;
    }

    .filmarium-latest-posts {
        padding: 60px 0;
    }
}

/* Mobile - 1 Column */
@media (max-width: 768px) {
    .latest-posts-grid {
        grid-template-columns: 1fr;
        gap: 25px;
    }

    .latest-posts-header .section-title {
        font-size: 32px;
    }

    .latest-posts-header .section-subtitle {
        font-size: 15px;
    }

    .filmarium-latest-posts {
        padding: 50px 0;
    }

    .latest-posts-header {
        margin-bottom: 35px;
    }

    .latest-post-title a {
        font-size: 18px;
    }

    .view-all-posts-btn {
        width: 100%;
        justify-content: center;
        padding: 14px 30px;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .filmarium-latest-posts {
        padding: 40px 0;
    }

    .latest-posts-container {
        padding: 0 15px;
    }

    .latest-posts-header .section-title {
        font-size: 28px;
    }

    .latest-post-content {
        padding: 20px;
    }

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

    .view-all-posts-btn {
        font-size: 15px;
    }
}

/* ==========================================================================
   Alternative Layout: 2 Columns (For narrower sections)
   ========================================================================== */

.filmarium-latest-posts.two-column .latest-posts-grid {
    grid-template-columns: repeat(2, 1fr);
}

@media (max-width: 768px) {
    .filmarium-latest-posts.two-column .latest-posts-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Dark Background Variant
   ========================================================================== */

.filmarium-latest-posts.dark-bg {
    background: #f8f9fa;
}

.filmarium-latest-posts.dark-bg .latest-post-card {
    background: #ffffff;
}

/* ==========================================================================
   Loading State (Optional)
   ========================================================================== */

.latest-post-card.loading {
    opacity: 0.6;
    pointer-events: none;
}

.latest-post-card.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    z-index: 10;
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .filmarium-latest-posts {
        padding: 20px 0;
    }

    .latest-post-card {
        box-shadow: none;
        border: 1px solid #dee2e6;
        page-break-inside: avoid;
    }

    .view-all-posts-btn {
        display: none;
    }
}

