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

:root {
  --paper: #ffffff;
  --stone: #f5f5f5;
  --ink: #1f1f1f;
  --line: #e4e4e4;
  --mute: #6d6d6d;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --radius: 10px;
  --shadow: 0 4px 6px rgba(0, 0, 0, .05);
}

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

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

body {
  margin: 0;
  background: var(--stone);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; }

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

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  font-family: var(--mono);
  font-size: 16px;
}

.skip:focus {
  position: static;
  display: block;
  padding: 10px 20px;
  background: var(--ink);
  color: #fff;
}

/* 顶部两行 */
.top {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.brandline {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 20px 4px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  text-decoration: none;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: .01em;
}

.brand .logo {
  height: 26px;
  width: auto;
  border-radius: 6px;
}

.menuline {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px 12px;
  display: flex;
  justify-content: flex-end;
}

.drawer { display: block; }

.drawer summary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 16px;
  list-style: none;
  position: relative;
  z-index: 2;
}

.drawer summary::-webkit-details-marker { display: none; }

.bars {
  display: block;
  width: 17px;
  height: 2px;
  background: currentColor;
  box-shadow: 0 6px 0 currentColor, 0 -6px 0 currentColor;
}

.s-open { display: none; }

.drawer[open] .s-open { display: inline; }
.drawer[open] .s-closed { display: none; }

.drawer menu {
  position: fixed;
  inset: 0;
  z-index: 1;
  margin: 0;
  padding: 128px 22px 44px;
  list-style: none;
  background: var(--ink);
  overflow-y: auto;
  display: grid;
  gap: 4px;
  align-content: start;
  counter-reset: n;
}

.drawer menu li {
  display: flex;
  align-items: center;
  counter-increment: n;
  border-bottom: 1px solid rgba(255, 255, 255, .12);
}

.drawer menu li::before {
  content: counter(n, decimal-leading-zero);
  font-family: var(--mono);
  font-size: 16px;
  color: rgba(255, 255, 255, .42);
  flex: 0 0 auto;
}

.drawer menu li a {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  min-height: 54px;
  padding: 10px 14px;
  color: #fff;
  text-decoration: none;
  font-family: var(--mono);
  font-size: 19px;
  border-radius: var(--radius);
}

.drawer menu li a:hover { background: rgba(255, 255, 255, .1); }

/* 首图区 */
.hero {
  position: relative;
  display: grid;
  place-items: center;
  gap: 4px;
  min-height: 45vh;
  padding: 46px 20px;
  overflow: hidden;
  background: var(--ink);
  color: #fff;
  text-align: center;
  isolation: isolate;
}

.hero .hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(160deg, rgba(31, 31, 31, .5), rgba(31, 31, 31, .86));
}

.hero-num {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  font-family: var(--mono);
  font-size: clamp(110px, 26vw, 270px);
  line-height: 1;
  font-weight: 700;
  color: rgba(255, 255, 255, .09);
  z-index: 0;
  pointer-events: none;
}

.hero h1 {
  position: relative;
  z-index: 2;
  margin: 0 0 12px;
  max-width: 20ch;
  font-size: clamp(28px, 6vw, 50px);
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -.01em;
}

.hero-sub {
  position: relative;
  z-index: 2;
  margin: 0;
  max-width: 620px;
  color: rgba(255, 255, 255, .84);
}

/* 页面主体 */
main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 16px 56px;
}

.wrap {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1fr);
}

.body { min-width: 0; }

