:root {
  --ink: #000000;
  --paper: #ffffff;
  --rule: 3px solid #000000;
  --r: 18px;
  --f-body: 'Nunito Sans', system-ui, -apple-system, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --f-head: 'Varela Round', 'Nunito Sans', system-ui, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

*,
*::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: var(--f-body);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.78;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
p { margin: 0 0 1.05em; }
menu, ul, ol { margin: 0; padding: 0; }

h1, h2, h3, h4 {
  font-family: var(--f-head);
  font-weight: 400;
  line-height: 1.16;
  letter-spacing: -0.012em;
  margin: 0 0 0.55em;
}

:focus-visible {
  outline: 3px solid #000000;
  outline-offset: 3px;
}

main { min-width: 0; }

/* ---------- 左侧固定书脊 ---------- */
.spine {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: 258px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
  padding: 1.9rem 1.35rem 1.6rem;
  background: var(--paper);
  border-right: var(--rule);
  overflow: auto;
}

.mark {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: var(--rule);
  border-radius: 50%;
  font-family: var(--f-head);
  font-size: 1.3rem;
  line-height: 1;
  text-decoration: none;
  overflow: hidden;
  transition: transform 0.25s ease;
}

.mark:hover { transform: rotate(-9deg); }
.mark img { width: 100%; height: 100%; object-fit: cover; }
.mark-sm { width: 42px; height: 42px; font-size: 1rem; border-width: 2px; }

.toc summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  min-height: 44px;
  font-size: 0.82rem;
  letter-spacing: 0.22em;
  padding: 0.2rem 0;
  border-bottom: var(--rule);
  transition: letter-spacing 0.25s ease;
}

.toc summary::-webkit-details-marker { display: none; }
.toc summary::after {
  content: "+";
  margin-left: auto;
  font-family: var(--f-head);
  font-size: 1.1rem;
  letter-spacing: 0;
}
.toc[open] summary::after { content: "−"; }
.toc summary:hover { letter-spacing: 0.3em; }

.toc menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  margin-top: 0.55rem;
}

.toc menu li { border-bottom: 1px solid rgba(0, 0, 0, 0.16); }
.toc menu li:last-child { border-bottom: none; }

.toc menu a {
  display: flex;
  align-items: center;
  min-height: 46px;
  padding: 0.35rem 0.4rem;
  text-decoration: none;
  font-size: 1rem;
  line-height: 1.35;
  transition: padding-left 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.toc menu a:hover,
.toc menu a:focus-visible {
  background: var(--ink);
  color: var(--paper);
  padding-left: 0.85rem;
}

.find {
  margin-top: auto;
  display: flex;
  gap: 0.4rem;
}

.find input {
  flex: 1 1 auto;
  min-width: 0;
  font: inherit;
  font-size: 1rem;
  padding: 0.55rem 0.85rem;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 999px;
}

.find button {
  font: inherit;
  font-size: 0.9rem;
  padding: 0.55rem 0.9rem;
  min-height: 44px;
  cursor: pointer;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 999px;
  transition: background 0.2s ease, color 0.2s ease;
}

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

/* ---------- 主区 ---------- */
main { margin-left: 258px; }
.wrap { max-width: 1160px; margin: 0 auto; }

.hero {
  display: grid;
  grid-template-columns: 1.06fr 0.94fr;
  align-items: center;
  min-height: 100svh;
  border-bottom: var(--rule);
}

.hero-copy {
  text-align: right;
  padding: clamp(2rem, 5vw, 5rem) clamp(1.4rem, 4vw, 4rem);
}

.badge {
  display: inline-block;
  margin: 0 0 1.6rem;
  padding: 0.34rem 1.15rem;
  border: var(--rule);
  border-radius: 999px;
  font-size: 0.82rem;
  letter-spacing: 0.2em;
  line-height: 1.5;
  transform: rotate(-3deg);
  position: relative;
  z-index: 3;
}

.subtitle {
  max-width: 42ch;
  margin: 0 0 1.2rem auto;
  font-size: 1.02rem;
  line-height: 1.85;
  letter-spacing: 0.01em;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.1rem, 5.1vw, 4.5rem);
  line-height: 1.06;
  letter-spacing: -0.025em;
}

