/*
* BrainSpark Digital - Modern Blog Styles
* Updated, modern styling for the blog page
*/

/* Blog Page Specific Variables - Literary Tech Theme */
:root {
    --blog-gradient: linear-gradient(135deg, #CC6848 0%, #b85a3d 100%);
    --blog-card-shadow: 0 4px 24px rgba(25, 25, 25, 0.08);
    --blog-card-shadow-hover: 0 20px 40px rgba(25, 25, 25, 0.15);
    --blog-hover-transform: translateY(-8px);
    --blog-border-radius: 16px;
    --blog-transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --blog-author-color: var(--primary-color);
}

/* Blog Hero Section */
.blog-hero {
    padding: 14rem 0 6rem;
    background-color: var(--bg-primary);
    position: relative;
    overflow: hidden;
    text-align: center;
}

.blog-hero::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: var(--blog-gradient);
    opacity: 0.1;
    z-index: 1;
}

.blog-hero::after {
    content: '';
    position: absolute;
    bottom: -80px;
    left: -80px;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: var(--blog-gradient);
    opacity: 0.05;
    z-index: 1;
}

.blog-hero-content {
    position: relative;
    z-index: 2;
    max-width: 80rem;
    margin: 0 auto;
}

.blog-hero h1 {
    font-size: 4.2rem;
    margin-bottom: 2rem;
    color: var(--text-color);
    line-height: 1.15;
    font-family: var(--font-serif);
}

.blog-hero-subheadline {
    font-size: 1.8rem;
    color: var(--muted-text);
    max-width: 65rem;
    margin: 0 auto 2rem;
    font-family: var(--font-sans);
}

/* Featured Post Section */
.featured-post {
    padding: 8rem 0;
    position: relative;
    z-index: 2;
}

.featured-post-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    background-color: var(--card-bg);
    border-radius: var(--blog-border-radius);
    overflow: hidden;
    box-shadow: var(--blog-card-shadow);
    transition: var(--blog-transition);
}

.featured-post-card:hover {
    transform: var(--blog-hover-transform);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

.featured-post-image {
    position: relative;
    overflow: hidden;
    height: 100%;
    min-height: 40rem;
}

.featured-post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.featured-post-card:hover .featured-post-image img {
    transform: scale(1.05);
}

.featured-post-content {
    padding: 4rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Author Info Styles */
.blog-author-info {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
}

.blog-author-info .author-name {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--blog-author-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.featured-post-card:hover .author-name {
    color: var(--secondary-color);
}

.featured-post-content h2 {
    font-size: 3rem;
    margin-bottom: 2rem;
    line-height: 1.3;
    transition: color 0.3s ease;
}

.featured-post-card:hover h2 {
    color: var(--primary-color);
}

.featured-post-content p {
    margin-bottom: 3rem;
    font-size: 1.6rem;
    line-height: 1.7;
}

/* Blog Main Section */
.blog-main {
    padding: 6rem 0 10rem;
    background-color: var(--background-color);
}

.blog-main-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 5rem;
    align-items: start; /* prevent grid items from stretching full height */
}

.blog-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(30rem, 1fr));
    gap: 3rem;
    align-items: start; /* prevent equal-height stretch to avoid huge whitespace when few cards */
}

.blog-card {
    background-color: var(--card-bg);
    border-radius: var(--blog-border-radius);
    overflow: hidden;
    box-shadow: var(--blog-card-shadow);
    transition: var(--blog-transition);
    height: auto; /* allow natural height to prevent tall empty cards when fewer items */
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

/* Square, full-tile variant for a tight grid aesthetic (like homepage cards) */
.blog-card.square {
    position: relative;
    display: block;
    aspect-ratio: 1 / 1; /* enforce square tile */
    overflow: hidden;
}

.blog-card.square .blog-image {
    position: absolute;
    inset: 0;
    aspect-ratio: auto; /* don't nest aspect ratios */
}

.blog-card.square .blog-content {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 1.6rem 2rem;
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.35) 50%, rgba(0,0,0,0) 100%);
    color: #fff;
}

.blog-card.square .blog-category {
    background-color: rgba(255,255,255,0.18);
    color: #fff;
}

