
/* 
    整体页面设置
    使用现代化的CSS3布局，确保响应式设计，适配各种屏幕尺寸
*/
body {
    margin: 0;
    padding: 0;
    font-family: 'Open Sans', sans-serif;
    background: linear-gradient(135deg, #8BC34A 70%, #F5F5DC 25%, #FFA500 5%);
    color: #333;
}

/* 
    导航栏样式
    固定在顶部，使用Flexbox布局实现水平排列
*/
.header {
    position: fixed;
    top: 0;
    width: 100%;
    height: 60px;
    background-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1000;
}

.nav-links {
    display: flex;
    gap: 15px;
}

.nav-links a {
    text-decoration: none;
    color: #8BC34A;
    font-size: 16px;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: #FFA500;
}

/* 
    章节导航系统
    侧边固定导航，帮助快速定位内容区域
*/
.sidebar {
    position: fixed;
    top: 60px;
    left: 0;
    width: 200px;
    height: calc(100% - 60px);
    background-color: rgba(245, 245, 220, 0.95);
    padding: 20px;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
}

.sidebar ul {
    list-style: none;
    padding: 0;
}

.sidebar ul li {
    margin-bottom: 15px;
}

.sidebar ul li a {
    text-decoration: none;
    color: #03A9F4;
    font-size: 16px;
    transition: color 0.3s ease;
}

.sidebar ul li a:hover {
    color: #FFA500;
}

/* 
    主内容区域
    使用Grid布局，确保模块化和响应性
*/
.main-content {
    margin-left: 220px;
    padding: 80px 20px 20px 20px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 40px;
}

@media (min-width: 768px) {
    .main-content {
        grid-template-columns: 1fr 1fr;
    }
}

.section {
    background-color: rgba(255, 255, 255, 0.8);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: relative;
}

/* 
    图片样式
    圆角、阴影、悬浮效果
*/
.section img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.section img:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

/* 
    标题样式
    使用Roboto字体，调整字号和颜色
*/
.section h2, .section h3, .section h4 {
    font-family: 'Roboto', sans-serif;
    color: #333;
}

.section h2 {
    font-size: 24px;
    margin-bottom: 10px;
}

.section h3 {
    font-size: 20px;
    margin-bottom: 8px;
}

.section h4 {
    font-size: 18px;
    margin-bottom: 6px;
}

/* 
    正文字体和样式
    确保阅读舒适
*/
.section p {
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 15px;
}

/* 
    代码块样式
    区分于正文，增强可读性
*/
.code-block {
    background-color: #f0f0f0;
    padding: 15px;
    border-radius: 5px;
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    margin-bottom: 15px;
}

.code-block code {
    color: #d6336c;
}

/* 
    交互动画
    使用关键帧动画实现元素显现效果
*/
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 1s forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 
    底部样式
    使用Flexbox对齐，保持简洁
*/
.footer {
    background-color: rgba(245, 245, 220, 0.95);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.footer a {
    text-decoration: none;
    color: #03A9F4;
    margin-right: 15px;
    transition: color 0.3s ease;
}

.footer a:hover {
    color: #FFA500;
}

/* 
    响应式调整
    针对不同屏幕尺寸优化布局
*/
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    .main-content {
        margin-left: 0;
    }
}

@media (max-width: 480px) {
    .header {
        flex-direction: column;
        height: auto;
        padding: 10px;
    }
    .nav-links {
        flex-direction: column;
        align-items: center;
    }
    .nav-links a {
        margin-bottom: 10px;
    }
    .section {
        padding: 15px;
    }
    .footer {
        flex-direction: column;
        align-items: flex-start;
    }
    .footer a {
        margin-bottom: 10px;
    }
}

