/* 宣传页: 黑底粒子 + 固定在屏幕上的章节卡片。改自 personal_agent 仓库 web/css/story.css(Feel 宣传页) */

:root {
  --bg: #04030a;
  --ink: #ece9f2;
  --ink-soft: rgba(236, 233, 242, .82);
  --ink-dim: rgba(236, 233, 242, .5);
  --line: rgba(255, 255, 255, .12);
  --accent: #6ff0c8;
  --serif: "Iowan Old Style", Georgia, "Songti SC", "STSong", "SimSun", serif;
  --latin-serif: "Iowan Old Style", "Hoefler Text", Baskerville, Georgia, serif;
  --sans: -apple-system, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--bg); }
body { color: var(--ink); background: var(--bg); font-family: var(--sans); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: inherit; }
#gl { position: fixed; inset: 0; z-index: 0; }
#gl canvas { display: block; width: 100%; height: 100%; }
#scroll { position: relative; z-index: -1; pointer-events: none; }

/* 顶部和底部的状态条 */
.hud {
  position: fixed; left: 0; right: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center;
  padding: 26px 34px;
  font: 500 11px/1 var(--mono); letter-spacing: .22em; text-transform: uppercase;
  color: rgba(236, 233, 242, .72);
  pointer-events: none; opacity: 0; transition: opacity 1.4s ease .4s;
}
.ready .hud { opacity: 1; }
.hud.top { top: 0; }
.hud.bottom { bottom: 0; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; pointer-events: auto; }
.brand .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 14px var(--accent); transition: background .8s, box-shadow .8s; }
.count b { color: #fff; font-weight: 600; font-size: 13px; }
#spec { display: flex; gap: 18px; color: var(--ink-dim); }
#spec span { display: flex; align-items: center; gap: 8px; }
#spec span::before { content: ""; width: 5px; height: 5px; border: 1px solid var(--accent); transform: rotate(45deg); }
.hint { display: flex; align-items: center; gap: 10px; transition: opacity .6s; }
.hint::after { content: ""; width: 1px; height: 34px; background: linear-gradient(var(--accent), transparent); animation: drip 2.2s ease-in-out infinite; }
@keyframes drip {
  0% { transform: scaleY(0); transform-origin: top; }
  50% { transform: scaleY(1); transform-origin: top; }
  51% { transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}
.scrolled .hint { opacity: 0; }

/* 右侧章节导航 */
#rail {
  position: fixed; right: 30px; top: 50%; transform: translateY(-50%); z-index: 6;
  display: flex; flex-direction: column; gap: 22px;
  opacity: 0; transition: opacity 1.4s ease .6s;
}
.ready #rail { opacity: 1; }
#rail .track { position: absolute; right: 3px; top: 4px; bottom: 4px; width: 1px; background: var(--line); }
#bar { position: absolute; inset: 0; background: var(--accent); transform-origin: top; transform: scaleY(0); transition: background .8s; }
#rail button {
  position: relative; background: none; border: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: flex-end; gap: 14px;
  font: 500 12px/1 var(--sans); letter-spacing: .12em; color: rgba(236, 233, 242, .4); transition: color .4s;
}
#rail button::after { content: ""; width: 7px; height: 7px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .35); background: var(--bg); transition: all .4s; }
#rail button span { opacity: 0; transform: translateX(6px); transition: all .4s; }
#rail:hover button span, #rail button.on span { opacity: 1; transform: none; }
#rail button.on { color: #fff; }
#rail button.on::after { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 12px var(--accent); }

/* 章节卡片：固定在屏幕上，滚动时由脚本控制淡入淡出 */
.card { position: fixed; z-index: 4; top: 50%; width: min(500px, 40vw); opacity: 0; pointer-events: none; will-change: transform, opacity, filter; }
.card.on { pointer-events: auto; }
.card > .in { transform: translateY(-50%); }
.card::before { content: ""; position: absolute; inset: -40% -35%; z-index: -1; background: radial-gradient(closest-side, rgba(4, 3, 10, .62), rgba(4, 3, 10, 0)); }
.card.l { left: 7vw; }
.card.r { right: calc(7vw + 60px); }
.card.c { left: 0; right: 0; margin-inline: auto; width: min(880px, 86vw); text-align: center; }
.card.b { top: auto; bottom: 10vh; left: 0; right: 0; margin-inline: auto; width: min(640px, 86vw); text-align: center; }
.card.b > .in { transform: none; }
.kicker { font: 500 11px/1.4 var(--mono); letter-spacing: .3em; text-transform: uppercase; color: var(--accent); margin-bottom: 22px; transition: color .8s; }
.card h2 { font: 400 clamp(30px, 2.9vw, 46px)/1.2 var(--serif); letter-spacing: .02em; margin-bottom: 10px; }
.card .en { font: italic 400 clamp(15px, 1.2vw, 18px)/1.4 var(--latin-serif); color: rgba(236, 233, 242, .55); margin-bottom: 24px; }
.card p { font-size: 15.5px; line-height: 1.95; color: var(--ink-soft); }
.facts { list-style: none; margin-top: 26px; border-top: 1px solid rgba(255, 255, 255, .1); text-align: left; }
.facts li { display: flex; gap: 16px; padding: 12px 0; border-bottom: 1px solid rgba(255, 255, 255, .1); font-size: 13.5px; line-height: 1.6; color: rgba(225, 230, 242, .78); }
.facts li em { flex: 0 0 52px; font: 500 11px/1.9 var(--mono); font-style: normal; letter-spacing: .12em; color: var(--accent); transition: color .8s; }
.fig { margin-top: 22px; font: 400 11px/1.6 var(--mono); letter-spacing: .08em; color: rgba(236, 233, 242, .4); }
.fig::before { content: ""; display: inline-block; width: 22px; height: 1px; margin-right: 10px; vertical-align: middle; background: var(--accent); transition: background .8s; }

