@import url('https://fonts.googleapis.com/css2?family=Exo:wght@300;400;500;600;700&family=Roboto+Mono:wght@300;400;500;700&display=swap');

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

:root {
  --ink: #1c1726;
  --ink-2: #251d36;
  --ink-3: #2d1445;
  --violet: #6514ff;
  --magenta: #bf00ff;
  --paper: #f7f3ff;
  --dim: #bcb0da;
  --line: rgba(247, 243, 255, 0.14);
  --r: 28px;
  --pad: clamp(18px, 4vw, 46px);
  --max: 1320px;
  --head-h: 76px;
  --font: 'Exo', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', system-ui, sans-serif;
  --mono: 'Roboto Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.78;
  font-weight: 400;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: -22%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.9;
  background-image:
    radial-gradient(circle at 20% 16%, rgba(101, 20, 255, 0.55), transparent 42%),
    radial-gradient(circle at 84% 76%, rgba(191, 0, 255, 0.44), transparent 46%),
    repeating-linear-gradient(115deg, rgba(247, 243, 255, 0.055) 0 1px, transparent 1px 36px);
  animation: drift 28s linear infinite alternate;
}

@keyframes drift {
  from { transform: translate3d(-2%, -1.5%, 0) scale(1); }
  to { transform: translate3d(2.5%, 2%, 0) scale(1.1); }
}

img { max-width: 100%; }

a { color: var(--paper); }

:focus-visible {
  outline: 3px solid var(--magenta);
  outline-offset: 3px;
  border-radius: 8px;
}

/* ---------- 顶栏 ---------- */

.sitehead {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(28, 23, 38, 0.84);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}

.headgrid {
  max-width: var(--max);
  margin: 0 auto;
  min-height: var(--head-h);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 0 var(--pad);
}

.hnav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 2px;
}

.hnav-r ul { justify-content: flex-end; }

.hnav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 12px;
  font-size: 16px;
  line-height: 1.2;
  text-decoration: none;
  border-radius: 12px;
  color: var(--paper);
  transition: background 0.22s ease, color 0.22s ease, transform 0.22s ease;
}

.hnav a::before {
  content: "";
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 2px;
  transform: rotate(45deg);
  background: var(--violet);
  transition: background 0.22s ease, transform 0.22s ease;
}

.hnav-r a::before { background: var(--magenta); }

.hnav a:hover,
.hnav a:focus-visible {
  background: rgba(191, 0, 255, 0.18);
  color: #fff;
}

.hnav a:hover::before { transform: rotate(0) scale(1.25); }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  justify-self: center;
  padding: 8px 6px;
  text-decoration: none;
  color: var(--paper);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.brandmark {
  width: 22px;
  height: 22px;
  border-radius: 8px 2px 8px 2px;
  background: linear-gradient(135deg, var(--violet), var(--magenta));
  box-shadow: 4px 4px 0 rgba(191, 0, 255, 0.35);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.brand:hover .brandmark {
  transform: rotate(-12deg) scale(1.06);
  box-shadow: 2px 2px 0 rgba(101, 20, 255, 0.6);
}

.search { display: flex; align-items: center; margin-left: 8px; }

.sinput {
  width: 118px;
  min-height: 40px;
  padding: 8px 15px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(247, 243, 255, 0.06);
  color: var(--paper);
  font-family: var(--font);
  font-size: 16px;
  transition: width 0.26s ease, border-color 0.26s ease, background 0.26s ease;
}

.sinput::placeholder { color: var(--dim); }

.sinput:focus {
  width: 168px;
  outline: none;
  border-color: var(--magenta);
  background: rgba(191, 0, 255, 0.16);
}

/* ---------- 骨架 ---------- */

.shell {
  position: relative;
  z-index: 1;
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(26px, 4vw, 54px) var(--pad) clamp(56px, 9vw, 120px);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(26px, 4vw, 48px);
  align-items: start;
}

.rail { min-width: 0; }

.rail-k {
  display: block;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.28em;
  color: var(--magenta);
}

.rail-h {
  margin: 2px 0 14px;
  font-size: 22px;
  line-height: 1.3;
  letter-spacing: 0.02em;
}

.rail-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rail-nav li.off { display: none; }

.rail-nav a {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 14px;
  font-size: 16px;
  line-height: 1.3;
  text-decoration: none;
  color: var(--paper);
  border-radius: 14px;
  background: rgba(247, 243, 255, 0.06);
  transition: background 0.22s ease, color 0.22s ease, transform 0.22s ease;
}

.rail-nav a:hover,
.rail-nav a:focus-visible {
  background: var(--violet);
  color: #fff;
  transform: translateX(3px);
}

main { min-width: 0; }

div {
  display: grid;
  gap: clamp(30px, 4.6vw, 54px);
}

/* ---------- 首屏 ---------- */

.hero {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: clamp(22px, 4vw, 46px);
  min-height: calc(100vh - var(--head-h));
  padding: clamp(34px, 7vw, 88px) 0 clamp(24px, 5vw, 56px);
  text-align: center;
  scroll-margin-top: var(--head-h);
}

.hero-txt { display: grid; gap: 18px; justify-items: center; }

.hero h1 {
  margin: 0;
  max-width: 18em;
  font-size: clamp(38px, 7.2vw, 86px);
  line-height: 1.06;
  font-weight: 700;
  letter-spacing: -0.025em;
  text-wrap: balance;
  background: linear-gradient(96deg, var(--paper) 0%, var(--paper) 32%, var(--magenta) 64%, var(--violet) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-lede {
  margin: 0;
  max-width: 32em;
  font-size: 17px;
  line-height: 1.8;
  color: var(--dim);
}

.hero-fig {
  position: relative;
  margin: 0;
  width: min(880px, 100%);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--line), 0 30px 70px -30px rgba(101, 20, 255, 0.7);
}

.hero-fig img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--r);
}

