:root {
  --ink: #000000;
  --paper: #ffffff;
  --line: rgba(0, 0, 0, 0.16);
  --line-hard: #000000;
  --inverse-line: rgba(255, 255, 255, 0.28);
  --hud-h: 4.5rem;
  --gutter: 1.5rem;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--hud-h) + 1rem);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background-color: var(--paper);
  background-image: repeating-linear-gradient(
    to right,
    rgba(0, 0, 0, 0.055) 0 1px,
    transparent 1px 6rem
  );
  color: var(--ink);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1rem;
  line-height: 1.75;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  height: auto;
}

/* ---------- 顶部 HUD ---------- */

.hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  background: var(--ink);
  color: var(--paper);
  border-bottom: 1px solid var(--inverse-line);
}

.hud-nav {
  max-width: 88rem;
  margin: 0 auto;
  padding: 0.4rem 1rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr auto;
  align-items: center;
  gap: 0.4rem 1.1rem;
}

.hud-grp {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem;
}

.hud-grp[data-side="b"] {
  justify-content: flex-end;
}

.hud-grp a,
.hud-brand,
.hud-cta {
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  padding: 0.45rem 0.55rem;
  color: var(--paper);
  font-size: 1rem;
  line-height: 1.2;
  text-decoration: none;
  letter-spacing: 0.02em;
  border-radius: 0;
}

.hud-grp a {
  border-bottom: 1px solid transparent;
}

.hud-grp a:hover,
.hud-grp a:focus-visible {
  border-bottom-color: var(--paper);
  outline: none;
}

.hud-brand {
  font-family: "Orbitron", "JetBrains Mono", sans-serif;
  font-weight: 900;
  font-size: 1.05rem;
  letter-spacing: 0.14em;
  padding-inline: 0.75rem;
  text-transform: uppercase;
}

.hud-cta {
  background: var(--paper);
  color: var(--ink);
  font-weight: 500;
  padding-inline: 0.9rem;
  border: 1px solid var(--paper);
}

.hud-cta:hover,
.hud-cta:focus-visible {
  background: var(--ink);
  color: var(--paper);
  outline: none;
}

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

.hero {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100svh;
  background: var(--ink);
  color: var(--paper);
  overflow: hidden;
}

.hero-fig {
  position: absolute;
  inset: 0;
}

.hero-fig img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: grayscale(1) contrast(1.15);
}

.hero-veil {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.82) 0%, rgba(0, 0, 0, 0.4) 42%, rgba(0, 0, 0, 0.88) 100%);
}

.hero-in {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 58rem;
  padding: calc(var(--hud-h) + 3rem) var(--gutter) 4rem;
  text-align: center;
}

.hero-h1 {
  margin: 0;
  font-family: "Orbitron", "JetBrains Mono", sans-serif;
  font-weight: 900;
  font-size: clamp(2rem, 6.2vw, 4.1rem);
  line-height: 1.06;
  letter-spacing: -0.005em;
  text-wrap: balance;
}

/* ---------- 正文骨架 ---------- */

.doc {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 15rem;
  column-gap: 3.5rem;
  max-width: 80rem;
  margin: 0 auto;
  padding: 3.5rem var(--gutter) 5.5rem;
  align-items: start;
}

.doc > div {
  grid-column: 1;
  max-width: 70ch;
  padding: 3rem 0 2.5rem;
  border-top: 1px solid var(--line-hard);
  scroll-margin-top: calc(var(--hud-h) + 1.5rem);
  background: rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.doc > div:first-of-type {
  border-top: 0;
  padding-top: 0.5rem;
}

.doc > div:target {
  border-top-color: var(--ink);
}

.doc > div > *:last-child {
  margin-bottom: 0;
}

section h2,
section h3 {
  font-family: "Orbitron", "JetBrains Mono", sans-serif;
  font-weight: 700;
  line-height: 1.24;
  letter-spacing: 0.01em;
  margin: 2.4rem 0 0.9rem;
  display: block;
}

section h2 {
  font-size: clamp(1.35rem, 2.5vw, 1.85rem);
}

section h3 {
  font-size: clamp(1.08rem, 1.9vw, 1.25rem);
}

section h2 > span,
section h3 > span,
.rail-h > span {
  display: inline;
}

section h2 > span::before,
section h3 > span::before,
.rail-h > span::before {
  content: "";
  display: inline-block;
  width: 1.1em;
  height: 2px;
  background: currentColor;
  vertical-align: middle;
  margin-right: 0.55em;
}

section p {
  margin: 0 0 1.15rem;
}

section ul,
section ol {
  margin: 0 0 1.3rem;
  padding-left: 1.35rem;
}

section li {
  margin-bottom: 0.5rem;
}

section a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.22em;
  text-decoration-thickness: 1px;
}

