/* ===== Blog Shared Styles ===== */
/* Extracted from build-blog.mjs CSS generator functions.
   Loaded as a static stylesheet on all blog pages. */

/* ===== Blog Nav Sidebar (shared across listing, category, tag, post pages) ===== */
.blog-layout {
    display: flex;
    flex-direction: row-reverse;
    max-width: 1200px;
    margin: 0 auto;
}
.blog-layout-main {
    flex: 1;
    min-width: 0;
}
.blog-layout-no-sidebar {
    max-width: 900px;
}
.blog-layout-no-sidebar .blog-layout-main {
    width: 100%;
}
.blog-nav-sidebar {
    width: 280px;
    min-width: 280px;
    border-right: 1px solid var(--border-warm);
    background: var(--bg-white);
    position: sticky;
    top: var(--header-height, 73px);
    height: calc(100vh - var(--header-height, 73px));
    overflow-y: auto;
    padding: var(--space-md);
}
.sidebar-heading {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: 0.875rem;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
    font-weight: 600;
}
.sidebar-cat-list, .sidebar-recent-list {
    list-style: none;
    padding: 0;
    margin: 0 0 var(--space-md) 0;
}
.sidebar-cat-list li, .sidebar-recent-list li {
    margin-bottom: 0;
}
.sidebar-recent-list li {
    padding: var(--space-xs) 0;
    border-bottom: 1px solid var(--border-warm);
}
.sidebar-recent-list li:last-child {
    border-bottom: none;
}
.sidebar-cat-list a, .sidebar-recent-list a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.15s ease;
}
.sidebar-cat-list a:hover, .sidebar-recent-list a:hover {
    color: var(--accent-terracotta);
}
.sidebar-cat-count {
    color: var(--text-muted);
    font-size: 0.75rem;
}
.sidebar-tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    margin-bottom: var(--space-md);
}
.sidebar-rss-link {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.8125rem;
    margin-top: var(--space-sm);
}
.sidebar-rss-link:hover {
    color: var(--accent-terracotta);
}
.sidebar-back-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2xs);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.8125rem;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border-warm);
    width: 100%;
}
.sidebar-back-link:hover {
    color: var(--accent-terracotta);
}

@media (max-width: 1023px) {
    .blog-nav-sidebar { display: none; }
    .blog-layout { flex-direction: column; }
}

/* ===== Blog Listing ===== */
.blog-header {
    text-align: center;
    padding: var(--space-xl) 0 var(--space-lg);
}
.blog-header h1 {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: clamp(2rem, 4vw, 2.75rem);
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}
.blog-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}
.blog-header-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm-xs);
}
.rss-link {
    color: var(--text-muted);
    transition: color 0.15s ease;
}
.rss-link:hover { color: var(--accent-terracotta); }
.rss-link svg { width: 20px; height: 20px; }

/* Category filter pills */
.category-filters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    justify-content: center;
    margin-bottom: var(--space-lg);
}
.category-pill {
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-warm);
    background: var(--bg-tint);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: 'DM Sans', sans-serif;
}
.category-pill:hover {
    border-color: var(--text-muted);
    color: var(--text-primary);
}
.category-pill.active {
    background: var(--text-primary);
    color: var(--bg-white);
    border-color: var(--text-primary);
}

/* Featured hero card */
.featured-post {
    background: var(--bg-white);
    border: 1px solid var(--border-warm);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
    box-shadow: var(--shadow-card);
    transition: box-shadow 0.2s ease;
}
.featured-post:hover {
    box-shadow: var(--shadow-card-hover);
}
.featured-post .post-category-pill {
    display: inline-block;
    padding: var(--space-3xs) var(--space-xs);
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-xs);
}
.featured-post h2 {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: clamp(1.4rem, 3vw, 1.8rem);
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
    line-height: 1.3;
}
.featured-post h2 a {
    color: inherit;
    text-decoration: none;
}
.featured-post h2 a:hover {
    color: var(--accent-terracotta);
}
.featured-post .post-meta {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: var(--space-sm);
}
.featured-post .post-excerpt {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: var(--space-sm);
}
.featured-post .post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

