/* ============================================================
   中国梦 · Chinese Dream — effects.css
   光标 / 滚动揭示 / 视差 / 时间轴 / 卡片 / 动效
   ============================================================ */

/* ---------------- 自定义光标 ---------------- */
.cursor-dot,
.cursor-ring {
  position: fixed;
  top: 0; left: 0;
  z-index: 9999;
  pointer-events: none;
  border-radius: 50%;
  transform: translate3d(-50%, -50%, 0);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.cursor-dot {
  width: 6px; height: 6px;
  background: var(--gold-light);
  box-shadow: 0 0 12px rgba(242, 209, 137, 0.9);
}
.cursor-ring {
  width: 34px; height: 34px;
  border: 1px solid rgba(217, 164, 65, 0.55);
  transition: width 0.3s var(--ease), height 0.3s var(--ease), opacity 0.3s ease, border-color 0.3s ease;
}
body.cursor-ready .cursor-dot,
body.cursor-ready .cursor-ring { opacity: 1; }
body.cursor-hover .cursor-ring {
  width: 56px; height: 56px;
  border-color: rgba(255, 45, 70, 0.8);
  background: rgba(200, 16, 46, 0.08);
}

/* ---------------- 滚动揭示 ---------------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(34px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
  transition-delay: var(--d, 0ms);
  will-change: opacity, transform;
}
[data-reveal="left"] { transform: translateX(-40px); }
[data-reveal="right"] { transform: translateX(40px); }
[data-reveal="zoom"] { transform: scale(0.94); }
[data-reveal].is-in {
  opacity: 1;
  transform: none;
}

/* 逐字/逐行 */
.fade-lines > * {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}
.fade-lines.is-in > * { opacity: 1; transform: none; }
.fade-lines.is-in > *:nth-child(1) { transition-delay: 0.05s; }
.fade-lines.is-in > *:nth-child(2) { transition-delay: 0.14s; }
.fade-lines.is-in > *:nth-child(3) { transition-delay: 0.23s; }
.fade-lines.is-in > *:nth-child(4) { transition-delay: 0.32s; }
.fade-lines.is-in > *:nth-child(5) { transition-delay: 0.41s; }
.fade-lines.is-in > *:nth-child(6) { transition-delay: 0.5s; }

/* ---------------- 视差 ---------------- */
[data-parallax] { will-change: transform; }

/* ---------------- 光斑 / 光晕 ---------------- */
.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  pointer-events: none;
  z-index: 1;
}
.glow-orb--red { background: rgba(200, 16, 46, 0.35); }
.glow-orb--gold { background: rgba(217, 164, 65, 0.22); }
.glow-orb--jade { background: rgba(46, 139, 122, 0.22); }

/* ---------------- 卡片 3D ---------------- */
[data-tilt] {
  transform-style: preserve-3d;
  transition: transform 0.35s var(--ease), box-shadow 0.5s var(--ease), border-color 0.5s var(--ease);
}
[data-tilt] > * { transform: translateZ(24px); }

/* ---------------- 数字滚动 ---------------- */
.count { font-variant-numeric: tabular-nums; }

/* ---------------- 标签 ---------------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.28rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(217, 164, 65, 0.06);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  color: var(--gold-light);
}

/* ---------------- 时间轴 ---------------- */
.timeline {
  position: relative;
  padding-left: 2.2rem;
  margin-top: 1rem;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 7px; top: 6px; bottom: 6px;
  width: 1px;
  background: linear-gradient(180deg, transparent, var(--gold), var(--red), transparent);
  opacity: 0.6;
}
.tl-item {
  position: relative;
  padding: 0 0 2.4rem 0.4rem;
}
.tl-item::before {
  content: "";
  position: absolute;
  left: -2.2rem; top: 0.42rem;
  width: 15px; height: 15px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  background: var(--ink);
  box-shadow: 0 0 0 4px rgba(217, 164, 65, 0.08);
  transition: background 0.4s var(--ease), box-shadow 0.4s var(--ease);
}
.tl-item.is-in::before {
  background: var(--gold);
  box-shadow: 0 0 22px rgba(217, 164, 65, 0.8), 0 0 0 4px rgba(217, 164, 65, 0.12);
}
.tl-item__year {
  font-family: var(--f-serif);
  font-size: clamp(1.5rem, 3.4vw, 2.2rem);
  color: var(--gold-light);
  line-height: 1;
  margin-bottom: 0.5rem;
  letter-spacing: 0.02em;
}
.tl-item h3 { font-size: 1.15rem; margin-bottom: 0.4rem; }
.tl-item p { margin-bottom: 0; font-size: 0.94rem; }
.tl-item.is-future .tl-item__year { color: var(--red-bright); }
.tl-item.is-future::before { border-color: var(--red-bright); }

