/* =========================================================
   X-1
   ========================================================= */

:root {
  --ink: #08090b;
  --fg: #f2f4f7;
  --fg-mute: #8d95a3;
  --dim: #5c636e;
  --line: rgba(255, 255, 255, 0.07);
  --accent: #67e8f9;
  --accent-dim: rgba(103, 232, 249, 0.55);

  --font-sans: 'Inter', 'Noto Sans SC', -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --pad: clamp(22px, 6vw, 88px);
  --max: 1120px;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--fg);
  font-family: var(--font-sans);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
h1, h2 { margin: 0; font-weight: 600; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

::selection {
  background: var(--accent);
  color: var(--ink);
}

/* ─── 背景 ─────────────────────────────────────────────── */

.grain {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  opacity: 0.028;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 78% 62% at 50% 34%, #000 20%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 78% 62% at 50% 34%, #000 20%, transparent 78%);
}

.glow {
  position: fixed;
  top: 0;
  left: 0;
  width: 620px;
  height: 620px;
  margin: -310px 0 0 -310px;
  z-index: 0;
  pointer-events: none;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(103, 232, 249, 0.075), transparent 66%);
  transform: translate3d(50vw, 42vh, 0);
  will-change: transform;
}

/* ─── 首屏 ─────────────────────────────────────────────── */

.stage {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  overflow: hidden;
}

/* 字标投在地面上的光，让它看起来悬着而不是贴着 */
.stage::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 13%;
  width: min(62vw, 900px);
  height: 130px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center,
    rgba(103, 232, 249, 0.13) 0%,
    rgba(103, 232, 249, 0.05) 38%,
    transparent 72%);
  filter: blur(18px);
  pointer-events: none;
}

/* ─── 导航栏（滚动后由字标变形而来）───────────────────── */

.nav {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: min(92vw, 1100px);
  height: 62px;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 20px;
  pointer-events: none;
}

.pill {
  position: absolute;
  inset: 0;
  border-radius: 18px;
  background: rgba(17, 19, 23, 0.72);
  border: 1px solid var(--line);
  backdrop-filter: blur(20px) saturate(170%);
  -webkit-backdrop-filter: blur(20px) saturate(170%);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: auto;
}

.tools {
  position: relative;
  display: flex;
  align-items: center;
  opacity: 0;
  pointer-events: auto;
}

.lang {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line);
}

.lang button {
  padding: 5px 13px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--dim);
  font-family: var(--font-sans);
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: color 0.25s ease, background 0.25s ease;
}

.lang button:hover { color: var(--fg-mute); }

.lang button.on {
  background: rgba(255, 255, 255, 0.1);
  color: var(--fg);
}

/* ─── 字标 ─────────────────────────────────────────────── */

/* 标记：X 的右下臂延长成那道「\」，同一个动作里既是 X 又是斜杠。
   白、直角、零圆角；下面挂一行 X–1 小字，滚动时小字先消失、标记缩进导航栏。 */
.mark {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 101;
  margin: 0;
  width: min(35vw, 700px, 76vh);
  color: #ffffff;
  transform-origin: center center;
  pointer-events: none;
  user-select: none;

  clip-path: inset(0 0 100% 0);
  animation: unmask 1.5s 0.1s cubic-bezier(0.16, 1, 0.3, 1) forwards;

  will-change: transform, opacity;
}

.mark-glyph {
  display: block;
  width: 100%;
  height: auto;
}