.hero-fig::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--r);
  background: linear-gradient(160deg, rgba(101, 20, 255, 0.45), rgba(191, 0, 255, 0.12) 55%, transparent);
  mix-blend-mode: screen;
  pointer-events: none;
}

/* ---------- 正文块 ---------- */

div > article:not(.hero) {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-radius: var(--r);
  padding: clamp(24px, 4.2vw, 56px);
  background: linear-gradient(158deg, var(--ink-2), #221a33 58%, var(--ink-3));
  scroll-margin-top: calc(var(--head-h) + 88px);
  scroll-snap-align: start;
}

div > article:not(.hero)::before {
  content: "";
  position: absolute;
  top: -78px;
  right: -74px;
  width: 216px;
  height: 216px;
  border-radius: 62px;
  transform: rotate(18deg);
  background: var(--violet);
  opacity: 0.32;
  z-index: -1;
}

div > article:not(.hero):nth-of-type(even)::before {
  right: auto;
  left: -80px;
  bottom: -80px;
  top: auto;
  border-radius: 50%;
  background: var(--magenta);
  opacity: 0.3;
}

div > article:not(.hero) > * { position: relative; z-index: 1; }

div small {
  display: block;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.26em;
  color: var(--magenta);
  margin-bottom: 8px;
}

div h2 {
  margin: 0 0 18px;
  font-size: clamp(26px, 3.6vw, 42px);
  line-height: 1.18;
  letter-spacing: -0.015em;
  font-weight: 700;
}

div h3 {
  margin: 30px 0 12px;
  font-size: clamp(20px, 2.3vw, 26px);
  line-height: 1.3;
  font-weight: 600;
  color: #fff;
}

div h3::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 10px;
  border-radius: 3px;
  transform: rotate(45deg);
  background: var(--magenta);
  vertical-align: 2px;
}

div p { margin: 0 0 16px; }

div p:last-child,
div ul:last-child,
div ol:last-child { margin-bottom: 0; }

div a {
  color: var(--magenta);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  transition: color 0.2s ease, background 0.2s ease;
}

div a:hover { color: #fff; background: rgba(191, 0, 255, 0.24); }

div ul,
div ol { margin: 0 0 18px; padding-left: 1.35em; }

div li { margin-bottom: 8px; }

div li::marker { color: var(--violet); font-weight: 700; }

div blockquote {
  margin: 0 0 18px;
  padding: 4px 0 4px 20px;
  border-left: 5px solid var(--magenta);
  color: var(--dim);
}

div img {
  height: auto;
  border-radius: 18px;
  margin: 8px 0 18px;
}

div table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
  margin-bottom: 18px;
}

div th,
div td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

div th { color: #fff; font-weight: 600; }

div code,
div pre { font-family: var(--mono); font-size: 15px; }

div pre {
  overflow-x: auto;
  padding: 16px;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.35);
}

div hr {
  border: 0;
  height: 1px;
  background: var(--line);
  margin: 26px 0;
}

/* ---------- 页脚 ---------- */

.foot {
  position: relative;
  z-index: 1;
  margin-top: clamp(28px, 5vw, 64px);
  padding: clamp(38px, 6vw, 78px) var(--pad) clamp(26px, 4vw, 44px);
  text-align: center;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(101, 20, 255, 0.18), transparent 72%);
}

.foot-mark {
  margin: 0 0 8px;
  font-size: clamp(42px, 12vw, 130px);
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.035em;
  background: linear-gradient(96deg, var(--violet), var(--magenta));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.foot-mark a {
  display: inline-block;
  padding: 8px 4px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.26s ease;
}

.foot-mark a:hover { transform: translateY(-4px); }

.foot-line {
  display: block;
  font-family: var(--mono);
  font-size: 15px;
  letter-spacing: 0.08em;
  color: var(--dim);
}

/* ---------- 动效 ---------- */

.reveal { opacity: 0; transform: translateY(24px); }

.reveal.in {
  opacity: 1;
  transform: none;
  transition: opacity 0.5s ease, transform 0.55s cubic-bezier(0.2, 0.7, 0.2, 1);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  body::before { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .hnav a, .rail-nav a, .sinput, .foot-mark a, .brandmark { transition: none; }
}

/* ---------- 断点 ---------- */

@media (min-width: 960px) {
  html { scroll-snap-type: y proximity; }

  .shell { grid-template-columns: 224px minmax(0, 1fr); }

  .rail {
    position: sticky;
    top: calc(var(--head-h) + 22px);
  }

  .rail-nav ul {
    flex-direction: column;
    flex-wrap: nowrap;
  }
}

@media (max-width: 959px) {
  .headgrid { grid-template-columns: 1fr auto; }
  .hnav-l { display: none; }
  .hnav-r ul { display: none; }
  .hnav-r { justify-self: end; }
  .brand { justify-self: start; font-size: 18px; }
  .search { margin-left: 0; }
  .sinput { width: 128px; }
  .sinput:focus { width: 152px; }
  .hero { min-height: calc(100vh - var(--head-h)); }
}

@media (min-width: 1100px) {
  .hnav a { padding: 9px 14px; }
}

@media (max-width: 480px) {
  body { font-size: 16px; }
  .hero h1 { font-size: clamp(34px, 10vw, 44px); }
  div > article:not(.hero) { border-radius: 22px; }
  .foot-mark { font-size: clamp(38px, 15vw, 60px); }
  .rail-h { font-size: 19px; }
}

button[aria-expanded]{min-width:44px;min-height:44px}
