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

:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --text-color: #333;
    --bg-color: #f5f7fa;
    --card-bg: #fff;
    --border-radius: 12px;
    --shadow: 0 4px 20px rgba(0,0,0,0.08);
    --shadow-hover: 0 8px 30px rgba(0,0,0,0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    line-height: 1.8;
    color: var(--text-color);
    background: var(--bg-color);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 头部样式 */
.site-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 40px 0;
    text-align: center;
}

.site-title {
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: 700;
}

.site-desc {
    font-size: 1.1em;
    opacity: 0.9;
    margin-bottom: 20px;
}

/* 导航样式 */
.main-nav {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

.main-nav a {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 20px;
    background: rgba(255,255,255,0.15);
    transition: all 0.3s;
    font-size: 0.95em;
}

.main-nav a:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-2px);
}

/* 文章卡片网格 */
.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 30px;
    padding: 40px 0;
}

.post-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s;
    position: relative;
    cursor: pointer;
}

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

/* 卡片整体可点击 */
.post-content h2 a {
    position: relative;
    display: inline-block;
}

.post-content h2 a::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

/* 确保卡片内其他元素可点击（升高层级） */
.post-card .tag,
.post-card .post-meta {
    position: relative;
    z-index: 2;
}

.post-cover {
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.post-icon {
    font-size: 3em;
}

.post-content {
    padding: 25px;
}

.post-content h2 {
    margin-bottom: 12px;
    font-size: 1.3em;
}

.post-content h2 a {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.3s;
}

.post-content h2 a:hover {
    color: var(--primary-color);
}

.post-content p {
    color: #666;
    font-size: 0.95em;
    line-height: 1.6;
}

.post-meta {
    margin-top: 15px;
}

.tag {
    display: inline-block;
    padding: 4px 10px;
    background: #e0e7ff;
    color: var(--primary-color);
    border-radius: 12px;
    font-size: 0.8em;
    margin-right: 8px;
}

/* 博客文章页样式 */
.post-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 60px 0;
    text-align: center;
}

.post-header h1 {
    font-size: 2em;
    margin-bottom: 10px;
}

.post-header .post-date {
    opacity: 0.8;
}

.post-body {
    background: var(--card-bg);
    margin: 40px auto;
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    max-width: 900px;
}

/* 问答模块 */
.qa-section {
    margin-bottom: 40px;
}

.qa-section h2 {
    color: var(--primary-color);
    font-size: 1.5em;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e7ff;
}

.qa-item {
    background: #f8f9fa;
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    border-left: 4px solid var(--primary-color);
}

.qa-item.warning {
    border-left-color: #f5576c;
    background: #fff5f5;
}

.question {
    font-weight: 600;
    color: #2d3748;
    font-size: 1.1em;
    margin-bottom: 12px;
}

.answer {
    color: #4a5568;
    line-height: 1.8;
}

.answer ul, .answer ol {
    margin-left: 20px;
    margin-top: 8px;
}

.answer li {
    margin-bottom: 5px;
}

.highlight {
    background: linear-gradient(120deg, #ffeaa7 0%, #ffeaa7 100%);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.poem-box {
    background: #f0fff4;
    border: 1px solid #9ae6b4;
    border-radius: 8px;
    padding: 15px;
    margin: 10px 0;
    font-style: italic;
    color: #2f855a;
    text-align: center;
}

.warning-box {
    background: #fff5f5;
    border: 1px solid #feb2b2;
    border-radius: 8px;
    padding: 15px;
    margin: 10px 0;
}

/* 底部导航 */
.post-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.post-nav a {
    color: var(--primary-color);
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 20px;
    background: #e0e7ff;
    transition: all 0.3s;
}

.post-nav a:hover {
    background: var(--primary-color);
    color: white;
}

/* 页脚 */
.site-footer {
    background: #2d3748;
    color: white;
    text-align: center;
    padding: 30px 0;
    margin-top: 60px;
}

/* 返回顶部 */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 1.5em;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s;
    z-index: 1000;
}

.back-to-top:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
}

/* 移动端适配 */
@media (max-width: 768px) {
    .site-title {
        font-size: 1.8em;
    }
    
    .post-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .main-nav {
        gap: 5px;
    }
    
    .main-nav a {
        font-size: 0.85em;
        padding: 6px 12px;
    }
    
    .post-body {
        padding: 20px;
        margin: 20px auto;
    }
    
    .post-header h1 {
        font-size: 1.5em;
    }
}

/* 打印样式 */
@media print {
    .site-header, .site-footer, .back-to-top, .post-nav {
        display: none;
    }
    
    .post-body {
        box-shadow: none;
        margin: 0;
    }
}