.prose {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.prose > div {
  min-width: 0;
  background: var(--paper);
  border-radius: var(--radius);
  padding: 22px 18px;
  box-shadow: var(--shadow);
  scroll-margin-top: 128px;
  transition: box-shadow .25s ease, transform .25s ease;
  overflow-wrap: anywhere;
}

.prose > div:hover { box-shadow: 0 10px 22px rgba(0, 0, 0, .08); }

small {
  display: block;
  font-family: var(--mono);
  font-size: 16px;
  letter-spacing: .08em;
  color: var(--mute);
  margin-bottom: 2px;
}

h1, h2, h3 { font-weight: 600; }

.prose h2 {
  font-size: 25px;
  line-height: 1.32;
  margin: 4px 0 12px;
  letter-spacing: -.01em;
}

.prose h3 {
  font-size: 20px;
  line-height: 1.4;
  margin: 20px 0 8px;
}

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

.prose ul,
.prose ol {
  margin: 0 0 14px;
  padding-left: 22px;
}

.prose li { margin-bottom: 6px; }

.prose a {
  text-underline-offset: 3px;
  text-decoration-color: #b6b6b6;
}

.prose img {
  height: auto;
  border-radius: var(--radius);
}

.prose blockquote {
  margin: 0 0 14px;
  padding: 12px 16px;
  border-left: 3px solid var(--ink);
  background: #f7f7f7;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.prose code {
  font-family: var(--mono);
  font-size: 16px;
  background: #f0f0f0;
  padding: .1em .35em;
  border-radius: 6px;
  overflow-wrap: anywhere;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
  display: block;
  overflow-x: auto;
}

.prose th,
.prose td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
}

/* 侧栏 */
.rail {
  background: var(--paper);
  border-radius: 16px;
  padding: 18px 14px;
  box-shadow: var(--shadow);
}

.rail h2 {
  font-size: 19px;
  margin: 2px 0 10px;
  line-height: 1.35;
}

.rail nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.rail nav a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 10px;
  font-family: var(--mono);
  font-size: 16px;
  text-decoration: none;
  border-radius: 8px;
  color: var(--ink);
}

.rail nav a:hover { background: var(--stone); }

.rail-top {
  display: flex;
  align-items: center;
  min-height: 44px;
  margin-top: 10px;
  padding: 6px 10px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 16px;
  text-decoration: none;
  color: var(--mute);
}

/* 页脚 */
footer {
  border-top: 1px solid var(--line);
  background: var(--paper);
  display: grid;
  gap: 16px;
  padding: 26px 20px;
  align-items: center;
}

.f-brand a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  text-decoration: none;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 16px;
}

.f-brand .logo {
  height: 24px;
  width: auto;
  border-radius: 6px;
}

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

.f-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 10px;
  font-family: var(--mono);
  font-size: 16px;
  text-decoration: none;
  border-radius: 8px;
}

.f-nav a:hover { background: var(--stone); }

.f-meta {
  display: grid;
  gap: 10px;
}

.sub {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sub input {
  flex: 1 1 140px;
  min-height: 44px;
  padding: 0 12px;
  font-family: var(--sans);
  font-size: 16px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.sub button {
  min-height: 44px;
  padding: 0 18px;
  font-family: var(--mono);
  font-size: 16px;
  color: #fff;
  background: var(--ink);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.sub button:hover { background: #000; }

.cr-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  align-items: center;
  justify-content: space-between;
}

.cr-row a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-family: var(--mono);
  font-size: 16px;
  color: var(--mute);
  text-decoration: none;
}

.cr {
  margin: 0;
  font-family: var(--mono);
  font-size: 16px;
  color: var(--mute);
}

/* 滚动淡入 */
html.js .prose > div {
  opacity: 0;
  transform: translateY(10px);
}

html.js .prose > div.in {
  opacity: 1;
  transform: none;
  transition: opacity .5s ease, transform .5s ease;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  html.js .prose > div {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .prose > div { transition: none; }
}

@media (min-width: 700px) {
  .prose > div { padding: 26px 26px; }
  main { padding: 32px 20px 64px; }
}

@media (min-width: 900px) {
  .prose { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .prose > div:nth-child(1),
  .prose > div:nth-child(4n+1) { grid-column: 1 / -1; }
  .wrap {
    grid-template-columns: minmax(0, 1fr) 248px;
    align-items: start;
    gap: 24px;
  }
  .rail { position: sticky; top: 128px; }
  footer {
    grid-template-columns: 1fr auto minmax(240px, 300px);
    gap: 30px;
    padding-left: max(20px, calc((100% - 1140px) / 2));
    padding-right: max(20px, calc((100% - 1140px) / 2));
  }
}

@media (prefers-reduced-motion: reduce) {
  html.js .prose > div.in { transition: none; }
}

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