@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&display=swap');

:root{
  --paper:#fafaf8;
  --gray:#4a4a4a;
  --ink:#1a1a1a;
  --r:18px;
  --mono:"Space Mono",ui-monospace,SFMono-Regular,Menlo,"PingFang SC","Hiragino Sans GB","Microsoft YaHei",monospace;
  --grain:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='150' height='150'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.78' numOctaves='2' stitchTiles='stitch'/></filter><rect width='150' height='150' filter='url(%23n)' opacity='0.16'/></svg>");
}

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

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

body{
  margin:0;
  padding:78px 0 84px;
  overflow-x:hidden;
  font-family:var(--mono);
  font-size:17px;
  line-height:1.78;
  color:var(--ink);
  background-color:var(--paper);
  background-image:var(--grain);
  background-repeat:repeat;
}

img{max-width:100%;height:auto}
p{margin:0 0 1.05em}

a{color:var(--ink)}
a:focus-visible,
button:focus-visible{
  outline:3px dashed var(--ink);
  outline-offset:3px;
}

.skip{
  position:fixed;
  top:-70px;
  left:14px;
  z-index:60;
  padding:8px 14px;
  font-size:16px;
  color:var(--paper);
  background:var(--ink);
  border-radius:999px;
  text-decoration:none;
}
.skip:focus{top:12px}

/* ---------- 侧边竖排导航 ---------- */

.rail{
  position:fixed;
  top:0;left:0;right:0;
  z-index:50;
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  background:rgba(250,250,248,.97);
  border-bottom:2px dashed rgba(26,26,26,.45);
}

.mark{
  flex:0 0 auto;
  display:grid;
  place-items:center;
  width:44px;height:44px;
  color:var(--ink);
  background:var(--paper);
  border:2px solid var(--ink);
  border-radius:14px;
  transform:rotate(-3deg);
}

.pills{
  flex:1 1 auto;
  display:flex;
  gap:8px;
  overflow-x:auto;
  padding:3px 2px;
  scrollbar-width:none;
}
.pills::-webkit-scrollbar{display:none}

.pill{
  flex:0 0 auto;
  display:inline-flex;
  align-items:center;
  min-height:42px;
  padding:8px 13px;
  font-size:16px;
  line-height:1.15;
  color:var(--ink);
  background:var(--paper);
  border:2px solid var(--ink);
  border-radius:999px;
  text-decoration:none;
  white-space:nowrap;
  transform:rotate(-1.2deg);
}
.pill:nth-child(even){transform:rotate(1.2deg)}
.pill:hover,
.pill.on{
  color:var(--paper);
  background:var(--ink);
  transform:rotate(0);
}

.cta{
  position:fixed;
  right:14px;bottom:14px;
  z-index:55;
  display:inline-flex;
  align-items:center;
  min-height:44px;
  padding:10px 18px;
  font-size:16px;
  font-weight:700;
  color:var(--paper);
  background:var(--ink);
  border:2px solid var(--ink);
  border-radius:999px;
  text-decoration:none;
  transform:rotate(-2deg);
}
.cta:hover{color:var(--ink);background:var(--paper)}

/* ---------- 首屏 ---------- */

.hero{
  position:relative;
  display:grid;
  gap:26px;
  align-items:center;
  min-height:70vh;
  max-width:1140px;
  margin:0 auto;
  padding:40px 20px 66px;
}

.hero::after{
  content:"";
  position:absolute;
  left:0;right:0;bottom:0;
  height:16px;
  background:var(--ink);
  clip-path:polygon(0 0,100% 0,100% 26%,0 100%);
}

.stamp{
  display:inline-block;
  margin:0 0 18px;
  padding:3px 13px;
  font-size:16px;
  color:var(--gray);
  border:2px dashed var(--gray);
  border-radius:999px;
  transform:rotate(-1.5deg);
}

