@import url('https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible:wght@400;700&family=Crimson+Pro:wght@400;500;600;700&display=swap');

:root {
  --ink: #1f1f1f;
  --paper: #ffffff;
  --mist: #f5f5f5;
  --line: #e3e3e3;
  --dim: #6d6d6d;
  --e1: 0 1px 2px rgba(31, 31, 31, .07), 0 3px 8px rgba(31, 31, 31, .05);
  --e2: 0 4px 12px rgba(31, 31, 31, .08), 0 12px 26px rgba(31, 31, 31, .06);
  --e3: 0 10px 26px rgba(31, 31, 31, .10), 0 28px 62px rgba(31, 31, 31, .09);
  --e4: 0 18px 46px rgba(31, 31, 31, .14), 0 48px 96px rgba(31, 31, 31, .12);
  --serif: 'Crimson Pro', Georgia, 'Songti SC', 'Noto Serif SC', serif;
  --sans: 'Atkinson Hyperlegible', system-ui, -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background-color: var(--mist);
  background-image: radial-gradient(rgba(31, 31, 31, .055) 1px, transparent 1px);
  background-size: 22px 22px;
  color: var(--ink);
  font: 400 17px/1.7 var(--sans);
  overflow-x: hidden;
}

img { max-width: 100%; }

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

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* ---------- 顶部：品牌居中，菜单分列，下方编号锚点条 ---------- */
.top {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(255, 255, 255, .87);
  backdrop-filter: blur(14px) saturate(1.15);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--e1);
}

.top-row {
  max-width: 1180px;
  margin: 0 auto;
  padding: .45rem 1rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: .6rem;
}

.menu p {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .1rem;
}

.menu-a p { justify-content: flex-end; }
.menu-b p { justify-content: flex-start; }

.menu a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 .55rem;
  color: #4a4a4a;
  text-decoration: none;
  font-size: .94rem;
  border-bottom: 2px solid transparent;
  transition: color .18s ease, border-color .18s ease, transform .18s ease;
}

.menu a:hover,
.menu a:focus-visible {
  color: var(--ink);
  border-bottom-color: var(--ink);
  transform: translateY(-1px);
}

.brand {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  padding: 0 1rem;
  background: var(--paper);
  box-shadow: var(--e2);
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.22rem;
  letter-spacing: .06em;
  text-decoration: none;
  transition: box-shadow .2s ease, transform .2s ease;
}

.brand:hover {
  box-shadow: var(--e3);
  transform: translateY(-1px);
}

.rail {
  border-top: 1px solid var(--line);
  background: rgba(245, 245, 245, .92);
}

.rail p {
  margin: 0 auto;
  max-width: 1180px;
  padding: .22rem 1rem;
  display: flex;
  gap: .32rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.rail p::-webkit-scrollbar { display: none; }

.rail a {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 40px;
  background: var(--paper);
  box-shadow: var(--e1);
  color: var(--dim);
  font-size: .76rem;
  letter-spacing: .14em;
  text-decoration: none;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}

.rail a:hover { transform: translateY(-1px); color: var(--ink); }

.rail a.on {
  background: var(--ink);
  color: #fff;
  box-shadow: var(--e2);
}

/* ---------- 首屏 ---------- */
.hero {
  position: relative;
  min-height: 70svh;
  display: grid;
  place-items: center;
  padding: 3rem 1rem 6.5rem;
  overflow: hidden;
  isolation: isolate;
  background-image:
    radial-gradient(rgba(31, 31, 31, .1) 1px, transparent 1px),
    linear-gradient(180deg, #ffffff 0%, #f5f5f5 100%);
  background-size: 18px 18px, 100% 100%;
}

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

.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.07);
  will-change: transform;
}

.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(245, 245, 245, .5), rgba(245, 245, 245, .92));
}

.hero-copy {
  position: relative;
  z-index: 3;
  max-width: 720px;
  text-align: center;
  background: rgba(255, 255, 255, .93);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: var(--e4);
  padding: clamp(1.4rem, 4vw, 2.9rem);
}

.eyebrow {
  margin: 0 0 .7rem;
  font-size: .78rem;
  letter-spacing: .22em;
  color: var(--dim);
}

.hero h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(1.85rem, 5.6vw, 3.4rem);
  line-height: 1.22;
  letter-spacing: .01em;
}

.hero-lead {
  margin: 1rem auto 0;
  max-width: 34em;
  color: #444;
  line-height: 1.85;
}

.hero-cta { margin: 1.6rem 0 0; }

.btn {
  display: inline-flex;
  align-items: center;
  min-height: 50px;
  padding: 0 1.7rem;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--e2);
  text-decoration: none;
  font-size: 1rem;
  letter-spacing: .04em;
  transition: transform .18s ease, box-shadow .18s ease;
}

.btn:hover,
.btn:focus-visible {
  transform: translateY(-2px);
  box-shadow: var(--e3);
}

.hero-sub {
  margin: 1rem 0 0;
  font-size: .9rem;
  color: var(--dim);
}

.hero-sub a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  display: inline-flex;
  align-items: center;
  min-height: 40px;
}

/* ---------- 主体：左目录 + 右正文 ---------- */
.stage {
  position: relative;
  z-index: 4;
  max-width: 1180px;
  margin: -4rem auto 0;
  padding: 0 1rem 4rem;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: clamp(1rem, 2.4vw, 2.2rem);
  align-items: start;
}

.side {
  position: sticky;
  top: 132px;
  background: var(--paper);
  box-shadow: var(--e2);
  padding: 1rem 1rem 1.15rem;
}

