
/* 
  全局样式重置，确保不同浏览器下的兼容性
  使用box-sizing: border-box来简化布局设计
*/
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* 
  设置页面的基础字体、背景色及色彩搭配
  主色调为深蓝色，通过渐变增强视觉层次
  辅助色为灰色，点缀色为亮橙色，符合黄金比例
*/
body {
  font-family: 'Roboto', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  background: linear-gradient(135deg, #1e3c72 70%, #2a5298 70%, #f5a623 5%);
  color: #333333;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* 
  设置固定导航栏样式
  深蓝色背景，白色文字，添加阴影提升层次感
  响应式设计确保在小屏幕下的良好显示
*/
.navbar {
  position: fixed;
  top: 0;
  width: 100%;
  background-color: #1e3c72;
  color: #FFFFFF;
  padding: 15px 30px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.navbar a {
  color: #FFFFFF;
  text-decoration: none;
  margin-left: 20px;
  transition: color 0.3s ease;
}

.navbar a:hover {
  color: #f5a623;
}

/* 
  主容器样式，使用Grid布局
  保证内容模块独立且宽度不低于500px
  添加响应式设计，适配不同屏幕尺寸
*/
.container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
  gap: 40px;
  max-width: 1200px;
  width: 100%;
  margin-top: 100px;
}

/* 
  模块样式，包含阴影和圆角
  背景色使用浅灰，增添层次感
  添加动态交互效果，如悬停时的轻微上浮
*/
.module {
  background-color: #f0f0f0;
  border-radius: 10px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  padding: 20px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.module:hover {
  transform: translateY(-10px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
}

/* 
  标题样式，使用亮橙色作为点缀色
  保证标题清晰且具备视觉吸引力
*/
h2, h3, h4 {
  color: #f5a623;
  margin-bottom: 15px;
}

h2 {
  font-size: 2em;
}

h3 {
  font-size: 1.75em;
}

h4 {
  font-size: 1.5em;
}

/* 
  段落样式，保证文本的可读性
  合理的行间距和文字颜色，提升阅读体验
*/
p {
  margin-bottom: 15px;
  color: #333333;
}

/* 
  图片样式，添加圆角、阴影和悬停放大效果
  保证装饰性图片不作为主要内容，描述属性为空
*/
img {
  width: 100%;
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

img:hover {
  transform: scale(1.05);
}

/* 
  代码块样式，使用深色背景和高亮字体
  确保代码内容与正文内容区分开来
  添加padding和圆角，提升可读性
*/
pre {
  background-color: #2a5298;
  color: #FFFFFF;
  padding: 15px;
  border-radius: 5px;
  overflow: auto;
  position: relative;
}

pre code {
  display: block;
  font-family: 'Courier New', Courier, monospace;
}

pre code::before {
  content: "代码示例";
  position: absolute;
  top: -25px;
  left: 10px;
  background-color: #1e3c72;
  color: #FFFFFF;
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 0.9em;
}

/* 
  提示信息样式，使用亮橙色强调
  确保提示信息在页面显著位置
*/
.alert {
  background-color: #f5a623;
  color: #FFFFFF;
  padding: 10px 20px;
  border-radius: 5px;
  text-align: center;
  font-size: 1.2em;
  margin-bottom: 30px;
}

/* 
  折叠区域样式，默认隐藏内容
  点击后展开，添加平滑过渡效果
*/
.collapsible {
  background-color: #ffffff;
  color: #333333;
  cursor: pointer;
  padding: 10px;
  width: 100%;
  border: none;
  text-align: left;
  outline: none;
  font-size: 1em;
  border-radius: 5px;
  margin-bottom: 10px;
  transition: background-color 0.3s ease;
}

.active, .collapsible:hover {
  background-color: #f5a623;
  color: #ffffff;
}

.content {
  padding: 0 20px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s ease;
  background-color: #f0f0f0;
  border-radius: 0 0 10px 10px;
}

/* 
  响应式设计，适配不同屏幕尺寸
  小于768px时，调整布局为单栏
*/
@media (max-width: 768px) {
  .container {
    grid-template-columns: 1fr;
  }

  .navbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .navbar a {
    margin-left: 0;
    margin-top: 10px;
  }
}

/* 
  响应式调整字体大小，提升在小屏幕上的可读性
*/
@media (max-width: 1200px) {
  body {
    font-size: 15px;
  }
}

@media (max-width: 768px) {
  body {
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 13px;
  }
}

