
/* 
  全局样式设置
  设置页面的基础字体、颜色、背景以及响应式布局的基础
*/
body {
  margin: 0;
  padding: 0;
  font-family: 'Roboto', sans-serif; /* 正文字体 */
  font-size: 16px; /* 正文字号 */
  line-height: 1.6;
  color: #2E7D32; /* 深绿色为主色 */
  background: linear-gradient(135deg, #F5F0E1 70%, #F7F7F7 30%); /* 主背景采用浅米色和灰色渐变 */
}

/* 
  导航栏样式
  固定在顶部，包含多级菜单，使用Flexbox布局
*/
.navbar {
  position: fixed;
  top: 0;
  width: 100%;
  background-color: rgba(255, 255, 255, 0.9); /* 半透明背景 */
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* 轻微阴影 */
  display: flex;
  justify-content: center; /* 水平居中 */
  align-items: center;
  padding: 15px 0;
  z-index: 1000;
}

/* 导航链接样式 */
.navbar a {
  margin: 0 20px;
  text-decoration: none;
  color: #2E7D32; /* 深绿色 */
  font-family: 'Montserrat', sans-serif; /* 标题字体 */
  font-weight: 600;
  transition: color 0.3s ease;
}

.navbar a:hover {
  color: #4285F4; /* 蓝色点缀 */
}

/* 
  主体内容区样式
  使用Grid布局分隔不同的视觉区块
*/
.main-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 40px;
  padding: 100px 50px 50px; /* 上方预留导航栏空间 */
}

/* 内容区块的基本样式 */
.section {
  background-color: #FFFFFF; /* 白色背景 */
  border-radius: 10px; /* 圆角 */
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); /* 阴影效果 */
  padding: 30px;
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.section:hover {
  transform: translateY(-10px); /* 悬停时上移 */
  box-shadow: 0 12px 20px rgba(0, 0, 0, 0.2); /* 加深阴影 */
}

/* 
  标题样式
  使用Montserrat字体，颜色与主色一致
*/
.section h2, .section h3, .section h4 {
  font-family: 'Montserrat', sans-serif;
  color: #2E7D32;
  margin-bottom: 15px;
}

.section h2 {
  font-size: 1.8em; /* H2字号 */
}

.section h3 {
  font-size: 1.6em; /* H3字号 */
}

.section h4 {
  font-size: 1.4em; /* H4字号 */
}

/*
  正文段落样式
  使用Roboto字体，提升可读性
*/
.section p {
  font-family: 'Roboto', sans-serif;
  font-size: 16px; /* 正文字号 */
  color: #2E7D32;
  margin-bottom: 15px;
}

/* 
  装饰性图片样式
  设置圆角、阴影与悬停效果
*/
.decorative-image {
  width: 100%;
  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 8px 12px rgba(0,0,0,0.2);
}

/* 
  分隔线样式
  使用渐变线条作为区块分隔
*/
.divider {
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, #2E7D32, #4285F4);
  margin: 40px 0;
  border: none;
}

/* 
  提示信息样式
  突出显示“这是一个网页样式设计参考”文字
*/
.prompt {
  text-align: center;
  font-size: 1.2em;
  color: #FFFFFF;
  background-color: #2E7D32;
  padding: 20px;
  border-radius: 5px;
  margin: 50px 0;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* 
  代码块样式
  高亮显示CSS代码示例，与正文区分
*/
.code-block {
  background-color: #F0F0F0;
  border-left: 5px solid #4285F4; /* 蓝色边框 */
  padding: 15px;
  border-radius: 5px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 14px;
  overflow-x: auto;
  margin-bottom: 20px;
}

/* 
  章节导航样式
  使用固定在侧边，可点击快速定位
*/
.chapter-nav {
  position: fixed;
  top: 100px;
  left: 20px;
  width: 200px;
}

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

.chapter-nav li {
  margin-bottom: 10px;
}

.chapter-nav a {
  text-decoration: none;
  color: #2E7D32;
  font-family: 'Montserrat', sans-serif;
  transition: color 0.3s ease;
}

.chapter-nav a:hover {
  color: #4285F4;
}

/* 
  响应式设计
  确保在不同设备上的良好展示
*/
@media (max-width: 768px) {
  .main-content {
    padding: 100px 20px 20px;
    grid-template-columns: 1fr;
  }
  
  .chapter-nav {
    display: none; /* 移动端隐藏章节导航 */
  }
}

@media (max-width: 480px) {
  body {
    font-size: 15px; /* 调整手机端字体大小 */
  }

  .section {
    padding: 20px;
  }

  .navbar a {
    margin: 0 10px;
    font-size: 14px;
  }
}