/* Tag badges */
.tag-badge {
    display: inline-block;
    padding: 2px var(--space-xs);
    border-radius: var(--radius-xs);
    background: var(--bg-tint);
    color: var(--text-muted);
    font-size: 0.75rem;
    text-decoration: none;
}
.tag-badge:hover {
    background: var(--accent-sage-light, #eef3ee);
    color: var(--accent-sage);
}

/* Card grid */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}
.blog-card {
    background: var(--bg-white);
    border: 1px solid var(--border-warm);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    box-shadow: var(--shadow-subtle);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.blog-card:hover {
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-2px);
}
.blog-card .post-category-pill {
    display: inline-block;
    padding: var(--space-3xs) var(--space-xs);
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-xs);
}
.blog-card h3 {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: 1.15rem;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
    line-height: 1.3;
}
.blog-card h3 a {
    color: inherit;
    text-decoration: none;
}
.blog-card h3 a:hover {
    color: var(--accent-terracotta);
}
.blog-card .post-meta {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: var(--space-xs);
}
.blog-card .post-excerpt {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: var(--space-xs);
}
.blog-card .post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

.empty-message {
    text-align: center;
    padding: var(--space-xl) 0;
    color: var(--text-muted);
    font-size: 1.1rem;
}

@media (max-width: 1023px) {
    .blog-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Blog Post Layout ===== */
.blog-post-layout {
    display: flex;
    max-width: 1200px;
    margin: 0 auto;
    min-height: calc(100vh - 140px);
}
.blog-post-main {
    flex: 1;
    min-width: 0;
    padding: var(--space-lg);
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: var(--space-md);
    flex-wrap: wrap;
}
.breadcrumb a {
    color: var(--text-muted);
    text-decoration: none;
}
.breadcrumb a:hover {
    color: var(--accent-terracotta);
}
.breadcrumb .separator {
    color: var(--border-warm);
}

/* Post header */
.post-category-pill {
    display: inline-block;
    padding: var(--space-3xs) var(--space-xs);
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-xs);
    text-decoration: none;
    transition: all 0.2s ease;
}
.blog-post-main h1 {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: clamp(1.5rem, 3vw, 2rem);
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
    line-height: 1.3;
}
.post-meta-line {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: var(--space-xs);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-sm-xs);
}
.post-reviewed {
    color: var(--accent-sage);
    font-size: 0.8125rem;
}
.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    margin-bottom: var(--space-md);
}

/* Post content */
.blog-post-content h2 {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: clamp(1.2rem, 2.5vw, 1.4rem);
    color: var(--text-primary);
    margin-top: var(--space-lg);
    margin-bottom: var(--space-sm);
    line-height: 1.3;
    scroll-margin-top: calc(var(--header-height, 73px) + var(--space-sm));
}
.blog-post-content h3 {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: clamp(1.05rem, 2vw, 1.15rem);
    color: var(--text-primary);
    margin-top: var(--space-md);
    margin-bottom: var(--space-xs);
}
.blog-post-content p {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: var(--space-sm);
}
.blog-post-content ul, .blog-post-content ol {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: var(--space-sm);
    padding-left: var(--space-md);
}
.blog-post-content a {
    color: var(--link-color);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.blog-post-content a:hover {
    color: var(--accent-terracotta);
}
.blog-post-content blockquote {
    border-left: 3px solid var(--accent-terracotta);
    padding-left: var(--space-sm);
    margin: var(--space-md) 0;
    color: var(--text-muted);
    font-style: italic;
}
.blog-post-content code {
    background: var(--bg-tint);
    padding: 2px 6px;
    border-radius: var(--radius-xs);
    font-size: 0.9em;
}

/* Sidebar TOC */
.toc-heading {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}
.toc-list {
    list-style: none;
    padding: 0;
    margin: 0 0 var(--space-md) 0;
}
.toc-list li {
    margin-bottom: var(--space-xs);
}
.toc-list li a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.8125rem;
    line-height: 1.4;
    display: block;
    padding: var(--space-xs) 0;
    border-left: 2px solid transparent;
    padding-left: 10px;
    transition: all 0.15s ease;
}
.toc-list li a:hover {
    color: var(--accent-terracotta);
    border-left-color: var(--accent-terracotta);
}
.toc-list li a.toc-active {
    color: var(--accent-terracotta);
    border-left-color: var(--accent-terracotta);
    font-weight: 600;
}

