@font-face {
  font-family: "Geist";
  src: url("assets/fonts/Geist-Variable.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Geist Mono";
  src: url("assets/fonts/GeistMono-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #ffffff;
  --ink-2: #9b9b9b;
  --ink-3: #666666;
  --base: #000000;
  --line: #313131;
  --accent: #8ab4ff;

  --s25: 2px;
  --s50: 4px;
  --s75: 8px;
  --s100: 12px;
  --s200: 16px;
  --s300: 24px;
  --s400: 32px;
  --s500: 40px;
  --s600: 48px;
  --s700: 64px;
  --s800: 80px;
  --s900: 96px;

  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: "Geist", "Microsoft YaHei", "PingFang SC", sans-serif;
}

.heading-1 { font-size: 60px; line-height: 1.06; font-weight: 600; letter-spacing: -0.02em; }
.heading-2 { font-size: 48px; line-height: 1.12; font-weight: 600; letter-spacing: -0.02em; }
.heading-3 { font-size: 36px; line-height: 1.2; font-weight: 600; letter-spacing: -0.01em; }
.heading-4 { font-size: 30px; line-height: 1.2; font-weight: 600; }

.title-1 { font-size: 20px; line-height: 28px; font-weight: 500; }
.body-2 { font-size: 16px; line-height: 26px; font-weight: 500; }
.body-3 { font-size: 16px; line-height: 26px; font-weight: 400; }
.body-6 { font-size: 14px; line-height: 22px; font-weight: 400; }
.button-md { font-size: 16px; line-height: 24px; font-weight: 600; }
.caption-2 { font-size: 14px; line-height: 20px; font-weight: 400; }
.caption-3 { font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: 0.14em; }
.caption-4 { font-size: 12px; line-height: 16px; font-weight: 500; }

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--base);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-radius: var(--r-xs);
}

.skip {
  position: fixed;
  left: var(--s200);
  top: calc(-1 * var(--s900));
  z-index: 20;
  padding: var(--s75) var(--s100);
  background: var(--ink);
  color: var(--base);
  border-radius: var(--r-sm);
}
.skip:focus { top: var(--s200); }

/* ---------------- canvas ---------------- */

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

/* ---------------- nav ---------------- */

.nav {
  position: fixed;
  top: var(--s200);
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: var(--s300);
  padding: var(--s75) var(--s200);
  border-radius: 999px;
  background: rgba(20, 20, 20, 0.55);
  border: 1px solid var(--line);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  white-space: nowrap;
}

.nav-brand { color: var(--ink); }
.nav-dot { width: 4px; height: 4px; border-radius: 999px; background: var(--ink-3); }
.nav a { color: var(--ink-2); transition: color 300ms var(--ease); }
.nav a:hover { color: var(--ink); }

/* ---------------- progress ---------------- */

.progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 11;
  background: rgba(255, 255, 255, 0.06);
}
.progress span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #6ea8fe, #ffffff);
}

/* ---------------- chapters ---------------- */

#story { position: relative; z-index: 1; }

.chapter {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--s900) var(--s300);
  opacity: 0;
  will-change: opacity, transform;
  pointer-events: none;
}

/* 左侧文字区压暗，保证可读性又不盖住右侧的粒子 */
.chapter::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.9) 0%,
    rgba(0, 0, 0, 0.68) 34%,
    rgba(0, 0, 0, 0.18) 58%,
    rgba(0, 0, 0, 0) 72%
  );
  pointer-events: none;
  z-index: -1;
}

.chapter > * {
  position: relative;
  max-width: 680px;
  margin-left: clamp(0px, 9vw, 160px);
}

.eyebrow { color: var(--accent); margin-bottom: var(--s300); letter-spacing: 0.16em; }

/* 题记：一行衬线小字，压在标题上方 */
.epigraph {
  font-family: "Songti SC", "Source Han Serif SC", "Noto Serif CJK SC", "SimSun", serif;
  font-size: clamp(15px, 1.05vw, 18px);
  line-height: 1.9;
  letter-spacing: 0.24em;
  color: var(--ink-2);
  margin-bottom: var(--s200);
}

.chapter h1,
.chapter h2 {
  color: var(--ink);
  background: linear-gradient(90deg, #ffffff 0%, #9b9b9b 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  max-width: 680px;
}

.chapter-body {
  color: var(--ink-2);
  margin-top: var(--s300);
  max-width: 600px;
  text-wrap: pretty;
}
.chapter-body + .chapter-body { margin-top: var(--s200); }

.chapter-note { color: var(--ink-3); margin-top: var(--s400); }

.cta {
  align-self: flex-start;
  margin-top: var(--s500);
  padding: var(--s75) var(--s100);
  background: var(--ink);
  color: var(--base);
  border-radius: var(--r-md);
  transition: transform 500ms var(--ease), background 300ms var(--ease);
}
.cta:hover { background: #e4e4e4; transform: translateY(-1px); }
.cta:active { transform: scale(0.98); }

/* ---------------- app chapter ---------------- */

.chapter--app {
  justify-content: center;
  align-items: flex-start;
}

.app-head {
  display: flex;
  align-items: center;
  gap: var(--s200);
  margin-bottom: var(--s200);
}

.app-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--r-lg);
  display: block;
  background: #181818;
  box-shadow: 0 0 40px -8px var(--accent);
  transition: transform 600ms var(--ease);
}
.chapter--app:hover .app-icon { transform: scale(1.05); }

.app-kind { color: var(--ink-3); letter-spacing: 0.12em; margin-bottom: var(--s50); }

.app-books {
  color: var(--ink-3);
  margin-top: var(--s300);
  letter-spacing: 0.02em;
}

.app-tag {
  margin-top: var(--s300);
  align-self: flex-start;
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: var(--r-xs);
  padding: var(--s25) var(--s75);
}

/* ---------------- about chapter ---------------- */

.chapter--about .chapter-body { max-width: 560px; }

/* ---------------- noscript ---------------- */

.noscript {
  position: relative;
  z-index: 2;
  padding: var(--s900) var(--s300);
  color: var(--ink-2);
  max-width: 680px;
}

/* ---------------- responsive ---------------- */

@media (max-width: 720px) {
  .heading-2 { font-size: 34px; line-height: 1.16; }
  .heading-3 { font-size: 30px; line-height: 1.2; }
  .chapter { padding: var(--s800) var(--s200); justify-content: flex-end; padding-bottom: var(--s900); }
  .chapter > * { margin-left: 0; }
  .chapter::before {
    background: linear-gradient(0deg, rgba(0,0,0,0.88) 30%, rgba(0,0,0,0.2) 75%, transparent);
  }
  .nav { gap: var(--s200); padding: var(--s75) var(--s100); font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .chapter { transition: none; }
  .cta:hover, .chapter--app:hover .app-icon { transform: none; }
}