/* 
    BLOG STYLES
    Sleek, responsive, and compatible with light/dark themes.
*/

.blog-page, .blog-detail-page {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    padding-top: 140px; /* Offset for navbar */
    font-family: 'Poppins', sans-serif;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Hero Section */
.blog-hero {
    position: relative;
    padding: 60px 20px 80px;
    text-align: center;
    overflow: hidden;
}

.blog-hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 50%, rgba(220, 20, 60, 0.05) 0%, transparent 80%);
    z-index: 1;
}

.blog-hero-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
    margin: 0 auto;
}

.blog-label {
    display: inline-block;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.blog-hero h1 {
    font-size: 48px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 24px;
    letter-spacing: -1px;
}

.blog-hero p {
    font-size: 18px;
    color: var(--text-secondary);
    line-height: 1.6;
}

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

/* Grid Layout */
.blog-grid-section {
    padding-bottom: 100px;
}

.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 40px;
    margin-top: 40px;
}

/* Cards */
.blog-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1), box-shadow 0.4s ease, border-color 0.4s ease;
    display: flex;
    flex-direction: column;
}

.blog-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px var(--shadow);
    border-color: var(--text-muted);
}

.blog-card-image {
    height: 220px;
    position: relative;
    overflow: hidden;
    background: var(--bg-secondary);
}

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

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

.blog-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: var(--text-muted);
}

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

.blog-card-meta {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.blog-card-title {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 15px;
    line-height: 1.3;
}

.blog-card-title a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

.blog-card-title a:hover {
    color: var(--text-secondary);
}

.blog-card-excerpt {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 24px;
    flex-grow: 1;
}

.read-more-btn {
    align-self: flex-start;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: gap 0.3s ease;
}

.read-more-btn:hover {
    gap: 12px;
}

/* Empty State */
.blog-empty-state {
    text-align: center;
    padding: 100px 20px;
    max-width: 600px;
    margin: 0 auto;
}

.blog-empty-state i {
    font-size: 64px;
    color: var(--text-muted);
    margin-bottom: 30px;
}

.blog-empty-state h2 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 15px;
}