.blog-card.square h3 { color: #fff; margin: 0.8rem 0 0.6rem; }
.blog-card.square p { margin: 0; font-size: 1.4rem; line-height: 1.5; }

.blog-card:hover {
    transform: var(--blog-hover-transform);
    box-shadow: var(--blog-card-shadow-hover);
    border-color: rgba(204, 104, 72, 0.15);
}

.blog-image {
    position: relative;
    overflow: hidden;
    aspect-ratio: 1 / 1; /* default square */
}

.blog-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
    display: block;
}

.blog-card:hover .blog-image img {
    transform: scale(1.05);
}

.blog-content {
    padding: 2.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* Blog Meta & Author Styles */
.blog-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.blog-author {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--blog-author-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color 0.3s ease;
}

.blog-card:hover .blog-author {
    color: var(--secondary-color);
}

.blog-content h3 {
    font-size: 2.2rem;
    margin-bottom: 1.2rem;
    line-height: 1.3;
    transition: color 0.3s ease;
    font-family: var(--font-serif);
}

.blog-card:hover h3 {
    color: var(--primary-color);
}

.blog-content p {
    margin-bottom: 1.6rem;
    color: var(--text-light);
    line-height: 1.7;
}

.read-more {
    display: inline-flex;
    align-items: center;
    color: var(--primary-color);
    font-weight: 500;
    transition: var(--blog-transition);
    margin-top: auto;
}

.read-more i {
    margin-left: 0.8rem;
    transition: transform 0.3s ease;
}

.blog-card:hover .read-more {
    color: var(--secondary-color);
}

.blog-card:hover .read-more i {
    transform: translateX(5px);
}

/* Blog Sidebar */
.blog-sidebar {
    position: sticky;
    top: 10rem;
    align-self: start !important; /* do not stretch to full row height */
    place-self: start !important; /* ensure both axes start */
    height: max-content !important; /* only as tall as its content */
}

/* Stronger override to neutralize legacy global sidebar box styling on detail page */
.blog-main-grid .blog-sidebar {
    background: transparent !important;
    padding: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}

.sidebar-section {
    background-color: var(--card-bg);
    border-radius: var(--blog-border-radius);
    padding: 3rem;
    margin-bottom: 3rem;
    box-shadow: var(--blog-card-shadow);
}

.sidebar-section h4 {
    font-size: 2rem;
    margin-bottom: 2rem;
    position: relative;
    padding-bottom: 1rem;
}

.sidebar-section h4::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50px;
    height: 3px;
    background: var(--blog-gradient);
    border-radius: 2px;
}

.blog-search {
    display: flex;
    margin-bottom: 1rem;
}

.blog-search input {
    flex-grow: 1;
    padding: 1.2rem 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px 0 0 8px;
    font-size: 1.6rem;
    transition: all 0.3s ease;
}

.blog-search input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.blog-search button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0 1.5rem;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.blog-search button:hover {
    background-color: var(--secondary-color);
}

.blog-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.blog-categories li {
    margin-bottom: 1rem;
}

.blog-categories a {
    display: inline-block;
    padding: 0.8rem 1.5rem;
    background-color: var(--blog-category-bg);
    color: var(--blog-category-color);
    border-radius: 50px;
    font-size: 1.4rem;
    font-weight: 500;
    transition: var(--blog-transition);
}

.blog-categories a:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-3px);
}

.newsletter-signup {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.newsletter-signup input {
    padding: 1.2rem 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1.6rem;
    transition: all 0.3s ease;
}

.newsletter-signup input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.newsletter-signup button {
    width: 100%;
}

.newsletter-note {
    font-size: 1.4rem;
    color: var(--text-light);
    margin-bottom: 0;
}

/* Blog Detail Page */
.blog-post-header {
    padding: 14rem 0 6rem; /* extra top space to clear fixed navbar */
    background-color: var(--background-alt);
    position: relative;
    overflow: hidden;
    text-align: center;
}

.blog-post-header::before,
.blog-post-header::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: var(--blog-gradient);
    z-index: 1;
    opacity: 0.08;
}

.blog-post-header::before {
    top: -80px;
    right: -80px;
    width: 300px;
    height: 300px;
}

.blog-post-header::after {
    bottom: -50px;
    left: -50px;
    width: 200px;
    height: 200px;
}

.blog-post-header-content {
    position: relative;
    z-index: 2;
    max-width: 80rem;
    margin: 0 auto;
    text-align: center;
}