.hero-fig {
  position: relative;
  margin: clamp(1.1rem, 3vw, 2.4rem) clamp(1.1rem, 3vw, 2.4rem) clamp(1.1rem, 3vw, 2.4rem) 0;
  border: var(--rule);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--paper);
}

.hero-img {
  width: 100%;
  height: 100%;
  min-height: clamp(240px, 44vh, 600px);
  object-fit: cover;
}

.hero-fig figcaption {
  position: absolute;
  left: 0.8rem;
  bottom: 0.8rem;
  padding: 0.15rem 0.7rem;
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 999px;
}

/* ---------- 正文 ---------- */
.body { border-bottom: var(--rule); }

.prose {
  padding: clamp(1.4rem, 3.5vw, 3rem) clamp(1.2rem, 4vw, 3.6rem) clamp(2rem, 5vw, 4rem);
}

.prose > article {
  padding-block: clamp(2rem, 4vw, 3.2rem);
  border-top: var(--rule);
}

.prose > article:first-child { border-top: none; padding-top: clamp(0.6rem, 2vw, 1.2rem); }

.prose [id] { scroll-margin-top: clamp(96px, 14vh, 140px); }

.prose h2 {
  font-size: clamp(1.5rem, 3.1vw, 2.35rem);
  letter-spacing: -0.02em;
  max-width: 30ch;
}

.prose h2::before {
  content: "";
  display: block;
  width: 2.6rem;
  height: 3px;
  background: var(--ink);
  margin-bottom: 0.85rem;
}

.prose h3 {
  font-size: 1.16rem;
  letter-spacing: 0.01em;
  margin-top: 1.7rem;
}

.prose h3::before {
  content: "";
  display: inline-block;
  width: 0.55em;
  height: 0.55em;
  margin-right: 0.5em;
  background: var(--ink);
  border-radius: 50%;
  vertical-align: 0.08em;
}

.prose p { max-width: 68ch; }

.prose ul, .prose ol { margin: 0 0 1.2em; padding-left: 1.35em; }
.prose li { margin-bottom: 0.45em; max-width: 62ch; }
.prose li::marker { font-weight: 600; }

.prose a {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  transition: background 0.18s ease, color 0.18s ease;
}

.prose a:hover { background: var(--ink); color: var(--paper); }

.prose strong { font-weight: 700; }

.prose blockquote {
  margin: 1.6rem 0;
  padding: 0.4rem 0 0.4rem 1.2rem;
  border-left: 7px solid var(--ink);
  font-family: var(--f-head);
  font-size: 1.16rem;
  line-height: 1.62;
}
.prose blockquote p { margin-bottom: 0.4em; }

.prose figure {
  margin: 1.7rem 0;
  border: var(--rule);
  border-radius: var(--r);
  overflow: hidden;
}
.prose figure img { width: 100%; }
.prose figcaption {
  padding: 0.6rem 0.9rem;
  font-size: 0.85rem;
  border-top: 2px solid var(--ink);
}

.prose table {
  width: 100%;
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 1.6rem 0;
  font-size: 0.95rem;
}
.prose th, .prose td {
  padding: 0.6rem 0.7rem;
  text-align: left;
  border-bottom: 2px solid var(--ink);
  white-space: nowrap;
}
.prose th { font-family: var(--f-head); font-weight: 400; }

.prose hr {
  border: none;
  border-top: var(--rule);
  margin: 2rem 0;
}

.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92em;
  border: 1px solid var(--ink);
  border-radius: 6px;
  padding: 0.05em 0.35em;
}

@media (min-width: 900px) {
  .prose > article > p:first-of-type::first-letter {
    float: left;
    font-family: var(--f-head);
    font-size: 3.3em;
    line-height: 0.8;
    padding: 0.1em 0.14em 0 0;
  }
}