.blog-empty-state p {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.return-home-btn, .back-to-blog-btn {
    display: inline-block;
    padding: 14px 32px;
    background-color: var(--text-primary);
    color: var(--bg-primary);
    font-weight: 600;
    text-decoration: none;
    border-radius: 30px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.return-home-btn:hover, .back-to-blog-btn:hover {
    transform: scale(1.02);
    opacity: 0.9;
}

/* --- DETAIL PAGE --- */
.blog-detail-page {
    padding-top: 140px;
    padding-bottom: 100px;
}

.blog-detail-article {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

.blog-detail-nav {
    margin-bottom: 40px;
}

.back-to-blog {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.blog-detail-header {
    margin-bottom: 40px;
}

.blog-detail-meta {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 15px;
}

.blog-detail-title {
    font-size: 42px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 20px;
    letter-spacing: -1px;
}

.blog-detail-lead {
    font-size: 20px;
    color: var(--text-secondary);
    line-height: 1.6;
    font-weight: 300;
}

.blog-detail-featured-image {
    width: 100%;
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 50px;
    border: 1px solid var(--border-color);
}

.blog-detail-featured-image img {
    width: 100%;
    height: auto;
    display: block;
}

.blog-detail-content {
    font-size: clamp(1rem, 2vw, 1.15rem);
    line-height: 1.85;
    color: var(--text-primary);
    margin-bottom: 60px;
}

.blog-detail-content p {
    margin-bottom: 25px;
    font-weight: 400;
}

/* Rich text subheadings styling for SEO visibility */
.blog-detail-content h2 {
    font-size: clamp(1.8rem, 4vw, 2.2rem);
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 45px;
    margin-bottom: 20px;
    line-height: 1.3;
    letter-spacing: -0.5px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

.blog-detail-content h3 {
    font-size: clamp(1.4rem, 3vw, 1.7rem);
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 35px;
    margin-bottom: 15px;
    line-height: 1.3;
    letter-spacing: -0.3px;
}

.blog-detail-content h4 {
    font-size: clamp(1.1rem, 2.5vw, 1.3rem);
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 30px;
    margin-bottom: 12px;
}

/* Quotes/Highlights within text */
.blog-detail-content blockquote {
    margin: 40px 0;
    padding: 24px 30px;
    border-left: 4px solid var(--text-primary);
    background-color: var(--bg-secondary);
    border-radius: 0 16px 16px 0;
    font-style: italic;
    font-size: 1.15rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

/* Complementary inline images */
.blog-detail-content img {
    max-width: 100%;
    height: auto;
    border-radius: 16px;
    margin: 40px auto;
    display: block;
    box-shadow: 0 15px 30px var(--shadow);
    border: 1px solid var(--border-color);
}

/* Figure support for captioning images */
.blog-detail-content figure {
    margin: 45px 0;
    text-align: center;
}

.blog-detail-content figure img {
    margin: 0 auto 12px;
}

.blog-detail-content figcaption {
    font-size: 14px;
    color: var(--text-muted);
    font-style: italic;
}

/* Bullet list and Ordered list */
.blog-detail-content ul, .blog-detail-content ol {
    margin: 25px 0 25px 25px;
    padding-left: 0;
}

.blog-detail-content li {
    margin-bottom: 12px;
    line-height: 1.7;
    color: var(--text-secondary);
}

.blog-detail-content ul li {
    list-style-type: none;
    position: relative;
    padding-left: 20px;
}

.blog-detail-content ul li::before {
    content: "•";
    color: var(--text-primary);
    font-weight: bold;
    display: inline-block;
    width: 1em;
    margin-left: -1em;
    position: absolute;
    left: 5px;
}

/* Inline and block code formatting */
.blog-detail-content pre {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 24px;
    border-radius: 16px;
    overflow-x: auto;
    margin: 35px 0;
    font-family: 'Fira Code', 'Courier New', Courier, monospace;
    font-size: 14px;
    line-height: 1.6;
    border: 1px solid rgba(255,255,255,0.1);
}

.blog-detail-content code {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    padding: 3px 8px;
    border-radius: 6px;
    font-family: 'Fira Code', 'Courier New', Courier, monospace;
    font-size: 85%;
}

.blog-detail-content pre code {
    background-color: transparent;
    padding: 0;
    font-size: inherit;
    color: inherit;
}

.blog-detail-not-found {
    text-align: center;
    padding: 100px 20px;
    max-width: 500px;
    margin: 0 auto;
}

.blog-detail-not-found i {
    font-size: 64px;
    color: var(--text-muted);
    margin-bottom: 30px;
}

.blog-detail-not-found h1 {
    font-size: 32px;
    font-weight: 600;
    margin-bottom: 15px;
}

.blog-detail-not-found p {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

/* Responsiveness */
@media (max-width: 768px) {
    .blog-hero h1 {
        font-size: 36px;
    }
    .blog-hero p {
        font-size: 16px;
    }
    .blog-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    .blog-detail-title {
        font-size: 32px;
    }
    .blog-detail-lead {
        font-size: 18px;
    }
    .blog-detail-content {
        font-size: 16px;
        line-height: 1.7;
    }
    .blog-detail-author-box {
        flex-direction: column;
        text-align: center;
    }
}

/* Custom Blog Meta Improvements */
.blog-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.blog-category-tag {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    background-color: var(--text-primary);
    color: var(--bg-primary);
    padding: 4px 10px;
    border-radius: 12px;
    display: inline-block;
}

.blog-read-time {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.blog-author-meta {
    margin-bottom: 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Detail page enhancements */
.blog-detail-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
}

.blog-detail-author {
    font-weight: 600;
    color: var(--text-primary);
}

/* Written By Section Label */
.author-section-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-muted);
    margin-top: 60px;
    margin-bottom: 20px;
    position: relative;
    display: inline-block;
}

.author-section-title::after {
    content: '';
    display: block;
    width: 30px;
    height: 2px;
    background-color: var(--text-primary);
    margin-top: 8px;
}

.blog-detail-author-box {
    padding: 35px;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    background: var(--bg-card);
    display: flex;
    align-items: flex-start;
    gap: 28px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.02);
    transition: border-color 0.3s ease;
}

.blog-detail-author-box:hover {
    border-color: var(--text-muted);
}

.blog-detail-author-avatar img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
    box-shadow: 0 5px 15px var(--shadow);
}

.blog-detail-author-info {
    flex: 1;
}

.blog-detail-author-info h4 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px 0;
    letter-spacing: -0.3px;
}

.blog-detail-author-info .author-role {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.blog-detail-author-info .author-bio {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0;
}

/* Reading Progress Bar */
.reading-progress-container {
    position: fixed;
    top: 95px; /* Directly below the main navbar */
    left: 0;
    width: 100%;
    height: 4px;
    background: transparent;
    z-index: 999;
}

.reading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #666 0%, var(--text-primary) 100%);
    width: 0%;
    transition: width 0.1s ease-out;
}

/* Share widget styles */
.blog-share-widget {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 50px 0;
    padding: 20px 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.blog-share-widget span {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.share-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bg-primary);
    background-color: var(--text-primary);
    border: 1px solid var(--text-primary);
    font-size: 16px;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.share-btn:hover {
    transform: scale(1.1);
    background-color: transparent;
    color: var(--text-primary);
}

/* Related articles section */
.related-posts-section {
    padding: 80px 0;
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    margin-top: 80px;
}

.related-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 40px;
    letter-spacing: -0.5px;
    text-align: center;
}


