
/* 定义全局变量，用于统一管理颜色 */
:root {
  --main-color: #1A237E; /* 主色调：深蓝色，传达科技感与专业性 */
  --accent-color: #29B6F6; /* 辅助色：电光蓝，用于强调重要信息 */
  --background-color: #EEEEEE; /* 背景色：浅灰色，保持简洁与现代感 */
  --text-color: #333333; /* 正文字体颜色 */
  --header-height: 60px; /* 头部高度 */
  --footer-height: 40px; /* 底部高度 */
}

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

/* 容器设置，使用CSS Grid布局 */
.container {
  display: grid;
  grid-template-areas:
    "header"
    "main"
    "footer";
  grid-template-rows: var(--header-height) 1fr var(--footer-height);
  min-height: 100vh;
}

/* 头部样式 */
.header {
  grid-area: header;
  background: linear-gradient(90deg, var(--main-color), var(--accent-color));
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 品牌标识 */
.brand {
  font-size: 1.5em;
  color: white;
  text-decoration: none;
}

/* 导航菜单 */
.nav-links {
  display: flex;
  gap: 15px;
}

.nav-links a {
  color: white;
  text-decoration: none;
  font-size: 1em;
  position: relative;
  transition: color 0.3s ease;
}

.nav-links a::after {
  content: '';
  display: block;
  width: 0;
  height: 2px;
  background: white;
  transition: width 0.3s;
  position: absolute;
  bottom: -5px;
  left: 0;
}

.nav-links a:hover {
  color: #FFD700; /* 点缀色：金色，吸引视线 */
}

.nav-links a:hover::after {
  width: 100%;
}

/* 主内容区域 */
.main {
  grid-area: main;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* 文章样式 */
article {
  max-width: 800px;
  margin: 0 auto;
  background-color: white;
  padding: 30px;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* 文章标题 */
article h2, article h3 {
  color: var(--main-color);
}

article h2 {
  font-size: 2em;
  margin-bottom: 10px;
}

article h3 {
  font-size: 1.5em;
  margin-top: 20px;
}

/* 段落样式 */
article p {
  font-size: 1em;
  margin: 10px 0;
}

/* 强调文字 */
article span {
  font-weight: bold;
  color: var(--accent-color);
}

/* 代码块样式 */
pre {
  background-color: #f5f5f5;
  padding: 15px;
  border-radius: 5px;
  overflow: auto;
  position: relative;
}

pre code {
  font-family: 'Courier New', Courier, monospace;
  color: #2d2d2d;
}

/* 为代码块添加标题 */
pre code::before {
  content: "代码示例";
  display: block;
  background: var(--main-color);
  color: white;
  padding: 5px 10px;
  border-top-left-radius: 5px;
  border-top-right-radius: 5px;
  font-size: 0.9em;
  font-weight: bold;
}

/* 表格样式 */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
}

table th, table td {
  border: 1px solid #ddd;
  padding: 10px;
  text-align: left;
}

table th {
  background-color: var(--main-color);
  color: white;
}

table tr:nth-child(even) {
  background-color: #f9f9f9;
}

/* 按钮样式 */
.button {
  background: linear-gradient(45deg, var(--accent-color), var(--main-color));
  border: none;
  color: white;
  padding: 15px 32px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 1em;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  border-radius: 4px;
  cursor: pointer;
}

.button:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 16px rgba(0, 0, 0, 0.2);
}

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

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

/* 响应式设计 */
@media (max-width: 768px) {
  .nav-links {
    flex-direction: column;
    gap: 10px;
  }

  .header {
    flex-direction: column;
    align-items: flex-start;
    height: auto;
    padding: 10px;
  }

  .main {
    padding: 10px;
  }

  article {
    padding: 20px;
  }
}

@media (max-width: 480px) {
  .brand {
    font-size: 1.2em;
  }

  .nav-links a {
    font-size: 0.9em;
  }

  .button {
    padding: 10px 20px;
    font-size: 0.9em;
  }
}

