
/* 
 * 全局样式设置
 * 设置页面的基础字体、颜色和背景
 */
body {
  margin: 0;
  padding: 0;
  font-family: 'Roboto', sans-serif; /* 使用现代无衬线字体，保证阅读舒适 */
  background: linear-gradient(135deg, #1e3c72, #2a5298); /* 主背景采用蓝色渐变，符合科技感 */
  color: #ffffff; /* 设置全局文字颜色为白色，确保与背景的对比度 */
  line-height: 1.6;
}

/* 
 * 固定导航栏样式
 * 导航栏固定在顶部，半透明背景，包含主要导航链接
 */
.navbar {
  position: fixed;
  top: 0;
  width: 100%;
  background: rgba(255, 255, 255, 0.1); /* 半透明背景，符合玻璃拟态风格 */
  backdrop-filter: blur(10px); /* 应用模糊效果，增强玻璃感 */
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); /* 添加阴影，提升层次感 */
  padding: 15px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1000; /* 确保导航栏在最上层 */
}

/* 
 * 导航栏链接样式
 * 设置导航链接的颜色、间距及悬停效果
 */
.navbar a {
  color: #ffffff;
  margin: 0 15px;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
}

.navbar a:hover {
  color: #2a5298; /* 悬停时颜色变化，增强互动性 */
}

/* 
 * 主内容区域的样式
 * 设置内容区域的内边距，避免内容被导航栏遮挡
 */
.main-content {
  padding: 100px 20px 50px 20px; /* 上方留白确保内容不被固定导航栏遮挡 */
}

/* 
 * 章节导航系统样式
 * 设计清晰的章节导航，帮助用户快速定位内容
 */
.chapter-nav {
  position: fixed;
  top: 100px;
  right: 20px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  padding: 15px;
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.chapter-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.chapter-nav li {
  margin-bottom: 10px;
}

.chapter-nav a {
  color: #ffffff;
  text-decoration: none;
  font-size: 16px;
  transition: color 0.3s ease;
}

.chapter-nav a:hover {
  color: #2a5298;
}

/* 
 * 标题样式
 * 设置不同层级标题的字体大小和间距
 */
h1, h2, h3, h4 {
  color: #ffffff;
  margin-bottom: 20px;
}

h1 {
  font-size: 2.5rem;
}

h2 {
  font-size: 2rem;
}

h3 {
  font-size: 1.75rem;
}

h4 {
  font-size: 1.5rem;
}

/* 
 * 文章内容样式
 * 设置段落、代码块、表格等内容的样式
 */
article {
  max-width: 1200px;
  margin: 0 auto;
}

article p {
  font-size: 16px;
  margin-bottom: 20px;
}

article pre {
  background: rgba(0, 0, 0, 0.6);
  padding: 15px;
  border-radius: 10px;
  overflow-x: auto;
}

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

article table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
}

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

article th {
  background: rgba(255, 255, 255, 0.2);
}

article tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.1);
}

/* 
 * 图片装饰样式
 * 设置图片的圆角、阴影和悬停效果
 */
img.decorative-image {
  width: 100%;
  max-width: 320px;
  border-radius: 15px; /* 圆角效果 */
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3); /* 阴影提升立体感 */
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

img.decorative-image:hover {
  transform: scale(1.05); /* 悬停时略微放大 */
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5); /* 增强阴影 */
}

/* 
 * 按钮样式
 * 设置按钮的颜色、边框、圆角及悬停效果
 */
