/* ==========================================================================
   article.css — shared styles for all blog/articles/*.html pages (zh-Hans)
   ========================================================================== */

/* ==========================================================================
   1. Design tokens
   ========================================================================== */
:root {
    --brand:           #FF7E5F;
    --brand-alt:       #FEB47B;
    --brand-gradient:  linear-gradient(135deg, #FF7E5F 0%, #FEB47B 100%);
    --accent:          #5E5CE6;
    --text-main:       #1A1A1B;
    --text-muted:      #6E6E73;
    --text-light:      #8E8E93;
    --bg-main:         #FBFBFD;
    --bg-card:         #FFFFFF;
    --bg-alt:          #F5F5F7;
    --border-line:     #EDEDF0;
    --shadow-soft:     0 4px 20px rgba(0, 0, 0, 0.04);
    --shadow-card:     0 8px 32px rgba(0, 0, 0, 0.07);
    --font-sans:       "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Noto Sans SC", sans-serif;
    --r-sm:  12px;
    --r-md:  18px;
    --r-lg:  28px;
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   2. Reset & base
   ========================================================================== */
*, *::before, *::after {
    margin: 0; padding: 0; box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-main);
    color: var(--text-main);
    overflow-x: hidden;
    line-height: 1.55;
}

/* Ambient diffuse background */
.ambient-bg {
    position: fixed; inset: 0; z-index: -1; pointer-events: none;
    background:
        radial-gradient(circle at 4% 12%,  rgba(255,126,95,0.10) 0%, transparent 36%),
        radial-gradient(circle at 96% 82%,  rgba(94,92,230,0.08) 0%, transparent 36%),
        radial-gradient(circle at 55% 42%,  rgba(254,180,123,0.06) 0%, transparent 28%),
        var(--bg-main);
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 40px; }

/* ==========================================================================
   3. Nav bar — header.js injects <header class="nav-bar">
      Use "header" selector only; #site-header does NOT exist after injection.
   ========================================================================== */
header {
    height: 72px;
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 1000;
    background: rgba(251, 251, 253, 0.88);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 0 40px;
}

.logo-wrap {
    display: flex; align-items: center; gap: 10px;
    font-weight: 800; font-size: 19px; letter-spacing: -0.03em;
    color: var(--text-main); text-decoration: none;
}
.logo-icon {
    width: 32px; height: 32px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
.logo-icon img { width: 32px; height: 32px; object-fit: contain; display: block; }
.nav-links { display: flex; gap: 28px; align-items: center; }
.nav-links a {
    text-decoration: none; color: var(--text-muted);
    font-size: 14px; font-weight: 500; transition: color .2s;
}
.nav-links a:hover, .nav-links a.active { color: var(--brand); }
.nav-right { display: flex; align-items: center; gap: 12px; }
.cta-btn {
    padding: 9px 22px; background: var(--brand-gradient);
    color: #fff; border-radius: 100px;
    font-size: 13px; font-weight: 700; text-decoration: none;
    transition: opacity .2s, transform .15s;
}
.cta-btn:hover { opacity: .9; transform: translateY(-1px); }

/* ==========================================================================
   4. Article layout
   ========================================================================== */
.article-wrap {
    max-width: 760px;
    margin: 0 auto;
    padding: 48px 24px 100px;
}

/* ==========================================================================
   5. Breadcrumb
   ========================================================================== */
.breadcrumb {
    display: flex; align-items: center; flex-wrap: wrap; gap: 2px;
    font-size: 13px; color: var(--text-light);
    margin-bottom: 36px; list-style: none;
}
.breadcrumb a {
    color: var(--text-light); text-decoration: none; transition: color .2s;
}
.breadcrumb a:hover { color: var(--brand); }
.breadcrumb .sep { margin: 0 6px; }

/* ==========================================================================
   6. Article header
   ========================================================================== */
.article-cat {
    display: inline-block;
    font-size: 11px; font-weight: 700; letter-spacing: .12em;
    text-transform: uppercase; color: var(--brand);
    background: rgba(255, 126, 95, .08); padding: 4px 10px;
    border-radius: 100px; margin-bottom: 16px;
}
.article-title {
    font-size: 38px; font-weight: 800;
    letter-spacing: -.04em; line-height: 1.15;
    margin-bottom: 16px; color: var(--text-main);
}
.article-meta {
    font-size: 14px; color: var(--text-light);
    margin-bottom: 48px;
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}

/* ==========================================================================
   7. Article body typography
   ========================================================================== */
.article-body {
    font-size: 17px; line-height: 1.8; color: var(--text-main);
}
.article-body p { margin-bottom: 24px; }
.article-body h2 {
    font-size: 24px; font-weight: 700; letter-spacing: -.025em;
    margin: 44px 0 16px; color: var(--text-main);
}
.article-body h3 {
    font-size: 19px; font-weight: 700;
    margin: 32px 0 12px; color: var(--text-main);
}
.article-body ul, .article-body ol {
    padding-left: 24px; margin-bottom: 24px;
}
.article-body li { margin-bottom: 8px; }
.article-body strong { font-weight: 700; }
.article-body blockquote {
    border-left: 3px solid var(--brand);
    padding: 16px 20px; margin: 24px 0;
    background: rgba(255, 126, 95, .05);
    border-radius: 0 var(--r-sm) var(--r-sm) 0;
    font-style: italic; color: var(--text-muted);
}

/* ==========================================================================
   8. End-of-article CTA block
   ========================================================================== */
.article-cta {
    margin-top: 56px;
    padding: 28px 32px;
    background: linear-gradient(135deg, #FFF3F0 0%, #FFF8F3 100%);
    border: 1px solid #FFE0D6;
    border-radius: var(--r-lg);
    display: flex;
    align-items: center;
    gap: 20px;
}
.article-cta-icon {
    width: 52px; height: 52px; flex-shrink: 0;
    background: var(--brand-gradient); border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
    box-shadow: 0 6px 20px rgba(255, 126, 95, 0.35);
}
.article-cta-body {
    flex: 1; min-width: 0;
}
.article-cta-body h3 {
    font-size: 16px; font-weight: 700;
    margin: 0 0 4px; line-height: 1.3; color: var(--text-main);
}
.article-cta-body p {
    font-size: 13px; color: var(--text-muted);
    line-height: 1.55; margin: 0;
}
.btn-primary {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 12px 24px; background: var(--brand-gradient);
    color: #fff; border-radius: 100px;
    font-weight: 700; font-size: 14px; text-decoration: none;
    transition: opacity .2s, transform .15s;
}
.btn-primary:hover { opacity: .9; transform: translateY(-1px); }

/* ==========================================================================
   9. Divider
   ========================================================================== */
.article-divider {
    border: none; border-top: 1px solid var(--border-line); margin: 56px 0;
}

/* ==========================================================================
   10. Prev / Next navigation
   ========================================================================== */
.article-nav {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 16px; margin-bottom: 56px;
}
.article-nav-item {
    padding: 20px; background: var(--bg-card);
    border: 1px solid var(--border-line); border-radius: var(--r-md);
    text-decoration: none; color: inherit;
    transition: border-color .2s, box-shadow .2s;
    display: flex; flex-direction: column; gap: 6px;
}
.article-nav-item:hover {
    border-color: var(--brand); box-shadow: var(--shadow-soft);
}
.article-nav-item.is-prev { align-items: flex-start; }
.article-nav-item.is-next { align-items: flex-end; text-align: right; }
.article-nav-dir {
    font-size: 11px; font-weight: 700; letter-spacing: .06em;
    text-transform: uppercase; color: var(--text-light);
}
.article-nav-cat {
    font-size: 11px; font-weight: 600; color: var(--brand);
    background: rgba(255, 126, 95, .08); padding: 2px 8px; border-radius: 100px;
}
.article-nav-title {
    font-size: 14px; font-weight: 600; line-height: 1.4; color: var(--text-main);
}
.article-nav-empty {
    padding: 20px; background: var(--bg-alt);
    border: 1px dashed var(--border-line); border-radius: var(--r-md);
    display: flex; align-items: center; justify-content: center;
}
.article-nav-empty a {
    font-size: 13px; color: var(--text-muted); text-decoration: none;
}
.article-nav-empty a:hover { color: var(--brand); }

/* ==========================================================================
   11. Related articles
   ========================================================================== */
.related-section { margin-bottom: 56px; }
.related-section > h2 {
    font-size: 22px; font-weight: 700; letter-spacing: -.025em;
    margin-bottom: 20px;
}
.related-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
}
.related-card {
    padding: 20px; background: var(--bg-card);
    border: 1px solid var(--border-line); border-radius: var(--r-md);
    text-decoration: none; color: inherit;
    transition: border-color .2s, transform .2s, box-shadow .2s;
    display: flex; flex-direction: column; gap: 8px;
}
.related-card:hover {
    border-color: var(--brand);
    transform: translateY(-2px);
    box-shadow: var(--shadow-card);
}
.related-card-cat {
    font-size: 11px; font-weight: 700; letter-spacing: .06em;
    text-transform: uppercase; color: var(--brand);
}
.related-card-title {
    font-size: 14px; font-weight: 600; line-height: 1.4; color: var(--text-main);
}
.related-card-date {
    font-size: 12px; color: var(--text-light); margin-top: auto;
}

/* ==========================================================================
   12. Floating CTA widget
   ========================================================================== */
.float-cta {
    position: fixed; bottom: 28px; right: 28px; z-index: 500;
    background: #fff; border: 1px solid var(--border-line);
    border-radius: var(--r-lg);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.14);
    padding: 22px 24px; width: 280px;
    transform: translateY(20px); opacity: 0;
    transition: transform .4s var(--ease-out), opacity .4s;
    pointer-events: none;
}
.float-cta.is-visible {
    transform: translateY(0); opacity: 1; pointer-events: auto;
}
.float-cta-close {
    position: absolute; top: 12px; right: 12px;
    width: 24px; height: 24px; border-radius: 50%;
    background: var(--bg-alt); border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; color: var(--text-muted); transition: background .2s;
}
.float-cta-close:hover { background: var(--border-line); }
.float-cta-badge {
    font-size: 11px; font-weight: 700; letter-spacing: .08em;
    text-transform: uppercase; color: var(--brand); margin-bottom: 8px;
}
.float-cta h4 {
    font-size: 15px; font-weight: 700; margin-bottom: 6px; line-height: 1.35;
}
.float-cta p {
    font-size: 13px; color: var(--text-muted); margin-bottom: 14px; line-height: 1.5;
}
.float-cta .btn-primary {
    width: 100%; justify-content: center;
    font-size: 13px; padding: 10px 20px;
}

/* ==========================================================================
   13. Table of Contents (TOC) — optional; place .toc inside .article-body
       before the first <h2>; JS can add .is-active on scroll
   ========================================================================== */
.toc {
    background: var(--bg-alt);
    border: 1px solid var(--border-line);
    border-radius: var(--r-md);
    padding: 20px 24px;
    margin: 0 0 40px;
}
.toc-title {
    font-size: 12px; font-weight: 700; letter-spacing: .08em;
    text-transform: uppercase; color: var(--text-light);
    margin-bottom: 12px;
}
.toc-list {
    list-style: none; padding: 0; margin: 0;
    display: flex; flex-direction: column; gap: 6px;
}
.toc-link {
    font-size: 14px; font-weight: 500; color: var(--text-muted);
    text-decoration: none; transition: color .2s;
    display: flex; align-items: center; gap: 10px;
}
.toc-link::before {
    content: ''; width: 4px; height: 4px; flex-shrink: 0;
    border-radius: 50%; background: currentColor; opacity: .45;
    transition: opacity .2s, background .2s;
}
.toc-link:hover { color: var(--brand); }
.toc-link.is-active { color: var(--brand); font-weight: 600; }
.toc-link.is-active::before { opacity: 1; }
.toc-item-sub .toc-link { padding-left: 14px; font-size: 13px; }

/* ==========================================================================
   14. Footer (injected by footer.js — styles applied via element selector)
   ========================================================================== */
footer {
    border-top: 1px solid var(--border-line);
    padding: 52px 40px;
    display: flex; justify-content: space-between; align-items: center;
    color: var(--text-muted); font-size: 13px;
}
.footer-links { display: flex; gap: 24px; }
.footer-links a { color: inherit; text-decoration: none; transition: color .2s; }
.footer-links a:hover { color: var(--brand); }

/* ==========================================================================
   15. Responsive
   ========================================================================== */
@media (max-width: 768px) {
    .article-wrap { padding: 32px 16px 80px; }
    .article-title { font-size: 28px; }
    .article-body { font-size: 16px; }
    .article-nav { grid-template-columns: 1fr; }
    .related-grid { grid-template-columns: 1fr; }
    .article-cta { flex-wrap: wrap; padding: 24px; }
    .article-cta .btn-primary { width: 100%; justify-content: center; }
    .float-cta { width: calc(100vw - 32px); right: 16px; bottom: 16px; }
    header { padding: 0 20px; }
    footer { flex-direction: column; gap: 20px; text-align: center; padding: 40px 20px; }
    .footer-links { flex-wrap: wrap; justify-content: center; gap: 16px; }
}

@media (max-width: 480px) {
    .article-title { font-size: 24px; }
    .article-body h2 { font-size: 20px; }
}
