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

:root {
  --ink: #000000;
  --paper: #ffffff;
  --tone: #f1f0ee;
  --r: 18px;
  --gap: 1rem;
  --maxw: 1280px;
  --unit: 8px;
}

*,
*::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: 'Figtree', 'Noto Sans', Helvetica, 'Helvetica Neue', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  font-size: 17px;
  line-height: 1.65;
  font-weight: 400;
  letter-spacing: .002em;
}

a { color: inherit; }
img { max-width: 100%; height: auto; display: block; }

h1, h2, h3, h4 {
  font-weight: 700;
  line-height: 1.14;
  letter-spacing: -.022em;
  margin: 0 0 .6em;
}

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

/* ---------- 顶栏 ---------- */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  padding: calc(var(--unit) * 1.5) clamp(1rem, 3vw, 2.5rem);
  border-bottom: 2px solid var(--ink);
  background: var(--paper);
  position: relative;
  z-index: 30;
}

.mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  background: var(--ink);
  color: var(--paper);
  border-radius: 50%;
  overflow: hidden;
  text-decoration: none;
  font-weight: 600;
  font-size: 10px;
  line-height: 1.1;
  text-align: center;
  letter-spacing: 0;
}

.mark span { padding: 0 4px; }
.mark img { width: 100%; height: 100%; object-fit: cover; }

.find {
  display: flex;
  gap: calc(var(--unit) * .5);
  align-items: stretch;
}

.find input {
  font: inherit;
  font-size: 16px;
  min-height: 44px;
  width: clamp(110px, 22vw, 230px);
  padding: .4rem .7rem;
  border: 2px solid var(--ink);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
}

.find input::placeholder { color: #6b6b6b; }

.find button {
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  min-height: 44px;
  padding: .4rem 1rem;
  border: 2px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
}

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

/* ---------- 锚点条 ---------- */
.jump {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--paper);
  border-bottom: 2px solid var(--ink);
}

.jump > ol {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  list-style: none;
  margin: 0;
  padding: 0 clamp(.5rem, 2vw, 1.5rem);
}

.jump li {
  position: relative;
  animation: rise .45s cubic-bezier(.2, .7, .3, 1) both;
}

.jump li:nth-child(2) { animation-delay: .04s; }
.jump li:nth-child(3) { animation-delay: .08s; }
.jump li:nth-child(4) { animation-delay: .12s; }
.jump li:nth-child(5) { animation-delay: .16s; }
.jump li:nth-child(6) { animation-delay: .2s; }
.jump li:nth-child(7) { animation-delay: .24s; }

.jump a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: .6rem .8rem;
  text-decoration: none;
  font-size: 16px;
  font-weight: 500;
  white-space: nowrap;
}

.jump a:hover,
.jump a:focus-visible,
.jump a[aria-current] {
  background: var(--ink);
  color: var(--paper);
}

.jump a:focus-visible { outline: 3px solid var(--ink); outline-offset: -3px; }

.grp > a::after {
  content: "▾";
  margin-left: .4rem;
  font-size: .78em;
  transform: translateY(-1px);
}

.sub {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 40;
  display: none;
  flex-direction: column;
  min-width: 100%;
  list-style: none;
  margin: 0;
  padding: .25rem;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-top: 0;
}

.grp:hover .sub,
.grp:focus-within .sub { display: flex; }

/* ---------- 主体栅格 ---------- */
main {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--gap);
  align-items: start;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2.25rem) clamp(1rem, 3vw, 2.5rem) 3rem;
}

main > section {
  grid-column: 1 / 9;
  min-width: 0;
}

main > aside {
  grid-column: 9 / 13;
  min-width: 0;
}

/* ---------- 首屏 ---------- */
.hero {
  display: grid;
  align-content: end;
  justify-items: end;
  text-align: right;
  min-height: calc(100svh - 156px);
  margin-bottom: var(--gap);
  padding: clamp(2rem, 6vw, 5rem) clamp(1rem, 3vw, 2rem) clamp(1.25rem, 4vw, 2.5rem);
  border-radius: var(--r);
  background-color: var(--paper);
  background-image:
    linear-gradient(to right, rgba(0, 0, 0, .085) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 0, 0, .085) 1px, transparent 1px);
  background-size: 48px 48px;
}

.hero h1 {
  margin: 0;
  max-width: 22ch;
  font-size: clamp(2.3rem, 7.4vw, 5rem);
  line-height: 1.03;
  letter-spacing: -.035em;
  text-wrap: balance;
}

