/* Blog Page Professional Redesign */

/* Overriding Header to be Non-Sticky */
body.blog-page header {
    position: absolute !important;
    /* OR relative, depending on hero overlay needs */
    background: transparent !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: none;
}

/* If the header needs to be visible on a white background below the hero, 
   we might need a different approach, but usually "non-sticky" implies 
   it scrolls away. Let's make it absolute over the hero for a premium look, 
   or just standard relative flow if that's preferred. 
   Given "Professional", absolute over hero often looks best. */

body.blog-page header {
    position: absolute;
    width: 100%;
    top: 0;
    left: 0;
}

/* Hero styles handled by hero.css */
.blog-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 4rem 1.5rem;
}

/* Featured Post (Bento Large) */
.featured-post-wrapper {
    margin-bottom: 4rem;
}

.featured-card {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    background: var(--bg-secondary);
    border-radius: 1.5rem;
    overflow: hidden;
    border: 1px solid var(--border-secondary);
    box-shadow: var(--shadow-xl);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.featured-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border-color: var(--accent-primary);
}

.featured-image {
    position: relative;
    height: 100%;
    min-height: 400px;
}

.featured-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.featured-card:hover .featured-image img {
    transform: scale(1.05);
}

.featured-content {
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.tag-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.badge {
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-primary {
    background: var(--accent-primary);
    color: var(--bg-primary);
}

.badge-outline {
    border: 1px solid var(--border-secondary);
    color: var(--text-secondary);
}

.featured-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.featured-excerpt {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.read-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--accent-primary);
    text-decoration: none;
    transition: gap 0.2s ease;
}

.read-more-btn:hover {
    gap: 0.75rem;
}

/* Filter Bar - Glassmorphism & Responsive */
.blog-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    flex-wrap: wrap;
    gap: 1.5rem;

    /* Glassmorphic Style */
    background: rgba(17, 24, 39, 0.7);
    /* Darker base for better contrast */
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);

    padding: 1rem;
    border-radius: 1rem;
    position: sticky;
    top: 20px;
    z-index: 90;
}

/* Light mode override */
body.light-mode .blog-controls {
    background: rgba(255, 255, 255, 0.65);
    border-color: rgba(0, 0, 0, 0.05);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
}

.filter-group {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 5px;
}

.filter-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}

.filter-btn.active,
.filter-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.filter-btn.active {
    background: var(--accent-primary);
    color: var(--bg-primary);
}

.search-group {
    position: relative;
    min-width: 250px;
}

.search-group input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-secondary);
    border-radius: 8px;
    color: var(--text-primary);
}

.search-group i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

/* Blog Grid - Symmetrical & Auto-filling */
.blog-grid {
    display: grid;
    /* auto-fit ensures cards stretch to fill the row if there's space */
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 2.5rem;
    padding-bottom: 2rem;
}

.blog-card {
    background: var(--bg-secondary);
    border-radius: 1rem;
    overflow: hidden;
    border: 1px solid var(--border-secondary);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    height: 100%;
    /* Ensure equal height */
    position: relative;
    box-shadow: var(--shadow-md);
}

.blog-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-color: var(--accent-primary);
}

.card-img-top {
    position: relative;
    height: 240px;
    /* Slightly taller for better ratio */
    overflow: hidden;
    background: var(--bg-tertiary);
    /* Loading placeholder color */
}

.card-img-top img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.blog-card:hover .card-img-top img {
    transform: scale(1.08);
}

.card-placeholder-img {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-placeholder-img i {
    font-size: 3rem;
    color: #374151;
    transition: color 0.3s ease;
}

.blog-card:hover .card-placeholder-img i {
    color: var(--accent-primary);
}

.card-body {
    padding: 1.75rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.02));
}

.card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-meta span {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.card-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    line-height: 1.3;
    font-family: 'Playfair Display', serif;
    /* Or keep Inter if preferred, but Serif adds class */
}

.card-title a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s;
    background-image: linear-gradient(var(--accent-primary), var(--accent-primary));
    background-size: 0% 2px;
    background-repeat: no-repeat;
    background-position: left bottom;
    padding-bottom: 2px;
}

.card-title a:hover {
    color: var(--accent-primary);
    background-size: 100% 2px;
}

.card-text {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    flex-grow: 1;
    opacity: 0.9;
}

.author-mini {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: auto;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-secondary);
}

.author-mini img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--bg-secondary);
    box-shadow: 0 0 0 1px var(--border-secondary);
}

.author-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* Animations */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 900px) {
    .featured-card {
        grid-template-columns: 1fr;
    }

    .featured-image {
        height: 300px;
        min-height: auto;
    }
}

@media (max-width: 600px) {
    .blog-title {
        font-size: 2.5rem;
    }

    .blog-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .filter-group {
        width: 100%;
        justify-content: flex-start;
        padding-bottom: 0.5rem;
        /* Space for scrollbar */
        margin-bottom: 0.5rem;
    }

    .search-group {
        width: 100%;
    }
}