@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{
  --paper:#fafaf8;
  --gray:#4a4a4a;
  --ink:#1a1a1a;
  --serif:"Libre Bodoni","Songti SC","Noto Serif SC",Georgia,"Times New Roman",serif;
  --sans:"Public Sans","PingFang SC","Hiragino Sans GB","Microsoft YaHei",system-ui,-apple-system,sans-serif;
}

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

body{
  margin:0;
  overflow-x:hidden;
  color:var(--ink);
  background-color:var(--paper);
  background-image:
    radial-gradient(circle at 30% 20%, rgba(26,26,26,.055) 0 1px, transparent 1px),
    radial-gradient(circle at 70% 65%, rgba(26,26,26,.042) 0 1px, transparent 1px),
    repeating-linear-gradient(93deg, rgba(26,26,26,.022) 0 1px, transparent 1px 6px);
  background-size:27px 27px, 41px 41px, auto;
  font-family:var(--sans);
  font-size:17px;
  font-weight:400;
  line-height:1.72;
}

a{-webkit-tap-highlight-color:rgba(26,26,26,.14)}

/* 左侧竖排栏 */
.rail{
  position:fixed;
  top:0;bottom:0;left:0;
  width:212px;
  z-index:30;
  display:flex;
  flex-direction:column;
  gap:16px;
  padding:26px 18px 30px;
  border-right:2px solid var(--ink);
  background:rgba(250,250,248,.95);
}

.mark{
  display:flex;
  align-items:center;
  min-height:44px;
  padding:4px 0;
  color:var(--ink);
  text-decoration:none;
  transform:rotate(-1.6deg);
}
.mark-txt{
  font-family:var(--serif);
  font-size:23px;
  font-weight:600;
  line-height:1.14;
  letter-spacing:.01em;
}
.mark-img{display:block;width:100%;max-width:150px;height:auto}

.drawer{margin:0}
.drawer summary{
  list-style:none;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:44px;
  padding:0 18px;
  border:2px solid var(--ink);
  border-radius:999px;
  background:var(--paper);
  font-size:16px;
  letter-spacing:.16em;
  transform:rotate(.7deg);
  user-select:none;
  transition:background .09s steps(2),color .09s steps(2);
}
.drawer summary::-webkit-details-marker{display:none}
.drawer summary::after{
  content:"";
  width:8px;height:8px;
  margin-left:10px;
  border-right:2px solid currentColor;
  border-bottom:2px solid currentColor;
  transform:rotate(45deg) translateY(-2px);
}
.drawer[open] summary::after{transform:rotate(-135deg) translateY(-1px)}
.drawer summary:hover{background:var(--ink);color:var(--paper)}

.drawer menu{
  list-style:none;
  margin:12px 0 0;
  padding:0;
  display:grid;
  gap:7px;
}
.drawer menu li{animation:drop .26s steps(3) both}
.drawer menu li:nth-child(2){animation-delay:.03s}
.drawer menu li:nth-child(3){animation-delay:.06s}
.drawer menu li:nth-child(4){animation-delay:.09s}
.drawer menu li:nth-child(5){animation-delay:.12s}
.drawer menu li:nth-child(6){animation-delay:.15s}
.drawer menu li:nth-child(7){animation-delay:.18s}
.drawer menu a{
  display:flex;
  align-items:center;
  min-height:42px;
  padding:4px 14px;
  border:2px solid var(--ink);
  border-radius:999px;
  background:var(--paper);
  color:var(--ink);
  text-decoration:none;
  font-size:16px;
  line-height:1.3;
  transition:background .09s steps(2),color .09s steps(2);
}
.drawer menu li:nth-child(odd) a{transform:rotate(-.5deg)}
.drawer menu li:nth-child(even) a{transform:rotate(.5deg)}
.drawer menu a:hover{background:var(--ink);color:var(--paper)}

.find{margin:0}
.find input{
  width:100%;
  min-height:44px;
  padding:0 15px;
  border:2px solid var(--ink);
  border-radius:999px;
  background:rgba(255,255,255,.72);
  color:var(--ink);
  font:inherit;
  font-size:16px;
  transform:rotate(-.4deg);
}
.find input::placeholder{color:var(--gray);letter-spacing:.1em}
.find input:focus{outline:2px dashed var(--ink);outline-offset:3px}

