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

:root {
  --paper: #fdfbf7;
  --panel: #f5f5f5;
  --ink: #1a1a1a;
  --line: #e0e0e0;
  --mute: #5a5751;
  --mono: 'Share Tech Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, monospace;
  --read: Georgia, 'Songti SC', 'Noto Serif SC', 'SimSun', serif;
  --hdr: 110px;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--read);
  font-size: 17px;
  line-height: 1.78;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  opacity: .055;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

[id] { scroll-margin-top: 128px; }

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

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

.skip:focus {
  left: 12px;
  top: 12px;
  z-index: 300;
  background: var(--ink);
  color: var(--paper);
  padding: .6em 1em;
  border-radius: 4px;
}

/* ---------- 页头 ---------- */
.hd {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--paper);
  border-bottom: 1px solid var(--ink);
}

.hd-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  text-decoration: none;
  color: var(--ink);
}

.mark {
  font-family: var(--mono);
  font-size: .78rem;
  letter-spacing: .16em;
  border: 1px solid var(--ink);
  border-radius: 4px;
  padding: .4em .45em;
  line-height: 1;
}

.bname {
  font-family: var(--mono);
  font-size: 1.05rem;
  letter-spacing: .06em;
}

.hd-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.contact {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: .5em .85em;
  font-family: var(--mono);
  font-size: .9rem;
  text-decoration: none;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.contact:hover { border-color: var(--ink); }

.burger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: .5em .85em;
  font-family: var(--mono);
  font-size: .9rem;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 4px;
  cursor: pointer;
}

.burger-box {
  display: block;
  width: 16px;
  height: 8px;
  border-top: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
}

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

.hd-sub::-webkit-scrollbar { display: none; }

.strip ol {
  display: flex;
  margin: 0;
  padding: 0;
  list-style: none;
}

.strip li { flex: 0 0 auto; }

.strip a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: .6em 12px;
  font-family: var(--mono);
  font-size: .82rem;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  border-right: 1px solid var(--line);
}

.strip li:last-child a { border-right: 0; }
.strip a:hover { background: var(--panel); }
.strip .num { font-size: .7rem; color: var(--mute); letter-spacing: .1em; }

/* ---------- 全屏菜单 ---------- */
.ovl {
  position: fixed;
  inset: 0;
  z-index: 70;
  overflow-y: auto;
  background: var(--paper);
  padding: calc(var(--hdr) + 12px) 20px 40px;
  visibility: hidden;
  transform: translateY(-6px);
  transition: transform .18s ease-out, visibility .18s linear;
}

html.menu-open .ovl { visibility: visible; transform: none; }
html.menu-open body { overflow: hidden; }

.ovl ol {
  max-width: 760px;
  margin: 0 auto;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--ink);
}

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

.ovl a {
  display: flex;
  align-items: baseline;
  gap: 14px;
  min-height: 58px;
  padding: 15px 4px;
  font-family: var(--mono);
  font-size: clamp(1.1rem, 4.6vw, 1.85rem);
  color: var(--ink);
  text-decoration: none;
  letter-spacing: .01em;
}

.ovl a:hover { background: var(--panel); padding-left: 12px; }
.ovl .num { font-size: .62em; color: var(--mute); }

html.menu-open .ovl li { animation: rise .22s both; }
html.menu-open .ovl li:nth-child(1) { animation-delay: .01s; }
html.menu-open .ovl li:nth-child(2) { animation-delay: .04s; }
html.menu-open .ovl li:nth-child(3) { animation-delay: .07s; }
html.menu-open .ovl li:nth-child(4) { animation-delay: .1s; }
html.menu-open .ovl li:nth-child(5) { animation-delay: .13s; }
html.menu-open .ovl li:nth-child(6) { animation-delay: .16s; }
html.menu-open .ovl li:nth-child(7) { animation-delay: .19s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* ---------- 首屏 ---------- */
.hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  min-height: calc(100vh - 104px);
  min-height: calc(100svh - 104px);
  padding: clamp(26px, 7vw, 80px) 20px clamp(48px, 9vw, 104px);
  border-bottom: 1px solid var(--ink);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 7vw), 0 100%);
}

.hero-media { position: absolute; inset: 0; z-index: 0; }

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

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: var(--paper);
  opacity: .34;
}

.hero-in {
  position: relative;
  z-index: 2;
  max-width: 880px;
}

.badge {
  display: inline-block;
  margin: 0 0 18px;
  padding: .4em .7em;
  font-family: var(--mono);
  font-size: .78rem;
  letter-spacing: .2em;
  border: 1px solid var(--ink);
  border-radius: 4px;
}

