@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,400;0,500;1,400&display=swap');

:root {
  --ink: #000000;
  --blue: #3bb1ff;
  --red: #ff5252;
  --paper: #ffffff;
  --wash: #e8f5ff;
  --line: 3px solid var(--ink);
  --shadow: 5px 5px 0 var(--ink);
  --shadow-sm: 3px 3px 0 var(--ink);
  --r: 10px;
  --navh: 74px;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

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

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

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 17px;
  line-height: 1.7;
  font-weight: 400;
  letter-spacing: 0.01em;
}

img { max-width: 100%; }

hr {
  border: 0;
  border-top: 3px solid var(--ink);
  margin: 10px 0 14px;
}

a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--red);
  outline-offset: 3px;
}

/* ---------- 顶部导航 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--ink);
  border-bottom: var(--line);
}

.railnav {
  padding: 8px 14px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.rail-list {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin: 0 auto;
  padding: 0;
  list-style: none;
  min-width: max-content;
}

.rail-list a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 4px 11px;
  border: 3px solid transparent;
  border-radius: var(--r);
  color: #ffffff;
  text-decoration: none;
  font-size: 16px;
  line-height: 1.2;
  white-space: nowrap;
  transition: background 0.12s ease, color 0.12s ease, transform 0.12s ease,
    box-shadow 0.12s ease, border-color 0.12s ease;
}

.rail-list a:hover,
.rail-list a:focus-visible {
  background: var(--blue);
  color: var(--ink);
  border-color: var(--ink);
  box-shadow: 3px 3px 0 var(--red);
  transform: translate(-1px, -1px);
}

.nav-brand { flex: 0 0 auto; }

.nav-brand a {
  background: var(--blue);
  color: var(--ink);
  border: 3px solid #ffffff;
  box-shadow: 4px 4px 0 var(--red);
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 4px 14px;
}

.nav-brand a:hover,
.nav-brand a:focus-visible {
  background: var(--red);
  border-color: var(--ink);
  box-shadow: 4px 4px 0 var(--blue);
}

/* ---------- 版面 ---------- */
.stage {
  display: grid;
  grid-template-columns: 212px minmax(0, 1fr);
  gap: 34px;
  align-items: start;
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 20px 76px;
}

/* ---------- 侧栏 ---------- */
.rail {
  position: sticky;
  top: calc(var(--navh) + 18px);
  padding: 14px 12px 16px;
  border: var(--line);
  border-radius: var(--r);
  background: rgba(255, 255, 255, 0.74);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  box-shadow: var(--shadow);
}

.rail-h {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0.18em;
  font-weight: 700;
}

.rail-index {
  counter-reset: ri;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
}

.rail-index li { counter-increment: ri; }

.rail-index a {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 6px 4px;
  border-bottom: 1px dashed rgba(0, 0, 0, 0.4);
  color: var(--ink);
  text-decoration: none;
  font-size: 16px;
  line-height: 1.3;
  transition: background 0.12s ease, transform 0.12s ease;
}

.rail-index li:last-child a { border-bottom: 0; }

.rail-index a::before {
  content: counter(ri, decimal-leading-zero);
  margin-right: 8px;
  font-weight: 700;
  color: var(--red);
}

.rail-index a:hover,
.rail-index a:focus-visible {
  background: var(--wash);
  transform: translateX(3px);
}

/* ---------- 正文 ---------- */
.doc-main { min-width: 0; }

.doc { max-width: 74ch; }

.doc > section {
  padding: clamp(30px, 5vw, 58px) 0;
  scroll-margin-top: calc(var(--navh) + 18px);
}

.doc > section + section { border-top: var(--line); }