.blog-post-header h1 {
    font-size: clamp(3rem, 5vw, 4.6rem);
    line-height: 1.2;
    margin-bottom: 1.2rem;
    color: var(--header-color);
}

.blog-post-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
    color: var(--text-light);
    font-size: 1.4rem;
}

.blog-post-meta div { margin: 0 1.5rem; display: flex; align-items: center; }
.blog-post-meta i { margin-right: 0.8rem; color: var(--primary-color); }

.blog-post-content { padding: 6rem 0; }

.blog-post-main {
    background-color: var(--card-bg);
    padding: 4rem;
    border-radius: 1.2rem;
    box-shadow: var(--blog-card-shadow);
    margin-bottom: 4rem;
}

.blog-post-featured-image { width: 100%; height: auto; margin-bottom: 3rem; border-radius: 1rem; overflow: hidden; }
.blog-post-featured-image img { width: 100%; height: auto; object-fit: cover; }

.blog-post-text { font-size: 1.6rem; line-height: 1.8; color: var(--text-color); }
.blog-post-text h2 { font-size: 2.8rem; margin: 3rem 0 1.5rem; }
.blog-post-text h3 { font-size: 2.4rem; margin: 2.5rem 0 1.2rem; }
.blog-post-text p { margin-bottom: 2rem; }
.blog-post-text ul, .blog-post-text ol { margin-bottom: 2rem; padding-left: 2rem; }
.blog-post-text li { margin-bottom: 1rem; }
.blog-post-text blockquote { border-left: 4px solid var(--primary-color); padding: 1.5rem 2rem; margin: 2rem 0; background-color: rgba(204, 104, 72, 0.05); font-style: italic; border-radius: 0 8px 8px 0; }

.blog-post-tags { margin-top: 4rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.8rem; }
.blog-post-tags span { margin-right: 0.5rem; font-weight: 600; color: var(--text-color); }
.blog-tag { display: inline-block; padding: 0.6rem 1.4rem; background-color: rgba(204, 104, 72, 0.1); color: var(--primary-color); border-radius: 30px; font-size: 1.3rem; font-weight: 600; transition: all 0.3s ease; }
.blog-tag:hover { background-color: var(--primary-color); color: white; transform: translateY(-2px); }
.blog-tag.active { background-color: var(--primary-color); color: white; }

/* Comments section */
.blog-comments { margin-top: 4rem; }
.blog-comments h3 { font-size: 2.4rem; margin-bottom: 2rem; padding-bottom: 1rem; border-bottom: 1px solid rgba(0, 0, 0, 0.1); }
.comment { margin-bottom: 3rem; padding-bottom: 3rem; border-bottom: 1px solid rgba(0, 0, 0, 0.05); }
.comment-meta { display: flex; justify-content: space-between; margin-bottom: 1rem; }
.comment-author { font-weight: 600; font-size: 1.6rem; }
.comment-date { color: var(--text-light); font-size: 1.4rem; }
.comment-content { font-size: 1.5rem; line-height: 1.6; }

.comment-form { margin-top: 4rem; }
.comment-form h3 { font-size: 2.4rem; margin-bottom: 2rem; }
.comment-form form { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
.comment-form .full-width { grid-column: span 2; }
.comment-form input, .comment-form textarea { width: 100%; padding: 1.2rem 1.5rem; border: 1px solid rgba(0, 0, 0, 0.1); border-radius: 8px; font-size: 1.5rem; transition: all 0.3s ease; }
.comment-form input:focus, .comment-form textarea:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); }
.comment-form button { margin-top: 1rem; }

/* Related posts */
.related-posts { margin-top: 6rem; }
.related-posts h3 { font-size: 2.4rem; margin-bottom: 3rem; text-align: center; }
.related-posts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(30rem, 1fr)); gap: 3rem; }

/* Compact card variant - Modern, editorial style */
.blog-card.compact {
    border-radius: var(--blog-border-radius);
    box-shadow: var(--blog-card-shadow);
    background: var(--card-bg);
}

.blog-card.compact .blog-image {
    aspect-ratio: 16 / 10;
    height: auto;
}

