
/* CSS 样式设计参考 */

/* 定义全局变量，便于统一管理颜色 */
:root {
  /* 主色调部分 */
  --forest-green: #34A853; /* 森林绿，用于导航栏和主要按钮 */
  --soil-brown: #964B00; /* 土褐色，用于背景和标题 */
  --light-wood: #F5DEB3; /* 浅木色，用于背景和次要区域 */
  
  /* 辅助色部分 */
  --deep-blue: #1E90FF; /* 深蓝色，用于交互元素和悬浮效果 */
  --silver-gray: #C0C0C0; /* 银灰色，用于文字和次要装饰 */
  
  /* 点缀色部分 */
  --accent-color: #FF5722; /* 鲜艳橙，用于点缀和强调 */
  
  /* 字体 */
  --font-primary: 'Roboto', sans-serif; /* 正文字体 */
  --font-secondary: 'Great Vibes', cursive; /* 标题字体 */
  
  /* 其他变量 */
  --transition-speed: 0.3s; /* 过渡速度 */
}

/* 全局样式设置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-primary);
  line-height: 1.6;
  background: linear-gradient(135deg, var(--forest-green), var(--soil-brown));
  color: var(--silver-gray);
  padding-top: 60px; /* 为固定导航栏留出空间 */
}

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

.navbar a {
  color: var(--light-wood);
  text-decoration: none;
  margin: 0 10px;
  position: relative;
  font-size: 16px;
}

.navbar a:hover::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -5px;
  width: 100%;
  height: 2px;
  background: var(--deep-blue);
  border-radius: 2px;
  animation: glow 0.5s forwards;
}

@keyframes glow {
  from {
    opacity: 0;
    transform: scaleX(0);
  }
  to {
    opacity: 1;
    transform: scaleX(1);
  }
}

/* 主要容器样式 */
.container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  padding: 20px;
}

/* 章节样式 */
.section {
  background-color: var(--light-wood);
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.section.visible {
  opacity: 1;
  transform: translateY(0);
}

/* 标题样式 */
h2, h3, h4 {
  font-family: var(--font-secondary);
  color: var(--forest-green);
  margin-bottom: 10px;
}

h2 {
  font-size: 24px;
}

h3 {
  font-size: 20px;
}

h4 {
  font-size: 18px;
}

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

/* 代码块样式 */
pre {
  background-color: #2d2d2d;
  color: #f8f8f2;
  padding: 15px;
  border-radius: 5px;
  overflow-x: auto;
  margin-bottom: 15px;
  font-size: 14px;
}

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

/* 表格样式 */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 15px;
}

th, td {
  border: 1px solid var(--silver-gray);
  padding: 10px;
  text-align: left;
  font-size: 16px;
}

th {
  background-color: var(--forest-green);
  color: #fff;
}

tbody tr:nth-child(odd) {
  background-color: #f2f2f2;
}

/* 按钮样式 */
.button {
  background-color: var(--deep-blue);
  color: #fff;
  padding: 10px 20px;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  transition: box-shadow var(--transition-speed) ease, background-color var(--transition-speed) ease;
  font-size: 16px;
}

.button:hover {
  box-shadow: 0 0 15px var(--deep-blue);
  background-color: var(--silver-gray);
}

/* 图片样式 */
img {
  width: 100%;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

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

/* 底部样式 */
.footer {
  background-color: var(--soil-brown);
  color: var(--light-wood);
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.footer a {
  color: var(--deep-blue);
  text-decoration: none;
  margin: 0 10px;
  font-size: 16px;
}

.footer a:hover {
  text-decoration: underline;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .navbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .container {
    grid-template-columns: 1fr;
    padding: 10px;
  }

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

/* 动态生态元素动画 */
.leaf, .water-drop {
  position: absolute;
  top: -50px;
}

/* 漂浮叶子动画 */
.leaf {
  animation: float 10s infinite ease-in-out;
}

@keyframes float {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(360deg);
    opacity: 0;
  }
}

/* 流动水滴动画 */
.water-drop {
  animation: drop 5s infinite ease-in;
}

@keyframes drop {
  0% {
    transform: translateY(0) scale(1);
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) scale(0.5);
    opacity: 0;
  }
}

/* 面包屑导航样式 */
.breadcrumb {
  margin-bottom: 15px;
  font-size: 14px;
}

.breadcrumb a {
  color: var(--deep-blue);
  text-decoration: none;
  margin-right: 5px;
}

.breadcrumb a::after {
  content: '>';
  margin-left: 5px;
}

.breadcrumb a:last-child::after {
  content: '';
}

/* 动态显示章节 */
.section.visible {
  opacity: 1;
  transform: translateY(0);
}

/* 章节导航样式 */
.chapter-nav {
  position: fixed;
  top: 60px;
  right: 20px;
  background-color: rgba(52, 168, 83, 0.9);
  padding: 10px;
  border-radius: 5px;
}

.chapter-nav a {
  display: block;
  color: #fff;
  text-decoration: none;
  margin-bottom: 5px;
  font-size: 14px;
}

.chapter-nav a:hover {
  text-decoration: underline;
}

/* 提示信息样式 */
.prominent-message {
  text-align: center;
  padding: 20px;
  background-color: var(--soil-brown);
  color: var(--light-wood);
  font-size: 18px;
  border-radius: 10px;
  margin-bottom: 20px;
}

/* 加载动画样式 */
.loading-animation {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(52, 168, 83, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

