/* ═══════════════════════════════════════════════════════════════
   blog.css — Blog list & article page shared styles
   ═══════════════════════════════════════════════════════════════ */

/* ─── List page: layout ──────────────────────────────────────────── */

.blog-main {
    padding-top: 70px;
}

/* ─── Hero ──────────────────────────────────────────────────── */

.blog-hero {
    padding: 64px 0 48px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-surface);
}

.blog-hero h1 {
    font-family: var(--font-tech);
    font-size: clamp(28px, 4.5vw, 52px);
    font-weight: 800;
    letter-spacing: -1.5px;
    color: var(--text-primary);
    line-height: 1.15;
    margin: 12px 0 16px;
}

.blog-hero-sub {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 32px;
    max-width: 540px;
}

/* ─── Tag filter bar ─────────────────────────────────────────────── */

.blog-tags-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.blog-tag-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 15px;
    border-radius: 99px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-base);
    color: var(--text-secondary);
    font-size: 13px;
    font-family: var(--font-tech);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.blog-tag-btn:hover {
    border-color: var(--border-highlight);
    color: var(--text-primary);
    background: var(--bg-surface);
}

.blog-tag-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.blog-tag-count {
    font-size: 11px;
    opacity: 0.75;
}

/* ─── List page: body ──────────────────────────────────────────── */

.blog-body {
    padding: 52px 0 80px;
}

/* ─── Section headings ──────────────────────────────────────────────── */

.blog-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    font-family: var(--font-tech);
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.blog-article-count {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
    background: var(--bg-base);
    border: 1px solid var(--border-subtle);
    padding: 2px 9px;
    border-radius: 99px;
}

/* ─── Article list cards ──────────────────────────────────────────── */

.blog-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.blog-card {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    padding: 22px 26px;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.22s;
    box-shadow: var(--shadow-soft);
}

.blog-card:hover {
    transform: translateX(4px);
    border-color: rgba(37, 99, 235, 0.18);
    box-shadow: var(--shadow-hover);
}

.blog-card-body {
    flex: 1;
}

.blog-card-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.blog-card h3 {
    font-family: var(--font-tech);
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 8px;
    line-height: 1.35;
}

.blog-card p {
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.blog-card-footer {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border-subtle);
    font-size: 12.5px;
    color: var(--text-muted);
}

.blog-card-footer span {
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.blog-card-read {
    margin-left: auto;
    color: var(--accent-primary);
    font-weight: 500;
    font-size: 13px;
    opacity: 0;
    transition: opacity 0.2s;
}

.blog-card:hover .blog-card-read {
    opacity: 1;
}

/* ─── Inline tags ──────────────────────────────────────────────── */

.blog-inline-tag {
    font-size: 11.5px;
    font-weight: 500;
    padding: 3px 9px;
    border-radius: 99px;
    background: rgba(37, 99, 235, 0.07);
    color: var(--accent-primary);
    border: 1px solid rgba(37, 99, 235, 0.12);
    white-space: nowrap;
}

/* ─── Empty state ─────────────────────────────────────────────────── */

.blog-empty {
    text-align: center;
    padding: 60px 0;
    color: var(--text-muted);
}

.blog-empty i {
    font-size: 36px;
    display: block;
    margin-bottom: 14px;
    opacity: 0.4;
}

.blog-empty p {
    font-size: 15px;
    color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════════════════════
   Article page styles
   ═══════════════════════════════════════════════════════════════ */

.article-main {
    padding-top: 80px;
    padding-bottom: 80px;
}

.article-wrap {
    max-width: 780px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ─── Article hero ─────────────────────────────────────────────── */

.article-hero {
    padding: 48px 0 40px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 48px;
}

.article-back {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
    margin-bottom: 24px;
    transition: color 0.2s;
}

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

.article-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.article-hero h1 {
    font-family: var(--font-tech);
    font-size: clamp(24px, 3.5vw, 38px);
    font-weight: 800;
    letter-spacing: -1px;
    color: var(--text-primary);
    line-height: 1.2;
    margin: 0 0 20px;
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--text-muted);
}

.article-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ─── Article body ──────────────────────────────────────────────── */

.article-body {
    font-size: 15.5px;
    line-height: 1.9;
    color: var(--text-secondary);
}

.article-body h2 {
    font-family: var(--font-tech);
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 48px 0 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-subtle);
    scroll-margin-top: 90px;
}

.article-body h3 {
    font-family: var(--font-tech);
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 32px 0 12px;
    scroll-margin-top: 90px;
}

.article-body p {
    margin: 0 0 18px;
}

.article-body ul,
.article-body ol {
    padding-left: 22px;
    margin: 12px 0 18px;
}

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

.article-body strong {
    color: var(--text-primary);
    font-weight: 600;
}

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

.article-body code {
    font-family: 'JetBrains Mono', 'Fira Code', 'Menlo', monospace;
    font-size: 13px;
    background: var(--bg-base);
    color: #D97706;
    padding: 2px 7px;
    border-radius: 5px;
    border: 1px solid var(--border-subtle);
}

/* ─── Code blocks ─────────────────────────────────────────────────── */

.article-code-block {
    border-radius: 14px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border-subtle);
    margin: 20px 0;
    box-shadow: var(--shadow-soft);
}

