
/* 全局变量定义 */
:root {
  --primary-color: #1E272E; /* 主色调：深蓝色 */
  --secondary-color: #BFCBCF; /* 辅助色：银灰色 */
  --accent-color-1: #34C759; /* 点缀色1：荧光绿 */
  --accent-color-2: #03A9F4; /* 点缀色2：电蓝色 */
  --background-gradient: linear-gradient(135deg, #1E272E, #0f141c); /* 背景渐变 */
}

/* 全局样式 */
body {
  margin: 0;
  padding: 0;
  background: var(--background-gradient);
  color: var(--secondary-color);
  font-family: 'Roboto', sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

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

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

.navbar li {
  position: relative;
  margin: 0 15px;
}

.navbar a {
  color: var(--secondary-color);
  text-decoration: none;
  padding: 8px 12px;
  transition: color 0.3s;
}

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

.navbar li ul {
  display: none;
  position: absolute;
  top: 40px;
  background-color: var(--primary-color);
  padding: 10px;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.navbar li:hover ul {
  display: block;
  animation: dropdown 0.3s ease-in-out;
}

@keyframes dropdown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 容器样式 */
.container {
  max-width: 1200px;
  margin: 100px auto 50px;
  padding: 0 20px;
  display: grid;
  grid-template-areas:
    'header'
    'main'
    'footer';
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr auto;
}

/* 头部样式 */
header {
  grid-area: header;
  text-align: center;
  margin-bottom: 50px;
}

header h1 {
  color: var(--accent-color-1);
  font-size: 2.5em;
  margin-bottom: 10px;
}

.notice {
  font-size: 1.2em;
  color: var(--accent-color-2);
  margin-bottom: 20px;
}

/* 章节导航 */
.nav-chapters {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 40px;
}

.nav-chapters a {
  background-color: var(--accent-color-1);
  color: #fff;
  padding: 10px 15px;
  margin: 5px;
  border-radius: 20px;
  text-decoration: none;
  transition: background-color 0.3s;
}

.nav-chapters a:hover {
  background-color: var(--accent-color-2);
}

/* 文章内容区块 */
.article-section {
  margin-bottom: 50px;
}

.article-section h2 {
  font-size: 2em;
  color: var(--accent-color-1);
  margin-bottom: 15px;
}

.article-section p {
  font-size: 1em;
  margin-bottom: 15px;
}

/* 图片样式 */
.article-section img {
  width: 100%;
  max-width: 320px;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  margin: 10px 0;
  transition: transform 0.3s, box-shadow 0.3s;
}

.article-section img:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 12px rgba(0,0,0,0.3);
}

/* 代码块样式 */
.code-block {
  background-color: rgba(27,31,35,0.05);
  border-left: 4px solid var(--accent-color-1);
  padding: 15px;
  margin: 20px 0;
  overflow-x: auto;
  border-radius: 5px;
}

.code-block pre {
  margin: 0;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.95em;
  color: #c7254e;
}

/* 返回顶部按钮 */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background-color: var(--accent-color-2);
  color: #fff;
  padding: 10px 15px;
  border-radius: 50%;
  cursor: pointer;
  display: none;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 1000;
}

.back-to-top.show {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.back-to-top:hover {
  background-color: var(--accent-color-1);
  transform: translateY(-2px);
}

/* 响应式设计调整 */
@media (min-width: 768px) {
  .container {
    grid-template-areas:
      'header'
      'main'
      'footer';
    grid-template-columns: 1fr;
  }

  .nav-chapters {
    justify-content: flex-start;
  }
}

@media (min-width: 1200px) {
  .container {
    padding: 0 40px;
  }
}

/* 动画与过渡 */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.page-content {
  animation: fadeIn 1s ease-in;
}

/* 其他微交互效果 */
.button {
  background-color: var(--accent-color-1);
  color: #fff;
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  transition: background-color 0.3s, transform 0.2s;
  cursor: pointer;
}

.button:hover {
  background-color: var(--accent-color-2);
  transform: translateY(-2px);
}

/* 文章内链接样式 */
.article-section a {
  color: var(--accent-color-1);
  text-decoration: none;
  transition: color 0.3s;
}

.article-section a:hover {
  color: var(--accent-color-2);
}

/* 页脚样式 */
footer {
  grid-area: footer;
  text-align: center;
  padding: 20px 0;
  color: #ccc;
  font-size: 0.9em;
}

/* 代码示例区分 */
.code-example {
  background-color: #2d3436;
  color: #dfe6e9;
  padding: 15px;
  border-radius: 5px;
  overflow-x: auto;
  font-family: 'Courier New', Courier, monospace;
  margin-bottom: 20px;
  font-size: 0.9em;
}

/* 确保图片描述属性为空 */
img {
  alt: "";
}

