/* 基础重置和变量 */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --text-color: #333;
    --bg-color: #fefefe;
    --border-color: #e1e8ed;
    --code-bg: #f8f9fa;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --max-width: 1200px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: var(--bg-color);
}

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

/* 导航栏 */
.header {
    background: white;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    max-width: var(--max-width);
    margin: 0 auto;
}

.nav-brand a {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-menu a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: color 0.3s;
}

.nav-menu a:hover {
    color: var(--secondary-color);
}

/* 主页横幅 */
.hero {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    text-align: center;
    padding: 4rem 0;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* 文章区域 */
.posts-section {
    padding: 4rem 0;
    background: #f8f9fa;
}

.posts-section h2 {
    text-align: center;
    margin-bottom: 3rem;
    color: var(--primary-color);
}

.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.post-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
}

.post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.post-card h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.post-card p {
    color: #666;
    margin-bottom: 1rem;
}

.post-meta {
    font-size: 0.9rem;
    color: #999;
    margin-bottom: 1rem;
}

.read-more {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 500;
}

.read-more:hover {
    text-decoration: underline;
}

/* 关于页面 */
.about-section {
    padding: 4rem 0;
}

.about-section h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--primary-color);
}

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

.about-content ul {
    margin: 1rem 0;
    padding-left: 2rem;
}

/* 页脚 */
.footer {
    background: var(--primary-color);
    color: white;
    text-align: center;
    padding: 2rem 0;
}

.footer a {
    color: #fff;
    opacity: 0.8;
}

.footer a:hover {
    opacity: 1;
}

/* 文章页面样式 */
.article {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.article-header {
    text-align: center;
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.article-title {
    font-size: 2.2rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.article-date {
    color: #666;
    font-size: 0.9rem;
}

.article-content {
    line-height: 1.8;
}

.article-content h1,
.article-content h2,
.article-content h3 {
    margin: 2rem 0 1rem 0;
    color: var(--primary-color);
}

.article-content p {
    margin-bottom: 1.5rem;
}

.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1.5rem 0;
    box-shadow: var(--shadow);
}

/* 代码样式 */
.article-content pre {
    background: var(--code-bg);
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1.5rem 0;
    border-left: 4px solid var(--secondary-color);
}

.article-content code {
    background: var(--code-bg);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.9rem;
    font-family: 'Monaco', 'Consolas', monospace;
}

.article-content pre code {
    background: none;
    padding: 0;
}

/* 数学公式 */
.katex-display {
    margin: 1.5rem 0;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .nav {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-menu {
        gap: 1rem;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .posts-grid {
        grid-template-columns: 1fr;
    }
    
    .article {
        padding: 0 1rem;
    }
    
    .article-title {
        font-size: 1.8rem;
    }
}

