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

:root {
  --bh: 3.5rem;
  --ink: #000;
  --paper: #fff;
  --rule: #000;
  --hand: "Kalam", "Patrick Hand", "Kaiti SC", KaiTi, 楷体, cursive;
  --serif: Georgia, "Songti SC", "Noto Serif SC", "Source Han Serif SC", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

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

html[data-menu="open"] body { overflow: hidden; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; height: auto; }
a { color: var(--ink); }
p { margin: 0 0 1.05em; }
ul, ol { margin: 0 0 1.05em; padding-left: 1.25rem; }
li { margin: 0 0 .35em; }

h1, h2, h3, h4 { margin: 0 0 .7rem; line-height: 1.28; letter-spacing: -.012em; font-weight: 700; }
h2 { font-size: clamp(1.3rem, 3.1vw, 1.85rem); }
h3 { font-size: 1.12rem; }

h2 > span { display: inline; }
h2 > span::before {
  content: "";
  display: inline-block;
  width: .56em;
  height: .56em;
  background: var(--ink);
  margin-right: .5em;
  vertical-align: .08em;
}

blockquote {
  margin: 1.5rem 0;
  padding: .1rem 0 .1rem 1rem;
  border-left: 3px solid var(--ink);
  font-family: var(--hand);
  font-size: 1.02rem;
  line-height: 1.6;
}
blockquote p:last-child { margin-bottom: 0; }

figure { margin: 1.6rem 0; }
figcaption {
  font-family: var(--hand);
  font-size: .85rem;
  line-height: 1.5;
  margin-top: .45rem;
}

::selection { background: var(--ink); color: var(--paper); }

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

.skip {
  position: absolute;
  left: .6rem;
  top: -4rem;
  z-index: 70;
  background: var(--ink);
  color: var(--paper);
  padding: .7rem 1rem;
  text-decoration: none;
  border-radius: 4px;
  transition: top .18s ease;
}
.skip:focus { top: .6rem; }

/* 页首 */
.masthead {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: .6rem;
  min-height: var(--bh);
  padding: .45rem clamp(.85rem, 5vw, 2.6rem);
  background: var(--paper);
  border-bottom: 1.5px solid var(--rule);
}

.brandmark {
  position: relative;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  min-height: 42px;
  text-decoration: none;
  color: var(--ink);
}
.brandmark img { width: 26px; height: 26px; object-fit: contain; }
.mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  font-family: var(--hand);
  font-size: 1.25rem;
  line-height: 1;
}

.burger {
  position: relative;
  z-index: 3;
  margin-left: auto;
  min-height: 42px;
  padding: .45rem .95rem;
  font-family: var(--sans);
  font-size: .95rem;
  letter-spacing: .14em;
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  cursor: pointer;
}

.cta {
  position: relative;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: .45rem 1rem;
  background: var(--ink);
  color: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  text-decoration: none;
  font-family: var(--sans);
  font-size: .95rem;
  letter-spacing: .08em;
}

html[data-menu="open"] .brandmark,
html[data-menu="open"] .burger {
  color: var(--paper);
  background: var(--ink);
  border-color: var(--paper);
}
html[data-menu="open"] .cta {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--paper);
}

/* 全屏遮罩菜单 */
.masthead nav {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: none;
  overflow-y: auto;
  padding: 5rem 1.25rem 3rem;
  background: var(--ink);
  color: var(--paper);
}
html[data-menu="open"] .masthead nav { display: block; }

.masthead nav p {
  max-width: 28rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}
