
/* 定义颜色变量，遵循主色70%，辅色25%，点缀色5%的配色比例 */
:root {
  --primary-color: #212F3D; /* 主色调：深蓝 */
  --secondary-color: #ECF0F1; /* 辅色：浅灰 */
  --accent-color: #E67E22; /* 点缀色：橙色 */
  --text-color: #2C3E50; /* 文字颜色 */
  --background-gradient: linear-gradient(135deg, #212F3D, #E67E22);
}

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

/* 设置body背景和字体 */
body {
  font-family: 'Roboto', sans-serif;
  background-color: var(--secondary-color);
  color: var(--text-color);
  line-height: 1.6;
  padding: 20px;
}

/* 样式化导航栏 */
.navbar {
  position: fixed;
  top: 0;
  width: 100%;
  background: rgba(33, 47, 61, 0.9);
  backdrop-filter: blur(10px);
  padding: 15px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1000;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.navbar a {
  color: #ECF0F1;
  text-decoration: none;
  margin-left: 20px;
  font-weight: 500;
}

.navbar a:hover {
  color: var(--accent-color);
  transition: color 0.3s ease;
}

/* 主内容区样式 */
.container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
  gap: 40px;
  margin-top: 80px; /* 预留导航栏空间 */
}

/* 文章区块样式 */
.article {
  background: rgba(236, 240, 241, 0.8);
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* 文章标题样式 */
.article h2, .article h3 {
  color: var(--primary-color);
  margin-bottom: 15px;
}

.article h2 {
  font-size: 24px;
}

.article h3 {
  font-size: 20px;
}

/* 文章段落样式 */
.article p {
  font-size: 16px;
  margin-bottom: 15px;
  text-align: justify;
}

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

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

/* 代码块样式 */
pre {
  background: #2C3E50;
  color: #ECF0F1;
  padding: 15px;
  border-radius: 8px;
  overflow: auto;
  position: relative;
  margin-bottom: 20px;
}

pre::before {
  content: "代码示例";
  position: absolute;
  top: -20px;
  left: 10px;
  background: var(--primary-color);
  color: #ECF0F1;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 14px;
}

/* 按钮样式 */
.button {
  display: inline-block;
  background: var(--accent-color);
  color: #fff;
  padding: 10px 20px;
  border-radius: 5px;
  text-decoration: none;
  transition: background 0.3s ease;
}

.button:hover {
  background: #d35400;
}

/* 提示信息样式 */
.alert {
  background: var(--accent-color);
  color: #fff;
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
  text-align: center;
  font-weight: 600;
}

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

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