@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&family=Playfair+Display:ital,wght@0,400;0,700;0,900;1,400&family=Source+Serif+4:ital,wght@0,300;0,400;0,600;1,300&display=swap');

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

:root {
  --ink: #000000;
  --paper: #ffffff;
  --mute: #575757;
  --hair: #dcdcdc;
  --r: 10px;
  --serif: 'Playfair Display', 'Songti SC', 'Noto Serif SC', 'SimSun', Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.68;
  letter-spacing: .01em;
  overflow-x: hidden;
}

a { color: inherit; }

::selection { background: var(--ink); color: var(--paper); }

a:focus-visible,
summary:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- 顶部品牌条 ---------- */
.masthead {
  max-width: 1200px;
  margin: 0 auto;
  padding: clamp(12px, 2.4vw, 26px) clamp(16px, 4vw, 32px);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid var(--ink);
}

.brand {
  grid-column: 2;
  justify-self: center;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-family: var(--serif);
  font-weight: 900;
  font-size: clamp(1.15rem, 2.2vw, 1.6rem);
  letter-spacing: .02em;
  text-decoration: none;
}

.cta {
  grid-column: 3;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  font-size: 1rem;
  transition: background .22s ease, color .22s ease, transform .22s ease;
}

.cta:hover {
  background: var(--paper);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
  transform: translateY(-1px);
}

/* ---------- 粘性锚点条 ---------- */
.rail {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, .88);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--ink);
}

.nav {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px clamp(16px, 4vw, 32px);
}

.menu-pill {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  font-size: 1rem;
  letter-spacing: .08em;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.menu-pill::-webkit-details-marker { display: none; }

.nav[open] .menu-pill { background: var(--ink); color: var(--paper); }

.group {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin: .6rem 0 0;
  padding: 0;
  list-style: none;
}

.link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  font-size: 1rem;
  line-height: 1.2;
  text-decoration: none;
  transition: background .2s ease, color .2s ease;
}

.link:hover,
.link:focus-visible {
  background: var(--ink);
  color: var(--paper);
}

/* ---------- 版心 ---------- */
.shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 32px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 17rem;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}

.sheet {
  grid-column: 1;
  min-width: 0;
}

.hero {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 45vh;
  padding: clamp(1.8rem, 6vw, 4rem) 0 clamp(1.5rem, 4vw, 2.5rem);
}

.display {
  margin: 0;
  font-family: var(--serif);
  font-weight: 900;
  font-size: clamp(2.3rem, 6.2vw, 4.9rem);
  line-height: 1.02;
  letter-spacing: -.02em;
  overflow-wrap: break-word;
}

.lede {
  margin: 1.2rem 0 0;
  max-width: 46ch;
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--mute);
}

.band {
  height: 10px;
  margin-top: clamp(1.5rem, 4vw, 2.5rem);
  background: var(--ink);
  transform: skewY(-1.2deg);
  transform-origin: left center;
}

/* ---------- 正文 ---------- */
.prose {
  padding-bottom: 2rem;
  overflow-wrap: break-word;
}

.prose > article {
  padding-top: clamp(1.5rem, 4vw, 2.2rem);
  margin-top: clamp(2.5rem, 6vw, 4rem);
  border-top: 1px solid var(--ink);
}

.prose > article:first-child { margin-top: clamp(1.5rem, 4vw, 2.5rem); }

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

.prose h2 {
  margin: 0 0 .9rem;
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  line-height: 1.16;
  letter-spacing: -.01em;
}

.prose h3 {
  margin: 1.8rem 0 .7rem;
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(1.2rem, 2.2vw, 1.5rem);
  line-height: 1.3;
}

.prose p { margin: 0 0 1.05rem; max-width: 66ch; }

.prose ul,
.prose ol { margin: 0 0 1.1rem; padding-left: 1.3rem; max-width: 66ch; }

.prose li { margin-bottom: .4rem; }

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

.prose strong { font-weight: 700; }

.prose blockquote {
  margin: 1.5rem 0;
  padding: .2rem 0 .2rem 1.1rem;
  border-left: 3px solid var(--ink);
  font-family: var(--serif);
  font-size: 1.05rem;
  font-style: italic;
}

.prose img,
.prose iframe {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: var(--r);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.2rem;
  font-size: 1rem;
}

.prose th,
.prose td {
  border: 1px solid var(--ink);
  padding: .5rem .6rem;
  text-align: left;
}