.masthead nav a {
  display: block;
  padding: .9rem .2rem;
  color: var(--paper);
  text-decoration: none;
  font-size: 1.3rem;
  border-bottom: 1px solid #ffffff33;
}
.masthead nav a:first-child { border-top: 1px solid #ffffff33; }
.masthead nav a:hover { padding-left: .7rem; }

/* 粘性栏目条 */
.indexbar {
  position: sticky;
  top: var(--bh);
  z-index: 40;
  background: var(--paper);
  border-bottom: 1.5px solid var(--rule);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.indexbar ol {
  display: flex;
  gap: .1rem;
  margin: 0;
  padding: 0 clamp(.35rem, 3vw, 1.6rem);
  list-style: none;
}
.indexbar li { margin: 0; }
.indexbar a {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  min-height: 40px;
  padding: .45rem .6rem;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--sans);
  font-size: .95rem;
  white-space: nowrap;
}
.indexbar i {
  font-family: var(--hand);
  font-style: normal;
  font-size: .8rem;
  opacity: .5;
}
.indexbar a:hover,
.indexbar a[aria-current] { background: var(--ink); color: var(--paper); }
.indexbar a[aria-current] i { opacity: .8; }

main { display: block; }

main section[id] { scroll-margin-top: calc(var(--bh) + 4rem); }

/* 首屏 */
.hero {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 70vh;
  padding: 2.5rem clamp(.9rem, 5vw, 3rem) 3.5rem;
  overflow: hidden;
  background-image: radial-gradient(#00000026 1.1px, transparent 1.2px);
  background-size: 15px 15px;
  background-position: center;
  border-bottom: 1.5px solid var(--rule);
}

.hero-copy {
  position: relative;
  z-index: 2;
  max-width: 34rem;
  text-align: center;
  animation: rise .7s ease-out both;
}
.kicker {
  margin: 0 0 1rem;
  font-family: var(--hand);
  font-size: 1rem;
  letter-spacing: .06em;
}
.hero h1 {
  margin: 0 0 1rem;
  font-size: clamp(1.85rem, 5.4vw, 3.4rem);
  line-height: 1.14;
}
.dek {
  margin: 0;
  font-size: .98rem;
  line-height: 1.7;
  color: #1a1a1a;
}

.hero-pair { position: absolute; inset: 0; pointer-events: none; }
.hero-fig {
  position: absolute;
  width: clamp(94px, 21vw, 224px);
  margin: 0;
}
.hero-fig img {
  width: 100%;
  background: var(--paper);
  filter: grayscale(1) contrast(1.08);
  transform: rotate(-3deg);
  box-shadow: 7px 7px 0 var(--ink);
}
.hero-fig--a { left: 1.4vw; top: 13%; animation: rise .8s ease-out .1s both; }
.hero-fig--b { right: 1.4vw; bottom: 11%; text-align: right; animation: rise .8s ease-out .22s both; }
.hero-fig--b img { transform: rotate(2.5deg); box-shadow: -7px 7px 0 var(--ink); }

@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
}

/* 版心 */
.wrap {
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  gap: clamp(1.25rem, 3.6vw, 3.5rem);
  max-width: 76rem;
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 3.8rem) clamp(.9rem, 5vw, 2.6rem) 4rem;
}

/* 左侧栏 */
.rail {
  align-self: start;
  position: sticky;
  top: calc(var(--bh) + 3.6rem);
  border-left: 3px solid var(--rule);
  padding-left: 1rem;
}
.rail-note {
  margin: 0 0 .9rem;
  font-family: var(--hand);
  font-size: .95rem;
  letter-spacing: .05em;
}
.rail h2 {
  font-family: var(--sans);
  font-size: .95rem;
  letter-spacing: .16em;
  margin: 0 0 .6rem;
}
.rail h2 > span::before { width: .5em; height: .5em; }

