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

:root {
  --ink: #1c1726;
  --ink-deep: #120e19;
  --violet: #6514ff;
  --magenta: #bf00ff;
  --paper: #f4eeff;
  --dim: #bdb0d4;
  --line: rgba(191, 0, 255, .30);
  --line-soft: rgba(101, 20, 255, .28);
  --r: 28px;
  --mono: 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --hud: 'Share Tech Mono', 'Fira Code', ui-monospace, monospace;
}

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

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
  background: var(--ink-deep);
}

body {
  margin: 0;
  font-family: var(--mono);
  font-size: 17px;
  line-height: 1.75;
  color: var(--paper);
  background: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: -25%;
  z-index: 0;
  pointer-events: none;
  opacity: .5;
  background-image:
    repeating-linear-gradient(90deg, rgba(101, 20, 255, .22) 0 1px, transparent 1px 88px),
    repeating-linear-gradient(0deg, rgba(191, 0, 255, .14) 0 1px, transparent 1px 88px);
  animation: drift 28s linear infinite;
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-88px, -176px, 0); }
}

img { display: block; max-width: 100%; }

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

h1, h2, h3, h4 { font-family: var(--hud); font-weight: 400; letter-spacing: .01em; }

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  padding: 10px clamp(14px, 3vw, 34px);
  background: rgba(18, 14, 25, .9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand-wrap {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 4px 12px;
  font-family: var(--hud);
  font-size: 22px;
  color: #fff;
  text-decoration: none;
  letter-spacing: .06em;
  white-space: nowrap;
}

.brand-mark {
  width: 12px;
  height: 12px;
  background: var(--magenta);
  clip-path: polygon(0 0, 100% 0, 100% 60%, 40% 60%, 40% 100%, 0 100%);
}

.brand:hover .brand-mark { background: var(--violet); }

.nav { flex: 1; min-width: 0; }

.nav ol {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0;
  padding: 0 clamp(96px, 12vw, 176px);
  list-style: none;
}

.nav li:nth-child(4) { margin-left: auto; }

.nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 12px;
  font-size: 16px;
  color: var(--dim);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color .22s ease, border-color .22s ease, background-color .22s ease;
}

.nav a:hover,
.nav a:focus-visible {
  color: #fff;
  border-color: var(--magenta);
  background: rgba(191, 0, 255, .14);
}

.nav a[aria-current="true"] { color: #fff; border-color: var(--violet); }

/* ---------- Hero ---------- */

.hero {
  position: relative;
  z-index: 1;
  isolation: isolate;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: end;
  gap: clamp(24px, 4vw, 64px);
  padding: clamp(84px, 11vh, 132px) clamp(18px, 5vw, 64px) clamp(44px, 8vh, 92px);
  overflow: hidden;
}

.ghost {
  position: absolute;
  left: 50%;
  bottom: 2vh;
  z-index: -1;
  transform: translateX(-50%);
  font-family: var(--hud);
  font-size: clamp(76px, 24vw, 300px);
  line-height: .78;
  white-space: nowrap;
  color: transparent;
  -webkit-text-stroke: 2px rgba(191, 0, 255, .3);
  pointer-events: none;
  user-select: none;
}

.collage {
  position: relative;
  height: clamp(230px, 44vh, 430px);
  will-change: transform;
}

.slot {
  position: absolute;
  overflow: hidden;
  border: 2px solid var(--violet);
  background: linear-gradient(150deg, rgba(101, 20, 255, .38), rgba(191, 0, 255, .1));
}

.slot img { width: 100%; height: 100%; object-fit: cover; }

.slot--a {
  left: 0;
  top: 0;
  width: 62%;
  height: 78%;
  border-radius: var(--r) 6px var(--r) 6px;
  transform: rotate(-3deg);
}

.slot--b {
  right: 2%;
  bottom: 0;
  width: 56%;
  height: 66%;
  border-color: var(--magenta);
  border-radius: 6px var(--r) 6px var(--r);
  transform: rotate(3deg);
  mix-blend-mode: screen;
  filter: saturate(1.25) contrast(1.1);
}

.geo {
  display: block;
  width: 100%;
  height: 100%;
  background:
    repeating-linear-gradient(45deg, rgba(191, 0, 255, .35) 0 10px, transparent 10px 20px),
    var(--ink-deep);
}

.geo--alt {
  background:
    radial-gradient(circle at 30% 30%, var(--magenta), transparent 62%),
    repeating-linear-gradient(-45deg, rgba(101, 20, 255, .5) 0 8px, transparent 8px 18px),
    var(--ink-deep);
}

.hero-copy { text-align: right; }

.hero h1 {
  margin: 0;
  font-size: clamp(32px, 4.4vw, 60px);
  line-height: 1.14;
  color: #fff;
  text-shadow: 0 0 34px rgba(191, 0, 255, .38);
  overflow-wrap: break-word;
}

.hero h1::after {
  content: "";
  display: block;
  width: clamp(72px, 12vw, 160px);
  height: 8px;
  margin: 20px 0 0 auto;
  background: linear-gradient(90deg, var(--violet), var(--magenta));
}

/* ---------- 主体骨架 ---------- */

.shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 300px);
  gap: clamp(28px, 4vw, 56px);
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(40px, 7vw, 88px) clamp(16px, 4vw, 44px) clamp(56px, 8vw, 96px);
}

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