.side-k {
  margin: 0 0 .55rem;
  font-size: .76rem;
  letter-spacing: .2em;
  color: var(--dim);
}

.side ol {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: toc;
  display: grid;
  gap: .1rem;
}

.side li { counter-increment: toc; }

.side a {
  display: flex;
  align-items: center;
  gap: .5rem;
  min-height: 40px;
  padding: .15rem .35rem;
  border-left: 2px solid var(--line);
  color: #3c3c3c;
  text-decoration: none;
  font-size: .94rem;
  transition: background .18s ease, border-color .18s ease, color .18s ease;
}

.side a::before {
  content: counter(toc, decimal-leading-zero);
  font-size: .7rem;
  letter-spacing: .1em;
  color: var(--dim);
}

.side a:hover,
.side a:focus-visible {
  background: var(--mist);
  border-left-color: var(--ink);
  color: var(--ink);
}

.side-note {
  margin: 1rem 0 0;
  padding-top: .85rem;
  border-top: 1px solid var(--line);
  font-size: .84rem;
  line-height: 1.75;
  color: var(--dim);
}

.docs {
  position: relative;
  z-index: 5;
  background: var(--paper);
  box-shadow: var(--e3);
  padding: clamp(1.25rem, 3vw, 3rem);
}

.docs > h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(1.4rem, 2.8vw, 1.95rem);
  line-height: 1.3;
}

.subtitle {
  margin: .5rem 0 2rem;
  padding-bottom: 1.4rem;
  border-bottom: 1px solid var(--line);
  color: var(--dim);
  line-height: 1.75;
}

.content section {
  margin-top: 2.4rem;
  padding-top: 1.7rem;
  border-top: 1px solid var(--line);
  scroll-margin-top: 140px;
}

.content section:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.content h2 {
  margin: 0 0 .65rem;
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(1.45rem, 3vw, 2rem);
  line-height: 1.32;
}

.content h3 {
  margin: 1.7rem 0 .5rem;
  font-family: var(--serif);
  font-size: 1.22rem;
  line-height: 1.4;
}

.content p { margin: 0 0 1rem; line-height: 1.88; }

.content p.subtitle,
.content p.subhead,
.content p.lead,
.content p.desc {
  color: var(--dim);
  margin: -.15rem 0 1.1rem;
}

.content ul,
.content ol { margin: 0 0 1.1rem; padding-left: 1.35rem; line-height: 1.85; }

.content li { margin: .35rem 0; }

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

.content a:hover { background: var(--mist); }

.content blockquote {
  margin: 1.3rem 0;
  padding: .9rem 1.15rem;
  background: var(--mist);
  box-shadow: var(--e1);
  border-left: 3px solid var(--ink);
  line-height: 1.8;
}

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

.content img { display: block; height: auto; box-shadow: var(--e2); }

.content figure { margin: 1.3rem 0; }

.content figcaption { font-size: .85rem; color: var(--dim); margin-top: .5rem; }

.content strong { font-weight: 700; }

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

.content th,
.content td {
  border: 1px solid var(--line);
  padding: .55rem .7rem;
  text-align: left;
}

.content th { background: var(--mist); font-weight: 700; }

/* ---------- 页脚四栏 ---------- */
.foot {
  background: var(--ink);
  color: #dedede;
  padding: 3rem max(1rem, calc((100% - 1180px) / 2)) 0;
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 2rem 1.6rem;
}

.foot section { min-width: 0; }

.foot p { margin: 0 0 .55rem; line-height: 1.8; font-size: .92rem; }

.foot-h {
  font-size: .76rem;
  letter-spacing: .2em;
  color: #9d9d9d;
}

.foot-logo {
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: .05em;
}

.foot-links { display: grid; gap: .1rem; }

.foot a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  color: #dedede;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color .18s ease, border-color .18s ease;
}

.foot a:hover,
.foot a:focus-visible { color: #fff; border-bottom-color: #fff; }

.foot-bar {
  grid-column: 1 / -1;
  border-top: 1px solid #3a3a3a;
  padding: 1.1rem 0;
  display: flex;
}

.foot-bar p { margin: 0; font-size: .82rem; color: #9a9a9a; }

/* ---------- 动效 ---------- */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .7s ease, transform .7s cubic-bezier(.2, .7, .3, 1);
}

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

/* ---------- 断点 ---------- */
@media (max-width: 940px) {
  .stage {
    grid-template-columns: minmax(0, 1fr);
    margin-top: -2.6rem;
  }

  .side { position: static; }

  .side ol {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .15rem .5rem;
  }

  .foot { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  .top-row {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    gap: .1rem;
    padding: .4rem .6rem;
  }

  .brand { order: -1; box-shadow: var(--e1); font-size: 1.1rem; }

  .menu-a p,
  .menu-b p { justify-content: center; }

  .menu a { font-size: .9rem; padding: 0 .42rem; }

  .hero { min-height: auto; padding: 2.4rem 1rem 5rem; }

  .hero-copy { padding: 1.3rem 1.1rem; }

  .content section { scroll-margin-top: 168px; }
}

@media (max-width: 560px) {
  body { font-size: 16px; }

  .side ol { grid-template-columns: minmax(0, 1fr); }

  .foot { grid-template-columns: minmax(0, 1fr); padding-top: 2.2rem; }
}

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

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

  .hero-media img { transform: none !important; }

  .menu a,
  .brand,
  .btn,
  .rail a { transition: none; }
}

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