/* ===== CSS Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --accent: #0ea5e9;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --border: #e2e8f0;
    --code-bg: #1e293b;
    --code-text: #e2e8f0;
    --success: #16a34a;
    --warning: #f59e0b;
    --danger: #dc2626;
    --radius: 12px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);
    --max-width: 960px;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== Header ===== */
.site-header {
    background: linear-gradient(135deg, #1e293b 0%, #334155 50%, #1e3a5f 100%);
    color: #fff;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-lg);
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.logo {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.5px;
}

.logo .logo-icon {
    width: 32px;
    height: 32px;
    background: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.nav-links {
    display: flex;
    gap: 28px;
    list-style: none;
}

.nav-links a {
    color: #cbd5e1;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: #fff;
}

/* ===== Hero Section (Homepage) ===== */
.hero {
    background: linear-gradient(135deg, #1e293b 0%, #1e3a5f 100%);
    color: #fff;
    padding: 64px 24px 72px;
    text-align: center;
}

.hero h1 {
    font-size: 36px;
    font-weight: 800;
    margin-bottom: 16px;
    letter-spacing: -1px;
}

.hero p {
    font-size: 18px;
    color: #94a3b8;
    max-width: 560px;
    margin: 0 auto;
}

.hero-tags {
    margin-top: 24px;
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.hero-tags span {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    color: #e2e8f0;
}

/* ===== Main Container ===== */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
}

/* ===== Article Cards Grid ===== */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 24px;
    margin: 48px 0;
}

.article-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--border);
}

.article-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.card-banner {
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.card-banner svg {
    width: 100%;
    height: 100%;
}

.card-body {
    padding: 20px 24px 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-category {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.card-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text);
    line-height: 1.4;
}

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

.card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-light);
}

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

.card-arrow {
    color: var(--primary);
    font-weight: 600;
    font-size: 14px;
    transition: transform 0.2s;
}

.article-card:hover .card-arrow {
    transform: translateX(4px);
}

/* ===== Section Title ===== */
.section-title {
    text-align: center;
    margin: 56px 0 8px;
}

.section-title h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

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

/* ===== Article Detail Page ===== */
.article-header {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 40px 24px 32px;
}

.article-header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
}

.breadcrumb {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 16px;
}

.breadcrumb a {
    color: var(--primary);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.article-category {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-light);
    padding: 4px 12px;
    border-radius: 4px;
    margin-bottom: 12px;
}

.article-title {
    font-size: 32px;
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: 12px;
    color: var(--text);
}

.article-meta {
    font-size: 14px;
    color: var(--text-light);
    display: flex;
    gap: 20px;
}

.article-body {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 40px 24px 64px;
}

.article-body h2 {
    font-size: 24px;
    font-weight: 700;
    margin: 40px 0 16px;
    color: var(--text);
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border);
}

.article-body h2:first-child {
    margin-top: 0;
}

.article-body h3 {
    font-size: 19px;
    font-weight: 600;
    margin: 28px 0 12px;
    color: var(--text);
}

.article-body p {
    margin-bottom: 16px;
    color: var(--text);
    line-height: 1.8;
}

.article-body ul, .article-body ol {
    margin: 12px 0 20px 20px;
}

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

/* ===== Code Block ===== */
.article-body pre {
    background: var(--code-bg);
    color: var(--code-text);
    padding: 20px 24px;
    border-radius: 10px;
    overflow-x: auto;
    margin: 16px 0 24px;
    font-size: 14px;
    line-height: 1.6;
    font-family: "Fira Code", "JetBrains Mono", "Consolas", "Courier New", monospace;
}

.article-body code {
    font-family: "Fira Code", "JetBrains Mono", "Consolas", "Courier New", monospace;
    font-size: 0.9em;
}

.article-body p code, .article-body li code {
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: 2px 6px;
    border-radius: 4px;
}

/* ===== Info Box ===== */
.info-box {
    background: var(--primary-light);
    border-left: 4px solid var(--primary);
    padding: 16px 20px;
    border-radius: 0 8px 8px 0;
    margin: 20px 0;
}

.info-box.warning {
    background: #fef3c7;
    border-left-color: var(--warning);
}

.info-box.success {
    background: #dcfce7;
    border-left-color: var(--success);
}

.info-box p {
    margin: 0;
    font-size: 14px;
}

.info-box strong {
    display: block;
    margin-bottom: 4px;
}

/* ===== SVG Figure Container ===== */
.figure {
    margin: 28px 0;
    text-align: center;
}

.figure svg {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.figure figcaption {
    font-size: 13px;
    color: var(--text-light);
    margin-top: 10px;
    font-style: italic;
}

/* ===== Table ===== */
.article-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 14px;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.article-body th {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    padding: 12px 16px;
    text-align: left;
}

.article-body td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
}

.article-body tr:last-child td {
    border-bottom: none;
}

.article-body tr:nth-child(even) {
    background: #f8fafc;
}

/* ===== Article Nav (prev/next) ===== */
.article-nav {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px 64px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.article-nav a {
    flex: 1;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.article-nav a:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.article-nav a.next {
    text-align: right;
}

.article-nav .nav-label {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 4px;
}

.article-nav .nav-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--primary);
}

/* ===== Footer ===== */
.site-footer {
    background: #1e293b;
    color: #94a3b8;
    padding: 40px 24px 24px;
    text-align: center;
}

.footer-inner {
    max-width: var(--max-width);
    margin: 0 auto;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.footer-links a {
    color: #cbd5e1;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: #fff;
}

.footer-divider {
    width: 60px;
    height: 1px;
    background: #334155;
    margin: 0 auto 20px;
}

.footer-info {
    font-size: 13px;
    color: #64748b;
    line-height: 1.8;
}

.footer-info a {
    color: #94a3b8;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-info a:hover {
    color: #fff;
    text-decoration: underline;
}

.footer-copyright {
    margin-top: 8px;
    font-size: 12px;
    color: #475569;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .header-inner {
        padding: 0 16px;
    }

    .nav-links {
        display: none;
    }

    .hero {
        padding: 48px 20px 56px;
    }

    .hero h1 {
        font-size: 28px;
    }

    .hero p {
        font-size: 16px;
    }

    .articles-grid {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 0 16px;
    }

    .article-title {
        font-size: 24px;
    }

    .article-body {
        padding: 32px 16px 48px;
    }

    .article-body pre {
        padding: 16px;
        font-size: 13px;
    }

    .article-nav {
        flex-direction: column;
        padding: 0 16px 48px;
    }

    .article-nav a.next {
        text-align: left;
    }
}