.prose { min-width: 0; }

.prose > article {
  position: relative;
  margin: 0 0 clamp(36px, 5vw, 64px);
  padding: clamp(26px, 3.6vw, 52px) clamp(20px, 3vw, 42px);
  border: 1px solid var(--line-soft);
  border-radius: var(--r) 6px var(--r) 6px;
  background: linear-gradient(155deg, rgba(101, 20, 255, .13), rgba(28, 23, 38, .7) 58%);
  scroll-margin-top: 104px;
  overflow: hidden;
}

.prose > article:nth-of-type(even) {
  border-color: var(--line);
  border-radius: 6px var(--r) 6px var(--r);
  background: linear-gradient(155deg, rgba(191, 0, 255, .16), rgba(18, 14, 25, .78) 58%);
}

.prose > article::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 6px;
  height: 62px;
  background: var(--magenta);
}

.prose > article:nth-of-type(even)::before { background: var(--violet); height: 96px; }

.prose > article > :first-child { margin-top: 0; }

.prose h2 {
  margin: 0 0 6px;
  font-size: clamp(23px, 3.4vw, 36px);
  line-height: 1.28;
  color: #fff;
  overflow-wrap: break-word;
}

.prose h3 {
  margin: 30px 0 6px;
  font-size: clamp(19px, 2.4vw, 24px);
  line-height: 1.35;
  color: #f0e2ff;
}

.prose hr {
  height: 3px;
  margin: 0 0 22px;
  border: 0;
  background: linear-gradient(90deg, var(--violet), var(--magenta) 45%, transparent);
}

.prose p {
  margin: 0 0 18px;
  max-width: 70ch;
  color: var(--dim);
  overflow-wrap: break-word;
}

