/* ============================================================
   Theme CSS - 明快配色，响应式设计
   ============================================================ */

:root {
    --primary: #3B82F6;
    --primary-light: #DBEAFE;
    --primary-dark: #2563EB;
    --accent: #8B5CF6;
    --accent-light: #EDE9FE;
    --success: #10B981;
    --warning: #F59E0B;
    --gray-50: #F8FAFC;
    --gray-100: #F1F5F9;
    --gray-200: #E2E8F0;
    --gray-300: #CBD5E1;
    --gray-500: #64748B;
    --gray-700: #334155;
    --gray-900: #0F172A;
    --text: #1E293B;
    --text-secondary: #64748B;
    --bg: #F8FAFC;
    --surface: #FFFFFF;
    --border: #E2E8F0;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.08);
    --container: 1200px;
    --transition: 0.2s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

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

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }

img { max-width: 100%; height: auto; }
.container { max-width: var(--container); margin: 0 auto; padding: 0 24px; }

/* ===== Header ===== */
.site-header {
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    gap: 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    flex-shrink: 0;
}

.logo-icon { font-size: 24px; }

.site-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
}

.nav-link {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition);
}

.nav-link:hover,
.nav-link.active {
    background: var(--primary-light);
    color: var(--primary);
}

.header-actions { flex-shrink: 0; }

.search-form {
    display: flex;
    align-items: center;
    background: var(--gray-100);
    border-radius: 24px;
    padding: 4px 4px 4px 16px;
    transition: all var(--transition);
    border: 1px solid transparent;
}

.search-form:focus-within {
    background: var(--surface);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.search-input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    color: var(--text);
    width: 160px;
}

.search-btn {
    border: none;
    background: var(--primary);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition);
}

.search-btn:hover { background: var(--primary-dark); }

.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.mobile-menu-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: all var(--transition);
}

/* ===== Hero ===== */
.hero-section {
    text-align: center;
    padding: 60px 20px 40px;
}

.hero-section h1 {
    font-size: 36px;
    font-weight: 800;
    color: var(--gray-900);
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-desc {
    font-size: 17px;
    color: var(--text-secondary);
    margin-top: 12px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* ===== Articles Grid ===== */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    padding-bottom: 40px;
}

.article-card {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.article-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card-image {
    display: block;
    height: 200px;
    overflow: hidden;
    background: var(--gray-100);
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.article-card:hover .card-image img {
    transform: scale(1.05);
}

.card-body {
    padding: 20px;
}

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

.card-title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 10px;
}

.card-title a {
    color: var(--text);
    text-decoration: none;
}

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

.card-excerpt {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: var(--text-secondary);
}

.meta-sep { color: var(--gray-300); }

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}

.tag-link {
    font-size: 12px;
    color: var(--text-secondary);
    padding: 2px 8px;
    background: var(--gray-100);
    border-radius: 12px;
}

.tag-link:hover {
    background: var(--primary-light);
    color: var(--primary);
}

/* ===== Single Article ===== */
.single-article {
    padding: 40px 0;
}

.article-header {
    margin-bottom: 32px;
    text-align: center;
}

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

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

.article-meta {
    font-size: 14px;
    color: var(--text-secondary);
    display: flex;
    justify-content: center;
    gap: 6px;
}

.article-featured-image {
    margin-bottom: 32px;
    border-radius: var(--radius);
    overflow: hidden;
}

.article-content {
    font-size: 17px;
    line-height: 1.9;
    color: var(--text);
    max-width: 100%;
    margin: 0 auto 40px;
}

/* 相关资源区块（正文前内联） */
.article-resources {
    background: linear-gradient(135deg, #EEF2FF, #F0F9FF);
    border: 1px solid #BFDBFE;
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    margin: 0 auto 28px;
    max-width: 100%;
    scroll-margin-top: 20px;
}
.resources-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 10px;
}
.resources-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.resources-list li {
    padding: 6px 0;
    border-bottom: 1px solid rgba(59, 130, 246, 0.12);
}
.resources-list li:last-child {
    border-bottom: none;
}
.resources-list a {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--primary);
    text-decoration: none;
    transition: color 0.15s;
}
.resource-icon {
    flex-shrink: 0;
    font-size: 16px;
    line-height: 1;
}
.resources-list a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}
/* 资源区块定位高亮动画 */
.article-resources.resources-highlight {
    animation: resourceFlash 1.5s ease;
}
@keyframes resourceFlash {
    0%, 100% { border-color: #BFDBFE; box-shadow: none; }
    30% { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.18); }
}

