
/* 
==============================
整体页面布局与基础样式
==============================
*/
/* 设置页面的基础字体、背景渐变和文字颜色 */
body {
  margin: 0;
  padding: 0;
  font-family: 'Roboto', sans-serif;
  background: linear-gradient(135deg, #0d1b2a, #1b263b, #415a77);
  color: #ffffff;
  overflow-x: hidden;
}

/* 定义全局容器，使用Flexbox和Grid布局 */
.container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* 样式化导航栏 */
.navbar {
  position: fixed;
  top: 0;
  width: 100%;
  background: rgba(27, 38, 59, 0.9);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 15px 0;
  z-index: 1000;
  transition: background 0.3s ease;
}

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

.navbar a:hover {
  color: #00d2ff;
}

/* 侧边栏指示器样式 */
.sidebar {
  position: fixed;
  top: 50%;
  left: 20px;
  transform: translateY(-50%);
  z-index: 999;
}

.sidebar .indicator {
  width: 10px;
  height: 10px;
  background: #00d2ff;
  border-radius: 50%;
  margin-bottom: 15px;
  transition: background 0.3s ease;
}

.sidebar .indicator.active {
  background: #ffffff;
}

/* 样式化主要内容区 */
.main-content {
  margin-top: 60px; /* 避免与固定导航栏重叠 */
  scroll-snap-type: y mandatory;
  overflow-y: scroll;
  scroll-behavior: smooth;
}

/* 每个独立的页面部分 */
.section {
  height: 100vh;
  scroll-snap-align: start;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  box-sizing: border-box;
}

/* 奇数和偶数节的背景色 */
.section:nth-child(odd) {
  background: rgba(27, 38, 59, 0.8);
}

.section:nth-child(even) {
  background: rgba(65, 90, 119, 0.8);
}

/* 标题样式 */
h2, h3, h4 {
  font-family: 'Montserrat', sans-serif;
  color: #ffffff;
  margin-bottom: 20px;
}

h2 {
  font-size: 24px;
}

h3 {
  font-size: 20px;
}

h4 {
  font-size: 18px;
}

/* 段落文本样式 */
p {
  font-size: 16px;
  line-height: 1.6;
  margin-bottom: 20px;
}

/* 按钮样式 */
.btn {
  padding: 15px 30px;
  border: none;
  border-radius: 5px;
  background: linear-gradient(45deg, #00d2ff, #3a7bd5);
  color: #ffffff;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.btn:hover {
  background: linear-gradient(45deg, #3a7bd5, #00d2ff);
  box-shadow: 0 0 20px rgba(0, 210, 255, 0.7);
}

/* 样式化图片，添加圆角、阴影和过渡效果 */
img.decorative {
  width: 320px;
  height: 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;
  margin: 20px;
}

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

/* 代码块样式，与正文区分开 */
pre code {
  display: block;
  padding: 20px;
  background: rgba(0, 34, 51, 0.9);
  border-radius: 10px;
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.5;
  color: #00d2ff;
  border-left: 5px solid #00d2ff;
  margin-bottom: 20px;
}

/* 关键帧动画：星空闪烁效果 */
@keyframes twinkling {
  0% { opacity: 0.5; }
  50% { opacity: 1; }
  100% { opacity: 0.5; }
}

/* 星空背景层 */
.stars {
  position: absolute;
  width: 100%;
  height: 100%;
  background: transparent url('https://images.gptkong.com/demo/sample1.png') repeat top center;
  animation: twinkling 50s linear infinite;
  z-index: 1;
}

/* 数据流动画 */
@keyframes grow {
  0% { height: 0; }
  50% { height: 100%; }
  100% { height: 0; }
}

.data-stream {
  position: absolute;
  bottom: 0;
  width: 2px;
  height: 0;
  background: #00d2ff;
  animation: grow 3s infinite;
}

/* 图表样式 */
.chart {
  width: 80%;
  height: 400px;
  margin: 0 auto;
  position: relative;
  background: #1b263b;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 0 20px rgba(65, 90, 119, 0.5);
}

/* 前景元素样式 */
.foreground {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1);
  z-index: 2;
  transition: transform 0.5s ease;
}

.container:hover .foreground {
  transform: translate(-50%, -50%) scale(1.05);
}

/* 背景层样式 */
.background-layer {
  position: absolute;
  width: 100%;
  height: 100%;
  background: rgba(27, 38, 59, 0.5);
  z-index: 1;
  transform: translateZ(-1px) scale(2);
  pointer-events: none;
}

/* 响应式设计：小屏幕布局调整 */
@media (max-width: 768px) {
  .section {
    flex-direction: column;
    padding: 20px;
  }
  
  .chart {
    height: 300px;
  }
  
  .btn {
    width: 100%;
    padding: 10px;
    font-size: 14px;
  }
}

/* 无障碍设计：焦点样式 */
.btn:focus {
  outline: 2px dashed #00d2ff;
  outline-offset: 4px;
}

/* 代码示例专用样式 */
.code-example {
  background: rgba(0, 34, 51, 0.95);
  padding: 15px;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 20px;
}

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

/* 页面过渡动画 */
.page {
  opacity: 0;
  transition: opacity 0.5s ease;
}

.page.active {
  opacity: 1;
}

