
/* 全局样式设置 */
body {
  margin: 0;
  padding: 0;
  background: linear-gradient(135deg, #1e3c72, #2a5298, #8e44ad); /* 主色调渐变背景 */
  color: #ffffff;
  font-family: 'Roboto', sans-serif;
  line-height: 1.6;
  overflow-x: hidden; /* 避免横向滚动条 */
}

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

.navbar .logo {
  font-size: 1.5em;
  font-weight: bold;
  color: #ffffff;
}

.navbar .nav-links {
  list-style: none;
  display: flex;
}

.navbar .nav-links li {
  margin: 0 15px;
}

.navbar .nav-links a {
  color: #ffffff;
  text-decoration: none;
  font-size: 1em;
  transition: color 0.3s ease;
}

.navbar .nav-links a:hover {
  color: #00c6ff;
}

/* 移动端导航样式 */
.hamburger {
  display: none;
  flex-direction: column;
  cursor: pointer;
}

.hamburger div {
  width: 25px;
  height: 3px;
  background: #ffffff;
  margin: 4px 0;
  transition: all 0.3s ease;
}

@media (max-width: 768px) {
  .navbar .nav-links {
    display: none;
    flex-direction: column;
    position: fixed;
    top: 0;
    right: -200px;
    background: rgba(0, 0, 0, 0.9);
    height: 100%;
    width: 200px;
    padding-top: 60px;
    transition: right 0.3s ease;
  }

  .navbar .nav-links.active {
    right: 0;
  }

  .hamburger {
    display: flex;
  }
}

/* 主要内容区域 */
.main-content {
  padding: 100px 40px 40px 40px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

/* 文章样式 */
article {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

article:hover {
  transform: translateY(-10px);
  box-shadow: 0 8px 12px rgba(0, 0, 0, 0.2);
}

article h2, article h3, article h4 {
  color: #00c6ff;
}

article pre {
  background: rgba(0, 0, 0, 0.5);
  padding: 15px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 15px 0;
}

article code {
  color: #fffa;
  font-family: 'Courier New', Courier, monospace;
}

/* 图片样式 */
.image-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.image-gallery img {
  width: 100%;
  max-width: 320px;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

/* 提示信息样式 */
.reference-note {
  text-align: center;
  font-size: 1.2em;
  margin: 40px 0;
  color: #ff7f50;
  font-weight: bold;
}

/* 折叠区域样式 */
.collapsible {
  background-color: rgba(0, 0, 0, 0.6);
  color: #ffffff;
  cursor: pointer;
  padding: 10px;
  width: 100%;
  border: none;
  text-align: left;
  outline: none;
  font-size: 1em;
  border-radius: 8px;
  margin: 10px 0;
  transition: background 0.3s ease;
}

.collapsible:hover {
  background-color: rgba(0, 0, 0, 0.8);
}

.content {
  padding: 0 20px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  background-color: rgba(0, 0, 0, 0.4);
  border-radius: 8px;
}

/* 章节导航样式 */
.chapter-nav {
  position: fixed;
  top: 80px;
  right: 20px;
  background: rgba(0, 0, 0, 0.7);
  padding: 15px;
  border-radius: 8px;
  max-width: 200px;
}

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

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

.chapter-nav a {
  color: #ffffff;
  text-decoration: none;
  font-size: 0.9em;
  transition: color 0.3s ease;
}

.chapter-nav a:hover {
  color: #00c6ff;
}

/* 代码示例样式 */
.code-example {
  background: rgba(0, 0, 0, 0.6);
  padding: 15px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 20px 0;
}

.code-example code {
  color: #00ff00;
  font-family: 'Courier New', Courier, monospace;
}

/* 点击展开内容的样式调整 */
.collapsible.active + .content {
  max-height: 500px; /* 根据内容调整 */
}

/* 响应式调整 */
@media (max-width: 768px) {
  .main-content {
    padding: 100px 20px 20px 20px;
  }

  .chapter-nav {
    display: none;
  }
}