.blog-card.compact .blog-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(25,25,25,0.7) 0%, rgba(25,25,25,0.2) 40%, rgba(25,25,25,0) 70%);
    display: flex;
    align-items: flex-end;
    padding: 2rem;
    opacity: 0.9;
    transition: opacity 0.3s ease;
}

.blog-card.compact:hover .blog-overlay {
    opacity: 1;
}

.blog-card.compact .blog-date {
    color: #fff;
    font-size: 1.3rem;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.blog-card.compact .blog-meta {
    margin-bottom: 0.8rem;
}

.blog-card.compact .blog-author {
    font-size: 1.25rem;
    color: var(--blog-author-color);
}

.blog-card.compact .blog-content {
    padding: 2rem 2.4rem 2.6rem;
}

.blog-tags-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 1.2rem;
}

.blog-tags-inline .blog-tag,
.blog-tags-inline a {
    display: inline-block;
    background-color: rgba(204, 104, 72, 0.1);
    color: var(--primary-color);
    padding: 0.4rem 1rem;
    border-radius: 999px;
    font-size: 1.2rem;
    font-weight: 600;
    text-decoration: none;
    transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.blog-tags-inline a:hover {
    background-color: var(--primary-color);
    color: #fff;
    transform: translateY(-2px);
}

.blog-card.compact h3 {
    font-size: 2rem;
    margin: 0.6rem 0 1rem;
    font-family: var(--font-serif);
    line-height: 1.35;
}

.blog-card.compact p {
    font-size: 1.45rem;
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: 1.4rem;
}

.blog-card.compact .read-more {
    font-size: 1.4rem;
    font-weight: 600;
}

/* Animation Classes */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered animation delay for grid items */
.blog-list .animate-on-scroll:nth-child(1) { transition-delay: 0.1s; }
.blog-list .animate-on-scroll:nth-child(2) { transition-delay: 0.2s; }
.blog-list .animate-on-scroll:nth-child(3) { transition-delay: 0.3s; }
.blog-list .animate-on-scroll:nth-child(4) { transition-delay: 0.4s; }

/* Responsive Styles */
@media screen and (max-width: 1200px) {
    .blog-main-grid {
        grid-template-columns: 1fr;
        gap: 5rem;
    }
    
    .blog-sidebar {
        position: static;
        max-width: 60rem;
        margin: 0 auto;
    }
}

@media screen and (max-width: 992px) {
    .featured-post-card {
        grid-template-columns: 1fr;
    }
    
    .featured-post-image {
        min-height: 30rem;
    }
    
    .blog-hero h1 {
        font-size: 3.6rem;
    }

    /* Blog detail responsive */
    .blog-post-main { padding: 3rem; }
    .blog-post-header { padding-top: 12rem; padding-bottom: 5rem; }
}

/* Ensure nice layout when only 1 or 2 cards available */
.blog-list.is-few {
    grid-template-columns: repeat(auto-fit, minmax(32rem, 1fr));
    max-width: 70rem;
    margin-inline: auto; /* center within its column */
}

.blog-list.is-few .blog-card {
    margin-inline: auto;
}

/* center the few-items grid within the main/left column of the two-column layout */
.blog-main-grid .blog-list.is-few {
    justify-self: center;
}

@media screen and (max-width: 768px) {
    .blog-list {
        grid-template-columns: 1fr;
        max-width: 50rem;
        margin: 0 auto;
    }
    
    .featured-post-content {
        padding: 3rem;
    }
    
    .featured-post-content h2 {
        font-size: 2.4rem;
    }
    
    .blog-hero h1 {
        font-size: 3rem;
    }

    .comment-form form { grid-template-columns: 1fr; }
    .comment-form .full-width { grid-column: span 1; }
    .blog-post-header { padding-top: 11rem; padding-bottom: 4.5rem; }
}

@media screen and (max-width: 480px) {
    .featured-post-content {
        padding: 2.5rem;
    }
    
    .blog-content {
        padding: 2rem;
    }
    
    .sidebar-section {
        padding: 2.5rem;
    }
    
    .blog-hero h1 {
        font-size: 2.8rem;
    }
    
    .blog-hero-subheadline {
        font-size: 1.6rem;
    }

    .blog-post-meta { flex-direction: column; }
    .blog-post-meta div { margin: 0.5rem 0; }
    .blog-post-header { padding-top: 10rem; padding-bottom: 4rem; }
}