/* 基础样式 */
:root {
  --primary-color: #3e3a39; /* 传统墨色 */
  --secondary-color: #8f8279; /* 纸本色 */
  --bg-color: #f7f4ed; /* 宣纸背景色 */
  --accent-color: #b5493b; /* 印章红 */
  --text-color: #2b2b2b;
  --font-song: 'SimSun', 'Songti SC', 'STSong', serif;
  --font-hei: 'SimHei', 'Heiti SC', sans-serif;
  --spacing-base: 2rem;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-song);
  color: var(--text-color);
  background-color: var(--bg-color);
  overflow-x: hidden;
  line-height: 1.8;
  position: relative;
}

/* 视差滚动背景层 () */
.parallax-bg {
  position: fixed;
  top: -50%;
  left: -10%;
  width: 100%;
  height: 200%;
  background: url('https://pic.616pic.com/bg_w1180/00/01/07/LPM0P9MANQ.jpg!/fw/1120') no-repeat center center;
  background-size: cover;
  opacity: 0.15;
  z-index: -1;
  pointer-events: none;
  /* 我们会在 JS 中处理 transform: translateY() 来实现视差 */
}

/* 导航栏 */
nav {
  position: fixed;
  top: 0;
  width: 100%;
  background: rgba(247, 244, 237, 0.9);
  backdrop-filter: blur(5px);
  z-index: 100;
  border-bottom: 1px solid rgba(62, 58, 57, 0.1);
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

/* Canvas 粒子文字动画容器 */
.hero-canvas-container {
  width: 100%;
  height: 100vh;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: var(--bg-color); /* 宣纸背景色 */
  overflow: hidden;
  z-index: 10; /* 在主要内容之上，但在导航栏之下 */
}

/* 细腻噪点纹理与渐变遮罩层 */
.hero-canvas-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  /* 宣纸微弱渐变叠加 SVG 噪点纹理 (通过 filter 生成高频噪波) */
  background: 
    linear-gradient(135deg, rgba(247,244,237,0) 0%, rgba(220,215,200,0.4) 100%),
    url('data:image/svg+xml,%3Csvg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"%3E%3Cfilter id="noiseFilter"%3E%3CfeTurbulence type="fractalNoise" baseFrequency="0.8" numOctaves="3" stitchTiles="stitch"/%3E%3C/filter%3E%3Crect width="100%25" height="100%25" filter="url(%23noiseFilter)" opacity="0.08"/%3E%3C/svg%3E');
}

#textCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.scroll-hint {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-song);
  font-size: 1.2rem;
  color: var(--secondary-color);
  letter-spacing: 5px;
  z-index: 2;
  animation: bounce 2s infinite;
  pointer-events: none;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0) translateX(-50%); }
  40% { transform: translateY(-20px) translateX(-50%); }
  60% { transform: translateY(-10px) translateX(-50%); }
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary-color);
  text-decoration: none;
  letter-spacing: 2px;
}

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.nav-links a {
  text-decoration: none;
  color: var(--primary-color);
  font-size: 1.1rem;
  transition: color 0.3s;
  position: relative;
}

.nav-links a:hover, .nav-links a.active {
  color: var(--accent-color);
}

.nav-links a::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: -4px;
  left: 50%;
  background-color: var(--accent-color);
  transition: all 0.3s ease;
  transform: translateX(-50%);
}

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

/* 主要内容区 */
main {
  max-width: 1000px;
  margin: 100px auto 0;
  padding: 2rem;
  min-height: 100vh;
}

/* 骨架屏动画 (Skeleton Screen) */
#skeleton {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--bg-color);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  transition: opacity 0.5s ease;
}

