/* --- 全局样式和变量 --- */
:root {
    --primary-color: #2c3e50; /* 深蓝灰色 */
    --secondary-color: #3498db; /* 亮蓝色 */
    --background-color: #f8f9fa; /* 淡灰色背景 */
    --text-color: #34495e; /* 文本颜色 */
    --card-bg-color: #ffffff; /* 卡片背景 */
    --border-color: #e9ecef; /* 边框颜色 */
    --font-family: 'Helvetica Neue', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    --border-radius: 8px;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.7;
    /* --- 粘性页脚实现 --- */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 20px;
}

a {
    color: var(--secondary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #2980b9; /* 悬停时颜色加深 */
}

/* --- 头部样式 --- */
.site-header {
    background-color: var(--card-bg-color);
    padding: 20px 0;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-title a {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--primary-color);
}

.main-nav ul {
    list-style: none;
    display: flex;
    gap: 25px;
}

.main-nav a {
    font-size: 1.1rem;
    font-weight: 500;
    padding-bottom: 5px;
    border-bottom: 2px solid transparent;
    transition: border-color 0.3s ease;
}

.main-nav a.active,
.main-nav a:hover {
    color: var(--primary-color);
    border-bottom-color: var(--secondary-color);
}

/* --- 主要内容区域 --- */
main.container {
    padding-top: 40px;
    padding-bottom: 40px;
    /* --- 粘性页脚实现 --- */
    flex-grow: 1; /* 让 main 区域占据所有可用空间 */
}

.hero {
    text-align: center;
    margin-bottom: 60px;
}

.hero h2 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.hero p {
    font-size: 1.2rem;
    max-width: 700px;
    margin: 0 auto;
    color: #7f8c8d; /* 灰色文字 */
}

.section-title {
    font-size: 2rem;
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 40px;
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background-color: var(--secondary-color);
    margin: 10px auto 0;
    border-radius: 2px;
}


/* --- 文章卡片网格 --- */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.card {
    background-color: var(--card-bg-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 25px;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    opacity: 0; /* 初始不可见，用于JS动画 */
    transform: translateY(20px);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.card-emoji {
    font-size: 3rem;
    margin-bottom: 15px;
    background-color: var(--background-color);
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.card-title {
    font-size: 1.4rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.card-excerpt {
    flex-grow: 1;
    margin-bottom: 20px;
    color: #555;
}

.card-link {
    font-weight: bold;
    align-self: flex-start;
}

/* --- 底部样式 --- */
.site-footer {
    background-color: #2c3e50;
    color: #ecf0f1;
    text-align: center;
    padding: 30px 0;
}

.site-footer a {
    color: #ecf0f1;
    text-decoration: underline;
}

/* --- 文章和关于页面特定样式 --- */
.page-content {
    background-color: var(--card-bg-color);
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.page-content h1 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    color: var(--primary-color);
}

.page-content .meta {
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-bottom: 30px;
}

.page-content p, .page-content ul {
    margin-bottom: 20px;
}

.page-content ul {
    padding-left: 20px;
}

.page-content h2 {
    font-size: 1.8rem;
    margin-top: 40px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
    color: var(--primary-color);
}

.page-content pre {
    background-color: #2d2d2d;
    color: #f8f8f2;
    padding: 20px;
    border-radius: var(--border-radius);
    overflow-x: auto;
    font-family: 'Fira Code', 'Courier New', monospace;
    margin-bottom: 20px;
}

.page-content code {
    font-family: inherit;
}

.back-link {
    display: inline-block;
    margin-bottom: 30px;
    font-weight: bold;
}

/* --- 404 页面特定样式 --- */
.page-404 main.container {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding-top: 0;
    padding-bottom: 0;
}

.not-found-content {
    background-color: var(--card-bg-color);
    padding: 50px 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    max-width: 500px;
}

.not-found-content .emoji {
    font-size: 5rem;
    line-height: 1;
}

.not-found-content h1 {
    font-size: 6rem;
    color: var(--primary-color);
    margin: 10px 0;
    line-height: 1;
}

.not-found-content p {
    font-size: 1.2rem;
    color: #7f8c8d;
    margin-bottom: 30px;
}

.not-found-content .home-link {
    display: inline-block;
    background-color: var(--secondary-color);
    color: #fff;
    padding: 12px 25px;
    border-radius: 50px;
    font-weight: bold;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.not-found-content .home-link:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
    color: #fff;
}


/* --- 响应式设计 --- */
@media (max-width: 768px) {
    .site-header .container {
        flex-direction: column;
        gap: 15px;
    }

    .hero h2 {
        font-size: 2rem;
    }

    .hero p {
        font-size: 1rem;
    }
    
    .page-content {
        padding: 25px;
    }

    .not-found-content h1 {
        font-size: 4rem;
    }
    .not-found-content .emoji {
        font-size: 4rem;
    }
}