.article-code-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 18px;
    background: var(--bg-base);
    border-bottom: 1px solid var(--border-subtle);
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--font-tech);
}

.article-copy-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-size: 11.5px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.article-copy-btn:hover {
    background: var(--bg-base);
    border-color: var(--border-highlight);
}

.article-code-block pre {
    margin: 0;
    padding: 20px;
    background: #F8FAFC;
    font-family: 'JetBrains Mono', 'Fira Code', 'Menlo', monospace;
    font-size: 13px;
    line-height: 1.8;
    color: #334155;
    overflow: visible;
    white-space: pre;
    min-width: max-content;
}

.article-code-block .ky  { color: #2563EB; font-weight: 500; }
.article-code-block .st  { color: #D97706; }
.article-code-block .cm  { color: #94A3B8; font-style: italic; }
.article-code-block .ac  { color: #10B981; font-weight: 500; }
.article-code-block .kw  { color: #7C3AED; font-weight: 500; }

/* ─── Callout ────────────────────────────────────────────────── */

.article-callout {
    display: flex;
    gap: 14px;
    padding: 16px 18px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.7;
    margin: 20px 0;
    border-left: 3px solid transparent;
}

.article-callout > i { flex-shrink: 0; margin-top: 2px; font-size: 14px; }
.article-callout div { color: var(--text-secondary); }
.article-callout strong { color: var(--text-primary); }

.article-callout-info    { background: rgba(37,99,235,0.05);   border-color: rgba(37,99,235,0.3);  }
.article-callout-info > i { color: var(--accent-primary); }
.article-callout-tip     { background: rgba(16,185,129,0.05);  border-color: rgba(16,185,129,0.3); }
.article-callout-tip > i  { color: var(--accent-secondary); }
.article-callout-warn    { background: rgba(234,179,8,0.06);   border-color: rgba(234,179,8,0.4);  }
.article-callout-warn > i { color: #D97706; }

/* ─── Tables ──────────────────────────────────────────────────── */

.article-body .article-table-wrap {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
    margin: 20px 0;
    box-shadow: var(--shadow-soft);
}

.article-body table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.article-body thead th {
    background: var(--bg-base);
    padding: 11px 16px;
    text-align: left;
    color: var(--text-secondary);
    font-weight: 600;
    font-family: var(--font-tech);
    font-size: 12px;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.article-body tbody td {
    padding: 10px 16px;
    border-top: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    background: var(--bg-surface);
}

.article-body tbody tr:hover td { background: var(--bg-base); }

/* ─── Related articles ───────────────────────────────────────────────── */

.related-header {
    margin-top: 56px;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-subtle);
}

.related-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-tech);
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.related-title > i { color: var(--accent-primary); font-size: 14px; }

.related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 48px;
}

.related-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 18px 18px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.22s;
    box-shadow: var(--shadow-soft);
}

.related-card:hover {
    border-color: rgba(37,99,235,0.22);
    box-shadow: var(--shadow-hover);
    transform: translateY(-3px);
}

.related-card-tags { display: flex; flex-wrap: wrap; gap: 5px; }

.related-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.45;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.related-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.related-card-arrow {
    color: var(--accent-primary);
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity 0.18s, transform 0.18s;
}

.related-card:hover .related-card-arrow {
    opacity: 1;
    transform: translateX(0);
}

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

/* ─── Article footer nav ──────────────────────────────────────────── */

.article-footer-nav {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 1px solid var(--border-subtle);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.article-nav-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.22s;
    box-shadow: var(--shadow-soft);
}

.article-nav-card:hover {
    border-color: rgba(37, 99, 235, 0.2);
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.article-nav-card.prev { flex-direction: row-reverse; text-align: right; }

.article-nav-card > i {
    font-size: 18px;
    color: var(--accent-primary);
    flex-shrink: 0;
}

.article-nav-card div strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 3px;
}

.article-nav-card div span {
    font-size: 12.5px;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ─── Breadcrumb nav ─────────────────────────────────────────────── */

.article-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 24px;
    padding-top: 20px;
}

.article-breadcrumb a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.18s;
}

.article-breadcrumb a:hover { color: var(--accent-primary); }

.article-breadcrumb .bc-sep {
    color: var(--border-highlight);
    font-size: 10px;
    margin: 0 1px;
}

.article-breadcrumb .bc-current {
    color: var(--text-secondary);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 280px;
}

/* ─── Bottom download CTA card ────────────────────────────────────────── */

.article-download-cta {
    margin: 52px 0 0;
    padding: 36px 40px;
    background: linear-gradient(135deg, rgba(37,99,235,0.06) 0%, rgba(16,185,129,0.05) 100%);
    border: 1px solid rgba(37,99,235,0.15);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
}

.article-download-cta-body { flex: 1; }

.article-download-cta-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent-primary);
    background: rgba(37,99,235,0.08);
    border: 1px solid rgba(37,99,235,0.18);
    border-radius: 20px;
    padding: 4px 12px;
    margin-bottom: 12px;
}

