/* ============================================
   一瞬 · 永恒 — 宇宙之旅
   Theme: locked dark (deep space off-black)
   Accent: champagne gold #d9b071 (single, locked)
   ============================================ */

@font-face {
  font-family: "Cormorant Garamond";
  src: url("../fonts/cormorant-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

:root {
  --bg: #060608;
  --ink: #f4f1ea;
  --ink-dim: rgba(244, 241, 234, 0.62);
  --ink-faint: rgba(244, 241, 234, 0.38);
  --gold: #d9b071;
  --gold-soft: rgba(217, 176, 113, 0.55);
  --serif-cn: "Songti SC", "STSong", "Noto Serif SC", "SimSun", serif;
  --serif-latin: "Cormorant Garamond", "Songti SC", serif;
}

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

html {
  scroll-behavior: auto;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif-cn);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.locked {
  overflow: hidden;
  height: 100dvh;
}

::selection {
  background: rgba(217, 176, 113, 0.32);
  color: var(--ink);
}

/* ---------- 画布与氛围层 ---------- */

#cosmos {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(
    ellipse 90% 70% at 50% 50%,
    transparent 52%,
    rgba(2, 2, 4, 0.6) 100%
  );
}

.grain {
  position: fixed;
  inset: -120px;
  z-index: 3;
  pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  animation: grain-jump 1.1s steps(4) infinite;
}

@keyframes grain-jump {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-38px, 22px); }
  50% { transform: translate(24px, -30px); }
  75% { transform: translate(-14px, -18px); }
  100% { transform: translate(30px, 26px); }
}

/* 左侧旅程进度线 */
.progress {
  position: fixed;
  left: clamp(14px, 2.4vw, 34px);
  top: 50%;
  translate: 0 -50%;
  z-index: 5;
  width: 1px;
  height: 38vh;
  background: rgba(244, 241, 234, 0.1);
  pointer-events: none;
}

.progress i {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(to bottom, rgba(217, 176, 113, 0.2), var(--gold));
  transform: scaleY(0);
  transform-origin: top;
}

/* ---------- 序章 ---------- */

.intro {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(1.8rem, 4vh, 3rem);
  padding: 0 6vw;
  text-align: center;
  background: var(--bg);
}

.eyebrow {
  font-family: var(--serif-latin);
  font-style: italic;
  font-size: clamp(0.8rem, 1.4vw, 1rem);
  letter-spacing: 0.38em;
  text-indent: 0.38em;
  color: var(--gold-soft);
  text-transform: lowercase;
}

.intro-title {
  font-size: clamp(1.55rem, 4.4vw, 3.4rem);
  font-weight: 400;
  line-height: 1.7;
  letter-spacing: 0.14em;
  text-shadow: 0 2px 34px rgba(0, 0, 0, 0.65);
}

.pill-btn {
  font-family: var(--serif-cn);
  font-size: 0.95rem;
  letter-spacing: 0.42em;
  text-indent: 0.42em;
  color: var(--gold);
  background: transparent;
  border: 1px solid rgba(217, 176, 113, 0.45);
  border-radius: 999px;
  padding: 1.05rem 3rem;
  cursor: pointer;
  transition:
    background-color 0.45s cubic-bezier(0.16, 1, 0.3, 1),
    border-color 0.45s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.pill-btn:hover {
  background: rgba(217, 176, 113, 0.14);
  border-color: var(--gold);
}

.pill-btn:active {
  transform: translateY(1px) scale(0.98);
}

.pill-btn:focus-visible {
  outline: 1px solid var(--gold);
  outline-offset: 4px;
}

/* ---------- 旅程 / 五幕 ---------- */

.journey {
  position: relative;
  z-index: 4;
  pointer-events: none;
}

.scene {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  padding: 0 8vw;
}

.line {
  font-size: clamp(1.9rem, 6vw, 5.2rem);
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: 0.1em;
  text-shadow: 0 2px 40px rgba(0, 0, 0, 0.6);
}

/* 逐字显现的遮罩结构 */
.ch {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
  padding-bottom: 0.08em; /* 给宋体下沉笔画留位 */
}

.ch-in {
  display: inline-block;
  will-change: transform;
}

/* 第一幕：文字落在下三分之一，奇点在画面上方燃烧 */
.scene-0 {
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 16vh;
  text-align: center;
}

/* 第二幕：爆炸扑面而来，文字偏左 */
.scene-1 {
  justify-content: flex-start;
}

/* 第三幕：星云漂流，文字靠右 */
.scene-2 {
  justify-content: flex-end;
  text-align: right;
}

/* 第四幕：星河铺在脚下，文字悬于左上 */
.scene-3 {
  align-items: flex-start;
  padding-top: 20vh;
}

/* 终幕：居中献礼 */
.scene-final {
  justify-content: center;
  text-align: center;
}

.final-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(1.4rem, 3.4vh, 2.4rem);
  transform: translateY(-14vh); /* 让 ∞ 光符在文字下方显形 */
}

.line-final {
  font-size: clamp(2.4rem, 7.6vw, 6.4rem);
  letter-spacing: 0.16em;
}

.final-sub {
  font-size: clamp(0.95rem, 1.6vw, 1.2rem);
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  color: var(--ink-dim);
}

.scene-final .pill-btn {
  pointer-events: auto;
}

/* ---------- WebGL 不可用时的兜底 ---------- */

.no-webgl #cosmos {
  display: none;
}

.no-webgl body,
body.no-webgl {
  background:
    radial-gradient(ellipse 60% 40% at 50% 30%, rgba(217, 176, 113, 0.1), transparent 70%),
    radial-gradient(ellipse 100% 80% at 50% 110%, rgba(80, 95, 130, 0.14), transparent 70%),
    var(--bg);
}

.noscript-tip {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8vw;
  text-align: center;
  letter-spacing: 0.2em;
  line-height: 2;
  background: var(--bg);
  color: var(--ink-dim);
}

/* ---------- 移动端 ---------- */

@media (max-width: 768px) {
  .scene {
    padding: 0 7vw;
  }

  .scene-0 {
    padding-bottom: 13vh;
  }

  .scene-2 {
    text-align: left;
    justify-content: flex-start;
  }

  .scene-3 {
    padding-top: 15vh;
  }

  .line-final {
    font-size: 2.05rem;
    letter-spacing: 0.1em;
  }

  .final-sub {
    letter-spacing: 0.18em;
    text-indent: 0.18em;
  }

  .progress {
    display: none;
  }
}

/* ---------- 减少动态偏好 ---------- */

@media (prefers-reduced-motion: reduce) {
  .grain {
    animation: none;
  }

  .pill-btn {
    transition: none;
  }
}
