
/* 颜色变量定义，遵循黄金比例配色法则 */
:root {
  --primary-color: #1E3A8A; /* 主色调，深蓝色，营造信任与专业感 */
  --secondary-color: #3B82F6; /* 辅色，亮蓝色，增强层次感与未来感 */
  --accent-color: #EF4444; /* 点缀色，红色，用于吸引视线，制造视觉焦点 */
  --background-color: #0F172A; /* 页面背景色，避免纯白色，增加高级质感 */
  --text-color: #FFFFFF; /* 正文字体颜色，确保与背景的对比度 */
  --secondary-text-color: #CBD5E1; /* 次要文字颜色，提升层次感 */
}

/* 全局样式设置 */
body {
  margin: 0;
  padding: 0;
  background-color: var(--background-color);
  color: var(--text-color);
  font-family: 'Roboto', sans-serif;
  line-height: 1.6;
}

/* 导航栏样式 */
.navbar {
  position: fixed;
  top: 0;
  width: 100%;
  background-color: rgba(30, 58, 138, 0.9);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 15px 0;
  z-index: 1000;
  transition: background-color 0.3s ease;
}

.navbar a {
  color: var(--text-color);
  text-decoration: none;
  font-size: 1em;
  transition: color 0.3s ease, background-color 0.3s ease;
  padding: 10px 15px;
  border-radius: 5px;
}

.navbar a:hover {
  background-color: var(--secondary-color);
  color: var(--text-color);
}

/* 主要内容区的网格布局 */
.grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  padding: 100px 20px 20px 20px; /* 考虑固定导航栏的高度 */
}

/* 卡片样式 */
.card {
  background-color: #1F2937;
  color: var(--text-color);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  transform: translateY(-10px);
  box-shadow: 0 10px 15px rgba(0,0,0,0.2);
}

.card-header {
  background-color: var(--secondary-color);
  padding: 15px;
  font-size: 1.2em;
  color: var(--text-color);
}

.card-body {
  padding: 20px;
}

/* 按钮样式 */
.button-primary, .cta-button {
  background-color: var(--secondary-color);
  color: var(--text-color);
  border: none;
  padding: 10px 20px;
  cursor: pointer;
  border-radius: 25px;
  transition: background-color 0.3s ease, transform 0.3s ease;
  box-shadow: 0 4px 6px rgba(0,0,0,0.2);
}

.button-primary:hover, .cta-button:hover {
  background-color: var(--accent-color);
  transform: scale(1.05);
}

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

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

/* CSS3代码示例样式 */
.code-block {
  background-color: #111827;
  color: #E5E7EB;
  padding: 20px;
  border-radius: 8px;
  overflow-x: auto;
  font-family: 'Courier New', Courier, monospace;
  margin: 20px 0;
}

.code-block code {
  display: block;
}

/* 顶部提示信息样式 */
.header-note {
  text-align: center;
  padding: 50px 20px;
  font-size: 1.5em;
  color: var(--secondary-color);
}

/* 固定导航栏下的空间填充 */
.space-filler {
  height: 60px;
}

/* 微动画：闪烁效果 */
@keyframes twinkle {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* 星空背景样式 */
.starry-background {
  position: relative;
  width: 100%;
  height: 100vh;
  background: var(--primary-color);
  overflow: hidden;
}

.starry-background .star {
  position: absolute;
  width: 2px;
  height: 2px;
  background: #FFFFFF;
  border-radius: 50%;
  animation: twinkle 5s infinite;
}

/* 科技线路动画 */
.tech-lines {
  position: absolute;
  width: 100%;
  height: 100%;
  background: linear-gradient(45deg, transparent 25%, var(--secondary-color) 25%, var(--secondary-color) 50%, transparent 50%, transparent 75%, var(--secondary-color) 75%, var(--secondary-color));
  background-size: 50px 50px;
  animation: moveLines 10s linear infinite;
}

@keyframes moveLines {
  from { background-position: 0 0; }
  to { background-position: 50px 50px; }
}

/* 淡入动画 */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 1s forwards;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 固定聊天按钮 */
.chat-button {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background-color: var(--accent-color);
  color: var(--text-color);
  border: none;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  font-size: 1.5em;
  box-shadow: 0 4px 6px rgba(0,0,0,0.3);
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.3s ease;
}

.chat-button:hover {
  background-color: var(--secondary-color);
  transform: rotate(360deg);
}

/* 响应式设计 */
@media (max-width: 1200px) {
  .grid-container {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  }
}

@media (max-width: 768px) {
  .navbar {
    flex-direction: column;
  }

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

  .header-note {
    font-size: 1.2em;
  }
}

/* 章节导航样式 */
.chapter-nav {
  position: fixed;
  top: 80px;
  left: 20px;
  background-color: rgba(30, 58, 138, 0.8);
  padding: 10px;
  border-radius: 8px;
}

.chapter-nav a {
  display: block;
  color: var(--text-color);
  text-decoration: none;
  margin: 5px 0;
  transition: color 0.3s ease, background-color 0.3s ease;
  padding: 5px 10px;
  border-radius: 5px;
}

.chapter-nav a:hover {
  background-color: var(--secondary-color);
  color: var(--text-color);
}

/* 折叠区域样式 */
.collapsible {
  background-color: var(--primary-color);
  color: var(--text-color);
  cursor: pointer;
  padding: 10px;
  width: 100%;
  border: none;
  text-align: left;
  outline: none;
  font-size: 1em;
  border-radius: 5px;
  transition: background-color 0.3s ease;
}

.collapsible:hover {
  background-color: var(--secondary-color);
}

.collapsible:after {
  content: '\002B'; /* 加号符号 */
  font-size: 13px;
  float: right;
}

.collapsible.active:after {
  content: "\2212"; /* 减号符号 */
}

.content {
  padding: 0 15px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  background-color: var(--background-color);
}

/* 代码块高亮样式 */
pre {
  background-color: #1F2937;
  color: #D1D5DB;
  padding: 15px;
  border-radius: 8px;
  overflow-x: auto;
}

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

/* 总体过渡效果 */
* {
  transition: all 0.3s ease;
}