.doc > section.hero {
  min-height: calc(100svh - var(--navh) - 56px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 26px;
  padding: 26px 0 30px;
  text-align: center;
}

.hero-copy {
  margin: 0 auto;
  max-width: 50ch;
}

.hero h1 {
  margin: 0 0 18px;
  font-size: clamp(2rem, 6vw, 3.5rem);
  line-height: 1.08;
  letter-spacing: -0.015em;
  font-weight: 700;
  text-shadow: 4px 4px 0 var(--blue);
}

.hero-sub {
  margin: 0;
  font-size: 17px;
  color: #101010;
}

.hero-art {
  margin: 0;
  justify-self: center;
  align-self: center;
  max-width: 100%;
  overflow: hidden;
  border: var(--line);
  border-radius: var(--r);
  background: var(--wash);
  box-shadow: var(--shadow);
}

.hero-media {
  display: block;
  width: 100%;
  height: auto;
  max-height: 44svh;
  object-fit: cover;
}

.doc h2 {
  margin: 0 0 10px;
  padding-left: 14px;
  border-left: 8px solid var(--blue);
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.doc h3 {
  margin: 24px 0 8px;
  padding-bottom: 6px;
  border-bottom: 3px dashed rgba(0, 0, 0, 0.45);
  font-size: 1.14rem;
  line-height: 1.35;
}

.doc p { margin: 0 0 14px; }

.doc a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 3px;
  text-decoration-color: var(--red);
  text-underline-offset: 3px;
}

.doc a:hover { background: var(--blue); }

.doc ul,
.doc ol {
  margin: 0 0 16px;
  padding-left: 1.35em;
}

.doc li { margin-bottom: 8px; }

.doc img {
  height: auto;
  border: var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
}

.doc blockquote {
  margin: 0 0 18px;
  padding: 14px 16px;
  border: var(--line);
  border-left: 8px solid var(--red);
  border-radius: var(--r);
  background: var(--wash);
}

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

.doc table {
  width: 100%;
  margin: 0 0 18px;
  border-collapse: collapse;
  font-size: 16px;
}

.doc th,
.doc td {
  padding: 9px 11px;
  border: 3px solid var(--ink);
  text-align: left;
  vertical-align: top;
}

.doc th { background: var(--blue); }

.doc [class*="card"] {
  margin: 0 0 18px;
  padding: 18px;
  border: var(--line);
  border-radius: var(--r);
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  box-shadow: var(--shadow);
}

.doc [class*="card"] p:last-child { margin-bottom: 0; }

.doc code,
.doc pre {
  font-family: var(--mono);
  font-size: 15.5px;
}

.doc code {
  padding: 1px 5px;
  border: 2px solid var(--ink);
  background: var(--wash);
}

.doc pre {
  overflow-x: auto;
  padding: 14px;
  border: var(--line);
  background: var(--wash);
}

/* ---------- 页脚 ---------- */
.foot {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr 1fr;
  gap: 26px;
  padding: 42px 24px 0;
  background: var(--ink);
  color: #ffffff;
  border-top: var(--line);
}

.foot-col h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--blue);
}

.foot-col hr {
  border-top: 3px solid var(--blue);
  margin: 8px 0 12px;
}

.foot-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.foot-col a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 3px 9px;
  border: 3px solid transparent;
  border-radius: 8px;
  color: #ffffff;
  text-decoration: none;
  font-size: 16px;
  line-height: 1.3;
  transition: background 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}

.foot-col a:hover,
.foot-col a:focus-visible {
  background: var(--red);
  color: var(--ink);
  border-color: var(--ink);
  box-shadow: 3px 3px 0 var(--blue);
}

.foot-brand {
  display: inline-block;
  padding: 4px 13px;
  border: 3px solid #ffffff;
  border-radius: var(--r);
  background: var(--blue);
  color: var(--ink);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.06em;
  box-shadow: 4px 4px 0 var(--red);
}

.foot-host {
  margin: 14px 0 0;
  font-size: 16px;
  color: #bfe6ff;
  word-break: break-all;
}

.foot-base {
  grid-column: 1 / -1;
  margin-top: 6px;
  padding: 14px 0 18px;
  border-top: 3px dashed #6a6a6a;
  text-align: center;
  font-size: 16px;
  color: #c9c9c9;
}

/* ---------- 动效 ---------- */
.rv {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

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

/* ---------- 断点 ---------- */
@media (min-width: 861px) {
  .rail-list { justify-content: center; }
}

@media (max-width: 860px) {
  :root {
    --navh: 68px;
    --shadow: 4px 4px 0 var(--ink);
    --shadow-sm: 3px 3px 0 var(--ink);
  }

  .stage {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
    padding: 18px 16px 58px;
  }

  .doc-main { order: 1; }
  .rail { order: 2; position: static; }

  .doc { max-width: none; }

  .doc > section.hero {
    min-height: calc(100svh - var(--navh) - 40px);
  }

  .hero-media { max-height: 38svh; }

  .foot {
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding: 30px 16px 0;
  }
}

@media (max-width: 520px) {
  .foot { grid-template-columns: minmax(0, 1fr); }
  .foot-base { font-size: 15.5px; }
  .hero h1 { text-shadow: 3px 3px 0 var(--blue); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .rv { opacity: 1; transform: none; transition: none; }
  .rail-list a,
  .foot-col a,
  .rail-index a { transition: none; }
}

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