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

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

:root {
  --ink: #000000;
  --paper: #ffffff;
  --r: 4px;
  --pad: clamp(1rem, 4vw, 2.5rem);
  --max: 1200px;
  --sans: 'Public Sans', system-ui, -apple-system, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --serif: 'Libre Bodoni', 'Songti SC', 'Noto Serif SC', Georgia, serif;
}

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

body {
  margin: 0;
  background-color: var(--paper);
  background-image:
    linear-gradient(to right, rgba(0, 0, 0, .045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 0, 0, .045) 1px, transparent 1px);
  background-size: 72px 72px;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.75;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--ink); }
img { max-width: 100%; }

/* ---------- 顶栏 ---------- */
.masthead {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--ink);
}

.progress {
  height: 3px;
  background: transparent;
}
.progress i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--ink);
}

.top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--pad);
  min-height: 66px;
}

.nav p {
  display: flex;
  flex-wrap: wrap;
  gap: 0 clamp(.8rem, 2vw, 1.6rem);
  margin: 0;
}
.nav-l p { justify-content: flex-start; }
.nav-r p { justify-content: flex-end; }

.nav a {
  display: inline-block;
  padding: .78rem 0;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: .02em;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: border-color .22s ease;
}
.nav a:hover,
.nav a:focus-visible { border-bottom-color: var(--ink); }

.brand {
  font-family: var(--serif);
  font-size: clamp(1.15rem, 2.2vw, 1.5rem);
  font-weight: 600;
  letter-spacing: .08em;
  line-height: 1.5;
  text-decoration: none;
  white-space: nowrap;
  padding: .5rem 0;
}

/* ---------- 首屏 ---------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 0 0 var(--pad);
  min-height: calc(100svh - 70px);
}

.hero-lead {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 1.4rem;
  text-align: center;
  padding: clamp(2rem, 6vw, 4.5rem) clamp(0rem, 3vw, 2rem) clamp(2rem, 6vw, 4.5rem) 0;
}

.hero-lead h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2.15rem, 5.6vw, 4rem);
  line-height: 1.14;
  letter-spacing: .005em;
  max-width: 18ch;
}

.hero-desc {
  margin: 0;
  max-width: 34ch;
  font-size: 1.02rem;
  line-height: 1.8;
  color: rgba(0, 0, 0, .78);
}

.hero-fig {
  position: relative;
  margin: 0;
  overflow: hidden;
  background: var(--ink);
  min-height: 340px;
  clip-path: polygon(9% 0, 100% 0, 100% 100%, 0 100%);
}

.hero-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 125%;
  object-fit: cover;
  display: block;
  will-change: transform;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(26px); }
  to { opacity: 1; transform: none; }
}
.hero-lead > * {
  animation: rise .72s cubic-bezier(.2, .7, .3, 1) both;
}
.hero-lead > *:nth-child(2) { animation-delay: .1s; }

/* ---------- 主体区 ---------- */
.board {
  display: grid;
  grid-template-columns: minmax(0, 220px) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: start;
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 4.5rem) var(--pad);
}

.toc {
  position: sticky;
  top: 6rem;
  padding-left: 1rem;
  border-left: 2px solid var(--ink);
}

.toc small {
  display: block;
  font-size: 1rem;
  line-height: 1.5;
  letter-spacing: .16em;
  color: rgba(0, 0, 0, .6);
}

.toc h2 {
  margin: .1rem 0 1rem;
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: .06em;
}

.toc p {
  display: flex;
  flex-direction: column;
  margin: 0;
}

.toc a {
  display: block;
  padding: .6rem 0;
  font-size: 1rem;
  line-height: 1.6;
  text-decoration: none;
  border-bottom: 1px solid rgba(0, 0, 0, .14);
  transition: padding-left .22s ease, border-color .22s ease;
}
.toc a:last-child { border-bottom: 0; }
.toc a:hover,
.toc a:focus-visible {
  padding-left: .35rem;
  border-bottom-color: var(--ink);
}

/* ---------- 正文 ---------- */
.content div {
  scroll-margin-top: 6.5rem;
  margin: 0 0 clamp(1.5rem, 3vw, 2.25rem);
  padding: clamp(1.25rem, 3vw, 2.25rem);
  background: rgba(255, 255, 255, .74);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid var(--ink);
  border-radius: var(--r);
}
.content div:last-child { margin-bottom: 0; }

