
/* 
  页面整体样式设计
  使用现代CSS3技术，包括Flexbox、Grid、动画、过渡效果、3D变换等
  颜色搭配遵循70%主色、25%辅色、5%点缀色的黄金比例
  页面响应式设计，适配320px到1920px的各种屏幕宽度
  微交互效果提升用户体验，确保页面无视觉瑕疵
*/

/* 定义CSS变量，便于主题管理 */
:root {
  /* 主色调 - 深蓝 */
  --primary-color: #2C3E50;
  /* 辅助色 - 灰色 */
  --secondary-color: #95A5A6;
  /* 点缀色 - 亮橙 */
  --accent-color-orange: #E67E22;
  /* 点缀色 - 绿色 */
  --accent-color-green: #27AE60;
  /* 背景色 - 淡灰 */
  --background-color: #ECF0F1;
  /* 字体颜色 */
  --text-color: #2C3E50;
  /* 标题颜色 */
  --header-color: #34495E;
}

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

body {
  background-color: var(--background-color);
  color: var(--text-color);
  font-family: 'Roboto', sans-serif;
  line-height: 1.6;
  font-size: 16px;
  padding: 20px;
}

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

.navbar .logo {
  color: #FFFFFF;
  font-size: 24px;
  font-weight: bold;
}

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

.navbar ul li {
  margin-left: 20px;
}

.navbar ul li a {
  color: #FFFFFF;
  text-decoration: none;
  font-size: 16px;
  transition: color 0.3s ease;
}

.navbar ul li a:hover {
  color: var(--accent-color-orange);
}

/* 汉堡菜单样式（移动端） */
.hamburger-menu {
  display: none;
  flex-direction: column;
  cursor: pointer;
}

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

/* 展示导航菜单（移动端） */
@media (max-width: 768px) {
  .navbar ul {
    display: none;
    flex-direction: column;
    width: 100%;
    background-color: var(--primary-color);
    position: absolute;
    top: 60px;
    left: 0;
  }

  .navbar ul.active {
    display: flex;
  }

  .navbar ul li {
    margin: 15px 0;
    text-align: center;
  }

  .hamburger-menu {
    display: flex;
  }
}

/* 主要内容区域 */
.main {
  margin-top: 80px;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

/* 章节导航样式 */
.chapter-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 30px;
}

.chapter-nav a {
  background-color: var(--secondary-color);
  color: #FFFFFF;
  padding: 10px 20px;
  border-radius: 25px;
  text-decoration: none;
  transition: background-color 0.3s ease, transform 0.3s ease;
}

.chapter-nav a:hover {
  background-color: var(--accent-color-green);
  transform: translateY(-3px);
}

/* 文章内容样式 */
article {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
}

article h2, article h3, article h4 {
  color: var(--header-color);
}

article h2 {
  font-size: 28px;
  margin-bottom: 20px;
}

article h3 {
  font-size: 24px;
  margin-bottom: 15px;
}

article h4 {
  font-size: 20px;
  margin-bottom: 10px;
}

article p {
  font-size: 17px;
  margin-bottom: 15px;
}

article pre {
  background-color: #2C3E50;
  color: #ECF0F1;
  padding: 15px;
  border-radius: 8px;
  overflow-x: auto;
}

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

/* 图片样式 */
.article-image {
  width: 100%;
  max-width: 320px;
  border-radius: 10px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

/* 分隔线样式 */
.separator {
  height: 2px;
  background: linear-gradient(90deg, var(--accent-color-orange), var(--accent-color-green));
  border: none;
  margin: 40px 0;
}

/* 提示信息样式 */
.notice {
  background-color: var(--accent-color-green);
  color: #FFFFFF;
  padding: 15px;
  border-radius: 5px;
  text-align: center;
  font-weight: bold;
  margin-bottom: 30px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* 按钮样式 */
.button {
  background-color: var(--accent-color-orange);
  color: #FFFFFF;
  padding: 10px 25px;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.3s ease;
}

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

/* 图表样式 */
.chart {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.bar {
  width: 40px;
  background-color: var(--accent-color-green);
  transition: height 0.5s ease;
}

.bar:hover {
  background-color: var(--accent-color-orange);
}

/* 页脚样式 */
.footer {
  text-align: center;
  padding: 20px;
  background-color: var(--primary-color);
  color: #FFFFFF;
  margin-top: 50px;
  border-radius: 10px;
}

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

.fade-in {
  animation: fadeIn 2s ease-in-out;
}

/* 代码示例样式 */
.code-example {
  background-color: #34495E;
  color: #ECF0F1;
  padding: 20px;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 30px;
}

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