
/* 
 * 全局样式设置
 * 设置盒模型为盒子边框盒模型，便于布局
 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* 
 * 定义根变量，便于色彩管理
 */
:root {
    --main-color: #1e3c72; /* 主色调：科技蓝 */
    --secondary-color: #2a5298; /* 辅助色：渐变蓝 */
    --accent-color: #ff9800; /* 点缀色：橙色 */
    --background-color: #121212; /* 背景色：深色 */
    --text-color: #ffffff; /* 文字颜色：白色 */
    --secondary-text-color: #cccccc; /* 次要文字颜色：浅灰色 */
    --font-family: 'Roboto', sans-serif; /* 字体设置 */
}

/* 
 * 设置整体背景和字体
 */
body {
    background: linear-gradient(135deg, var(--main-color), var(--secondary-color));
    color: var(--text-color);
    font-family: var(--font-family);
    line-height: 1.6;
}

/* 
 * 导航栏样式
 * 固定在顶部，具有半透明效果
 */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background-color: rgba(30, 60, 114, 0.9);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    transition: background-color 0.3s ease;
}

/* 
 * 导航链接样式
 */
.navbar a {
    color: var(--text-color);
    margin: 0 15px;
    text-decoration: none;
    font-size: 1em;
    transition: color 0.3s ease;
}

.navbar a:hover {
    color: var(--accent-color);
}

/* 
 * 主内容区样式
 * 添加上边距以避免被固定导航栏覆盖
 */
.main-content {
    padding-top: 80px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 8px;
}

/* 
 * 章节标题样式
 */
h2, h3, h4 {
    color: var(--accent-color);
    margin-bottom: 20px;
}

h2 {
    font-size: 2em;
    margin-top: 40px;
}

h3 {
    font-size: 1.75em;
    margin-top: 30px;
}

h4 {
    font-size: 1.5em;
    margin-top: 25px;
}

/* 
 * 段落样式
 */
p {
    font-size: 16px;
    margin-bottom: 20px;
    color: var(--text-color);
}

/* 
 * 代码块样式
 * 使用深色背景和等宽字体
 */
pre {
    background: rgba(0, 0, 0, 0.8);
    padding: 15px;
    border-radius: 5px;
    overflow-x: auto;
    margin-bottom: 20px;
}

code {
    color: #00ff00;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
}

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

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

/* 
 * 按钮样式
 */
.btn {
    background-color: var(--accent-color);
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    cursor: pointer;
    color: var(--text-color);
    font-size: 16px;
    transition: background-color 0.3s ease;
}

.btn:hover {
    background-color: #e68900;
}

/* 
 * 导航系统样式
 * 使用固定定位，方便用户快速跳转
 */
.nav-section {
    position: fixed;
    top: 60px;
    right: 30px;
    background-color: rgba(30, 60, 114, 0.8);
    padding: 10px;
    border-radius: 8px;
    z-index: 999;
}

.nav-section a {
    display: block;
    color: var(--text-color);
    margin: 5px 0;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.3s ease;
}

.nav-section a:hover {
    color: var(--accent-color);
}

/* 
 * 响应式设计
 * 确保在320px到1920px宽度范围内良好展示
 */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .nav-section {
        position: static;
        margin-top: 20px;
    }
}

/* 
 * 过渡效果
 */
.section {
    padding: 60px 0;
    transition: background-color 0.5s ease;
}

.section:nth-child(even) {
    background-color: rgba(30, 60, 114, 0.7);
}

.section:nth-child(odd) {
    background-color: rgba(42, 82, 152, 0.7);
}

/* 
 * 固定导航栏样式
 * 定位在页面顶部，随滚动固定
 */
.fixed-nav {
    position: fixed;
    top: 0;
    width: 100%;
    background-color: rgba(18, 18, 18, 0.9);
    padding: 20px;
    z-index: 1000;
}

/* 
 * 样式示例代码块
 * 特别样式用于区分文章内容中的代码块
 */
.code-example {
    background-color: #2d2d2d;
    color: #ccc;
    padding: 20px;
    border-radius: 5px;
    font-family: 'Courier New', Courier, monospace;
    overflow-x: auto;
    margin-bottom: 20px;
}

.code-example code {
    color: #f8f8f2;
}

/* 
 * 折叠区域样式
 * 使用细节样式使得次要信息隐蔽但可展开
 */
.collapsible {
    background-color: rgba(30, 60, 114, 0.8);
    color: var(--text-color);
    cursor: pointer;
    padding: 10px;
    width: 100%;
    border: none;
    text-align: left;
    outline: none;
    font-size: 16px;
    border-radius: 4px;
    margin-bottom: 10px;
    transition: background-color 0.3s ease;
}

.collapsible:hover {
    background-color: var(--accent-color);
}

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

/* 
 * 章节内容块样式
 */
.chapter {
    margin-bottom: 40px;
}