/* ---------- 正文块 ---------- */
section > article:not(.hero) {
  background: var(--tone);
  border-radius: var(--r);
  padding: clamp(1.25rem, 3vw, 2.5rem);
  margin-bottom: var(--gap);
  scroll-margin-top: 5.5rem;
  overflow-wrap: break-word;
}

section > article:not(.hero):nth-child(3n) {
  background: var(--ink);
  color: var(--paper);
}

section > article h2 {
  font-size: clamp(1.35rem, 3vw, 2rem);
  letter-spacing: -.028em;
  margin-bottom: .7em;
}

section > article h3 {
  font-size: clamp(1.1rem, 2.2vw, 1.35rem);
  margin-top: 1.6em;
}

section a { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
section hr { border: 0; border-top: 2px solid currentColor; opacity: .3; margin: 1.1rem 0; }
section ul, section ol { padding-left: 1.25em; margin: 0 0 1em; }
section li { margin-bottom: .4em; }
section blockquote {
  margin: 1.2rem 0;
  padding-left: 1rem;
  border-left: 4px solid currentColor;
  font-weight: 500;
}

/* ---------- 侧栏 ---------- */
.side {
  border-top: 10px solid var(--ink);
  padding-top: .8rem;
}

.side h2 {
  font-size: 1rem;
  letter-spacing: .3em;
  font-weight: 600;
  margin-bottom: .55rem;
}

.side hr {
  border: 0;
  border-top: 2px solid var(--ink);
  margin: 0 0 .7rem;
}

.side ol {
  list-style: none;
  counter-reset: toc;
  margin: 0 0 1.1rem;
  padding: 0;
}

.side li {
  counter-increment: toc;
  border-bottom: 1px solid rgba(0, 0, 0, .16);
}

.side li a {
  display: flex;
  align-items: center;
  gap: .65rem;
  min-height: 44px;
  padding: .55rem 0;
  font-size: 16px;
  text-decoration: none;
}

.side li a::before {
  content: counter(toc, decimal-leading-zero);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .06em;
  font-variant-numeric: tabular-nums;
  opacity: .5;
}

.side li a:hover { text-decoration: underline; text-underline-offset: 4px; }

.totop {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: .6rem 1.1rem;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  font-size: 16px;
  font-weight: 600;
}

/* ---------- 大块 ---------- */
.cta {
  display: grid;
  gap: 1.1rem;
  justify-items: start;
  background: var(--ink);
  color: var(--paper);
  padding: clamp(2rem, 7vw, 5rem) clamp(1rem, 3vw, 2.5rem);
}

.cta h2 {
  margin: 0;
  font-size: clamp(2rem, 8.5vw, 4.5rem);
  line-height: 1;
  letter-spacing: -.04em;
}

.cta hr {
  width: 100%;
  border: 0;
  border-top: 2px solid var(--paper);
  margin: 0;
}

.cta a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: .75rem 1.5rem;
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 16px;
}

/* ---------- 页脚 ---------- */
footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem 1.25rem;
  padding: 1.1rem clamp(1rem, 3vw, 2.5rem);
  border-top: 2px solid var(--ink);
}

footer nav ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 .35rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

footer nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: .4rem .45rem;
  font-size: 16px;
  text-decoration: none;
}

footer nav a:hover { text-decoration: underline; text-underline-offset: 4px; }

.fmeta { font-size: 16px; letter-spacing: .02em; }

.mark:focus-visible,
.totop:focus-visible,
.cta a:focus-visible,
footer nav a:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

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

/* ---------- 窄屏 ---------- */
@media (max-width: 900px) {
  main { grid-template-columns: 1fr; padding-bottom: 2rem; }
  main > section,
  main > aside { grid-column: 1 / -1; }
  .side { margin-top: 2rem; }

  .jump > ol {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: thin;
    padding-bottom: 2px;
  }
  .jump li { flex: 0 0 auto; }

  .sub {
    position: static;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0;
    border: 0;
    border-top: 1px dashed rgba(0, 0, 0, .35);
    padding: .1rem 0;
  }
  .sub a { font-size: 15px; }

  .hero {
    min-height: 74svh;
    justify-items: end;
  }
  .hero h1 { font-size: clamp(2rem, 10vw, 3rem); }
  .cta h2 { font-size: clamp(1.8rem, 11vw, 3rem); }
}

@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}