/* 相关资源浮动按钮 */
.resources-fab {
    position: fixed;
    right: 24px;
    bottom: 32px;
    padding: 10px 18px;
    border-radius: 24px;
    background: var(--primary);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
    cursor: pointer;
    z-index: 999;
    transition: all 0.25s ease;
    border: none;
    outline: none;
}
.resources-fab:hover {
    transform: scale(1.06);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.55);
}

/* 移动端适配 */
@media (max-width: 480px) {
    .resources-fab {
        right: 16px;
        bottom: 24px;
        padding: 8px 14px;
        font-size: 13px;
    }
}

/* 微信内置浏览器引导遮罩 */
.wechat-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.82);
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
}
.wechat-guide {
    text-align: right;
    color: #fff;
    max-width: 300px;
    margin: 10px 10px 0 0;
}
.wechat-arrow {
    font-size: 25px;
    margin-bottom: 4px;
    display: inline-block;
    transform: rotate(-45deg);
    animation: wechatBounce 1.2s ease-in-out infinite;
}
.wechat-tip {
    font-size: 17px;
    line-height: 1.8;
    margin: 0;
    text-align: right;
}
.wechat-sub {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 12px;
    text-align: right;
}
@keyframes wechatBounce {
    0%, 100% { transform: rotate(-45deg) translate(0, 0); }
    50% { transform: rotate(-45deg) translate(6px, -6px); }
}

.article-content h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
    margin: 2em 0 0.8em;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--primary-light);
}

.article-content h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--gray-700);
    margin: 1.6em 0 0.6em;
}

.article-content h4 {
    font-size: 17px;
    font-weight: 600;
    color: var(--gray-700);
    margin: 1.4em 0 0.5em;
}

.article-content p {
    margin-bottom: 1.2em;
    text-indent: 2em;
}

.article-content ul, .article-content ol {
    margin: 0.8em 0 1.2em 1.5em;
}

.article-content li {
    margin-bottom: 0.4em;
}

.article-content blockquote {
    margin: 1.5em 0;
    padding: 16px 24px;
    background: var(--primary-light);
    border-left: 4px solid var(--primary);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 16px;
    color: var(--primary-dark);
    font-style: italic;
    text-indent: 0;
}

.article-content pre {
    background: #1E293B;
    color: #E2E8F0;
    padding: 20px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    font-size: 14px;
    margin: 1.2em 0;
}

.article-content code {
    font-family: "Fira Code", "Cascadia Code", Consolas, monospace;
    font-size: 0.9em;
}

.article-content :not(pre) > code {
    background: var(--gray-100);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--accent);
}

.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.2em 0;
}

.article-content th, .article-content td {
    padding: 10px 14px;
    border: 1px solid var(--border);
    font-size: 14px;
}

.article-content th {
    background: var(--gray-50);
    font-weight: 600;
}

.article-content img {
    max-width: 100%;
    border-radius: var(--radius-sm);
    margin: 1em 0;
}

.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    padding: 20px 0;
    border-top: 1px solid var(--border);
    max-width: 100%;
    margin: 0 auto 24px;
}

.tags-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.tag-pill {
    display: inline-block;
    font-size: 13px;
    font-weight: 500;
    color: var(--primary);
    background: var(--primary-light);
    padding: 4px 14px;
    border-radius: 20px;
    transition: all var(--transition);
}

.tag-pill:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-1px);
}

.tag-pill-sm {
    font-size: 12px;
    padding: 3px 10px;
}

.article-nav {
    max-width: 100%;
    margin: 0 auto;
}

/* ===== Sidebar ===== */
.article-sidebar {
    margin-top: 40px;
}

.sidebar-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    margin-bottom: 20px;
}

.sidebar-card h4 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 14px;
    color: var(--gray-900);
}

.sidebar-list {
    list-style: none;
}

.sidebar-list li {
    padding: 8px 0;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-list li:last-child { border-bottom: none; }

.sidebar-list a {
    font-size: 14px;
    color: var(--text);
    font-weight: 500;
}

.sidebar-list a:hover { color: var(--primary); }

.sidebar-list time {
    font-size: 12px;
    color: var(--text-secondary);
    flex-shrink: 0;
    margin-left: 12px;
}

.tag-cloud-sm {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* ===== List Cards (Search) ===== */
.articles-list {
    max-width: 800px;
    margin: 0 auto 40px;
}

.list-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    margin-bottom: 16px;
    transition: all var(--transition);
}

.list-card:hover {
    box-shadow: var(--shadow-md);
}

.list-card-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
}

