:root {
  --bg: #08090c;
  --text: #e9eaee;
  --dim: #8b909c;
  --soft: #b9bdc7;
  --acc: #8f7dff;
  --acc2: #58a0ff;
  --line: rgba(255, 255, 255, .1);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --maxw: 1080px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;          /* 页面不滚动：滚轮被接管成挡位 */
  overscroll-behavior: none;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
h1, h2 { margin: 0; font-weight: 500; letter-spacing: -.025em; line-height: 1.12; }

/* 层间遮罩画在 canvas 内部（流体之上、粒子之下） */
#fluid-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
  pointer-events: none;
}

.grain {
  position: fixed;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  z-index: 2;
  pointer-events: none;
  opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 900ms steps(1) infinite;
}
@keyframes grain {
  0%  { transform: translate(0, 0); }
  12% { transform: translate(-3%, -4%); }
  25% { transform: translate(2%, -2%); }
  37% { transform: translate(-2%, 3%); }
  50% { transform: translate(3%, 1%); }
  62% { transform: translate(-4%, -1%); }
  75% { transform: translate(1%, 4%); }
  87% { transform: translate(-1%, -3%); }
}

.wrap { width: min(100% - 40px, var(--maxw)); margin-inline: auto; }

/* ---------- 导航 ---------- */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 20;
}
nav .wrap { display: flex; align-items: center; gap: 26px; height: 62px; }
.brand { font-weight: 500; letter-spacing: -.01em; margin-right: auto; }
nav a { font-size: 14px; color: var(--dim); transition: color .2s; }
nav a:hover { color: var(--text); }
nav .btn { color: var(--bg); }

.btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border-radius: 6px;
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  font-weight: 500;
  transition: opacity .2s;
  will-change: transform;
}
.btn:hover { opacity: .85; }
.btn-lg { padding: 13px 26px; font-size: 15px; }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, .28);
  transition: border-color .3s, background .3s;
}
.btn-ghost:hover { border-color: rgba(255, 255, 255, .6); background: rgba(255, 255, 255, .04); }

/* ---------- 节点指示器 ---------- */
.dots {
  position: fixed;
  right: 22px; top: 50%;
  transform: translateY(-50%);
  z-index: 20;
  display: grid;
  gap: 15px;
}
.dots button {
  width: 7px; height: 7px;
  padding: 0; border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .2);
  cursor: pointer;
  transition: background .35s, transform .35s;
}
.dots button:hover { background: rgba(255, 255, 255, .45); }
.dots button.on { background: var(--text); transform: scale(1.5); }
/* 换挡后字还没拼出来：节点脉动，提示输入被挂起 */
.dots.busy button.on { animation: dotpulse .9s ease-in-out infinite; }
@keyframes dotpulse {
  0%, 100% { transform: scale(1.5); opacity: 1; }
  50%      { transform: scale(1); opacity: .45; }
}

/* ---------- 挡位轨道 ---------- */
.stage {
  position: fixed;
  inset: 0;
  z-index: 3;
  overflow: hidden;
}
.track {
  height: 100%;
  transform: translateY(0);
  transition: transform .74s cubic-bezier(.76, 0, .18, 1);
  will-change: transform;
}
.slide {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
}

h1 { font-size: clamp(34px, 6vw, 68px); }
h2 { font-size: clamp(30px, 5.2vw, 58px); }
.fig { font-family: var(--mono); letter-spacing: -.04em; font-size: clamp(24px, 4vw, 50px); }

.slide .btn-lg { margin-top: 40px; align-self: flex-start; }

/* 粒子层接管标题：文字保留占位与无障碍，但不上色 */
.glyph-mode [data-glyph] { color: transparent; }
/* 调试用：?outline 显示 DOM 文字的真实位置 */
.outline [data-glyph] { -webkit-text-stroke: 1px rgba(255, 70, 70, .85); }

.hint {
  position: absolute;
  left: 50%; bottom: 40px;
  transform: translateX(-50%);
  font-size: 12px;
  color: var(--dim);
  letter-spacing: .18em;
  animation: bob 2.4s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { transform: translate(-50%, 0); opacity: .45; }
  50%      { transform: translate(-50%, 7px); opacity: 1; }
}

/* ---------- 末屏页脚 ---------- */
.foot {
  position: absolute;
  left: 0; right: 0; bottom: 34px;
  width: min(100% - 40px, var(--maxw));
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: 22px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}
.foot a { font-size: 14px; color: var(--dim); transition: color .2s; }
.foot a:hover { color: var(--text); }
.note { margin-left: auto; font-size: 13px; color: var(--dim); }

/* ---------- 星空层 ---------- */
#star-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;      /* 与流体同层，DOM 在后 → 画在流体之上、内容之下 */
  display: block;
  pointer-events: none;
}

/* ---------- 文案与插图 ---------- */
.kicker {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .22em;
  color: var(--dim);
  margin-bottom: 20px;
}
.kicker::before {
  content: '';
  display: inline-block;
  width: 22px; height: 1px;
  background: linear-gradient(90deg, var(--acc), var(--acc2));
  vertical-align: middle;
  margin-right: 10px;
}

