/* ==========================================================================
   CSS 变量与基础重置
   ========================================================================== */
:root {
  --bg-obsidian: #030305;
  --bg-charcoal: #08080c;
  --text-starlight: #F2F0EB;
  --text-dust: #92929C;
  --text-dim: #4E4E58;
  --accent-gold: #D4AF37;
  --accent-amber: rgba(212, 175, 55, 0.24);
  --accent-redshift: #9E3328;
  --hairline: rgba(242, 240, 235, 0.08);

  --font-serif-en: 'Cormorant Garamond', Georgia, serif;
  --font-serif-cn: 'Noto Serif SC', 'Songti SC', serif;
  --font-mono: 'JetBrains Mono', monospace;

  --ease-weightless: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

/* 关键修复：使用 overflow-x: clip 替代 hidden，确保浏览器原生 position: sticky 100% 生效 */
html, body {
  background-color: var(--bg-obsidian);
  color: var(--text-starlight);
  font-family: var(--font-serif-cn);
  scroll-behavior: smooth;
  overflow-x: clip;
  width: 100%;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: rgba(212, 175, 55, 0.25);
  color: var(--text-starlight);
}

/* ==========================================================================
   全局胶片噪点与多层宇宙星空实况 Canvas
   ========================================================================== */
.noise-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  opacity: 0.032;
  pointer-events: none;
  z-index: 9999;
}

#starfield-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 0;
  pointer-events: none;
}

/* ==========================================================================
   四角固定天文望远镜取景器 UI (HUD)
   ========================================================================== */
.hud-frame {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
}

.hud-corner {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  line-height: 1.6;
  text-transform: uppercase;
}

.hud-top-left {
  top: 28px;
  left: 36px;
  display: flex;
  flex-direction: column;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background-color: var(--accent-gold);
  box-shadow: 0 0 8px var(--accent-gold);
  animation: live-blink 2s infinite ease-in-out;
}

@keyframes live-blink {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

.hud-tag {
  color: var(--text-dim);
  font-size: 10px;
}

.hud-title {
  color: var(--text-starlight);
  margin-top: 2px;
}

.hud-top-right {
  top: 28px;
  right: 36px;
  text-align: right;
}

.hud-data-row {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.hud-label {
  color: var(--text-dim);
  font-size: 9.5px;
  letter-spacing: 0.14em;
}

.hud-value {
  color: var(--text-dust);
  font-variant-numeric: tabular-nums;
}

.hud-bottom-bar {
  position: absolute;
  bottom: 28px;
  left: 36px;
  right: 36px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  font-family: var(--font-mono);
  font-size: 11px;
}

.hud-anchor-box {
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--accent-gold);
  padding-left: 12px;
  max-width: 60%;
}

.mobile-scale-readout {
  display: none;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
}

.highlight-gold {
  color: var(--accent-gold);
}

/* ==========================================================================
   右侧实时对数尺度标尺 (Logarithmic Scale HUD)
   ========================================================================== */
.scale-ruler {
  position: fixed;
  right: 36px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  pointer-events: none;
  font-family: var(--font-mono);
}

.ruler-header {
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--text-dim);
  margin-bottom: 14px;
}

.ruler-track {
  position: relative;
  height: 260px;
  width: 70px;
  border-right: 1px solid rgba(242, 240, 235, 0.16);
}

.ruler-ticks {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  padding-right: 12px;
  font-size: 10px;
  color: var(--text-dim);
}

.ruler-ticks span {
  position: relative;
}

.ruler-ticks span::after {
  content: '';
  position: absolute;
  right: -12px;
  top: 50%;
  width: 6px;
  height: 1px;
  background: rgba(242, 240, 235, 0.25);
}

.ruler-indicator {
  position: absolute;
  right: -4px;
  top: 0%;
  width: 7px;
  height: 7px;
  background: var(--accent-gold);
  border-radius: 50%;
  box-shadow: 0 0 12px var(--accent-gold);
  transition: top 0.12s ease-out;
}

.ruler-readout {
  margin-top: 18px;
  text-align: right;
}

.readout-label {
  font-size: 9px;
  color: var(--text-dim);
  letter-spacing: 0.15em;
}

