/* ========================================
   主题页面高级视觉优化
   ======================================== */

/* 1. 段落引用样式 */
.intro-paragraph:first-child::before,
.plot-section:first-child .plot-paragraph::before {
  content: "❝";
  position: absolute;
  left: -32px;
  top: 0;
  font-size: 48px;
  font-family: Georgia, serif;
  color: rgba(247, 192, 92, 0.3);
  line-height: 1;
}

/* 2. 章节数字装饰(故事走向页) */
.plot-section {
  counter-increment: plot-counter;
}

.theme-text-content {
  counter-reset: plot-counter;
}

.plot-heading::before {
  content: counter(plot-counter, decimal-leading-zero) " · ";
  color: rgba(247, 192, 92, 0.6);
  font-size: 0.85em;
  margin-right: 8px;
  font-family: 'Courier New', monospace;
}

/* 3. 渐变文字高亮 */
.intro-paragraph strong,
.plot-paragraph strong,
.insight-paragraph strong {
  background: linear-gradient(135deg, 
    rgba(247, 231, 173, 0.98), 
    rgba(247, 192, 92, 0.95));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 600;
  padding: 0 4px;
}

/* 4. 主题页背景粒子效果 */
.theme-page-body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    radial-gradient(2px 2px at 20% 30%, rgba(247, 192, 92, 0.3), transparent),
    radial-gradient(2px 2px at 60% 70%, rgba(247, 192, 92, 0.2), transparent),
    radial-gradient(1px 1px at 50% 50%, rgba(247, 231, 173, 0.25), transparent),
    radial-gradient(1px 1px at 80% 10%, rgba(247, 192, 92, 0.2), transparent);
  background-size: 200% 200%;
  background-position: 0% 0%;
  animation: sparkle 20s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
}

@keyframes sparkle {
  0%, 100% { background-position: 0% 0%; }
  25% { background-position: 100% 0%; }
  50% { background-position: 100% 100%; }
  75% { background-position: 0% 100%; }
}

/* 5. 段落序号标记 - 已禁用 */
/* 移除段落右侧的序号圆圈装饰 */

/* 6. 时间轴样式(故事走向页) */
.plot-section::before {
  content: "";
  position: absolute;
  left: -40px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg,
    rgba(247, 192, 92, 0.6),
    rgba(247, 192, 92, 0.3),
    rgba(247, 192, 92, 0.6));
  opacity: 0;
  transition: opacity 0.4s ease;
}

body[data-theme="plot"] .theme-content {
  position: relative;
  padding-left: 80px;
}

.plot-section:hover::before {
  opacity: 1;
}

/* 时间轴节点 */
.plot-section::after {
  content: "";
  position: absolute;
  left: -48px;
  top: 24px;
  width: 18px;
  height: 18px;
  background: rgba(247, 192, 92, 0.3);
  border: 3px solid rgba(247, 192, 92, 0.6);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(6, 7, 10, 0.8);
  transition: all 0.4s ease;
}

.plot-section:hover::after {
  background: rgba(247, 192, 92, 0.8);
  box-shadow: 
    0 0 0 4px rgba(6, 7, 10, 0.8),
    0 0 20px rgba(247, 192, 92, 0.6);
  transform: scale(1.3);
}

/* 7. 启示卡片阴影层次 */
.insight-section {
  transform-style: preserve-3d;
}

.insight-section::after {
  content: "";
  position: absolute;
  inset: 8px;
  background: rgba(247, 192, 92, 0.05);
  border-radius: 12px;
  z-index: -1;
  transform: translateZ(-10px);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.insight-section:hover::after {
  opacity: 1;
}

/* 8. 文字选中效果增强 */
.intro-paragraph::selection,
.plot-paragraph::selection,
.insight-paragraph::selection {
  background: rgba(247, 192, 92, 0.4);
  color: rgba(255, 255, 255, 1);
  text-shadow: 0 0 8px rgba(247, 192, 92, 0.6);
}

/* 9. 段落连接线装饰 */
.intro-paragraph + .intro-paragraph::before {
  content: "···";
  display: block;
  text-align: center;
  color: rgba(247, 192, 92, 0.4);
  margin: -16px 0 16px;
  letter-spacing: 8px;
  font-size: 20px;
}

/* 10. Banner 图片渐变遮罩 */
.theme-banner::before {
  background: 
    linear-gradient(135deg, rgba(247, 192, 92, 0.25), transparent 60%),
    url("../assets/images/gatsby-poster.png") center/cover;
  filter: brightness(0.8) saturate(1.3) contrast(1.1);
}

/* 11. 总结区域装饰图案 */
.insight-conclusion {
  position: relative;
  overflow: visible;
}

.insight-conclusion::before {
  content: "★";
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 32px;
  color: rgba(247, 192, 92, 0.5);
  animation: rotateStar 10s linear infinite;
}

@keyframes rotateStar {
  0% { transform: translateX(-50%) rotate(0deg); }
  100% { transform: translateX(-50%) rotate(360deg); }
}

/* 12. 页脚额外信息 */
.theme-page-footer::before {
  content: "「 所念皆星河 」";
  display: block;
  font-family: var(--font-heading);
  font-size: 12px;
  letter-spacing: 0.3em;
  color: rgba(247, 192, 92, 0.5);
  margin-bottom: 12px;
  text-transform: uppercase;
}

/* 13. 页面切换过渡 */
.theme-page-body {
  animation: pageTransition 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

@keyframes pageTransition {
  from {
    opacity: 0;
    filter: blur(10px);
  }
  to {
    opacity: 1;
    filter: blur(0);
  }
}

/* 14. 导航链接激活状态 */
.theme-page-nav a.active {
  background: rgba(247, 192, 92, 0.25);
  border-color: rgba(247, 192, 92, 0.7);
  color: rgba(247, 231, 173, 1);
  box-shadow: 0 0 20px rgba(247, 192, 92, 0.4);
}

/* 15. 标题淡入效果 */
.theme-content h1 {
  animation: fadeInUp 0.8s cubic-bezier(0.23, 1, 0.32, 1) 0.3s backwards;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 16. 平滑滚动行为 */
html {
  scroll-behavior: smooth;
}

/* 17. 无障碍:减少动画模式 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* 18. 打印优化 */
@media print {
  .reading-progress,
  .back-to-top,
  .paragraph-bookmark,
  .custom-cursor-glow {
    display: none !important;
  }
  
  .theme-content {
    box-shadow: none !important;
    background: white !important;
    color: black !important;
  }
  
  .intro-paragraph,
  .plot-paragraph,
  .insight-paragraph {
    border-left-color: #999 !important;
    background: none !important;
  }
}

/* 19. 深色模式适配(预留) */
@media (prefers-color-scheme: light) {
  /* 如果用户系统是浅色模式,可以在此调整 */
  /* 当前设计已针对深色优化,此处预留 */
}

/* 20. 性能优化:GPU加速 */
.intro-paragraph,
.plot-section,
.insight-section,
.theme-banner {
  will-change: transform;
  backface-visibility: hidden;
  transform: translateZ(0);
}