.js .content div {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .6s ease, transform .6s ease;
}
.js .content div.in {
  opacity: 1;
  transform: none;
}

.content h2 {
  margin: .3rem 0 1rem;
  font-family: var(--serif);
  font-size: clamp(1.4rem, 2.6vw, 1.95rem);
  font-weight: 600;
  line-height: 1.28;
}

.content h3 {
  margin: 1.6rem 0 .55rem;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.45;
}

.content p {
  margin: 0 0 1rem;
  max-width: 68ch;
}
.content p:last-child { margin-bottom: 0; }

.content ul,
.content ol {
  margin: 0 0 1rem;
  padding-left: 1.35rem;
}
.content li { margin: .4rem 0; }

.content a {
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: opacity .2s ease;
}
.content a:hover { opacity: .62; }

.content blockquote {
  margin: 1.2rem 0;
  padding: .4rem 0 .4rem 1.2rem;
  border-left: 3px solid var(--ink);
  font-family: var(--serif);
  font-size: 1.1rem;
  line-height: 1.7;
}

.content table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 1rem;
  line-height: 1.6;
}
.content th,
.content td {
  padding: .6rem .7rem;
  border-bottom: 1px solid var(--ink);
  text-align: left;
}
.content th { font-weight: 600; }

.content img {
  height: auto;
  border-radius: var(--r);
}

.content small {
  display: block;
  margin-top: 1.1rem;
  font-size: 1rem;
  line-height: 1.5;
  letter-spacing: .14em;
  color: rgba(0, 0, 0, .58);
}
.content small + h2,
.content small + h3 { margin-top: .18rem; }

/* ---------- 页脚 ---------- */
.foot {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.4rem;
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 3rem) var(--pad) 1.5rem;
  border-top: 2px solid var(--ink);
  font-size: 1rem;
  line-height: 1.65;
}

.foot p { margin: 0; }

.foot-brand {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: .06em;
}

.foot-links a {
  display: block;
  padding: .48rem 0;
  text-decoration: none;
}
.foot-links a:hover,
.foot-links a:focus-visible { text-decoration: underline; }

.foot-desc { color: rgba(0, 0, 0, .7); }

.foot small {
  grid-column: 1 / -1;
  margin-top: .6rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(0, 0, 0, .28);
  font-size: 1rem;
  color: rgba(0, 0, 0, .66);
  letter-spacing: .04em;
}

/* ---------- 回顶 ---------- */
.to-top {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 30;
  min-height: 44px;
  padding: .6rem 1rem;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.4;
  color: var(--paper);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: var(--r);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity .24s ease, transform .24s ease, visibility .24s;
}
.to-top.on {
  opacity: 1;
  visibility: visible;
  transform: none;
}

/* ---------- 断点 ---------- */
@media (max-width: 820px) {
  .top {
    grid-template-columns: 1fr;
    gap: .1rem;
    padding-bottom: .55rem;
    min-height: 0;
  }
  .brand {
    order: -1;
    justify-self: center;
    padding: .6rem 0 .1rem;
  }
  .nav-l p,
  .nav-r p {
    justify-content: center;
    column-gap: 1rem;
  }
  .nav a { padding: .55rem 0; }

  .hero {
    grid-template-columns: minmax(0, 1fr);
    padding: 0;
    min-height: 0;
  }
  .hero-lead {
    padding: 2.25rem var(--pad) 2rem;
    gap: 1rem;
  }
  .hero-lead h1 { font-size: clamp(1.9rem, 8.4vw, 2.6rem); }
  .hero-fig {
    min-height: 0;
    height: 42svh;
    clip-path: polygon(0 0, 100% 9%, 100% 100%, 0 100%);
  }

  .board { grid-template-columns: minmax(0, 1fr); }
  .toc {
    position: static;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 .8rem;
    padding: 0 0 .5rem;
    border-left: 0;
    border-bottom: 1px solid var(--ink);
  }
  .toc small { display: inline; }
  .toc h2 {
    margin: 0 0 .2rem;
    font-size: 1.05rem;
  }
  .toc p {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0 1rem;
    width: 100%;
  }
  .toc a {
    border-bottom: 0;
    padding: .4rem 0;
    min-height: 40px;
  }
  .content div { scroll-margin-top: 1rem; }

  .foot { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-lead > * { animation: none; }
  .js .content div {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .to-top { transition: none; }
}

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