.readout-number {
  font-size: 15px;
  color: var(--accent-gold);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

.readout-sub {
  font-size: 10px;
  color: var(--text-dust);
  margin-top: 2px;
}

/* ==========================================================================
   幕与幕之间的尺度跃迁衔接桥 (Scale Bridge — 消除章节间的空白断层)
   ========================================================================== */
.scale-bridge {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2vh 20px;
  pointer-events: none;
}

.bridge-line-top,
.bridge-line-bottom {
  width: 1px;
  height: 64px;
  background: linear-gradient(to bottom, transparent, rgba(212, 175, 55, 0.38), transparent);
}

.bridge-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 12px 22px;
  border: 1px solid rgba(212, 175, 55, 0.16);
  background: rgba(5, 5, 8, 0.72);
  backdrop-filter: blur(6px);
}

.bridge-code {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--accent-gold);
}

.bridge-desc {
  font-family: var(--font-serif-cn);
  font-size: 12.5px;
  color: var(--text-dust);
  font-weight: 300;
  letter-spacing: 0.04em;
}

/* ==========================================================================
   主滚动叙事章节与极度淡化的背景水印编号 (01~04)
   ========================================================================== */
.scrolly-container {
  position: relative;
  z-index: 10;
}

.chapter {
  position: relative;
  min-height: 105vh;
  min-height: 105dvh;
  width: 100%;
  padding: 10vh 10vw;
  display: flex;
  align-items: center;
  overflow: clip;
}

/* 优化点 4：极度淡化/透明化 01~04 背景编号，采用微弱描边幽灵水印质感 */
.bleed-number {
  position: absolute;
  font-family: var(--font-serif-en);
  font-size: 28vw;
  font-weight: 300;
  color: rgba(242, 240, 235, 0.006);
  -webkit-text-stroke: 1px rgba(242, 240, 235, 0.024);
  line-height: 0.8;
  top: 12%;
  left: -2vw;
  pointer-events: none;
  user-select: none;
  z-index: 0;
}

.bleed-right {
  left: auto;
  right: -2vw;
}

.bleed-center {
  left: 50%;
  transform: translateX(-50%);
  top: 3%;
}

/* 序幕 Hero Section */
.hero-section {
  min-height: 96vh;
  min-height: 96dvh;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 0 24px;
}

.editorial-kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.28em;
  color: var(--accent-gold);
  margin-bottom: 24px;
}

.hero-title {
  font-family: var(--font-serif-cn);
  font-weight: 200;
  font-size: clamp(2rem, 5vw, 4.5rem);
  line-height: 1.38;
  letter-spacing: 0.05em;
  color: var(--text-starlight);
  margin-bottom: 32px;
}

.serif-italic {
  font-family: var(--font-serif-cn);
  font-weight: 300;
  color: #D8D4C8;
}

.hero-subtitle {
  max-width: 580px;
  margin: 0 auto;
  font-size: clamp(14px, 1.1vw, 15.5px);
  line-height: 2;
  color: var(--text-dust);
  font-weight: 300;
}

.scroll-prompt {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.mono-tiny {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.22em;
  color: var(--text-dim);
}

.scroll-line {
  width: 1px;
  height: 72px;
  background: linear-gradient(to bottom, var(--accent-gold), transparent);
}

/* ==========================================================================
   不对称网格布局与散文排版
   ========================================================================== */
.chapter-grid {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 7vw;
  align-items: center;
}

.reverse-grid {
  grid-template-columns: 0.85fr 1.15fr;
}

.chapter-meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.2em;
  color: var(--accent-gold);
  margin-bottom: 14px;
}

.chapter-title {
  font-size: clamp(1.7rem, 3.2vw, 2.85rem);
  font-weight: 300;
  letter-spacing: 0.04em;
  color: var(--text-starlight);
  line-height: 1.28;
}

.chapter-en-title {
  font-family: var(--font-serif-en);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(1.25rem, 2vw, 1.75rem);
  color: var(--text-dim);
  margin-top: 4px;
  margin-bottom: 28px;
  letter-spacing: 0.03em;
}

.prose-body p {
  font-size: 15px;
  line-height: 2.02;
  color: var(--text-dust);
  font-weight: 300;
  margin-bottom: 20px;
  text-align: justify;
}

.prose-body strong {
  color: var(--text-starlight);
  font-weight: 400;
  border-bottom: 1px solid var(--accent-amber);
}

/* 天体物理参数遥测栏 */
.telemetry-box {
  margin-top: 36px;
  padding-top: 22px;
  border-top: 1px solid var(--hairline);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.telemetry-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.t-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  color: var(--text-dim);
}

.t-val {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-starlight);
}