.hero h1{
  margin:0 0 20px;
  font-size:clamp(28px,6.4vw,54px);
  line-height:1.18;
  letter-spacing:-.02em;
}

.lede{
  max-width:36em;
  margin:0;
  color:var(--gray);
  font-size:17px;
}

.hero-art{
  order:2;
  margin:0;
  padding:12px;
  max-width:280px;
  background:rgba(255,255,255,.72);
  border:2px solid var(--ink);
  border-radius:var(--r);
  transform:rotate(3deg);
  will-change:transform;
}
.hero-art svg{display:block;width:100%;height:auto}

/* ---------- 正文与右栏 ---------- */

.paper{
  display:grid;
  gap:34px;
  max-width:1140px;
  margin:0 auto;
  padding:34px 20px 42px;
}

.sheet{min-width:0;max-width:70ch}

.sheet article{
  margin:0 0 46px;
  padding:0 0 10px;
  border-bottom:2px dashed rgba(26,26,26,.22);
  scroll-margin-top:96px;
}
.sheet article:last-child{border-bottom:0}

.sheet h2{
  margin:0 0 .55em;
  font-size:clamp(22px,4.2vw,31px);
  line-height:1.26;
  letter-spacing:-.01em;
}
.sheet h2 span{
  padding:0 .12em;
  background:linear-gradient(transparent 64%,rgba(26,26,26,.18) 64%);
}

.sheet h3{
  margin:1.5em 0 .5em;
  font-size:20px;
  line-height:1.35;
}
.sheet h3 span{
  border-bottom:2px solid var(--ink);
}

.sheet ul,
.sheet ol{padding-left:1.35em;margin:0 0 1.1em}
.sheet li{margin:0 0 .45em}

.sheet a{
  text-decoration:underline;
  text-decoration-thickness:2px;
  text-underline-offset:3px;
}
.sheet a:hover{background:rgba(26,26,26,.1)}

.sheet blockquote{
  margin:1.4em 0;
  padding:12px 18px;
  color:var(--gray);
  border-left:4px solid var(--ink);
  background:rgba(255,255,255,.6);
  transform:rotate(-.4deg);
}

.sheet figure{
  margin:1.5em 0;
  padding:10px;
  background:#fff;
  border:2px solid var(--ink);
  border-radius:var(--r);
  transform:rotate(-.6deg);
}
.sheet figure img{border-radius:12px}

.sheet table{
  width:100%;
  margin:1.4em 0;
  border-collapse:collapse;
  font-size:16px;
}
.sheet th,
.sheet td{
  padding:8px 10px;
  text-align:left;
  border:2px solid var(--ink);
}
.sheet th{background:rgba(26,26,26,.08)}

.sheet code,
.sheet pre{
  font-family:var(--mono);
  font-size:16px;
}
.sheet pre{
  overflow-x:auto;
  padding:12px;
  background:#fff;
  border:2px dashed var(--gray);
  border-radius:12px;
}

/* ---------- 右栏 ---------- */

.side{
  align-self:start;
  padding:16px 16px 20px;
  background:rgba(255,255,255,.8);
  border:2px solid var(--ink);
  border-radius:var(--r);
  transform:rotate(.7deg);
}

.side h2{
  margin:0 0 12px;
  font-size:17px;
  line-height:1.3;
  letter-spacing:.06em;
}
.side h2 span{
  display:inline-block;
  padding-bottom:4px;
  border-bottom:2px solid var(--ink);
}

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

.side li + li{border-top:1px dashed rgba(26,26,26,.3)}

.side a{
  display:flex;
  align-items:center;
  gap:10px;
  min-height:42px;
  padding:6px 0;
  font-size:16px;
  color:var(--ink);
  text-decoration:none;
}
.side a::before{
  counter-increment:idx;
  content:counter(idx,decimal-leading-zero);
  font-size:15px;
  color:var(--gray);
}
.side a:hover{background:rgba(26,26,26,.08)}

/* ---------- 结尾拼贴 ---------- */