section a:hover,
section a:focus-visible {
  background: var(--ink);
  color: var(--paper);
  outline: none;
}

section blockquote {
  margin: 1.6rem 0;
  padding: 0.4rem 0 0.4rem 1.15rem;
  border-left: 3px solid var(--ink);
}

section pre {
  margin: 1.4rem 0;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.95rem;
  line-height: 1.6;
}

section code {
  font-family: inherit;
}

section img {
  display: block;
  width: 100%;
  margin: 1.5rem 0;
  filter: grayscale(1);
}

section strong {
  font-weight: 500;
  box-shadow: inset 0 -0.42em 0 rgba(0, 0, 0, 0.12);
}

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

.rail {
  grid-column: 2;
  grid-row: 1 / span 99;
  align-self: start;
  position: sticky;
  top: calc(var(--hud-h) + 1.6rem);
  padding-left: 1.2rem;
  border-left: 1px solid var(--line-hard);
}

.rail-h {
  margin: 0 0 0.7rem;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.16em;
  font-family: "JetBrains Mono", monospace;
}

.rail-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.rail-list li {
  border-bottom: 1px solid var(--line);
}

.rail-list a {
  display: flex;
  align-items: center;
  min-height: 2.5rem;
  padding: 0.55rem 0.4rem;
  color: inherit;
  text-decoration: none;
  line-height: 1.3;
}

.rail-list a:hover,
.rail-list a:focus-visible {
  background: var(--ink);
  color: var(--paper);
  outline: none;
}

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

.colophon {
  border-top: 1px solid var(--line-hard);
  background: var(--ink);
  color: var(--paper);
  padding: 1.1rem var(--gutter);
}

.colo-in {
  max-width: 88rem;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 1.6rem;
}

.colo-brand {
  font-style: normal;
  letter-spacing: 0.12em;
  font-family: "Orbitron", "JetBrains Mono", sans-serif;
  font-weight: 700;
  font-size: 1rem;
}

.colo-links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.2rem;
  margin: 0;
  padding: 0;
}

.colo-links a {
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  color: var(--paper);
  text-decoration: none;
  border-bottom: 1px solid var(--inverse-line);
}

.colo-links a:hover,
.colo-links a:focus-visible {
  border-bottom-color: var(--paper);
  outline: none;
}

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

.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition:
    opacity 0.55s cubic-bezier(0.2, 0.7, 0.2, 1),
    transform 0.55s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.reveal.in {
  opacity: 1;
  transform: none;
}

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

@media (max-width: 900px) {
  :root {
    --hud-h: 9.2rem;
    --gutter: 1.1rem;
  }

  .hud-nav {
    grid-template-columns: 1fr auto;
    gap: 0.15rem 0.6rem;
    padding: 0.35rem 0.9rem 0.5rem;
  }

  .hud-brand {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
    padding-left: 0;
  }

  .hud-cta {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }

  .hud-grp {
    grid-column: 1 / -1;
  }

  .hud-grp[data-side="b"] {
    justify-content: flex-start;
  }

  .hud-grp a {
    padding-inline: 0.4rem;
  }

  .doc {
    grid-template-columns: minmax(0, 1fr);
    column-gap: 0;
    padding-top: 2rem;
    padding-bottom: 3.5rem;
  }

  .doc > div {
    grid-column: 1;
    max-width: none;
    padding: 2.25rem 0 2rem;
    scroll-margin-top: calc(var(--hud-h) + 1rem);
  }

  .doc > div:first-of-type {
    padding-top: 0;
  }

  .rail {
    grid-column: 1;
    grid-row: auto;
    position: static;
    margin-top: 2.5rem;
    padding-left: 0;
    padding-top: 1.5rem;
    border-left: 0;
    border-top: 1px solid var(--line-hard);
  }

  .rail-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 1rem;
  }

  .hero-in {
    padding: calc(var(--hud-h) + 1.5rem) var(--gutter) 3rem;
  }
}

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

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

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