/* ---------- 右侧栏 ---------- */
.toc {
  grid-column: 2;
  position: sticky;
  top: 96px;
  margin-top: clamp(1.8rem, 6vw, 4rem);
  padding: 1rem;
  border: 1px solid var(--ink);
  border-radius: var(--r);
  background: rgba(255, 255, 255, .62);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.toc-h,
.col-h {
  display: flex;
  align-items: center;
  margin: 0 0 .8rem;
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: .14em;
}

.toc-h::before,
.col-h::before {
  content: "";
  width: 14px;
  height: 1px;
  margin-right: 8px;
  background: var(--ink);
}

.toc-h { padding-bottom: .7rem; border-bottom: 1px solid var(--ink); }

.toc-list {
  display: flex;
  flex-direction: column;
  gap: .1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.toc-list a {
  display: flex;
  align-items: center;
  min-height: 40px;
  font-size: 1rem;
  line-height: 1.3;
  text-decoration: none;
  border-bottom: 1px solid var(--hair);
  transition: padding-left .2s ease;
}

.toc-list li:last-child a { border-bottom: 0; }

.toc-list a:hover { padding-left: 6px; text-decoration: underline; }

.mini {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  margin-top: .8rem;
  font-size: 1rem;
  text-decoration: none;
  border-bottom: 1px solid var(--ink);
}

/* ---------- 页脚 ---------- */
.foot {
  margin-top: clamp(3rem, 8vw, 6rem);
  padding: clamp(2rem, 5vw, 3rem) clamp(16px, 4vw, 32px) 1.5rem;
  border-top: 1px solid var(--ink);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(1.5rem, 3vw, 2.5rem);
}

.foot menu { margin: 0; padding: 0; list-style: none; }

.foot .link {
  border: 0;
  border-radius: 0;
  padding: 0;
  min-height: 40px;
}

.foot .link:hover,
.foot .link:focus-visible {
  background: transparent;
  color: var(--ink);
  text-decoration: underline;
}

.brandmark {
  margin: 0;
  font-family: var(--serif);
  font-weight: 900;
  font-size: 1.5rem;
  line-height: 1.15;
}

.sub {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  padding: .6rem;
  border: 1px solid var(--ink);
  border-radius: var(--r);
  background: rgba(255, 255, 255, .62);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.sub input {
  flex: 1 1 7rem;
  min-width: 0;
  min-height: 40px;
  padding: 0 .35rem;
  border: 0;
  border-bottom: 1px solid var(--ink);
  border-radius: 0;
  background: transparent;
  font: inherit;
  color: inherit;
}

.sub button {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font: inherit;
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}

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

.foot-base {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: .5rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--ink);
  font-size: 1rem;
}

.foot-base p { margin: 0; }

.foot-base a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  text-decoration: none;
  border-bottom: 1px solid var(--ink);
}

/* ---------- 入场动效 ---------- */
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.group li,
.toc-list li { animation: rise .5s cubic-bezier(.2, .7, .3, 1) both; }

.group li:nth-child(1), .toc-list li:nth-child(1) { animation-delay: .02s; }
.group li:nth-child(2), .toc-list li:nth-child(2) { animation-delay: .06s; }
.group li:nth-child(3), .toc-list li:nth-child(3) { animation-delay: .1s; }
.group li:nth-child(4), .toc-list li:nth-child(4) { animation-delay: .14s; }
.group li:nth-child(5), .toc-list li:nth-child(5) { animation-delay: .18s; }
.group li:nth-child(6), .toc-list li:nth-child(6) { animation-delay: .22s; }
.group li:nth-child(7), .toc-list li:nth-child(7) { animation-delay: .26s; }

/* ---------- 断点 ---------- */
@media (max-width: 1023px) {
  .nav:not([open]) .group { display: none; }
}

@media (min-width: 1024px) {
  .menu-pill { display: none; }

  .nav {
    display: grid;
    grid-template-columns: 1fr 1px 1fr;
    align-items: center;
    gap: 1.25rem;
    min-height: 64px;
  }

  .nav::before {
    content: "";
    grid-column: 2;
    grid-row: 1;
    justify-self: center;
    width: 1px;
    height: 1.6rem;
    background: var(--ink);
  }

  .group-a { grid-column: 1; grid-row: 1; justify-self: end; margin: 0; }
  .group-b { grid-column: 3; grid-row: 1; justify-self: start; margin: 0; }

  .nav:not([open]) .group { display: flex; }
}

@media (max-width: 899px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .toc {
    grid-column: 1;
    position: static;
    margin-top: 2.5rem;
  }
  .hero { min-height: 0; padding-top: 2rem; }
}

@media (max-width: 640px) {
  .foot { grid-template-columns: 1fr 1fr; }
  .display { font-size: clamp(2rem, 9vw, 2.8rem); }
}

@media (max-width: 460px) {
  .foot { grid-template-columns: 1fr; }
  .cta { padding: 0 14px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .group li,
  .toc-list li { animation: none; }
  .cta,
  .link,
  .sub button,
  .toc-list a { transition: none; }
}

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