.lead {
  margin: 0;
  max-width: 44ch;
  font-size: 16px;
  line-height: 2;
  color: var(--soft);
}
.slide h1 + .lead { margin-top: 26px; }
.lead .w { display: inline-block; }

.cols {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(32px, 6vw, 72px);
  align-items: center;
  margin-top: 38px;
}

.viz { margin: 0; }
/* 3D 物件画布：透明底，星空和流体从物件之间透过来 */
.viz canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
}
.viz figcaption {
  margin-top: 12px;
  text-align: center;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .18em;
  color: var(--dim);
}

/* ---------- 数据卡片 ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 44px;
}
.stat {
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, .028);
}
.stat b {
  display: block;
  font-family: var(--mono);
  font-weight: 500;
  font-size: clamp(20px, 2.6vw, 32px);
  letter-spacing: -.03em;
  line-height: 1.3;
}
.stat span { font-size: 13px; color: var(--dim); }
.stat.hot b {
  background: linear-gradient(90deg, var(--acc), var(--acc2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- 出入场 ----------
   停稳（transitionend）加 .on 入场；换挡瞬间移除，.22s 内收场。
   带 data-glyph 的元素不参与位移/缩放：粒子在停稳后测 rect，
   中间态会让字拼到错的位置——首屏按钮因此只做透明度。 */
.slide .kicker {
  opacity: 0;
  letter-spacing: .4em;
  filter: blur(5px);
  transition: opacity .6s ease, letter-spacing .9s cubic-bezier(.16, 1, .3, 1), filter .6s ease;
}
.slide.on .kicker { opacity: 1; letter-spacing: .22em; filter: blur(0); transition-delay: .05s; }

/* 逐字凝聚：延时由 JS 写在每个 span 的 --d 上 */
.lead .w {
  opacity: 0;
  transform: translateY(.5em);
  filter: blur(7px);
  transition: opacity .5s ease, transform .65s cubic-bezier(.16, 1, .3, 1), filter .5s ease;
  transition-delay: var(--d, 0s);
}
.slide.on .lead .w { opacity: 1; transform: none; filter: blur(0); }

/* 物件：辉光中浮现 */
.slide .viz canvas {
  opacity: 0;
  transform: scale(1.05);
  filter: blur(18px);
  transition: opacity .9s ease, transform 1.2s cubic-bezier(.16, 1, .3, 1), filter .9s ease;
}
.slide.on .viz canvas { opacity: 1; transform: none; filter: blur(0); transition-delay: .25s; }
.slide .viz figcaption {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .6s ease, transform .6s cubic-bezier(.16, 1, .3, 1);
}
.slide.on .viz figcaption { opacity: 1; transform: none; transition-delay: .55s; }

.slide .stat {
  opacity: 0;
  transform: translateY(22px);
  filter: blur(6px);
  transition: opacity .6s ease, transform .7s cubic-bezier(.16, 1, .3, 1), filter .6s ease;
}
.slide.on .stat {
  opacity: 1; transform: none; filter: blur(0);
  transition-delay: calc(.12s + var(--i, 0) * .07s);
}

.slide .btn-lg {
  opacity: 0;   /* 按钮标签由粒子拼出，盒子只做透明度，不做位移 */
  transition: opacity .7s ease .3s, border-color .3s, background .3s;
}
.slide.on .btn-lg { opacity: 1; }

/* 离场：不等入场延时，快速散去 */
.slide:not(.on) .kicker,
.slide:not(.on) .lead .w,
.slide:not(.on) .viz canvas,
.slide:not(.on) .viz figcaption,
.slide:not(.on) .stat,
.slide:not(.on) .btn-lg {
  transition-duration: .22s;
  transition-delay: 0s !important;
}

/* 显式关动效（?motion=off）：内容直接可见，不做任何过渡 */
.no-motion .slide .kicker { opacity: 1; letter-spacing: .22em; filter: none; transition: none; }
.no-motion .lead .w { opacity: 1; transform: none; filter: none; transition: none; }
.no-motion .slide .viz canvas { opacity: 1; transform: none; filter: none; transition: none; }
.no-motion .slide .viz figcaption { opacity: 1; transform: none; transition: none; }
.no-motion .slide .stat { opacity: 1; transform: none; filter: none; transition: none; }
.no-motion .slide .btn-lg { opacity: 1; transition: none; }

@media (max-width: 860px) {
  .cols { grid-template-columns: 1fr; gap: 30px; }
  .viz { max-width: 460px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px), (max-height: 640px) {
  .viz { display: none; }   /* 小屏放不下插图，让文案完整露出 */
  .lead { font-size: 15px; }
}

@media (max-height: 700px) {
  .stats { margin-top: 28px; }
  .stat { padding: 14px 16px; }
}

@media (max-width: 720px) {
  .dots { display: none; }
  .note { display: none; }
}