.outro{
  position:relative;
  display:grid;
  justify-items:center;
  gap:10px;
  max-width:1140px;
  margin:0 auto;
  padding:26px 20px 44px;
  text-align:center;
  border-top:2px solid var(--ink);
}
.outro-art{
  margin:0;
  transform:rotate(2deg);
}
.outro-art svg{display:block}
.outro h2{
  margin:0;
  font-size:20px;
  letter-spacing:.05em;
}
.outro h2 span{
  padding:2px 10px;
  background:var(--ink);
  color:var(--paper);
}
.backtop{
  display:inline-flex;
  align-items:center;
  min-height:44px;
  padding:9px 20px;
  font-size:16px;
  color:var(--ink);
  background:var(--paper);
  border:2px solid var(--ink);
  border-radius:999px;
  text-decoration:none;
  transform:rotate(-1deg);
}
.backtop:hover{color:var(--paper);background:var(--ink)}

/* ---------- 页脚 ---------- */

.foot{
  margin-top:18px;
  padding:30px 20px 24px;
  background:rgba(255,255,255,.65);
  border-top:2px solid var(--ink);
}

.foot-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:26px 16px;
  max-width:1140px;
  margin:0 auto 26px;
}

.foot-nav dl,
.foot dl{margin:0}

.foot dt{
  margin-bottom:8px;
  padding-bottom:6px;
  font-size:16px;
  font-weight:700;
  letter-spacing:.05em;
  border-bottom:2px solid var(--ink);
}

.foot dd{
  margin:0;
  border-bottom:1px dashed rgba(26,26,26,.28);
}
.foot dd:last-child{border-bottom:0}

.foot dd a{
  display:inline-flex;
  align-items:center;
  min-height:40px;
  padding:2px 0;
  font-size:16px;
  text-decoration:none;
}
.foot dd a:hover{text-decoration:underline;text-underline-offset:3px}

.foot-bar{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  max-width:1140px;
  margin:0 auto;
  padding-top:16px;
  border-top:2px dashed rgba(26,26,26,.35);
}
.foot-bar p{margin:0;font-size:16px;color:var(--gray)}
.foot-back a{
  display:inline-flex;
  align-items:center;
  min-height:40px;
  padding:0 4px;
  color:var(--ink);
  text-decoration:underline;
  text-underline-offset:3px;
}

/* ---------- 桌面 ---------- */

@media (min-width:900px){
  body{padding:0 0 0 138px}

  .rail{
    inset:0 auto 0 0;
    width:138px;
    flex-direction:column;
    align-items:stretch;
    justify-content:flex-start;
    gap:16px;
    padding:22px 12px;
    border-bottom:0;
    border-right:2px dashed rgba(26,26,26,.45);
  }
  .mark{margin:0 auto 4px}
  .pills{
    flex-direction:column;
    overflow:visible;
    gap:10px;
  }
  .pill{justify-content:center;text-align:center}

  .hero{
    grid-template-columns:minmax(0,1fr) 300px;
    padding:84px 36px 96px;
  }
  .hero-art{order:0;max-width:none}

  .paper{
    grid-template-columns:minmax(0,1fr) 272px;
    gap:48px;
    padding:44px 36px 52px;
  }
  .sheet article{scroll-margin-top:32px}
  .side{position:sticky;top:28px}

  .outro{padding:30px 36px 56px}
  .foot{padding:38px 36px 26px}
  .foot-grid{grid-template-columns:repeat(4,minmax(0,1fr));gap:26px 28px}
}

@media (min-width:1180px){
  .hero{padding-left:56px;padding-right:56px}
  .paper{padding-left:56px;padding-right:56px}
}

@media (prefers-reduced-motion:reduce){
  html{scroll-behavior:auto}
  .hero-art,
  .pill,
  .side,
  .sheet figure,
  .stamp,
  .cta,
  .backtop,
  .mark{transform:none}
  .hero-art{will-change:auto}
}

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