/* 「\」比 X 晚一拍落下，像最后补的一刀 */
.mark-slash {
  transform-box: fill-box;
  transform-origin: 50% 50%;
  opacity: 0;
  animation: slashIn 0.8s 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slashIn {
  from { opacity: 0; transform: translateX(-2.5%); }
  to   { opacity: 1; transform: none; }
}

/* 首屏下面的 X–1 小字 */
.mark-word {
  position: absolute;
  left: 50%;
  top: calc(100% + 2.6vh);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.55em;
  font-family: var(--font-mono);
  font-size: clamp(12px, 0.95vw, 15px);
  letter-spacing: 0.28em;
  color: var(--fg-mute);
  white-space: nowrap;
  opacity: 0;
  animation: wordIn 1s 1.05s ease forwards;
}

.mark-word i {
  display: block;
  width: 2.6em;
  height: 1px;
  background: rgba(255, 255, 255, 0.18);
  font-style: normal;
}

@keyframes wordIn { to { opacity: 1; } }

/* 有 JS 时由脚本接管位置；字库就绪前把入场动画挂起，避免按兜底字体闪一下 */
html.js .mark {
  opacity: 0;
  animation-play-state: paused;
}

html.js.mark-ready .mark { animation-play-state: running; }

/* 无 JS 兜底：居中显示，小字直接出现 */
html:not(.js) .mark {
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  clip-path: inset(-8% -6% -22% -6%);
}

html:not(.js) .mark-word { opacity: 1; }

@keyframes unmask {
  from { clip-path: inset(0 0 100% 0); }
  to   { clip-path: inset(-8% -6% -22% -6%); }
}

.stage::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 46px;
  width: 1px;
  height: 58px;
  background: linear-gradient(to bottom, transparent, var(--line), transparent);
  transform: translateX(-50%);
  animation: breathe 3.4s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { opacity: 0.25; transform: translateX(-50%) scaleY(0.6); }
  50%      { opacity: 1;    transform: translateX(-50%) scaleY(1); }
}

.cue {
  position: absolute;
  left: 50%;
  bottom: 104px;
  transform: translateX(-50%);
  width: 26px;
  height: 26px;
  color: var(--dim);
  opacity: 0;
  animation: fadeIn 1s 1.6s ease forwards;
  transition: color 0.3s ease;
}

.cue:hover { color: var(--accent); }

.cue svg {
  width: 100%;
  height: 100%;
  animation: bob 2.8s ease-in-out infinite;
}

@keyframes fadeIn { to { opacity: 1; } }

@keyframes bob {
  0%, 100% { transform: translateY(0); opacity: 0.5; }
  50%      { transform: translateY(5px); opacity: 1; }
}

/* ─── 目录 ─────────────────────────────────────────────── */

.block {
  position: relative;
  z-index: 1;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--pad);
}

.block:first-of-type {
  padding-top: clamp(72px, 11vw, 140px);
}

.block + .block {
  margin-top: clamp(38px, 5vw, 68px);
}

.block h2 {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.7;
}

.block h2::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

.dir li { border-bottom: 1px solid var(--line); }

.dir .row {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 17px 0;
  transition: padding 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.dir .n {
  flex: none;
  min-width: 24px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--dim);
  transition: color 0.3s ease;
}

.dir b {
  flex: none;
  font-size: clamp(15px, 1.6vw, 17px);
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: color 0.3s ease;
}

.dir i {
  flex: none;
  margin-left: auto;
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 11.5px;
  letter-spacing: 0.02em;
  color: var(--dim);
  transition: color 0.3s ease;
}

/* 项目副标题 */
.dir .sub {
  flex: none;
  font-size: 12.5px;
  color: var(--dim);
  transition: color 0.3s ease;
}

.dir .row:hover { padding-left: 12px; }
.dir .row:hover b { color: var(--accent); }
.dir .row:hover .n { color: var(--accent); }
.dir .row:hover .sub { color: var(--fg-mute); }
.dir .row:hover i { color: var(--accent-dim); }

/* 空列表占位 */
.dir:not(:has(li))::after {
  content: '—';
  display: block;
  padding: 22px 0;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--dim);
  opacity: 0.5;
}

/* ─── 页脚 ─────────────────────────────────────────────── */

.foot {
  position: relative;
  z-index: 1;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--pad) clamp(56px, 8vw, 92px);
  margin-top: clamp(72px, 11vw, 130px);
}

.foot p {
  padding-top: 28px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.9;
  color: var(--dim);
}

/* ─── 滚动显现 ─────────────────────────────────────────── */

html.js .block {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}

html.js .block.in {
  opacity: 1;
  transform: none;
}

/* ─── 响应式 ───────────────────────────────────────────── */

@media (max-width: 720px) {
  .mark { width: min(74vw, 78vh); }

  .mark { font-size: min(43vw, 26vh); }

  .dir .row { gap: 12px; padding: 15px 0; }
  .dir .n { min-width: 20px; }
  .dir .sub { display: none; }
}

@media (max-width: 420px) {
  .mark { width: min(80vw, 78vh); }
  .mark { font-size: min(43vw, 24vh); }
  .dir i { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .mark { clip-path: inset(-8% -6% -22% -6%); }
  .block { opacity: 1; transform: none; }
  .cue { opacity: 1; }
  .glow { transition: none; }
}