/* 主区 */
.page{
  margin-left:212px;
  display:flex;
  flex-direction:column;
  min-height:100vh;
}
main{
  flex:1 1 auto;
  width:100%;
  max-width:1080px;
  padding:0 40px;
}

/* 首屏 */
.hero{
  position:relative;
  min-height:70vh;
  display:grid;
  justify-items:center;
  align-content:center;
  gap:16px;
  text-align:center;
  padding:64px 0 58px;
  background-image:radial-gradient(rgba(26,26,26,.17) .9px, transparent .9px);
  background-size:19px 19px;
  background-position:center;
}
.hero > *{animation:ink .34s steps(4) both}
.hero > :nth-child(2){animation-delay:.07s}
.hero > :nth-child(3){animation-delay:.14s}

.hero h1{
  margin:0;
  max-width:20em;
  font-family:var(--serif);
  font-weight:600;
  font-size:clamp(30px,5.2vw,56px);
  line-height:1.16;
  letter-spacing:-.012em;
}
.hero .dek{
  margin:0;
  max-width:36em;
  color:var(--gray);
  font-size:17px;
}

.scrap{
  margin:0;
  color:var(--ink);
  transform:rotate(-3deg);
  animation:wobble 5.6s steps(6) infinite;
}
.scrap svg{display:block;width:104px;height:auto}
.hero-pic{
  display:block;
  width:132px;
  height:auto;
  border:2px solid var(--ink);
  border-bottom-width:6px;
  border-radius:14px;
  background:var(--paper);
  filter:grayscale(1) contrast(1.16);
}

/* 目录 + 正文 */
.deck{
  display:grid;
  grid-template-columns:1fr;
  gap:26px;
  padding:38px 0 10px;
  border-top:2px solid var(--ink);
}

.toc{
  border:2px solid var(--ink);
  border-bottom-width:6px;
  border-radius:20px 28px 22px 28px;
  padding:16px 15px 18px;
  background:rgba(255,255,255,.68);
  transform:rotate(-.6deg);
}
.toc small{
  display:block;
  font-size:13px;
  letter-spacing:.3em;
  color:var(--gray);
}
.toc h2{
  margin:2px 0 11px;
  font-family:var(--serif);
  font-size:24px;
  font-weight:600;
  line-height:1.2;
}
.toc ol{
  list-style:none;
  counter-reset:toc;
  margin:0;
  padding:0;
  display:grid;
  gap:2px;
}
.toc li{counter-increment:toc;min-width:0}
.toc a{
  display:flex;
  align-items:baseline;
  gap:9px;
  min-height:40px;
  padding:6px 2px;
  border-bottom:1px dashed rgba(26,26,26,.3);
  color:var(--gray);
  text-decoration:none;
  font-size:16px;
  line-height:1.35;
}
.toc a::before{
  content:counter(toc,decimal-leading-zero);
  font-family:var(--serif);
  font-size:12px;
  letter-spacing:.06em;
  color:var(--ink);
}
.toc a:hover{color:var(--ink)}

.body{min-width:0}
.body > section{
  padding:36px 0 44px;
  border-top:2px dashed rgba(26,26,26,.4);
  scroll-margin-top:26px;
}
.body > section:first-child{border-top:0;padding-top:4px}

