
/* 
整体页面的样式设计，融合未来感与高级质感，通过CSS3的各种高级特性实现响应式布局与丰富的交互效果。
1. 基本布局与字体设置
*/
body {
    margin: 0;
    padding: 0;
    font-family: 'Roboto', sans-serif;
    font-size: 16px;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: #ffffff;
    transition: background 0.3s ease, color 0.3s ease;
}

/* 
导航栏样式，固定在顶部，包含章节导航链接，使用高对比度色彩与悬停效果
*/
nav {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.7);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
}

nav .logo {
    font-size: 1.5em;
    font-weight: bold;
    color: #00ff7f;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 20px;
}

nav ul li a {
    color: #ffffff;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 4px;
    transition: background 0.3s ease, transform 0.3s ease;
}

nav ul li a:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* 
主内容区域，使用网格布局，并包含多个模块，带有悬停动画和阴影效果
*/
main {
    padding: 100px 50px 50px 50px;
    display: grid;
    grid-template-columns: 1fr 3fr;
    gap: 30px;
}

/* 
侧边导航栏样式，包含可折叠功能
*/
.sidebar {
    background: rgba(0, 0, 0, 0.5);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    position: sticky;
    top: 100px;
}

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

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

.sidebar ul li a {
    color: #00ff7f;
    text-decoration: none;
    transition: color 0.3s ease, transform 0.3s ease;
}

.sidebar ul li a:hover {
    color: #ff8c00;
    transform: translateX(5px);
}

/* 
文章内容样式，包含标题、段落和代码块，使用渐变背景与阴影提升质感
*/
article {
    background: rgba(255, 255, 255, 0.1);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

article h2, article h3, article h4 {
    color: #00ff7f;
    margin-top: 20px;
    margin-bottom: 10px;
}

article p {
    line-height: 1.6;
    margin-bottom: 15px;
}

article pre {
    background: rgba(0, 0, 0, 0.7);
    padding: 15px;
    border-radius: 10px;
    overflow-x: auto;
    margin-bottom: 20px;
}

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

/* 
图片样式，应用圆角、阴影和悬停效果
*/
img {
    width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

img:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
}

/* 
章节导航系统样式，固定在页面一侧，使用淡入动画
*/
.chapter-nav {
    position: fixed;
    top: 100px;
    right: 30px;
    background: rgba(0, 0, 0, 0.5);
    padding: 15px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
}

.chapter-nav a {
    color: #ffffff;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 4px;
    transition: background 0.3s ease, color 0.3s ease;
}

.chapter-nav a:hover {
    background: #00ff7f;
    color: #000000;
}

/* 
响应式设计，确保在不同屏幕尺寸下布局自适应
*/
@media (max-width: 1200px) {
    main {
        grid-template-columns: 1fr;
    }
    .chapter-nav {
        display: none;
    }
}

@media (max-width: 768px) {
    nav ul {
        display: none;
    }
    .sidebar {
        display: none;
    }
}

@media (max-width: 480px) {
    body {
        padding: 20px;
    }
}

/* 
按钮样式，结合渐变与过渡效果，提升交互体验
*/
.button {
    background: linear-gradient(45deg, #00ff7f, #ff8c00);
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.3s ease;
}

.button:hover {
    background: linear-gradient(45deg, #ff8c00, #00ff7f);
    transform: scale(1.05);
}

/* 
折叠区域样式，隐藏与显示内容的过渡动画
*/
.collapsible {
    background: rgba(0, 0, 0, 0.6);
    color: #ffffff;
    cursor: pointer;
    padding: 10px;
    width: 100%;
    border: none;
    text-align: left;
    outline: none;
    font-size: 16px;
    border-radius: 5px;
    transition: background 0.3s ease;
}

.collapsible:hover {
    background: rgba(255, 140, 0, 0.7);
}

.content {
    padding: 0 18px;
    max-height: 0;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.4);
    transition: max-height 0.3s ease;
    border-radius: 0 0 10px 10px;
}

.active + .content {
    max-height: 500px;
}

/* 
代码示例块样式，区别于文章内容，通过背景与字体颜色区分
*/
.code-sample {
    background: #2a2a2a;
    color: #f1f1f1;
    padding: 20px;
    border-radius: 10px;
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    margin-bottom: 20px;
}

