/* ===== 基础变量 ===== */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --text: #1e293b;
    --text-light: #64748b;
    --bg: #ffffff;
    --bg-alt: #f8fafc;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.12);
    --radius: 12px;
    --transition: 0.3s ease;
    --max-width: 1200px;
}

/* ===== 基础样式 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

img {
    max-width: 100%;
    height: auto;
}

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

a:hover {
    color: var(--primary-dark);
}

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

/* ===== 导航栏 ===== */
.navbar {
    position: sticky;
    top: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    z-index: 100;
    backdrop-filter: blur(10px);
}

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

.nav-logo {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
}

.nav-logo:hover {
    color: var(--primary);
}

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

.nav-links a {
    color: var(--text-light);
    font-weight: 500;
    padding: 4px 0;
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary);
}

.nav-links a:hover::after,
.nav-links a.active::after {
    width: 100%;
}

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

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text);
    transition: var(--transition);
}

/* ===== Hero 区域 ===== */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 120px 0 100px;
    text-align: center;
}

.hero-content h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 16px;
}

.hero-content p {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 32px;
}

.btn-primary {
    display: inline-block;
    background: white;
    color: var(--primary);
    padding: 12px 32px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 1rem;
    transition: var(--transition);
    border: none;
}

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

.btn-secondary {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 12px 32px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 1rem;
    transition: var(--transition);
    border: none;
}

.btn-secondary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

/* ===== 通用 Section ===== */
.section {
    padding: 80px 0;
}

.section-alt {
    background: var(--bg-alt);
}

.section-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 40px;
    text-align: center;
}

/* ===== 文章卡片 ===== */
.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 24px;
}

.post-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 24px;
}

.post-card {
    background: var(--bg);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    transition: var(--transition);
}

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

.post-card-image {
    overflow: hidden;
}

.post-card-image img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform var(--transition);
}

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

.post-card-body {
    padding: 20px;
}

.post-tag {
    display: inline-block;
    background: var(--primary-light);
    color: var(--primary);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 12px;
}

.post-card-body h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.4;
}

.post-card-body h3 a {
    color: var(--text);
}

.post-card-body h3 a:hover {
    color: var(--primary);
}

.post-card-body p {
    color: var(--text-light);
    font-size: 0.95rem;
    line-height: 1.6;
}

.post-meta {
    display: flex;
    gap: 16px;
    margin-top: 12px;
    color: var(--text-light);
    font-size: 0.85rem;
}

/* ===== 筛选栏 ===== */
.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 20px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-light);
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition);
}

.filter-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

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

/* ===== 页面标题 ===== */
.page-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 80px 0 60px;
    text-align: center;
}

.page-header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.page-header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* ===== 关于预览 ===== */
.about-preview {
    display: flex;
    align-items: center;
    gap: 40px;
    max-width: 700px;
    margin: 0 auto;
}

.about-avatar {
    flex-shrink: 0;
}

.about-avatar img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary);
}

.about-info h2 {
    font-size: 1.5rem;
    margin-bottom: 12px;
}

.about-info p {
    color: var(--text-light);
    margin-bottom: 16px;
}

/* ===== 关于页面 ===== */
.about-page {
    max-width: 800px;
    margin: 0 auto;
}

.about-page-avatar {
    text-align: center;
    margin-bottom: 24px;
}

.about-page-avatar img {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--primary);
}

.about-page-content {
    text-align: center;
}

.about-page-content h2 {
    font-size: 1.8rem;
    margin-bottom: 12px;
}

.about-page-content h3 {
    font-size: 1.3rem;
    margin: 24px 0 12px;
}

.about-page-content p {
    color: var(--text-light);
    margin-bottom: 16px;
}

.skill-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.skill-item {
    background: var(--bg-alt);
    padding: 16px;
    border-radius: var(--radius);
    text-align: left;
}

.skill-name {
    display: block;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 4px;
}

.skill-desc {
    color: var(--text-light);
    font-size: 0.9rem;
}

.contact-list {
    list-style: none;
    text-align: left;
    display: inline-block;
}

.contact-list li {
    padding: 8px 0;
    color: var(--text-light);
}

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

/* ===== 文章详情 ===== */
.post-detail {
    padding: 40px 0 80px;
}

.post-header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.post-header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    margin: 16px 0;
}

.post-content {
    max-width: 720px;
    margin: 0 auto;
    line-height: 1.8;
}

.post-content h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 32px 0 16px;
    color: var(--text);
}

.post-content p {
    margin-bottom: 16px;
    color: var(--text-light);
}

.post-content ul {
    margin: 16px 0;
    padding-left: 24px;
}

.post-content li {
    margin: 8px 0;
    color: var(--text-light);
}

.post-content strong {
    color: var(--text);
}

.post-nav {
    text-align: center;
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

/* ===== 页脚 ===== */
.footer {
    background: var(--text);
    color: white;
    padding: 48px 0 24px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
    margin-bottom: 32px;
}

.footer-section h3 {
    font-size: 1.1rem;
    margin-bottom: 16px;
}

.footer-section p {
    opacity: 0.7;
}

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

.footer-section li {
    margin: 8px 0;
}

.footer-section a {
    color: white;
    opacity: 0.7;
}

.footer-section a:hover {
    opacity: 1;
}

.footer-bottom {
    text-align: center;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    opacity: 0.7;
}

/* ===== 隐藏文章卡片（筛选） ===== */
.post-card.hidden {
    display: none;
}

/* ===== 回到顶部按钮 ===== */
.back-to-top {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 44px;
    height: 44px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 50;
    border: none;
    font-size: 1.2rem;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
    }

    .nav-links {
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--bg);
        flex-direction: column;
        padding: 24px;
        gap: 16px;
        border-bottom: 1px solid var(--border);
        transform: translateY(-100%);
        opacity: 0;
        transition: var(--transition);
        z-index: 99;
    }

    .nav-links.open {
        transform: translateY(0);
        opacity: 1;
    }

    .hero-content h1 {
        font-size: 2rem;
    }

    .hero-content p {
        font-size: 1rem;
    }

    .hero {
        padding: 80px 0 60px;
    }

    .post-grid,
    .post-list {
        grid-template-columns: 1fr;
    }

    .about-preview {
        flex-direction: column;
        text-align: center;
    }

    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }

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

    .page-header h1 {
        font-size: 2rem;
    }

    .post-header h1 {
        font-size: 1.8rem;
    }
}

@media (max-width: 480px) {
    .hero-content h1 {
        font-size: 1.6rem;
    }

    .container {
        padding: 0 16px;
    }

    .section {
        padding: 48px 0;
    }
}