.skeleton-item {
  background: linear-gradient(90deg, #e0dcd1 25%, #f2efe6 50%, #e0dcd1 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 4px;
}

.skeleton-title {
  width: 300px;
  height: 40px;
}

.skeleton-text {
  width: 600px;
  height: 20px;
}

.skeleton-text.short {
  width: 400px;
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* 滚动显现效果 (Reveal on Scroll) */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s cubic-bezier(0.5, 0, 0, 1);
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* 首页内容样式 */
.poem-section {
  text-align: center;
  margin-bottom: 4rem;
}

.poem-title {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  color: var(--primary-color);
  letter-spacing: 5px;
}

.poem-author {
  font-size: 1.2rem;
  color: var(--secondary-color);
  margin-bottom: 2rem;
}

.poem-content {
  font-family: var(--font-song);
  font-size: 1.5rem;
  line-height: 2.5;
  letter-spacing: 2px;
  margin-bottom: 2rem;
}

.poem-annotations {
  text-align: left;
  background: rgba(255, 255, 255, 0.5);
  padding: 2rem;
  border-radius: 8px;
  border-left: 4px solid var(--accent-color);
  margin-bottom: 4rem;
}

.poem-annotations h3 {
  margin-bottom: 1rem;
  color: var(--primary-color);
}

.pinyin-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 4px;
}

.pinyin-item {
  font-family: var(--font-song);
  font-size: 1.5rem;
  text-align: center;
  color: var(--primary-color);
}

.pinyin-item rt {
  font-family: Arial, sans-serif;
  font-size: 0.8rem;
  color: var(--secondary-color);
  letter-spacing: 1px;
}

/* 作者简介 */
.author-section {
  display: flex;
  gap: 2rem;
  align-items: center;
  background: rgba(255, 255, 255, 0.6);
  padding: 2rem;
  border-radius: 8px;
  margin-bottom: 4rem;
}

.author-image {
  flex: 0 0 200px;
  height: 250px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.author-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(80%) sepia(20%);
}

.author-info {
  flex: 1;
}

.author-info h3 {
  font-size: 1.8rem;
  margin-bottom: 1rem;
}

.author-info p {
  margin-bottom: 1rem;
  text-justify: inter-ideograph;
}

.btn-more {
  display: inline-block;
  padding: 0.5rem 1.5rem;
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
  text-decoration: none;
  border-radius: 20px;
  transition: all 0.3s;
}

.btn-more:hover {
  background: var(--primary-color);
  color: var(--bg-color);
}

/* 运用手法 (四个竖框) */
.techniques-section {
  margin-bottom: 4rem;
}

.section-title {
  text-align: center;
  font-size: 2rem;
  margin-bottom: 2rem;
  color: var(--primary-color);
  position: relative;
}

.section-title::after {
  content: '';
  display: block;
  width: 50px;
  height: 2px;
  background: var(--accent-color);
  margin: 10px auto 0;
}

.techniques-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}

.technique-card {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(0,0,0,0.1);
  padding: 2rem 1rem;
  text-align: center;
  writing-mode: vertical-rl;
  text-orientation: upright;
  min-height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 5px;
  font-size: 1.3rem;
  border-radius: 8px;
  transition: transform 0.3s, box-shadow 0.3s;
  box-shadow: 2px 2px 10px rgba(0,0,0,0.05);
}

.technique-card:hover {
  transform: translateY(-5px);
  box-shadow: 2px 10px 20px rgba(0,0,0,0.1);
  border-color: var(--accent-color);
  color: var(--accent-color);
}

/* 手法详情页样式 */
.technique-detail-header {
  text-align: center;
  margin-bottom: 4rem;
  padding: 3rem 2rem;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 8px;
  border-left: 4px solid var(--accent-color);
}

.technique-title {
  font-size: 3rem;
  color: var(--primary-color);
  margin-bottom: 1rem;
  letter-spacing: 5px;
}

.technique-subtitle {
  font-size: 1.3rem;
  color: var(--secondary-color);
  font-style: italic;
}

.technique-section {
  margin-bottom: 4rem;
}

.feature-list {
  list-style: none;
  padding-left: 1rem;
}

.feature-list li {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
  position: relative;
  line-height: 1.8;
}

.feature-list li::before {
  content: "•";
  color: var(--accent-color);
  font-size: 1.5rem;
  position: absolute;
  left: 0;
  top: -2px;
}

.poem-example {
  background: rgba(255, 255, 255, 0.4);
  padding: 1.5rem;
  border-radius: 4px;
  margin: 1.5rem 0;
  border-left: 3px solid var(--accent-color);
}

.poem-text {
  font-family: var(--font-song);
  font-size: 1.2rem;
  line-height: 2;
  color: var(--primary-color);
  text-align: center;
}

.back-to-index {
  text-align: center;
  margin: 4rem 0 2rem;
}

.btn-back {
  display: inline-block;
  padding: 0.8rem 2.5rem;
  background: var(--primary-color);
  color: var(--bg-color);
  text-decoration: none;
  border-radius: 25px;
  transition: all 0.3s ease;
  font-size: 1.1rem;
  letter-spacing: 1px;
}