.button {
  padding: 12px 25px;
  background: linear-gradient(45deg, #2a5298, #1e3c72); /* 渐变背景 */
  border: none;
  border-radius: 30px;
  color: #ffffff;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.3s ease;
}

.button:hover {
  background: linear-gradient(45deg, #1e3c72, #2a5298); /* 悬停时颜色反转 */
  transform: translateY(-5px); /* 轻微上移 */
}

/* 
 * 卡片样式
 * 设置信息卡片的玻璃拟态效果及交互反馈
 */
.card {
  background: rgba(255, 255, 255, 0.1); /* 半透明背景 */
  border: 1px solid rgba(255, 255, 255, 0.3); /* 边框 */
  border-radius: 15px;
  backdrop-filter: blur(10px); /* 模糊效果 */
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37); /* 深色阴影 */
  padding: 20px;
  color: #ffffff;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
}

.card:hover {
  transform: translateY(-10px); /* 悬停时上移 */
  box-shadow: 0 16px 64px 0 rgba(31, 38, 135, 0.5); /* 增强阴影 */
}

/* 
 * 响应式布局
 * 使用媒体查询确保在不同屏幕尺寸下页面布局的适应性
 */
@media (max-width: 1920px) {
  /* 针对更大屏幕的优化 */
}

@media (max-width: 1366px) {
  /* 针对中等屏幕的优化 */
}

@media (max-width: 768px) {
  /* 针对平板设备的优化 */
  .chapter-nav {
    display: none; /* 移动设备隐藏章节导航，避免占用空间 */
  }
}

@media (max-width: 480px) {
  /* 针对手机设备的优化 */
  .navbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .navbar a {
    margin: 10px 0;
  }

  .main-content {
    padding: 80px 15px 30px 15px;
  }
}

/* 
 * 代码示例块样式
 * 为文章中的CSS3代码块设计专属样式，区别于正文样式
 */
.code-sample {
  background: rgba(0, 0, 0, 0.7);
  padding: 20px;
  border-radius: 10px;
  overflow-x: auto;
  margin-bottom: 20px;
}

.code-sample code {
  color: #00ff00;
  font-family: 'Courier New', Courier, monospace;
}

/* 
 * 底部区域样式
 * 设置底部的透明渐变背景及内容布局
 */
.footer {
  background: linear-gradient(to top, rgba(30, 60, 114, 0.9), rgba(30, 60, 114, 0.5)); /* 渐变背景 */
  padding: 40px 20px;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.footer .social-media, .footer .subscription {
  margin-bottom: 20px;
}

.footer a {
  color: #ffffff;
  margin: 0 10px;
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer a:hover {
  color: #2a5298;
}

.footer input[type="email"] {
  padding: 10px;
  border: none;
  border-radius: 25px;
  margin-right: 10px;
}

.footer button {
  padding: 10px 20px;
  border: none;
  border-radius: 25px;
  background: #2a5298;
  color: #ffffff;
  cursor: pointer;
  transition: background 0.3s ease;
}

.footer button:hover {
  background: #1e3c72;
}

/* 
 * 视差滚动效果样式
 * 为视差滚动区域设置背景及覆盖层
 */
.parallax {
  background-image: url('https://images.gptkong.com/demo/sample1.png'); /* 使用提供的图片之一 */
  height: 500px;
  background-attachment: fixed;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  position: relative;
}

.parallax::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(30, 60, 114, 0.3); /* 覆盖层，增强色彩 */
}

/* 
 * 数据可视化动画样式
 * 为数据图表设置动态效果
 */
.chart {
  width: 100%;
  height: 300px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 15px;
  position: relative;
  overflow: hidden;
}

.chart::before {
  content: '';
  position: absolute;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, #2a5298, #1e3c72);
  animation: rotateChart 10s linear infinite;
  opacity: 0.3;
  z-index: 0;
}

.chart-content {
  position: relative;
  z-index: 1;
}

/* 
 * 数据图表旋转动画关键帧
 */
@keyframes rotateChart {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* 
 * 按钮动画效果
 * 设置按钮点击反馈的缩放效果
 */
.button:active {
  transform: scale(0.95);
}

/* 
 * 页面背景色调整
 * 确保整体页面色彩丰富且协调，避免使用纯白色背景
 */
section {
  background: rgba(30, 60, 114, 0.5); /* 半透明背景 */
  padding: 50px 20px;
  margin-bottom: 30px;
  border-radius: 15px;
}

/* 
 * 表单样式
 * 优化订阅表单的视觉效果
 */
.subscription-form {
  display: flex;
  align-items: center;
}

.subscription-form input[type="email"] {
  flex: 1;
  padding: 10px 15px;
  border: none;
  border-radius: 25px;
  margin-right: 10px;
}

.subscription-form button {
  padding: 10px 20px;
  border: none;
  border-radius: 25px;
  background: #2a5298;
  color: #ffffff;
  cursor: pointer;
  transition: background 0.3s ease;
}

.subscription-form button:hover {
  background: #1e3c72;
}

/* 
 * 图标样式
 * 统一图标的颜色和尺寸，添加悬停效果
 */
.icon {
  width: 24px;
  height: 24px;
  stroke: #ffffff;
  stroke-width: 2;
  fill: none;
  transition: stroke 0.3s ease;
}

.icon:hover {
  stroke: #2a5298;
}

/* 
 * 响应式图片布局
 * 在不同屏幕尺寸下调整图片的排列方式
 */
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.image-grid img {
  width: 100%;
  border-radius: 15px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

/* 
 * 表格样式优化
 * 提高表格的可读性和美观度
 */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
}

th, td {
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 10px;
  text-align: left;
}

th {
  background: rgba(255, 255, 255, 0.2);
}

tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.1);
}

/* 
 * 代码块内的代码样式
 * 提高代码示例的可读性
 */
code.language-css {
  color: #00ff00;
  font-family: 'Courier New', Courier, monospace;
}

/* 
 * 强调重要信息
 * 使用强调色彩突出关键内容
 */
strong {
  color: #ffcc00;
}

/* 
 * 链接样式
 * 设置内部链接的颜色和悬停效果
 */
a.internal-link {
  color: #ffcc00; /* 点缀色 */
  text-decoration: none;
  transition: color 0.3s ease;
}

a.internal-link:hover {
  color: #ffffff;
}

/* 
 * 保持页面层次感
 * 通过不同的背景和边距分隔不同的内容区块
 */
.section {
  background: rgba(255, 255, 255, 0.05);
  padding: 40px 20px;
  border-radius: 15px;
  margin-bottom: 30px;
}