.hero h1 {
  margin: 0 0 18px;
  max-width: 20ch;
  font-family: var(--mono);
  font-weight: 500;
  font-size: clamp(1.85rem, 7vw, 4rem);
  line-height: 1.14;
  letter-spacing: -.01em;
}

.lede {
  margin: 0 0 26px;
  max-width: 54ch;
  font-size: 1rem;
}

.cue {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  padding: .55em 1.15em;
  font-family: var(--mono);
  font-size: .9rem;
  text-decoration: none;
  color: var(--paper);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 4px;
}

.cue:hover { background: var(--paper); color: var(--ink); }

/* ---------- 主体骨架 ---------- */
.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
}

.body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 258px;
  align-items: start;
  gap: clamp(28px, 4vw, 56px);
  padding: clamp(32px, 5vw, 64px) 0;
}

.prose { min-width: 0; }

.prose > section {
  padding: clamp(26px, 4vw, 44px) 0;
  border-top: 1px solid var(--line);
}

.prose > section:first-child { border-top: 1px solid var(--ink); }

.prose h2 {
  margin: 0 0 .5em;
  font-family: var(--mono);
  font-weight: 500;
  font-size: clamp(1.3rem, 3.6vw, 1.85rem);
  line-height: 1.26;
  letter-spacing: .01em;
}

.prose h3 {
  margin: 1.7em 0 .4em;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 1.06rem;
  line-height: 1.4;
}

.prose hr {
  margin: 0 0 1.4em;
  border: 0;
  border-top: 1px solid var(--line);
}

.prose p { margin: 0 0 1.1em; max-width: 66ch; }
.prose ul,
.prose ol { margin: 0 0 1.1em; padding-left: 1.2em; }
.prose li { margin: .35em 0; }

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

.prose blockquote {
  margin: 1.4em 0;
  padding: .2em 0 .2em 1.1em;
  border-left: 2px solid var(--ink);
}

.prose table {
  width: 100%;
  margin: 0 0 1.2em;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: .9rem;
}

.prose th,
.prose td {
  padding: .55em .7em;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.prose th { background: var(--panel); }

.prose img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.prose figure { margin: 1.2em 0; }

.prose code {
  padding: .1em .3em;
  font-family: var(--mono);
  font-size: .92em;
  background: var(--panel);
  border-radius: 4px;
}

/* ---------- 侧栏 ---------- */
.side {
  position: sticky;
  top: calc(var(--hdr) + 16px);
  padding: 16px;
  font-family: var(--mono);
  font-size: .85rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.side h2 {
  margin: 0 0 .5em;
  font-family: var(--mono);
  font-weight: 500;
  font-size: .95rem;
  letter-spacing: .14em;
}

.side hr {
  margin: 0 0 .85em;
  border: 0;
  border-top: 1px solid var(--ink);
}

.toc ol {
  counter-reset: t;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}

.toc li {
  counter-increment: t;
  border-bottom: 1px solid var(--line);
}

.toc a {
  display: block;
  min-height: 40px;
  padding: .6em 0;
  line-height: 1.45;
  color: var(--ink);
  text-decoration: none;
}

.toc a::before {
  content: counter(t, decimal-leading-zero) " ";
  font-size: .8em;
  color: var(--mute);
}

.toc a:hover,
.toc a[aria-current="true"] { text-decoration: underline; }

.totop {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: .4em .8em;
  font-family: var(--mono);
  font-size: .85rem;
  color: var(--ink);
  text-decoration: none;
  border: 1px solid var(--ink);
  border-radius: 4px;
}

.totop:hover { background: var(--ink); color: var(--paper); }

/* ---------- 页脚 ---------- */
.ft {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 22px 20px;
  background: var(--panel);
  border-top: 1px solid var(--ink);
}

.ft-brand {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-family: var(--mono);
  font-size: clamp(1.05rem, 4vw, 1.7rem);
  letter-spacing: -.01em;
  text-decoration: none;
  color: var(--ink);
}

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

.ft-nav ol {
  display: flex;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ft-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: .4em .6em;
  font-family: var(--mono);
  font-size: .8rem;
  color: var(--mute);
  text-decoration: none;
}

.ft-nav a:hover { color: var(--ink); text-decoration: underline; }

.ft-meta {
  margin-left: auto;
  text-align: center;
  font-family: var(--mono);
  font-size: .75rem;
  color: var(--mute);
}

.ft-meta p { margin: 0; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .body { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; order: 2; }
  .hero { clip-path: polygon(0 0, 100% 0, 100% calc(100% - 12vw), 0 100%); }
}

@media (max-width: 600px) {
  :root { --hdr: 108px; }
  body { font-size: 16.5px; }
  .bname { font-size: .98rem; }
  .prose table { display: block; overflow-x: auto; }
  .ft-meta { margin-left: 0; text-align: left; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

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