@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&family=Nunito:wght@300;400;500;600;700&display=swap');

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

:root {
  --paper: #fdfbf7;
  --paper-2: #f5f5f5;
  --ink: #1a1a1a;
  --muted: #57544f;
  --rule: #e0e0e0;
  --rule-2: #cdc8bd;
  --card: #ffffff;
  --radius: 10px;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Nunito', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.8;
  letter-spacing: .01em;
}

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

h1, h2, h3, h4 {
  font-family: 'Fredoka', 'Nunito', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: .005em;
  margin: 0 0 .6rem;
  text-wrap: balance;
}

p { margin: 0 0 1.05rem; }

a { color: var(--ink); text-underline-offset: .22em; }

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

img { max-width: 100%; height: auto; display: block; border-radius: var(--radius); }

.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;
}

.skip {
  position: absolute;
  left: .75rem;
  top: -4rem;
  z-index: 6;
  background: var(--ink);
  color: var(--paper);
  padding: .7rem 1rem;
  min-height: 44px;
  border-radius: var(--radius);
  text-decoration: none;
}

.skip:focus { top: .75rem; }

/* 顶栏 */
.masthead {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}

.bar {
  display: flex;
  align-items: center;
  gap: .9rem;
  padding: 1rem 1.25rem .7rem;
  max-width: 1180px;
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  text-decoration: none;
  font-family: 'Fredoka', 'PingFang SC', system-ui, sans-serif;
  font-weight: 600;
  font-size: 1.06rem;
  letter-spacing: .02em;
  min-height: 44px;
}

.logo-mark {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  flex: none;
  object-fit: contain;
}

.logo-dot {
  display: inline-block;
  background: var(--ink);
  border-radius: 8px;
}

.finder {
  display: flex;
  align-items: center;
  gap: .45rem;
  margin-left: auto;
  flex: 1 1 auto;
  max-width: 21rem;
  min-width: 0;
}

.finder-input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  padding: .5rem .8rem;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--rule-2);
  border-radius: var(--radius);
  border-bottom: 3px solid var(--ink);
  -webkit-appearance: none;
  appearance: none;
}

.finder-input.miss { border-bottom-color: #8c2f1f; }

.finder-btn {
  flex: none;
  min-height: 44px;
  padding: .5rem .9rem;
  font: inherit;
  font-size: 1rem;
  font-family: 'Fredoka', system-ui, sans-serif;
  color: var(--paper);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  cursor: pointer;
}

/* 横向栏目条 */
.strip {
  display: flex;
  gap: .5rem;
  overflow-x: auto;
  padding: .2rem 1.25rem .95rem;
  max-width: 1180px;
  margin: 0 auto;
  scrollbar-width: thin;
}

.strip a {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  min-height: 44px;
  padding: .5rem .8rem;
  font-size: 1rem;
  text-decoration: none;
  white-space: nowrap;
  background: var(--card);
  border: 1px solid var(--rule);
  border-bottom: 3px solid var(--ink);
  border-radius: var(--radius);
}

.strip a::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: none;
  border: 1px solid var(--ink);
  border-radius: 2px;
}

/* 首屏 */
.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  min-height: 64vh;
  padding: 4rem 1.25rem 4.5rem;
  text-align: center;
  border-bottom: 1px solid var(--rule);
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 16px;
  background: var(--ink);
  clip-path: polygon(0 100%, 100% 0, 100% 100%);
}

.hero::before {
  content: "";
  position: absolute;
  top: 2.2rem;
  left: 50%;
  width: 64px;
  height: 3px;
  margin-left: -32px;
  background: var(--ink);
  border-radius: 2px;
}

.hero-title {
  margin: 0;
  max-width: 18ch;
  font-size: clamp(2rem, 7vw, 3.5rem);
  font-weight: 700;
  line-height: 1.18;
}

.hero-figure {
  margin: 0;
  width: min(100%, 30rem);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--card);
  padding: .4rem;
}

/* 双栏正文 */
.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 17rem;
  gap: 3rem;
  align-items: start;
  max-width: 1120px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

.prose {
  min-width: 0;
  font-size: 1.0625rem;
  line-height: 1.85;
}

.prose > section {
  scroll-margin-top: 1.25rem;
  padding-top: 2rem;
  margin-top: 2.4rem;
  border-top: 1px dashed var(--rule-2);
}

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

.prose h2 { font-size: clamp(1.35rem, 3.4vw, 1.7rem); }
.prose h3 { font-size: 1.15rem; }

.prose ul, .prose ol { padding-left: 1.2rem; margin: 0 0 1.1rem; }
.prose li { margin-bottom: .4rem; }

.prose blockquote {
  margin: 0 0 1.1rem;
  padding: .2rem 0 .2rem 1rem;
  border-left: 3px solid var(--ink);
  color: var(--muted);
}

.prose img {
  border: 1px solid var(--rule);
  margin: 1rem 0;
}

