
/* 全局样式设置 */
/* 设置页面的默认字体、背景颜色、文字颜色以及过渡效果 */
body {
  margin: 0;
  padding: 0;
  font-family: 'Roboto', sans-serif;
  background: linear-gradient(135deg, #1e3c72 70%, #2a5298 25%, #ff7e5f 5%);
  color: #333;
  transition: background 0.3s ease, color 0.3s ease;
}

/* 导航栏样式 */
/* 设置导航栏的布局、背景、阴影以及固定位置 */
.navbar {
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  position: fixed;
  width: 100%;
  top: 0;
  z-index: 1000;
}

/* 导航链接样式 */
/* 设置导航链接的颜色、内边距以及过渡效果 */
.navbar a {
  text-decoration: none;
  color: #333;
  padding: 15px 20px;
  transition: color 0.3s ease;
}

/* 导航链接悬停效果 */
/* 在鼠标悬停时改变链接颜色 */
.navbar a:hover {
  color: #ff7e5f;
}

/* 主要内容容器样式 */
/* 使用网格布局设置主要内容区域 */
.container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  padding: 100px 20px 20px;
}

/* 章节导航样式 */
/* 设置章节导航的背景、内边距和边框圆角 */
.table-of-contents {
  background: rgba(255, 255, 255, 0.2);
  padding: 20px;
  border-radius: 10px;
  margin-bottom: 30px;
}

/* 章节导航列表样式 */
/* 移除默认列表样式并设置列表项的间距 */
.table-of-contents ul {
  list-style: none;
  padding: 0;
}

.table-of-contents li {
  margin-bottom: 10px;
}

/* 章节导航链接样式 */
/* 设置章节链接的颜色以及悬停时的颜色变化 */
.table-of-contents a {
  text-decoration: none;
  color: #2a5298;
  transition: color 0.3s ease;
}

.table-of-contents a:hover {
  color: #ff7e5f;
}

/* 文章样式 */
/* 设置文章的最大宽度、外边距和内边距 */
article {
  max-width: 800px;
  margin: 0 auto;
}

/* 文章标题样式 */
/* 设置文章中h2标题的字体大小、颜色和下边距 */
article h2 {
  font-size: 1.8em;
  color: #1e3c72;
  margin-bottom: 10px;
}

/* 文章段落样式 */
/* 设置文章段落的内边距、背景颜色、边框圆角和阴影效果 */
article section {
  margin-bottom: 30px;
  padding: 20px;
  background: rgba(255,255,255,0.2);
  border-radius: 10px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  transition: background 0.3s ease;
}

/* 文章段落悬停效果 */
/* 在鼠标悬停时改变段落背景颜色 */
article section:hover {
  background: rgba(255,255,255,0.3);
}

/* 图片样式 */
/* 设置图片的宽度、最大宽度、圆角、阴影和过渡效果 */
img {
  width: 100%;
  max-width: 320px;
  border-radius: 10px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  transition: transform 0.3s ease;
}

/* 图片悬停效果 */
/* 在鼠标悬停时放大图片 */
img:hover {
  transform: scale(1.05);
}

/* 代码块样式 */
/* 为代码块设置背景颜色、内边距、边框圆角和阴影效果 */
.code-block {
  background: #f5f5f5;
  padding: 15px;
  border-radius: 5px;
  overflow-x: auto;
  font-family: 'Courier New', Courier, monospace;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.1);
  margin-bottom: 20px;
}

/* 预格式化文本样式 */
/* 移除预格式化文本的默认外边距 */
.code-block pre {
  margin: 0;
}

/* 响应式设计 */
/* 在屏幕宽度大于768px时，设置网格布局为两列 */
@media (min-width: 768px) {
  .container {
    grid-template-columns: 1fr 1fr;
  }

  img {
    max-width: 100%;
  }
}

/* 按钮样式 */
/* 设置按钮的背景颜色、文字颜色、内边距、边框圆角以及过渡效果 */
.button {
  background-color: #ff7e5f;
  color: #fff;
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  transition: background-color 0.3s ease, transform 0.3s ease;
  cursor: pointer;
  text-decoration: none;
}

/* 按钮悬停效果 */
/* 在鼠标悬停时改变按钮背景颜色并放大 */
.button:hover {
  background-color: #feb47b;
  transform: scale(1.05);
}

/* 动画效果 */
/* 定义淡入动画 */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* 应用于元素的淡入效果 */
.fade-in {
  animation: fadeIn 1s ease-in-out;
}

/* CSS代码示例块样式 */
/* 为CSS代码示例块设置专属样式，与主体内容区分 */
.css-example {
  background: #2a5298;
  color: #fff;
  padding: 20px;
  border-radius: 10px;
  font-family: 'Courier New', Courier, monospace;
  overflow-x: auto;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  margin-bottom: 20px;
}

/* CSS代码块内部高亮样式 */
/* 为代码中的关键字添加高亮效果 */
.css-example .keyword {
  color: #ff7e5f;
  font-weight: bold;
}

/* 强调文本样式 */
/* 为需要强调的文本添加粗体和颜色变化 */
strong {
  color: #ff7e5f;
  font-weight: bold;
}