.article-download-cta h3 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 8px;
    font-family: var(--font-tech);
    line-height: 1.3;
}

.article-download-cta p {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.6;
}

.article-download-cta-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.article-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 13px 28px;
    background: var(--accent-primary);
    color: #fff;
    border-radius: 12px;
    font-size: 14.5px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.22s;
    box-shadow: 0 4px 14px rgba(37,99,235,0.28);
}

.article-cta-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37,99,235,0.36);
    color: #fff;
}

.article-cta-link {
    font-size: 12.5px;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.18s;
}

.article-cta-link:hover { color: var(--accent-primary); }

/* ─── Floating widget ─────────────────────────────────────────────── */

.article-float-widget {
    position: fixed;
    bottom: 32px;
    right: 32px;
    z-index: 990;
    width: 240px;
    background: var(--bg-surface);
    border: 1px solid rgba(37,99,235,0.18);
    border-radius: 18px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(37,99,235,0.1);
    padding: 20px 20px 18px;
    transform: translateY(120px);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
    pointer-events: none;
}

.article-float-widget.fw-visible {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.article-float-widget.fw-hidden {
    transform: translateY(120px) !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.fw-close {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 24px;
    height: 24px;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
    padding: 0;
}

.fw-close:hover { background: var(--bg-base); color: var(--text-primary); }

.fw-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
    margin-bottom: 12px;
}

.fw-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    font-family: var(--font-tech);
}

.fw-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 14px;
}

.fw-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: 100%;
    padding: 10px 0;
    background: var(--accent-primary);
    color: #fff;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    box-shadow: 0 3px 10px rgba(37,99,235,0.25);
}

.fw-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    color: #fff;
}

/* ─── Responsive ─────────────────────────────────────────────────── */

@media (max-width: 600px) {
    .blog-hero {
        padding: 48px 0 36px;
    }
    .blog-hero h1 {
        font-size: 36px;
    }
    .blog-card {
        padding: 18px 18px;
    }
    .blog-featured-card {
        padding: 20px 20px;
    }
    .article-footer-nav {
        grid-template-columns: 1fr;
    }
    .article-body {
        font-size: 14.5px;
    }
    .article-body h2 {
        font-size: 19px;
    }
    .article-download-cta {
        flex-direction: column;
        padding: 24px 22px;
        gap: 20px;
    }
    .article-download-cta-actions {
        width: 100%;
    }
    .article-cta-btn {
        width: 100%;
        justify-content: center;
    }
    .article-float-widget {
        width: calc(100vw - 32px);
        right: 16px;
        bottom: 16px;
    }
}

@media (max-width: 480px) {
    .blog-hero h1 { font-size: 22px; }
    .blog-search-input { font-size: 13.5px; }
    .blog-tags { gap: 6px; }
    .blog-tag { font-size: 12px; padding: 5px 10px; }

    /* Article page */
    .article-breadcrumb { font-size: 12px; flex-wrap: wrap; gap: 4px; }
    .article-hero-title { font-size: 22px; }
    .article-body { font-size: 14px; }
    .article-code-block pre { font-size: 12px; padding: 14px 16px; }
    .article-code-bar { padding: 7px 14px; font-size: 11.5px; }
    .article-body table { font-size: 12.5px; }

    /* Hide float widget on very small screens */
    .article-float-widget { display: none !important; }

    /* Compact bottom download CTA */
    .article-download-cta { padding: 20px 16px; }
    .article-download-cta h3 { font-size: 17px; }
    .article-download-cta p { font-size: 13px; }

    /* Related articles */
    .related-card { padding: 14px; }
    .related-card-title { font-size: 14px; }
}
@media (max-width: 768px) {
    .blog-main { padding-top: 0; }
    .blog-hero { padding-top: 92px; }
    .article-main { padding-top: 0; }
    .article-breadcrumb { margin-top: 72px; }

    .blog-tags-bar {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-left: -16px;
        margin-right: -16px;
        padding-left: 16px;
        padding-right: 16px;
        padding-bottom: 2px;
    }

    .blog-tag-btn {
        flex-shrink: 0;
        font-size: 12.5px;
        padding: 6px 12px;
    }
}