.prose strong { font-weight: 700; }

.prose code {
  font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace;
  font-size: .95em;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: .1em .35em;
}

.prose section.hit { outline: 2px dashed var(--ink); outline-offset: 8px; }

/* 右侧索引 */
.rail { align-self: start; position: sticky; top: 1.5rem; }

.rail-box {
  background: var(--card);
  border: 1px solid var(--rule);
  border-bottom: 3px solid var(--ink);
  border-radius: var(--radius);
  padding: 1.1rem 1.1rem 1.3rem;
}

.rail-title {
  font-size: 1rem;
  letter-spacing: .12em;
  margin-bottom: .3rem;
}

.subtitle {
  font-size: .82rem;
  line-height: 1.65;
  color: var(--muted);
  margin: .1rem 0 1rem;
}

.rail-list {
  list-style: none;
  counter-reset: rail;
  margin: 0;
  padding: 0;
}

.rail-list li { counter-increment: rail; }

.rail-list a {
  display: flex;
  align-items: center;
  gap: .6rem;
  min-height: 40px;
  padding: .35rem 0;
  font-size: .92rem;
  text-decoration: none;
  border-bottom: 1px dotted var(--rule-2);
}

.rail-list a::before {
  content: counter(rail, decimal-leading-zero);
  font-family: 'Fredoka', system-ui, sans-serif;
  font-size: .72rem;
  letter-spacing: .06em;
  color: var(--muted);
}

/* 页脚 */
.pagefoot {
  background: var(--paper-2);
  border-top: 1px solid var(--rule);
}

.foot-cta {
  max-width: 1120px;
  margin: 0 auto;
  padding: 3rem 1.25rem 2.6rem;
  text-align: center;
}

.cta-title {
  font-size: clamp(1.5rem, 5vw, 2.2rem);
  margin-bottom: 1.2rem;
}

.cta-btn {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: .8rem 1.7rem;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  font-family: 'Fredoka', system-ui, sans-serif;
  letter-spacing: .06em;
}

.foot-grid {
  display: grid;
  grid-template-columns: 1.1fr 1.25fr 1fr 1fr;
  gap: 2rem;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1.25rem 2.4rem;
  align-items: start;
}

.pagefoot dl { margin: 0; }

.pagefoot dt {
  font-family: 'Fredoka', system-ui, sans-serif;
  font-size: .78rem;
  letter-spacing: .14em;
  color: var(--muted);
  margin-bottom: .5rem;
}

.pagefoot dd {
  margin: 0 0 .3rem;
  font-size: .93rem;
  line-height: 1.55;
}

.foot-nav dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 .9rem;
}

.foot-nav dl dt { grid-column: 1 / -1; }

.foot-nav a,
.foot-top a {
  display: block;
  padding: .55rem 0;
  min-height: 40px;
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
}

.foot-brand .brand { font-size: 1rem; }

.foot-base {
  border-top: 1px solid var(--rule);
  padding: 1.2rem 1.25rem;
  text-align: center;
  font-size: .85rem;
  color: var(--muted);
}

.foot-base p { margin: 0; }

/* 进场 */
.js .prose > article { opacity: 0; transform: translateY(12px); }
.js .prose > article.revealed {
  opacity: 1;
  transform: none;
  transition: opacity .28s steps(4, end), transform .28s steps(4, end);
}

.js .rail-list li { opacity: 0; transform: translateX(-6px); }
.js .rail.on .rail-list li {
  opacity: 1;
  transform: none;
  transition: opacity .2s steps(3, end), transform .2s steps(3, end);
}

.js .rail.on .rail-list li:nth-child(2) { transition-delay: .05s; }
.js .rail.on .rail-list li:nth-child(3) { transition-delay: .1s; }
.js .rail.on .rail-list li:nth-child(4) { transition-delay: .15s; }
.js .rail.on .rail-list li:nth-child(5) { transition-delay: .2s; }
.js .rail.on .rail-list li:nth-child(6) { transition-delay: .25s; }
.js .rail.on .rail-list li:nth-child(7) { transition-delay: .3s; }

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

@media (max-width: 900px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 2.2rem;
    padding-top: 2rem;
  }
  .rail { position: static; top: auto; }
  .foot-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 620px) {
  body { font-size: 16px; }
  .hero { min-height: 56vh; padding: 3.4rem 1.1rem 3.6rem; }
  .bar { flex-wrap: wrap; padding: .9rem 1.1rem .7rem; }
  .finder { flex: 1 1 100%; max-width: none; margin-left: 0; }
  .strip { padding: .1rem 1.1rem .85rem; }
  .shell { padding: 1.8rem 1.1rem 3rem; }
  .foot-grid { grid-template-columns: 1fr; gap: 1.6rem; }
  .foot-nav dl { grid-template-columns: 1fr 1fr; }
  .foot-cta { padding: 2.4rem 1.1rem 2rem; }
}

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