.body small{
  display:block;
  font-size:13px;
  letter-spacing:.28em;
  color:var(--gray);
}
.body h2{
  margin:.15em 0 .62em;
  font-family:var(--serif);
  font-weight:600;
  font-size:clamp(23px,2.6vw,33px);
  line-height:1.26;
  letter-spacing:-.005em;
}
.body h2::after{
  content:"";
  display:block;
  width:64px;
  height:6px;
  margin-top:.34em;
  background:repeating-linear-gradient(90deg,var(--ink) 0 8px,transparent 8px 13px);
  transform:rotate(-1deg);
}
.body h3{
  margin:1.5em 0 .5em;
  font-family:var(--serif);
  font-weight:600;
  font-size:21px;
  line-height:1.32;
}
.body h4{margin:1.4em 0 .4em;font-size:17px;letter-spacing:.04em}
.body p{margin:0 0 1.05em}
.body ul,.body ol{margin:0 0 1.1em;padding-left:1.3em}
.body li{margin:0 0 .4em}
.body a{
  color:var(--ink);
  text-decoration:underline;
  text-decoration-thickness:2px;
  text-underline-offset:3px;
}
.body blockquote{
  margin:1.3em 0;
  padding:14px 18px;
  border-left:5px solid var(--ink);
  background:rgba(26,26,26,.045);
  transform:rotate(-.35deg);
}
.body blockquote p:last-child{margin:0}
.body figure{margin:1.3em 0}
.body img{
  max-width:100%;
  height:auto;
  border:2px solid var(--ink);
  border-radius:14px;
  filter:grayscale(.15) contrast(1.05);
}
.body figcaption{margin-top:.45em;font-size:15px;color:var(--gray)}
.body table{width:100%;border-collapse:collapse;margin:1.2em 0;font-size:16px}
.body th,.body td{border:2px solid var(--ink);padding:8px 10px;text-align:left;vertical-align:top}
.body th{background:rgba(26,26,26,.07);font-weight:600}
.body code{
  font-family:ui-monospace,SFMono-Regular,Menlo,monospace;
  font-size:15px;
  padding:1px 5px;
  border-radius:5px;
  background:rgba(26,26,26,.075);
}
.body pre{
  overflow-x:auto;
  padding:14px 16px;
  border:2px solid var(--ink);
  border-radius:14px;
  background:rgba(26,26,26,.05);
}

/* 页脚三栏 */
footer{
  display:grid;
  grid-template-columns:1fr;
  gap:24px;
  width:100%;
  max-width:1080px;
  margin-top:40px;
  padding:34px 40px 26px;
  border-top:3px double var(--ink);
}
footer dl{margin:0}
footer dt{
  margin-bottom:7px;
  font-size:13px;
  letter-spacing:.24em;
  color:var(--gray);
}
footer dd{margin:0 0 3px;font-size:16px}
footer dd a{
  display:inline-flex;
  align-items:center;
  min-height:40px;
  padding-right:6px;
  border-bottom:2px solid transparent;
  color:var(--ink);
  text-decoration:none;
}
footer dd a:hover{border-bottom-color:var(--ink)}
footer .cr{
  grid-column:1/-1;
  margin:6px 0 0;
  padding-top:14px;
  border-top:1px dashed rgba(26,26,26,.35);
  font-size:15px;
  color:var(--gray);
}

@keyframes ink{
  from{opacity:0;transform:translateY(10px)}
  to{opacity:1;transform:translateY(0)}
}
@keyframes drop{
  from{opacity:0;transform:translateY(-6px) rotate(-.6deg)}
  to{opacity:1;transform:translateY(0) rotate(-.6deg)}
}
@keyframes wobble{
  0%,100%{transform:rotate(-3.2deg)}
  50%{transform:rotate(1.8deg)}
}

@media (min-width:600px){
  .toc ol{grid-template-columns:1fr 1fr;column-gap:12px}
}

@media (min-width:700px){
  footer{grid-template-columns:repeat(3,minmax(0,1fr));gap:32px}
}

@media (min-width:900px){
  .deck{grid-template-columns:196px minmax(0,1fr);gap:52px;align-items:start}
  .toc{position:sticky;top:26px}
}

@media (max-width:899px){
  .rail{
    top:0;bottom:auto;left:0;right:0;
    width:auto;
    flex-direction:row;
    align-items:center;
    gap:12px;
    padding:9px 14px 10px;
    border-right:0;
    border-bottom:2px solid var(--ink);
  }
  .mark{min-height:40px}
  .mark-txt{font-size:19px}
  .mark-img{max-width:96px}
  .drawer summary{min-height:40px;padding:0 15px;font-size:15px;letter-spacing:.12em}
  .drawer menu{
    position:absolute;
    left:12px;right:12px;top:62px;
    padding:10px;
    border:2px solid var(--ink);
    border-radius:20px;
    background:var(--paper);
    box-shadow:0 10px 0 -4px rgba(26,26,26,.16);
  }
  .drawer menu a{font-size:16px}
  .find{display:none}
  .page{margin-left:0}
  main{padding:0 18px;padding-top:72px}
  .hero{min-height:0;padding:22px 0 34px;gap:12px}
  .hero h1{font-size:clamp(28px,8vw,38px)}
  .hero .dek{font-size:16px}
  .scrap svg{width:82px}
  .hero-pic{width:104px}
  .deck{padding-top:24px}
  .body > section{scroll-margin-top:84px;padding:30px 0 36px}
  footer{margin-top:26px;padding:26px 18px 22px}
}

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