/* Reading progress bar */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: var(--accent-terracotta);
    z-index: 1000;
    transition: width 50ms linear;
}

/* Back to top */
.back-to-top {
    position: fixed;
    bottom: var(--space-2xl);
    right: var(--space-md);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-white);
    color: var(--text-muted);
    border: 1px solid var(--border-warm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease, background 0.15s ease, color 0.15s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    z-index: 999;
}
.back-to-top svg {
    width: 16px;
    height: 16px;
}
.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}
.back-to-top:hover {
    background: var(--accent-terracotta);
    color: var(--bg-cream);
    border-color: var(--accent-terracotta);
}

/* Stat panels */
.stat-panel {
    display: flex;
    align-items: baseline;
    gap: var(--space-sm-xs);
    padding: var(--space-sm) var(--space-md-sm);
    border-radius: var(--radius-sm);
    margin: var(--space-sm) 0;
}
.stat-number {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1;
}
.stat-label { font-size: 1rem; color: var(--text-secondary); }
.stat-highlight { background: var(--accent-terracotta-light, #fdf0ed); }
.stat-highlight .stat-number { color: var(--accent-terracotta); }
.stat-subtle { background: var(--bg-tint); border: 1px solid var(--border-warm); }
.stat-subtle .stat-number { color: var(--text-primary); }
.stat-accent { background: var(--accent-sage-light, #eef3ee); }
.stat-accent .stat-number { color: var(--accent-sage); }

/* Bar charts */
.chart-container { margin: var(--space-md) 0; }
.chart-title {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
}
.chart-row { display: flex; align-items: center; gap: var(--space-sm-xs); margin-bottom: var(--space-xs); }
.chart-label { min-width: 120px; font-size: 0.875rem; color: var(--text-secondary); text-align: right; }
.chart-bar-track { flex: 1; height: 24px; background: var(--bg-tint); border-radius: var(--radius-xs); overflow: hidden; }
.chart-bar { height: 100%; border-radius: var(--radius-xs); transition: width 0.3s ease; }
.chart-bar-terracotta { background: var(--accent-terracotta); }
.chart-bar-sage { background: var(--accent-sage); }
.chart-value { min-width: 60px; font-size: 0.875rem; font-weight: 600; color: var(--text-primary); }

/* Mobile TOC */
.mobile-toc {
    display: none;
    background: var(--bg-tint);
    border: 1px solid var(--border-warm);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-md);
    overflow: hidden;
}
.mobile-toc summary {
    padding: var(--space-sm);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    color: var(--text-primary);
}
.mobile-toc .toc-list {
    padding: 0 var(--space-sm) var(--space-sm);
}

@media (max-width: 1023px) {
    .blog-post-layout .blog-nav-sidebar {
        display: none;
    }
    .mobile-toc {
        display: block;
    }
    .blog-post-layout {
        flex-direction: column;
    }
    .blog-post-main {
        padding: var(--space-md);
    }
    .featured-post {
        padding: var(--space-md);
    }
    .blog-card {
        padding: var(--space-sm);
    }
    .stat-panel { flex-direction: column; gap: var(--space-2xs); padding: var(--space-sm-xs) var(--space-sm); }
    .stat-number { font-size: 1.5rem; }
    .chart-row { flex-direction: column; align-items: flex-start; gap: var(--space-2xs); }
    .chart-label { min-width: auto; text-align: left; }
    .chart-value { min-width: auto; }
}
