
/* 主要颜色变量定义 */
:root {
  --primary-color: #d4a373; /* 米黄色，作为主色调 */
  --secondary-color: #8d6748; /* 褐色，作为辅色 */
  --accent-color: #556b2f; /* 橄榄绿，增加层次感 */
  --tech-color: #1e90ff; /* 蓝色，体现科技属性 */
  --cta-color: #ff4500; /* 亮橙色，用于点缀和CTA按钮 */
  --background-gradient: linear-gradient(135deg, #d4a373, #1e90ff); /* 渐变背景 */
  --section-bg-gradient: radial-gradient(circle at top left, #556b2f, #d4a373); /* 部分区域的渐变背景 */
  --shadow-color: rgba(0, 0, 0, 0.1); /* 阴影颜色 */
  --hover-shadow-color: rgba(0, 0, 0, 0.2); /* 悬浮时阴影颜色 */
}

/* 全局样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
/* 页面背景和字体 */
body {
  background: var(--primary-color);
  color: var(--secondary-color);
  font-family: 'Montserrat', sans-serif;
  line-height: 1.6;
  font-size: 16px; /* 正文字号 */
  padding-top: 70px; /* 避免导航栏遮挡内容 */
  transition: background 0.3s ease;
}

/* 导航栏样式 */
.navbar {
  position: fixed;
  top: 0;
  width: 100%;
  background-color: var(--primary-color);
  box-shadow: 0 2px 4px var(--shadow-color);
  padding: 15px 20px;
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.navbar a {
  color: var(--secondary-color);
  margin: 0 10px;
  text-decoration: none;
  transition: color 0.3s ease;
}

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

/* 主要内容容器 */
.container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  grid-gap: 20px;
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

/* 模块样式 */
.module {
  background-color: #fff;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 4px 6px var(--shadow-color);
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.module:hover {
  box-shadow: 0 6px 8px var(--hover-shadow-color);
  transform: translateY(-5px);
}

/* 按钮样式 */
.button {
  background-color: var(--cta-color);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.2s ease;
}

.button:hover {
  background-color: darken(var(--cta-color), 10%);
  transform: scale(1.05);
}

/* 图片样式 */
img.decorative {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 4px 6px var(--shadow-color);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

img.decorative:hover {
  transform: scale(1.02);
  box-shadow: 0 6px 8px var(--hover-shadow-color);
}

/* 标题样式 */
h2, h3, h4 {
  color: var(--secondary-color);
  margin-bottom: 15px;
}

h2 {
  font-size: 24px; /* h2标题字号 */
}

h3 {
  font-size: 20px; /* h3标题字号 */
}

h4 {
  font-size: 18px; /* h4标题字号 */
}

/* 段落样式 */
p {
  margin-bottom: 15px;
  font-size: 16px;
  line-height: 1.8;
}

/* 代码块样式 */
pre {
  background-color: #f5f5f5;
  padding: 15px;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 15px;
}

code {
  font-family: 'Fira Code', monospace;
  color: #333;
}

/* 折叠区域样式 */
.collapsible {
  background-color: var(--primary-color);
  color: var(--secondary-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: darken(var(--primary-color), 10%);
}

.collapsible + .content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  background-color: #fff;
  padding: 0 10px;
  border-radius: 4px;
  box-shadow: 0 2px 4px var(--shadow-color);
}

.collapsible.active + .content {
  max-height: 500px; /* 足够显示内容 */
  padding: 15px;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .navbar {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .container {
    grid-template-columns: 1fr;
    padding: 10px;
  }
  
  .button {
    width: 100%;
    padding: 15px;
  }
}

@media (min-width: 769px) and (max-width: 1200px) {
  .container {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  }
}

@media (max-width: 500px) {
  .module, pre, .content {
    padding: 15px;
  }
  
  h2 {
    font-size: 20px;
  }
  
  h3 {
    font-size: 18px;
  }
  
  h4 {
    font-size: 16px;
  }
  
  p {
    font-size: 15px;
  }
}

