
/* 
全局样式设置
设置基础字体、背景色、主色调、辅助色和点缀色，遵循黄金比例配色法。
*/
body {
    margin: 0;
    padding: 0;
    font-family: 'Roboto', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    background: linear-gradient(135deg, #2980b9 70%, #ecf0f1 25%, #27ae60 5%);
    color: #2c3e50;
    overflow-x: hidden;
}

/* 
导航栏样式
固定在顶部，使用弹性盒子布局，包含导航链接和提示文字。
*/
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(52, 73, 94, 0.9);
    padding: 1rem 2rem;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.navbar a {
    color: #ecf0f1;
    text-decoration: none;
    margin: 0 1rem;
    transition: color 0.3s ease;
}

.navbar a:hover {
    color: #27ae60;
}

/* 
主内容区域样式
使用网格布局，将不同的内容分割为独立的视觉区块。
*/
.main-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 6rem 2rem 2rem 2rem;
}

/* 
章节区块样式
每个章节作为独立的区块，添加背景、阴影和动画效果。
*/
.section {
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.section:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px rgba(0,0,0,0.2);
}

/* 
标题样式
不同层级的标题使用不同的字体大小和颜色，确保信息层次分明。
*/
h1, h2, h3, h4 {
    color: #2c3e50;
}

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

h2 {
    font-size: 2rem;
    margin-bottom: 0.75rem;
}

h3 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

h4 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

/* 
段落和文本样式
确保文本易读，使用合适的行高和字体颜色。
*/
p {
    font-size: 1rem;
    color: #34495e;
    margin-bottom: 1rem;
}

/* 
代码块样式
为文章中的代码示例提供独特的样式，与正文区分开。
*/
pre {
    background-color: #f4f4f4;
    padding: 1rem;
    border-radius: 5px;
    overflow-x: auto;
    margin-bottom: 1rem;
}

code {
    font-family: 'Courier New', Courier, monospace;
    color: #c0392b;
}

/* 
图片样式
为装饰性图片添加圆角、阴影和悬停效果。
*/
.decorative-image {
    width: 100%;
    max-width: 320px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.decorative-image:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 15px rgba(0,0,0,0.2);
}

/* 
按钮样式
设计美观的按钮，包含渐变色和悬停动画。
*/
.button {
    background: linear-gradient(45deg, #6dd5fa, #2980b9);
    border: none;
    padding: 0.75rem 1.5rem;
    color: #ffffff;
    cursor: pointer;
    border-radius: 5px;
    transition: background 0.3s ease, transform 0.3s ease;
    font-size: 1rem;
}

.button:hover {
    background: linear-gradient(45deg, #2980b9, #6dd5fa);
    transform: scale(1.05);
}

/* 
响应式设计
使用媒体查询确保页面在不同设备上均有良好表现。
*/
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
    }
    .main-content {
        padding: 6rem 1rem 1rem 1rem;
    }
}

@media (max-width: 600px) {
    h1 {
        font-size: 2rem;
    }
    h2 {
        font-size: 1.75rem;
    }
    .button {
        width: 100%;
        padding: 1rem;
    }
}

/* 
章节导航样式
设计清晰的导航系统，帮助用户快速定位内容区域。
*/
.chapter-nav {
    position: fixed;
    top: 80px;
    right: 20px;
    background-color: rgba(52, 73, 94, 0.9);
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.chapter-nav a {
    display: block;
    color: #ecf0f1;
    text-decoration: none;
    margin-bottom: 0.5rem;
    transition: color 0.3s ease;
}

.chapter-nav a:hover {
    color: #27ae60;
}

/* 
提示文字样式
在显著位置显示提示信息，使用醒目的字体和颜色。
*/
.prompt {
    text-align: center;
    font-size: 1.2rem;
    color: #c0392b;
    margin: 2rem 0;
    animation: fadeIn 2s ease-in-out;
}

/* 
动画效果
定义淡入动画，增强页面动态感。
*/
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 
数据可视化图表容器
为图表添加动画效果，提升视觉吸引力。
*/
.chart-container {
    position: relative;
    width: 100%;
    height: 400px;
    animation: fadeIn 2s ease-in-out;
}

/* 
卡片布局样式
使用网格布局创建模块化卡片，增强可读性和互动性。
*/
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    padding: 2rem;
}

.card {
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    padding: 1.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 15px rgba(0,0,0,0.2);
}

/* 
滑动动画元素
为滚动触发的元素添加淡入效果。
*/
.scroll-element {
    animation: scrollFadeIn 1s ease-out forwards;
    opacity: 0;
}

@keyframes scrollFadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 
侧边栏导航样式
为多功能网页提供二级导航，提升用户体验。
*/
.sidebar-nav {
    position: fixed;
    top: 80px;
    left: 20px;
    background-color: rgba(52, 73, 94, 0.9);
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.sidebar-nav a {
    display: block;
    color: #ecf0f1;
    text-decoration: none;
    margin-bottom: 0.5rem;
    transition: color 0.3s ease;
}

.sidebar-nav a:hover {
    color: #27ae60;
}

/* 
面包屑导航样式
帮助用户了解当前所在位置，便于导航。
*/
.breadcrumb {
    margin: 2rem 0;
    font-size: 0.9rem;
}

.breadcrumb a {
    color: #2980b9;
    text-decoration: none;
    margin-right: 0.5rem;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb span {
    margin-right: 0.5rem;
}

/* 
卡片式设计的按钮
为卡片中的按钮提供统一的样式，提升互动性。
*/
.card .button {
    display: inline-block;
    margin-top: 1rem;
}

