
/* 全局样式重置，确保不同浏览器下的一致性 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* 定义CSS变量用于统一色彩管理 */
:root {
  --main-color: #1b263b; /* 主色调深蓝 */
  --secondary-color: #a0c4ff; /* 辅助色浅蓝 */
  --accent-color: #00d2ff; /* 点缀色亮蓝 */
  --background-gradient: linear-gradient(135deg, #0d1b2a, #1b263b);
  --font-family: 'Roboto', sans-serif;
}

/* 设置主体背景和字体 */
body {
  background: var(--background-gradient);
  color: #ffffff;
  font-family: var(--font-family);
  line-height: 1.6;
  padding-top: 60px; /* 为固定导航预留空间 */
}

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

/* 导航链接样式 */
.navbar a {
  color: #ffffff;
  text-decoration: none;
  font-size: 16px;
  margin: 0 15px;
  transition: color 0.3s ease;
}

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

/* 主体容器使用网格布局 */
.container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
  gap: 40px;
  padding: 50px;
}

/* 文章内容样式 */
article {
  max-width: 1200px;
  margin: 0 auto;
}

/* 标题样式 */
h2, h3, h4 {
  margin-bottom: 20px;
  color: var(--accent-color);
}

h2 {
  font-size: 2em;
  border-bottom: 2px solid var(--secondary-color);
  padding-bottom: 10px;
}

h3 {
  font-size: 1.75em;
  margin-top: 30px;
}

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

/* 段落样式 */
p {
  font-size: 16px;
  margin-bottom: 20px;
  text-align: justify;
}

/* 代码块样式 */
pre {
  background: rgba(255, 255, 255, 0.1);
  padding: 15px;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 20px;
}

code {
  color: #a0c4ff;
  font-family: 'Courier New', Courier, monospace;
  font-size: 15px;
}

/* 按钮样式 */
.button {
  background-image: var(--background-gradient);
  border: none;
  padding: 15px 30px;
  color: #ffffff;
  font-size: 16px;
  border-radius: 25px;
  cursor: pointer;
  transition: background-image 0.5s ease;
}

.button:hover {
  background-image: linear-gradient(90deg, #8e2de2, #4a00e0);
}

/* 图片样式，添加圆角和阴影 */
img {
  width: 100%;
  border-radius: 10px;
  box-shadow: 0 4px 8px 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 16px rgba(0, 0, 0, 0.5);
}

/* 响应式布局调整 */
@media (max-width: 768px) {
  .navbar {
    flex-direction: column;
    padding: 20px 0;
  }

  .navbar a {
    margin: 10px 0;
  }

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

  h2 {
    font-size: 1.5em;
  }

  h3 {
    font-size: 1.3em;
  }

  h4 {
    font-size: 1.1em;
  }

  p {
    font-size: 15px;
  }
}

/* 定义关键帧动画，实现旋转线条效果 */
@keyframes rotateLine {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* 定义关键帧动画，实现按钮闪光效果 */
@keyframes shine {
  to {
    left: 100%;
  }
}

/* 代码块内样式 */
.language-css {
  background: rgba(0, 0, 0, 0.2);
  padding: 10px;
  border-radius: 5px;
}

/* 高亮显示代码块 */
pre code {
  display: block;
  white-space: pre-wrap;
  word-wrap: break-word;
}