/* ---------------- 章节侧栏索引 ---------------- */
.side-index {
  position: fixed;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: flex-end;
}
.side-index a {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  color: rgba(243, 237, 225, 0.3);
  transition: color 0.3s var(--ease);
}
.side-index a::before {
  content: "";
  width: 14px; height: 1px;
  background: currentColor;
  transition: width 0.35s var(--ease);
}
.side-index a:hover,
.side-index a.is-active { color: var(--gold-light); }
.side-index a.is-active::before { width: 26px; }

/* ---------------- 图表容器 ---------------- */
.chart-box {
  position: relative;
  padding: 1.6rem;
  border-radius: var(--radius);
  border: 1px solid var(--line-soft);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.008));
}
.chart-box canvas { width: 100%; height: 260px; display: block; }
.chart-box__title {
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  color: var(--gold);
  text-transform: uppercase;
  margin-bottom: 1rem;
}
.chart-legend {
  display: flex;
  gap: 1.2rem;
  flex-wrap: wrap;
  margin-top: 0.8rem;
  font-size: 0.76rem;
  color: rgba(243, 237, 225, 0.55);
}
.chart-legend i {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 3px;
  margin-right: 0.45em;
  vertical-align: middle;
}

/* ---------------- 进度条 ---------------- */
.meter {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.meter i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--red), var(--gold));
  transition: width 1.6s var(--ease);
}

/* ---------------- 跑马灯 ---------------- */
.marquee {
  overflow: hidden;
  border-block: 1px solid var(--line-soft);
  padding: 1.1rem 0;
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee__track {
  display: flex;
  gap: 3rem;
  width: max-content;
  animation: marquee 38s linear infinite;
}
.marquee:hover .marquee__track { animation-play-state: paused; }
.marquee__item {
  font-family: var(--f-serif);
  font-size: clamp(1.1rem, 2.2vw, 1.6rem);
  color: rgba(243, 237, 225, 0.22);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 3rem;
}
.marquee__item::after {
  content: "◆";
  font-size: 0.5em;
  color: var(--red);
}

/* ---------------- 引文 ---------------- */
.quote {
  position: relative;
  padding: 2.2rem 2.2rem 2.2rem 3.7rem;
  border-left: 2px solid var(--red);
  background: linear-gradient(90deg, rgba(200, 16, 46, 0.10), transparent 70%);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-family: var(--f-serif);
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  line-height: 1.9;
  color: #efe8da;
}
.quote::before {
  content: "“";
  position: absolute;
  left: 1rem; top: 0.2rem;
  font-family: var(--f-serif);
  font-size: 4rem;
  color: var(--red);
  line-height: 1;
  opacity: 0.6;
}

/* ---------------- 弹窗 ---------------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 1.2rem;
  background: rgba(3, 5, 8, 0.82);
  backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s var(--ease);
}
.modal.is-open { opacity: 1; pointer-events: auto; }
.modal__panel {
  position: relative;
  width: min(720px, 100%);
  max-height: 86vh;
  overflow: auto;
  padding: 2.2rem;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, #12161f, #0a0d13);
  box-shadow: var(--shadow);
  transform: translateY(24px) scale(0.97);
  transition: transform 0.45s var(--ease);
}
.modal.is-open .modal__panel { transform: none; }
.modal__close {
  position: absolute;
  top: 1rem; right: 1rem;
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--paper);
  cursor: pointer;
  font-size: 1.1rem;
}
.modal__close:hover { border-color: var(--red); color: var(--red-bright); }

/* ---------------- 返回顶部 ---------------- */
.to-top {
  position: fixed;
  right: 22px; bottom: 24px;
  z-index: 70;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(12, 16, 24, 0.8);
  color: var(--gold);
  cursor: pointer;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease), border-color 0.3s;
  backdrop-filter: blur(8px);
}
.to-top.is-visible { opacity: 1; transform: none; }
.to-top:hover { border-color: var(--gold); }

/* ---------------- 动画关键帧 ---------------- */
@keyframes text-sweep {
  0% { background-position: 0% 50%; }
  100% { background-position: 260% 50%; }
}
@keyframes line-up {
  to { transform: translateY(0); }
}
@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(200, 16, 46, 0.6); }
  70% { box-shadow: 0 0 0 12px rgba(200, 16, 46, 0); }
  100% { box-shadow: 0 0 0 0 rgba(200, 16, 46, 0); }
}
@keyframes scroll-line {
  0%, 100% { transform: scaleY(0.4); opacity: 0.4; transform-origin: top; }
  50% { transform: scaleY(1); opacity: 1; transform-origin: top; }
}
@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
@keyframes float-y {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-14px); }
}
.float { animation: float-y 7s ease-in-out infinite; }

/* ---------------- 无障碍：减弱动效 ---------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  [data-reveal] { opacity: 1; transform: none; }
  .hero h1 .line > span { transform: none; }
}

@media (max-width: 900px) {
  .side-index { display: none; }
  .cursor-dot, .cursor-ring { display: none; }
}