/* 序章 */
.hero h1 { font: 400 clamp(52px, 8.4vw, 132px)/1 var(--serif); letter-spacing: .02em; }
.hero h1 em { font: italic 400 1.08em/1 var(--latin-serif); margin-right: .12em; }
.hero h1 em { color: var(--accent); text-shadow: 0 0 48px color-mix(in srgb, var(--accent) 35%, transparent); }
.hero .zh { margin-top: 26px; font: 300 clamp(16px, 1.6vw, 22px)/1.5 var(--sans); letter-spacing: .5em; color: rgba(236, 233, 242, .8); padding-left: .5em; }
.hero blockquote { margin: 44px auto 0; max-width: 520px; font: 400 clamp(15px, 1.25vw, 19px)/1.7 var(--serif); color: rgba(236, 233, 242, .72); }
.hero blockquote small { display: block; margin-top: 10px; font: italic 400 14px/1.6 var(--latin-serif); color: var(--ink-dim); }

/* 终章 */
.cta { display: flex; gap: 12px; margin-top: 30px; flex-wrap: wrap; }
.cta a {
  display: inline-flex; align-items: center; gap: 10px; padding: 13px 22px; border-radius: 999px; text-decoration: none;
  font: 500 14px/1 var(--sans); letter-spacing: .08em; border: 1px solid rgba(255, 255, 255, .2);
  background: rgba(255, 255, 255, .04); backdrop-filter: blur(8px); transition: transform .3s, box-shadow .3s;
}
.cta a:first-child { background: var(--accent); color: #1a0d02; border-color: transparent; box-shadow: 0 0 30px color-mix(in srgb, var(--accent) 35%, transparent); }
.cta a:hover { transform: translateY(-2px); }
.coda { margin-top: 28px; font: italic 400 16px/1.5 var(--latin-serif); color: rgba(236, 233, 242, .6); }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

/* 加载 */
#loader { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: var(--bg); transition: opacity 1.2s ease, visibility 1.2s; }
.ready #loader { opacity: 0; visibility: hidden; }
#loader .box { width: 260px; text-align: center; }
#loader h3 { font: 400 22px/1.3 var(--serif); color: var(--ink); margin-bottom: 26px; }
#loader .line { height: 1px; background: rgba(255, 255, 255, .1); overflow: hidden; }
#loadbar { height: 100%; background: var(--accent); transform-origin: left; transform: scaleX(0); transition: transform .4s ease; }
#loadtxt { margin-top: 16px; font: 500 11px/1.6 var(--mono); letter-spacing: .2em; color: var(--ink-dim); }

#nogl { position: fixed; inset: 0; z-index: 30; display: grid; place-content: center; gap: 14px; text-align: center; background: var(--bg); font-size: 16px; padding: 24px; }
#nogl[hidden] { display: none; }

.cinema .hud, .cinema #rail, .cinema .card { opacity: 0 !important; pointer-events: none; }

@media (max-width: 820px) {
  .hud { padding: 18px; font-size: 10px; }
  #spec, #rail, .keys { display: none; }
  .card.l, .card.r, .card.b { top: auto; bottom: 7vh; left: 6vw; right: auto; margin: 0; width: 88vw; text-align: left; }
  .card.l > .in, .card.r > .in { transform: none; }
  .card::before { inset: -30% -20%; }
  .card p { font-size: 14px; line-height: 1.8; }
  .facts { display: none; }
  .card.c { top: 18%; }
  .card.c > .in { transform: none; }
  .hero .zh { letter-spacing: .3em; }
}
@media (prefers-reduced-motion: reduce) {
  .hint::after { animation: none; }
}

/* 顶栏右边的登录和申请开通 */
.hud-right { display: flex; align-items: center; gap: 22px; }
.entry { display: flex; gap: 10px; pointer-events: auto; }
.entry a {
  font: 500 13px/1 var(--sans); letter-spacing: .08em; text-transform: none; text-decoration: none;
  padding: 9px 16px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .22); background: rgba(255, 255, 255, .05);
  backdrop-filter: blur(8px); color: var(--ink); transition: border-color .3s, background .3s;
}
.entry a:hover { border-color: var(--accent); }
.entry a.primary { background: var(--accent); color: #031a14; border-color: transparent; }
@media (max-width: 820px) {
  .hud-right .count { display: none; }
  .entry a { padding: 8px 12px; font-size: 12px; }
}
