/* ===== Blog Section ===== */
.blog-page {
    padding-top: 80px;
}

.blog-main {
    min-height: calc(100vh - 160px);
    padding: 60px 0 100px;
}

/* ===== Blog Header ===== */
.blog-header {
    margin-bottom: 48px;
}

.blog-header h1 {
    font-size: clamp(2rem, 4vw, 3rem);
    margin-bottom: 8px;
}

.blog-header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* ===== Blog List ===== */
.blog-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-width: 800px;
}

.blog-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    transition: all var(--transition);
}

.blog-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 24px var(--primary-glow);
}

.blog-card h2 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.blog-card h2 a {
    transition: color var(--transition);
}

.blog-card h2 a:hover {
    color: var(--primary);
}

.blog-card > p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 16px;
}

.blog-card-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.blog-card-meta time {
    font-weight: 500;
}

.blog-author {
    position: relative;
    padding-left: 16px;
}

.blog-author::before {
    content: '·';
    position: absolute;
    left: 0;
    color: var(--border);
    font-weight: 700;
}

.blog-read-more {
    display: inline-block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary);
    transition: gap var(--transition);
}

.blog-read-more:hover {
    text-decoration: underline;
}

/* ===== Tags ===== */
.blog-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.blog-tag {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    padding: 4px 12px;
    border-radius: 50px;
    background: rgba(91, 61, 228, 0.08);
    color: var(--primary);
    letter-spacing: 0.02em;
}

/* ===== Single Article ===== */
.blog-article {
    max-width: 720px;
}

.blog-back {
    display: inline-block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 24px;
    transition: color var(--transition);
}

.blog-back:hover {
    color: var(--primary);
}

.blog-article-header {
    margin-bottom: 40px;
    padding-bottom: 32px;
    border-bottom: 1px solid var(--border);
}

.blog-article-header h1 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    margin-bottom: 16px;
}

.blog-article-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

/* ===== Article Body ===== */
.blog-article-body {
    font-size: 1.05rem;
    line-height: 1.8;
}

.blog-article-body h2 {
    font-size: 1.5rem;
    margin-top: 40px;
    margin-bottom: 16px;
}

.blog-article-body h3 {
    font-size: 1.2rem;
    margin-top: 32px;
    margin-bottom: 12px;
}

.blog-article-body p {
    margin-bottom: 20px;
    color: var(--text);
}

.blog-article-body ul,
.blog-article-body ol {
    margin-bottom: 20px;
    padding-left: 24px;
    list-style: disc;
}

.blog-article-body ol {
    list-style: decimal;
}

.blog-article-body li {
    margin-bottom: 8px;
    line-height: 1.7;
}

.blog-article-body strong {
    font-weight: 600;
}

.blog-article-body a {
    color: var(--primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.blog-article-body a:hover {
    text-decoration-thickness: 2px;
}

.blog-article-body code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    padding: 2px 8px;
    border-radius: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
}

.blog-article-body pre {
    margin-bottom: 24px;
    padding: 20px 24px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    overflow-x: auto;
}

.blog-article-body pre code {
    padding: 0;
    border: none;
    background: none;
    font-size: 0.85rem;
    line-height: 1.7;
    color: var(--text-muted);
}

/* ===== Tables =====
   Data-heavy posts (benchmarks, changelogs) lean on tables, so they get the
   same card treatment as code blocks: one outer border, no cell grid. A table
   never exceeds the text column; one too wide to fit scrolls inside its own
   wrapper rather than widening the article. */
.blog-table {
    margin: 0 0 28px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    overflow-x: auto;
    overscroll-behavior-x: contain;
}

.blog-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    line-height: 1.6;
    font-variant-numeric: tabular-nums;
}

.blog-table th {
    text-align: left;
    padding: 12px 16px;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.blog-table td {
    padding: 11px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: top;
}

.blog-table tbody tr:last-child td {
    border-bottom: none;
}

.blog-table tbody tr:hover td {
    background: var(--bg-alt);
}

/* Key/value tables (no header row): make the first column the label. */
.blog-table table:not(:has(thead)) td:first-child {
    color: var(--text-muted);
    white-space: nowrap;
}

.blog-table td code {
    font-size: 0.85em;
    padding: 1px 6px;
}

.blog-table td strong {
    color: var(--text);
}


/* ===== Responsive ===== */
@media (max-width: 640px) {
    .blog-main {
        padding: 40px 0 72px;
    }

    .blog-card {
        padding: 24px;
    }

    .blog-card h2 {
        font-size: 1.25rem;
    }

    .blog-table table {
        font-size: 0.82rem;
    }

    .blog-table th,
    .blog-table td {
        padding: 9px 12px;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(12px);
        flex-direction: column;
        padding: 24px;
        gap: 16px;
        border-bottom: 1px solid var(--border);
    }

    .nav-links.active {
        display: flex;
    }

    .nav-toggle {
        display: flex;
    }
}

/* ===== Article Figures & Lightbox ===== */
.blog-figure {
    margin: 32px 0;
}

.blog-figure a.lightbox-trigger {
    display: block;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: zoom-in;
    background: var(--surface);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.blog-figure a.lightbox-trigger:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

.blog-figure img {
    display: block;
    width: 100%;
    height: auto;
}

.blog-figure figcaption {
    margin-top: 12px;
    font-size: 0.9rem;
    color: var(--text-muted);
    text-align: center;
    font-style: italic;
}

.lightbox-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4vh 4vw;
    background: rgba(10, 10, 20, 0.92);
    backdrop-filter: blur(6px);
    opacity: 0;
    cursor: zoom-out;
    transition: opacity var(--transition);
}

.lightbox-overlay.open {
    opacity: 1;
}

.lightbox-overlay img {
    max-width: 100%;
    max-height: 92vh;
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transform: scale(0.96);
    transition: transform var(--transition);
}

.lightbox-overlay.open img {
    transform: scale(1);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 24px;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    transition: background var(--transition);
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

body.lightbox-active {
    overflow: hidden;
}