/* ==========================================================================
   科学艺术视觉装置与 1 像素人类对比锚点 (彻底修复图1挤压竖条问题)
   ========================================================================== */
.visual-column {
  position: relative;
  width: 100%;
}

.art-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 4.2;
  background: radial-gradient(circle at center, rgba(16, 16, 24, 0.45) 0%, transparent 75%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.phenomenon-canvas {
  width: 100%;
  height: 100%;
  display: block;
  -webkit-mask-image: radial-gradient(ellipse at center, black 50%, transparent 78%);
  mask-image: radial-gradient(ellipse at center, black 50%, transparent 78%);
}

.instrument-caption {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--hairline);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}

/* 1像素微缩对比锚点 (桌面端带折线引线，移动端自适应为底部横向宽幅图注) */
.micro-anchor {
  position: absolute;
  pointer-events: none;
  z-index: 5;
}

.pixel-dot {
  display: block;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background-color: var(--accent-gold);
  box-shadow: 0 0 10px 2px var(--accent-gold);
  animation: pulse-dot 2.4s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 0.35; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.35); }
}

.anchor-line {
  position: absolute;
  top: 1px;
  left: 1px;
  overflow: visible;
}

/* 关键修复：显式指定 width: max-content，防止由于父级 0px 宽度导致文字被压缩成1字宽的细长竖条 */
.anchor-caption {
  position: absolute;
  top: 22px;
  left: 20px;
  width: max-content;
  max-width: min(320px, 42vw);
  white-space: normal;
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.45;
  letter-spacing: 0.05em;
  color: var(--accent-gold);
  background: rgba(4, 4, 7, 0.9);
  padding: 5px 10px;
  border: 1px solid rgba(212, 175, 55, 0.32);
  backdrop-filter: blur(6px);
}

/* ==========================================================================
   300vh 宇宙空洞沉浸过渡区 (The Great Void Scroll — 严格锁定在屏幕中央)
   ========================================================================== */
.void-transition {
  position: relative;
  height: 300vh;
  width: 100%;
  background: radial-gradient(circle at center, rgba(4, 4, 7, 0.96) 0%, rgba(2, 2, 4, 0.98) 100%);
  border-top: 1px solid rgba(212, 175, 55, 0.08);
  border-bottom: 1px solid rgba(212, 175, 55, 0.08);
}

.void-sticky-hud {
  position: sticky;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 0 24px;
  z-index: 20;
  transition: opacity 0.35s ease-out;
}

/* JS 双重保障锁定类：当滚动进入牧夫座空洞区间时，强制固定在视口正中央 */
.void-sticky-hud.is-pinned {
  position: fixed;
  top: 0;
  left: 0;
}

.void-sticky-hud.is-bottom {
  position: absolute;
  top: auto;
  bottom: 0;
  left: 0;
}

.void-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--accent-redshift);
  margin-bottom: 24px;
}

.void-counter {
  font-family: var(--font-mono);
  font-size: clamp(14px, 1.6vw, 19px);
  line-height: 1.85;
  color: var(--text-starlight);
  letter-spacing: 0.06em;
  margin-bottom: 28px;
}

.mobile-break {
  display: none;
}

.void-highlight {
  color: var(--accent-gold);
  font-weight: 400;
  padding: 0 5px;
  font-variant-numeric: tabular-nums;
}

.void-whisper {
  max-width: 540px;
  font-size: 13.5px;
  line-height: 2.05;
  color: var(--text-dust);
  font-weight: 300;
  margin-bottom: 38px;
}

.void-progress-wrap {
  width: min(320px, 80vw);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.void-progress-bar {
  width: 100%;
  height: 1px;
  background: rgba(242, 240, 235, 0.12);
  position: relative;
}

.void-progress-fill {
  position: absolute;
  left: 0;
  top: -1px;
  height: 2px;
  width: 0%;
  background: var(--accent-gold);
  box-shadow: 0 0 8px var(--accent-gold);
}

.void-status-row {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--text-dim);
}

/* ==========================================================================
   终幕：宇宙网全宽排印与尾声
   ========================================================================== */
.chapter-full {
  flex-direction: column;
  justify-content: center;
  padding-top: 12vh;
  padding-bottom: 16vh;
}

.cosmic-web-wrapper {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  z-index: 2;
}

.web-frame {
  aspect-ratio: 16 / 8.5;
  margin-bottom: 48px;
}

.web-editorial {
  max-width: 980px;
  margin: 0 auto;
}