@media (min-width: 1120px) {
  .prose > article {
    column-count: 2;
    column-gap: clamp(2rem, 4vw, 3.6rem);
  }
  .prose > article > * { break-inside: avoid; }
  .prose h2 { column-span: all; }
}

/* ---------- 页脚 ---------- */
.colophon { border-top: none; }

.cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 2rem;
  padding: clamp(2rem, 6vw, 4.6rem) clamp(1.2rem, 4vw, 3.2rem);
  border-bottom: var(--rule);
}

.cta-t {
  margin: 0;
  font-family: var(--f-head);
  font-size: clamp(1.6rem, 4.8vw, 3.1rem);
  line-height: 1.04;
  letter-spacing: -0.03em;
}

.cta-btn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  min-height: 50px;
  padding: 0.7rem 1.7rem;
  border: var(--rule);
  border-radius: 999px;
  text-decoration: none;
  font-size: 1rem;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.cta-btn:hover { background: var(--ink); color: var(--paper); transform: translateX(-4px); }

.f-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem 1.4rem;
  padding: 1.2rem clamp(1.2rem, 4vw, 3.2rem) 1.4rem;
}

.f-nav { display: flex; flex-wrap: wrap; gap: 0.1rem 1.05rem; }

.f-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.3rem 0.15rem;
  font-size: 0.94rem;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: border-color 0.2s ease;
}
.f-nav a:hover { border-bottom-color: var(--ink); }

.f-copy {
  margin-left: auto;
  font-size: 0.83rem;
  letter-spacing: 0.08em;
}

/* ---------- 滚动显现 ---------- */
.js .rv { opacity: 0; transform: translateY(16px); }
.js .rv.in {
  opacity: 1;
  transform: none;
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.2, 0.7, 0.3, 1);
}

/* ---------- 断点 ---------- */
@media (max-width: 880px) {
  .spine {
    position: sticky;
    top: 0;
    bottom: auto;
    left: auto;
    width: auto;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.9rem;
    border-right: none;
    border-bottom: var(--rule);
    overflow: visible;
  }

  main { margin-left: 0; }

  .toc { margin-left: auto; position: relative; }
  .toc summary {
    border: 2px solid var(--ink);
    border-radius: 999px;
    padding: 0.3rem 0.9rem;
    font-size: 0.86rem;
    letter-spacing: 0.12em;
  }
  .toc summary:hover { letter-spacing: 0.12em; }
  .toc summary::after { margin-left: 0.5rem; }

  .toc menu {
    position: absolute;
    right: 0;
    top: calc(100% + 0.55rem);
    margin: 0;
    padding: 0.4rem 0.55rem;
    min-width: min(76vw, 262px);
    max-height: 68vh;
    overflow: auto;
    background: var(--paper);
    border: var(--rule);
    border-radius: var(--r);
    box-shadow: 0 12px 0 rgba(0, 0, 0, 0.07);
  }

  .find { margin-top: 0; }
  .find input { padding: 0.45rem 0.7rem; }
  .find button { display: none; }

  .hero {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .hero-copy { padding: 1.9rem 1.15rem 1.4rem; }
  .badge { margin-bottom: 1.1rem; }
  .subtitle { max-width: 34ch; margin-bottom: 0.9rem; }
  .hero-fig {
    margin: 0 1.15rem 1.6rem;
    border-radius: var(--r);
  }
  .hero-img { min-height: 0; aspect-ratio: 4 / 3; }

  .prose { padding-inline: 1.15rem; }
}

@media (max-width: 700px) {
  .find { display: none; }
  .f-copy { margin-left: 0; width: 100%; }
}

@media (max-width: 420px) {
  body { font-size: 16.5px; }
  .f-nav { gap: 0.1rem 0.8rem; }
  .f-nav a { font-size: 0.9rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .rv { opacity: 1; transform: none; }
  .mark:hover, .cta-btn:hover { transform: none; }
}

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