.list-card-title a { color: var(--text); }
.list-card-title a:hover { color: var(--primary); }

.list-card-excerpt {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

/* ===== Archive Header ===== */
.archive-header {
    text-align: center;
    padding: 48px 20px 36px;
}

.archive-header h1 {
    font-size: 32px;
    font-weight: 800;
    color: var(--gray-900);
}

.archive-desc {
    font-size: 15px;
    color: var(--text-secondary);
    margin-top: 8px;
}

/* ===== Search ===== */
.search-box-wide {
    max-width: 600px;
    margin: 0 auto 40px;
}

.search-form-inline {
    display: flex;
    gap: 12px;
}

.search-input-lg {
    flex: 1;
    padding: 12px 18px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 16px;
    outline: none;
    transition: border-color var(--transition);
    font-family: inherit;
}

.search-input-lg:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 22px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
    font-family: inherit;
    border: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-outline:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
}

/* ===== Pagination ===== */
.pagination {
    display: flex;
    justify-content: center;
    padding: 20px 0 40px;
}

.pagination ul {
    display: flex;
    list-style: none;
    gap: 6px;
    align-items: center;
}

.pagination li { display: inline-flex; }

.pagination a, .pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: all var(--transition);
}

.pagination a {
    color: var(--text-secondary);
    background: var(--surface);
    border: 1px solid var(--border);
}

.pagination a:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

.pagination .current {
    background: var(--primary);
    color: white;
    border: 1px solid var(--primary);
    font-weight: 700;
}

.pagination .dots {
    color: var(--text-secondary);
}

/* ===== Empty State ===== */
.empty-page {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-page h2 {
    font-size: 22px;
    color: var(--text);
    margin-bottom: 8px;
}

/* ===== Tags Cloud Page ===== */
.tags-cloud-page {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px 16px;
    padding: 12px 0 60px;
    max-width: 900px;
    margin: 0 auto;
}

.tags-cloud-item {
    display: inline-block;
    font-weight: 600;
    color: var(--primary);
    line-height: 1.4;
    padding: 4px 6px;
    border-radius: 6px;
    transition: all 0.2s ease;
    text-decoration: none;
}

.tags-cloud-item:hover {
    color: var(--primary-dark);
    background: var(--primary-light);
    transform: translateY(-2px);
}

/* ===== Footer ===== */
.site-footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    margin-top: 60px;
    padding: 48px 0 0;
}

.footer-inner {
    display: grid;
    grid-template-columns: 2fr 1fr 2fr;
    gap: 40px;
    padding-bottom: 40px;
}

.footer-brand {
    color: var(--text-secondary);
}

.footer-logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    display: block;
    margin-bottom: 8px;
}

.footer-desc {
    font-size: 14px;
    line-height: 1.6;
}

.footer-links h4, .footer-tags h4 {
    font-size: 15px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 14px;
}

.footer-links ul {
    list-style: none;
}

.footer-links li { margin-bottom: 8px; }

.footer-links a {
    font-size: 14px;
    color: var(--text-secondary);
}

.footer-links a:hover { color: var(--primary); }

.footer-tags .tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.footer-bottom {
    border-top: 1px solid var(--border);
    padding: 20px 0;
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
}

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

    .header-inner {
        height: 56px;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .site-nav {
        display: none;
        position: absolute;
        top: 56px;
        left: 0;
        right: 0;
        background: var(--surface);
        flex-direction: column;
        padding: 12px;
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow-lg);
    }

    .site-nav.open {
        display: flex;
    }

    .nav-link {
        width: 100%;
        padding: 12px 16px;
    }

    .header-actions { display: none; }

    .articles-grid {
        grid-template-columns: 1fr;
    }

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

    .article-content {
        font-size: 16px;
    }

    .footer-inner {
        grid-template-columns: 1fr;
        gap: 24px;
    }

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

@media (max-width: 600px) {
    .hero-section {
        padding: 36px 16px 24px;
    }

    .hero-section h1 {
        font-size: 24px;
    }

    .article-card .card-image {
        height: 180px;
    }

    .search-form-inline {
        flex-direction: column;
    }

    .pagination a, .pagination span {
        min-width: 32px;
        height: 32px;
        font-size: 13px;
    }
}

/* ===== Print ===== */
@media print {
    .site-header, .site-footer, .article-sidebar, .article-nav { display: none; }
    .article-content { max-width: 100%; }
}