.prose strong { color: #fff; font-weight: 600; }

.prose a {
  color: #e9bcff;
  text-decoration: underline;
  text-decoration-color: var(--magenta);
  text-underline-offset: 3px;
}

.prose a:hover { color: #fff; background: rgba(191, 0, 255, .2); }

.prose ul, .prose ol {
  margin: 0 0 18px;
  padding-left: 22px;
  color: var(--dim);
}

.prose li { margin: 0 0 10px; }

.prose ul li::marker { color: var(--magenta); }
.prose ol li::marker { color: var(--violet); }

.prose blockquote {
  margin: 0 0 18px;
  padding: 14px 18px;
  border-left: 4px solid var(--magenta);
  background: rgba(191, 0, 255, .1);
  color: #e6dbff;
}

.prose blockquote p:last-child { margin-bottom: 0; }

.prose code {
  font-family: var(--mono);
  font-size: .95em;
  padding: 1px 6px;
  background: rgba(101, 20, 255, .28);
  border-radius: 4px;
  color: #fff;
}

.prose pre {
  margin: 0 0 18px;
  padding: 16px;
  background: var(--ink-deep);
  border: 1px solid var(--line);
  border-radius: 6px var(--r) 6px var(--r);
  overflow-x: auto;
}

.prose pre code { background: none; padding: 0; }

.prose table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 0 0 18px;
}

.prose :is(th, td) {
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  text-align: left;
  color: var(--dim);
}

.prose th { color: #fff; background: rgba(191, 0, 255, .16); }

/* ---------- 右侧栏 ---------- */

.rail {
  position: sticky;
  top: 100px;
  align-self: start;
  padding: 22px 20px 18px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: rgba(18, 14, 25, .82);
}

.rail-title {
  margin: 0 0 6px;
  font-size: 22px;
  color: #fff;
}

.rail hr {
  height: 3px;
  margin: 0 0 12px;
  border: 0;
  background: linear-gradient(90deg, var(--magenta), transparent);
}

.rail-list {
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.rail-list a {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 6px 8px;
  font-size: 16px;
  color: var(--dim);
  text-decoration: none;
  border-bottom: 1px dashed rgba(191, 0, 255, .22);
  transition: color .22s ease, padding-left .22s ease, background-color .22s ease;
}

.rail-list a::before {
  content: "";
  width: 8px;
  height: 8px;
  margin-right: 10px;
  background: var(--violet);
  flex: 0 0 auto;
}

.rail-list a:hover,
.rail-list a[aria-current="true"] {
  color: #fff;
  padding-left: 14px;
  background: rgba(101, 20, 255, .2);
}

.rail-list a:hover::before,
.rail-list a[aria-current="true"]::before { background: var(--magenta); }

.rail-top { margin: 0; }

.rail-top a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  font-size: 16px;
  color: #fff;
  text-decoration: none;
  border: 1px solid var(--magenta);
  border-radius: 999px;
  transition: background-color .22s ease, color .22s ease;
}

.rail-top a:hover { background: var(--magenta); color: var(--ink-deep); }

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

.foot {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr) minmax(0, auto);
  align-items: center;
  gap: 16px clamp(20px, 4vw, 48px);
  padding: clamp(28px, 4vw, 46px) clamp(16px, 4vw, 48px);
  border-top: 2px solid var(--violet);
  background:
    radial-gradient(120% 170% at 100% 0%, rgba(191, 0, 255, .22), transparent 62%),
    var(--ink-deep);
}

.foot-brand a {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  font-family: var(--hud);
  font-size: clamp(24px, 3.2vw, 34px);
  color: #fff;
  text-decoration: none;
  letter-spacing: .05em;
}

.foot-brand a::before {
  content: "";
  width: 12px;
  height: 12px;
  margin-right: 12px;
  background: var(--magenta);
  clip-path: polygon(0 0, 100% 0, 100% 60%, 40% 60%, 40% 100%, 0 100%);
}

.foot-nav ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.foot-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 6px 10px;
  font-size: 16px;
  color: var(--dim);
  text-decoration: none;
  transition: color .22s ease;
}

.foot-nav a:hover { color: #fff; text-decoration: underline; text-underline-offset: 4px; }

.foot-copy {
  font-size: 16px;
  color: var(--dim);
  text-align: right;
  white-space: nowrap;
}

/* ---------- 自适应 ---------- */

@media (max-width: 1023px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 12px 14px 6px;
  }

  .brand-wrap { position: static; transform: none; text-align: center; }

  .nav { overflow-x: auto; scrollbar-width: none; }

  .nav::-webkit-scrollbar { display: none; }

  .nav ol {
    padding: 0;
    min-width: max-content;
    gap: 4px;
  }

  .nav li:nth-child(4) { margin-left: 0; }

  .hero {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 26px;
    padding-top: 26px;
    min-height: auto;
  }

  .hero-copy { order: -1; text-align: left; }

  .hero h1::after { margin-left: 0; }

  .collage { height: clamp(220px, 42vh, 340px); }

  .ghost { bottom: -2vh; }

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

  .rail { position: static; }
}

@media (max-width: 760px) {
  body { font-size: 16px; }

  .prose > article { padding: 24px 18px; }

  .foot {
    grid-template-columns: minmax(0, 1fr);
    text-align: center;
    gap: 10px;
  }

  .foot-nav ul { justify-content: center; }

  .foot-copy { text-align: center; }

  .ghost { font-size: clamp(64px, 30vw, 150px); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  body::before { animation: none; }

  .collage, .ghost { transform: none !important; }

  * { transition-duration: .01ms !important; }
}

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