.two-col-prose {
  column-count: 2;
  column-gap: 48px;
  margin-top: 12px;
}

.wide-telemetry {
  margin-top: 44px;
}

/* 尾声：暗淡蓝点 */
.epilogue-section {
  min-height: 85vh;
  min-height: 85dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 24px 80px;
  border-top: 1px solid var(--hairline);
}

.pale-blue-dot {
  width: 3px;
  height: 3px;
  background: #8bb8e8;
  border-radius: 50%;
  margin: 0 auto 32px;
  box-shadow: 0 0 14px 3px rgba(139, 184, 232, 0.65);
}

.epilogue-quote {
  font-size: clamp(1.1rem, 2.2vw, 1.65rem);
  font-weight: 300;
  color: var(--text-starlight);
  letter-spacing: 0.05em;
  line-height: 1.6;
  margin-bottom: 16px;
}

.epilogue-author {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--text-dim);
  margin-bottom: 48px;
}

.mono-button {
  background: transparent;
  border: 1px solid rgba(212, 175, 55, 0.35);
  color: var(--accent-gold);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  padding: 14px 24px;
  cursor: pointer;
  transition: all 0.5s var(--ease-weightless);
}

.mono-button:hover {
  background: rgba(212, 175, 55, 0.12);
  border-color: var(--accent-gold);
}

/* 失重感阻尼显现动画 */
.reveal-item {
  opacity: 0;
  transform: translateY(32px) scale(0.985);
  transition: opacity 1.3s var(--ease-weightless), transform 1.3s var(--ease-weightless);
}

.reveal-item.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* ==========================================================================
   移动端与平板端深度适配 (彻底解决图1标注框过窄挤压与重叠)
   ========================================================================== */
@media (max-width: 960px) {
  .scale-ruler {
    display: none;
  }

  .mobile-scale-readout {
    display: flex;
  }

  .hud-top-left {
    top: 14px;
    left: 16px;
  }

  .hud-top-right {
    top: 14px;
    right: 16px;
  }

  .hide-on-mobile {
    display: none;
  }

  .hud-bottom-bar {
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(to top, rgba(3, 3, 5, 0.96) 50%, rgba(3, 3, 5, 0));
    border-top: 1px solid rgba(242, 240, 235, 0.05);
  }

  .hud-anchor-box {
    max-width: 62%;
    padding-left: 8px;
  }

  .hud-anchor-box .hud-value {
    font-size: 10px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .chapter {
    min-height: auto;
    padding: 8vh 6vw 10vh;
  }

  .chapter-grid,
  .reverse-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .reverse-grid .visual-column {
    order: -1;
  }

  /* 移动端同样保持 01~04 极度淡化，绝不抢夺星空与正文视线 */
  .bleed-number {
    font-size: 42vw;
    top: 2%;
    color: rgba(242, 240, 235, 0.005);
    -webkit-text-stroke: 1px rgba(242, 240, 235, 0.018);
  }

  .art-frame {
    aspect-ratio: 1 / 1;
    max-height: 360px;
    margin-bottom: 12px;
  }

  .web-frame {
    aspect-ratio: 4 / 3.2;
    margin-bottom: 24px;
  }

  /* 关键修复（针对图1）：在移动端将1像素对比文字框宽幅居中放置在画布底部安全区内，不再挤成细长竖列 */
  .micro-anchor {
    position: static;
  }

  .pixel-dot {
    position: absolute;
    top: 48%;
    left: 50%;
    transform: translate(-50%, -50%);
  }

  .anchor-line {
    display: none;
  }

  .anchor-caption {
    position: absolute;
    top: auto;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    max-width: 88vw;
    text-align: center;
    font-size: 10.5px;
    line-height: 1.45;
    padding: 6px 12px;
    background: rgba(4, 4, 8, 0.92);
    border: 1px solid rgba(212, 175, 55, 0.35);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  }

  .two-col-prose {
    column-count: 1;
  }

  .prose-body p {
    font-size: 14.5px;
    line-height: 1.95;
    text-align: left;
  }

  .telemetry-box {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 24px;
    padding-top: 16px;
  }

  .telemetry-item {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px dashed rgba(242, 240, 235, 0.06);
    padding-bottom: 8px;
  }

  .mobile-break {
    display: inline;
  }

  .void-status-row span:last-child {
    display: none;
  }

  .void-status-row {
    justify-content: center;
  }

  .scroll-prompt {
    bottom: 68px;
  }

  .scroll-line {
    height: 40px;
  }
}