/* --- BLOG HERO --- */
.blog-hero {
    min-height: 400px;
    height: 55vh;
}
.blog-hero::before {
    background: url('../../assets/aai.webp') no-repeat center center/cover;
}
.blog-hero h1 {
    font-size: 4.5rem;
}

/* --- BLOG FILTERS & CARDS COMMON STYLES --- */
.card-image-wrapper {
    position: relative;
    overflow: hidden;
}
.card-image-wrapper .category-tag {
    position: absolute;
    top: 16px;
    left: 16px;
    background-color: var(--color-primary-accent);
    color: var(--color-bg-main);
    padding: 6px 12px;
    border-radius: var(--border-radius);
    font-size: 0.8rem;
    font-weight: 700;
    z-index: 2;
}
.article-card {
    background-color: var(--color-bg-content);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    overflow: hidden;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    transition: transform 0.4s ease, box-shadow 0.4s ease, border-color 0.4s ease;
}
.article-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    border-color: var(--color-primary-accent);
}
.article-card img {
    width: 100%;
    height: 240px;
    object-fit: cover;
    transition: transform 0.4s ease;
}
.article-card:hover img {
    transform: scale(1.05);
}
.article-card .card-content {
    padding: calc(var(--spacing-unit) * 3);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}
.article-card h3 {
    font-size: 1.3rem;
    color: var(--color-text-main);
    margin-bottom: calc(var(--spacing-unit) * 1.5);
}
.article-card p {
    color: var(--color-text-secondary);
    margin-bottom: calc(var(--spacing-unit) * 2);
    flex-grow: 1;
}
.article-card .read-more {
    font-weight: 700;
    color: var(--color-primary-accent);
    margin-top: auto;
    transition: color 0.3s ease;
}
.article-card:hover .read-more {
    color: var(--color-primary-hover);
}

/* --- FEATURED ARTICLES GRID --- */
.featured-articles {
    display: grid;
    grid-template-columns: 2fr 1fr;
    grid-template-rows: auto auto;
    gap: calc(var(--spacing-unit) * 4);
    grid-template-areas:
        "main side1"
        "main side2";
}
.featured-main { grid-area: main; }
.featured-side { grid-area: auto; }

.featured-main h3 { font-size: 2rem; }
.featured-main img { height: 100%; min-height: 500px; }

/* --- ALL ARTICLES GRID & FILTERS --- */
.blog-filters {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: calc(var(--spacing-unit) * 2);
    margin-bottom: calc(var(--spacing-unit) * 6);
}
.filter-btn {
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    padding: 10px 20px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}
.filter-btn:hover {
    background-color: var(--color-bg-content);
    color: var(--color-text-main);
    border-color: var(--color-primary-accent);
}
.filter-btn.active {
    background-color: var(--color-primary-accent);
    color: var(--color-bg-main);
    border-color: var(--color-primary-accent);
}
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: calc(var(--spacing-unit) * 4);
}

/* --- BLOG POST STYLES --- */
.blog-post-header {
    padding: calc(var(--spacing-unit) * 12) 0;
    text-align: center;
    color: #fff;
    position: relative;
    overflow: hidden; /* Contains the absolutely positioned image */
}

/* New rule to style the <img> as a background */
.blog-post-header .blog-post-header-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0; /* Places the image behind the overlay and text */
}

.blog-post-header::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(0deg, var(--color-bg-main) 5%, rgba(13, 27, 42, 0.6) 100%);
    z-index: 1; /* Sits above the image but below the text container */
}
.blog-post-header .container {
    position: relative;
    z-index: 2; /* Ensures text is on top of the overlay */
}
.blog-post-title {
    font-size: 3rem;
    margin-bottom: var(--spacing-unit);
    text-shadow: 0 2px 8px rgba(0,0,0,0.7);
}
.blog-post-meta {
    font-size: 1rem;
    color: var(--color-text-secondary);
    font-weight: 600;
}
.blog-post-content {
    max-width: 800px;
    padding-top: calc(var(--spacing-unit) * 8);
    padding-bottom: calc(var(--spacing-unit) * 8);
}
.blog-post-content .lead {
    font-size: 1.25rem;
    color: var(--color-text-main);
    margin-bottom: calc(var(--spacing-unit) * 4);
}
.blog-post-content h2 {
    font-size: 2rem;
    margin-top: calc(var(--spacing-unit) * 6);
    margin-bottom: calc(var(--spacing-unit) * 3);
    color: var(--color-primary-accent);
}
.blog-post-content p,
.blog-post-content ul li {
    font-size: 1.1rem;
    line-height: 1.8;
}

/* --- STYLES FOR BLOG POST IMAGE FRAME & ANIMATION --- */
.blog-post-image {
    margin: calc(var(--spacing-unit) * 5) 0;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: transform 0.4s ease, box-shadow 0.4s ease, border-color 0.4s ease;
    background-color: var(--color-bg-content);
}
.blog-post-image:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    border-color: var(--color-primary-accent);
}
.blog-post-image img {
    width: 100%;
    display: block;
    transition: transform 0.4s ease;
}
.blog-post-image:hover img {
    transform: scale(1.05);
}
.blog-post-content figcaption {
    text-align: center;
    font-style: italic;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    padding: 0 calc(var(--spacing-unit) * 2);
    transition: max-height 0.4s ease-out, opacity 0.4s ease-out, padding 0.4s ease-out;
}
.blog-post-image:hover figcaption {
    opacity: 1;
    max-height: 5em;
    padding: calc(var(--spacing-unit) * 2);
}

.blog-post-content .quote {
    margin: calc(var(--spacing-unit) * 5) 0;
    padding-left: calc(var(--spacing-unit) * 4);
    border-left: 4px solid var(--color-primary-accent);
}
.blog-post-content .quote blockquote {
    font-size: 1.3rem;
    font-style: italic;
    color: var(--color-text-main);
    margin: 0;
}
.blog-post-content .quote cite {
    display: block;
    margin-top: var(--spacing-unit);
    color: var(--color-text-secondary);
}
.blog-post-cta {
    text-align: center;
    margin-top: calc(var(--spacing-unit) * 6);
}

/* --- CTA SECTION --- */
.cta-section {
    background: linear-gradient(145deg, #1B263B, #151F30);
    padding: calc(var(--spacing-unit) * 8);
    border-radius: var(--border-radius);
    text-align: center;
    max-width: 900px;
    margin: calc(var(--spacing-unit) * 8) auto;
}
.cta-section h2 {
    color: var(--color-primary-accent);
}
.cta-buttons {
    margin-top: calc(var(--spacing-unit) * 4);
    display: flex;
    justify-content: center;
    gap: calc(var(--spacing-unit) * 3);
    flex-wrap: wrap;
}
.button-secondary {
    display: inline-block;
    background-color: transparent;
    color: var(--color-primary-accent);
    padding: 12px 30px;
    border: 2px solid var(--color-primary-accent);
    font-weight: 700;
    font-size: 16px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s ease;
}
.button-secondary:hover {
    background-color: var(--color-primary-accent);
    color: var(--color-bg-main);
}

/* RESPONSIVE DESIGN */
@media (max-width: 900px) {
    .featured-articles {
        grid-template-columns: 1fr;
        grid-template-areas:
            "main"
            "side1"
            "side2";
    }
    .featured-main img {
        height: 400px;
        min-height: auto;
    }
}
@media (max-width: 768px) {
    .blog-hero h1,
    .blog-post-title {
        font-size: 2.8rem;
    }
}