.btn-back:hover {
  background: var(--accent-color);
  transform: translateX(-5px);
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

/* 手法卡片链接样式 */
.techniques-grid a.technique-card {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

/* 宋朝时间轴 */
.timeline-section {
  margin-bottom: 4rem;
}

.timeline {
  position: relative;
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 0;
}

.timeline::after {
  content: '';
  position: absolute;
  width: 2px;
  background-color: var(--secondary-color);
  top: 0;
  bottom: 0;
  left: 50%;
  margin-left: -1px;
}

.timeline-item {
  padding: 10px 40px;
  position: relative;
  background-color: inherit;
  width: 50%;
}

.timeline-item.left {
  left: 0;
}

.timeline-item.right {
  left: 50%;
}

.timeline-item::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  right: -8px;
  background-color: var(--bg-color);
  border: 3px solid var(--accent-color);
  top: 20px;
  border-radius: 50%;
  z-index: 1;
}

.timeline-item.right::after {
  left: -8px;
}

.timeline-content {
  padding: 1.5rem;
  background-color: rgba(255,255,255,0.8);
  position: relative;
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.timeline-year {
  font-weight: bold;
  color: var(--accent-color);
  margin-bottom: 0.5rem;
}

.timeline-title {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
  color: var(--primary-color);
}

/* Tabs for other pages */
.tabs-nav {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.tab-btn {
  background: transparent;
  border: 1px solid var(--secondary-color);
  padding: 0.5rem 2rem;
  font-family: var(--font-song);
  font-size: 1.1rem;
  cursor: pointer;
  border-radius: 20px;
  transition: all 0.3s;
}

.tab-btn:hover, .tab-btn.active {
  background: var(--primary-color);
  color: var(--bg-color);
  border-color: var(--primary-color);
}

.tab-content {
  display: none;
  animation: fadeIn 0.5s;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Content blocks in tabs */
.content-block {
  background: rgba(255, 255, 255, 0.6);
  padding: 2rem;
  border-radius: 8px;
  margin-bottom: 2rem;
}

.content-block h3 {
  color: var(--accent-color);
  margin-bottom: 1rem;
  border-bottom: 1px dashed var(--secondary-color);
  padding-bottom: 0.5rem;
}

/* Footer */
footer {
  text-align: center;
  padding: 2rem;
  border-top: 1px solid rgba(62, 58, 57, 0.1);
  margin-top: 4rem;
  color: var(--secondary-color);
  font-size: 0.9rem;
}

/* 回到顶部按钮 */
.back-to-top {
  position: fixed;
  bottom: 40px;
  right: 40px;
  width: 50px;
  height: 50px;
  background: var(--primary-color);
  color: var(--bg-color);
  border: none;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 99;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.back-to-top.show {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background: var(--accent-color);
  transform: translateY(-5px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

@media screen and (max-width: 768px) {
  .back-to-top {
    bottom: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
    font-size: 1.2rem;
  }
}

/* 向下翻页按钮 */
.scroll-down-btn {
  display: block;
  margin: 3rem auto 0;
  width: 60px;
  height: 60px;
  background: transparent;
  border: 2px solid var(--secondary-color);
  border-radius: 50%;
  font-size: 1.8rem;
  color: var(--secondary-color);
  cursor: pointer;
  transition: all 0.3s ease;
  animation: bounce-down 2s infinite;
}

.scroll-down-btn:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
  transform: scale(1.1);
}

/* Hero 区域的向下按钮特殊定位 */
.hero-canvas-container .scroll-down-btn {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  background: rgba(247, 244, 237, 0.8);
  backdrop-filter: blur(5px);
}

.hero-canvas-container .scroll-down-btn:hover {
  transform: translateX(-50%) scale(1.1);
}

@keyframes bounce-down {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(10px); }
  60% { transform: translateY(5px); }
}

.hero-canvas-container .scroll-down-btn {
  animation: bounce-down-hero 2s infinite;
}

@keyframes bounce-down-hero {
  0%, 20%, 50%, 80%, 100% { transform: translateX(-50%) translateY(0); }
  40% { transform: translateX(-50%) translateY(10px); }
  60% { transform: translateX(-50%) translateY(5px); }
}

/* 响应式 */
@media screen and (max-width: 768px) {
  .author-section {
    flex-direction: column;
  }
  .techniques-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .technique-card {
    writing-mode: horizontal-tb;
    min-height: 100px;
  }
  .timeline::after {
    left: 31px;
  }
  .timeline-item {
    width: 100%;
    padding-left: 70px;
    padding-right: 25px;
  }
  .timeline-item.right {
    left: 0%;
  }
  .timeline-item.left::after, .timeline-item.right::after {
    left: 23px;
  }
  .scroll-down-btn {
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
  }
}