.toc { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 0; }
.toc a {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .5rem 0;
  min-height: 40px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--sans);
  font-size: .95rem;
  border-bottom: 1px dotted #00000055;
}
.toc a:hover { background: #f1f1f1; }
.toc i { font-family: var(--hand); font-style: normal; font-size: .8rem; opacity: .5; }

.rail-tip {
  margin: 1rem 0 0;
  font-family: var(--hand);
  font-size: .95rem;
  line-height: 1.6;
}

/* 正文 */
.lede {
  border-top: 3px solid var(--rule);
  padding-top: .9rem;
  margin-bottom: 2.4rem;
}
.lede h2 {
  font-family: var(--sans);
  font-size: 1rem;
  letter-spacing: .2em;
}
.lede h2 > span::before { width: .5em; height: .5em; }
.lede p { margin: 0; font-size: .98rem; }

.page-body { counter-reset: sec; }
.page-body > section {
  counter-increment: sec;
  position: relative;
  margin-top: 2.6rem;
  padding-top: 1.5rem;
  border-top: 1.5px solid var(--rule);
}
.page-body > section:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.page-body > section::before {
  content: "0" counter(sec);
  position: absolute;
  top: 1.75rem;
  right: 0;
  font-family: var(--hand);
  font-size: .85rem;
  opacity: .45;
}
.page-body > section:first-child::before { top: .2rem; }

.page-body h2 { border-bottom: 1.5px solid var(--rule); padding-bottom: .45rem; }
.page-body h3 { margin-top: 1.6rem; }
.page-body img { filter: grayscale(1) contrast(1.05); }
.page-body a { text-decoration-thickness: 1px; text-underline-offset: 3px; }
.page-body ul, .page-body ol { padding-left: 1.3rem; }

.page-body > section:first-child > p:first-of-type::first-letter {
  float: left;
  font-size: 3.5em;
  line-height: .82;
  padding: .06em .1em 0 0;
  font-family: var(--hand);
}

/* 页脚 */
.colophon {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.1rem;
  padding: 1.6rem clamp(.9rem, 5vw, 2.6rem) 2.6rem;
  border-top: 3px solid var(--rule);
}
.wordmark {
  margin: 0;
  font-size: clamp(2.1rem, 10.5vw, 6.2rem);
  line-height: .92;
  letter-spacing: -.045em;
  font-weight: 700;
}
.colophon small {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .3rem 1rem;
  font-family: var(--sans);
  font-size: .95rem;
}
.colophon small a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 .2rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* 揭示动效 */
.will-reveal { opacity: 0; transform: translateY(14px); }
.is-in {
  opacity: 1;
  transform: none;
  transition: opacity .55s ease, transform .55s ease;
}

/* 中屏 */
@media (max-width: 1024px) {
  .rail { position: static; }
}

@media (max-width: 1100px) {
  .page-body > section > p { column-count: 1; }
}

@media (min-width: 1101px) {
  .page-body > section > p { column-count: 2; column-gap: 2.6rem; }
}

/* 窄屏 */
@media (max-width: 860px) {
  .wrap {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.6rem;
    padding-top: 1.6rem;
  }
  .rail {
    border-left: 0;
    border-top: 2px solid var(--rule);
    padding: .9rem 0 0;
  }
  .rail h2 { margin-bottom: .4rem; }
  .toc {
    display: flex;
    gap: .5rem;
    overflow-x: auto;
    padding-bottom: .5rem;
    -webkit-overflow-scrolling: touch;
  }
  .toc li { flex: 0 0 auto; }
  .toc a {
    border: 1.5px solid var(--ink);
    border-radius: 4px;
    padding: .5rem .75rem;
    white-space: nowrap;
  }
  .rail-tip { margin-top: .6rem; }
}

@media (max-width: 720px) {
  .hero {
    min-height: 0;
    padding-top: 2.2rem;
    place-items: stretch;
  }
  .hero-copy { max-width: none; }
  .hero-pair {
    position: static;
    display: flex;
    justify-content: center;
    gap: .9rem;
    margin-top: 1.9rem;
  }
  .hero-fig { position: static; width: 45%; max-width: 180px; margin: 0; }
  .hero-fig--b { text-align: right; }
  .colophon { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 420px) {
  .cta { padding: .45rem .7rem; font-size: .9rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-delay: 0ms !important;
    transition-duration: .001ms !important;
  }
  .will-reveal { opacity: 1; transform: none; }
}

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