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

:root{
  --paper:#fafaf8;
  --ink:#1a1a1a;
  --gray:#4a4a4a;
  --soft:#efede6;
  --line:#cfccc4;
  --hand:14px 8px 16px 10px / 10px 16px 8px 14px;
  --mono:'JetBrains Mono',ui-monospace,SFMono-Regular,Menlo,monospace;
  --sans:'Inter',system-ui,-apple-system,'PingFang SC','Microsoft YaHei',sans-serif;
  --head:'Space Grotesk','Inter',system-ui,sans-serif;
}

*{box-sizing:border-box}

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

body{
  margin:0;
  background-color:var(--paper);
  color:var(--ink);
  font-family:var(--sans);
  font-size:17px;
  line-height:1.68;
  background-image:
    radial-gradient(circle at 14% 22%, rgba(26,26,26,.05) 0 1px, transparent 1px),
    radial-gradient(circle at 72% 68%, rgba(26,26,26,.038) 0 1px, transparent 1px),
    repeating-linear-gradient(0deg, rgba(26,26,26,.018) 0 1px, transparent 1px 30px);
  background-size:7px 7px, 13px 13px, 100% 30px;
}

a{color:var(--ink)}

/* ---------- 头部 ---------- */
.top{
  background:var(--paper);
  border-bottom:2px solid var(--ink);
}

.top-bar{
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:10px 18px;
  padding:8px 18px;
}

.brand{
  display:inline-flex;
  align-items:center;
  gap:10px;
  min-height:44px;
  padding:6px 4px;
  text-decoration:none;
  color:var(--ink);
  font-family:var(--head);
  font-weight:700;
  font-size:18px;
  letter-spacing:.01em;
}

.brand-mark{
  position:relative;
  flex:none;
  width:22px;
  height:22px;
  border:2px solid var(--ink);
  border-radius:7px 3px 8px 4px;
  transform:rotate(-4deg);
}

.brand-mark::after{
  content:"";
  position:absolute;
  left:3px;
  right:3px;
  top:9px;
  height:2px;
  background:var(--ink);
  transform:rotate(7deg);
}

.rail{
  flex:1 1 320px;
  min-width:0;
}

.rail p{
  display:flex;
  flex-wrap:wrap;
  gap:2px 3px;
  margin:0;
}

.rail a{
  display:inline-flex;
  align-items:center;
  gap:7px;
  min-height:44px;
  padding:9px 10px;
  font-family:var(--mono);
  font-size:16px;
  color:var(--gray);
  text-decoration:none;
  border-radius:var(--hand);
  transition:color 90ms linear, background-color 90ms linear, transform 90ms steps(2);
}

.rail a::before{
  content:"";
  flex:none;
  width:9px;
  height:9px;
  border:1.5px solid currentColor;
  border-radius:3px 1px 3px 1px;
  transform:rotate(-9deg);
}

.rail a:hover,
.rail a:focus-visible{
  color:var(--ink);
  background:var(--soft);
  transform:rotate(-1.2deg);
  outline:none;
}

.tape{
  position:sticky;
  top:0;
  z-index:20;
  background:rgba(250,250,248,.97);
  border-top:1px dashed var(--line);
}

.subnav p{
  display:flex;
  margin:0;
  padding:3px 12px;
  overflow-x:auto;
  scrollbar-width:thin;
}

.subnav a{
  flex:none;
  display:inline-flex;
  align-items:center;
  min-height:44px;
  padding:10px 12px;
  font-size:16px;
  color:var(--gray);
  text-decoration:none;
  white-space:nowrap;
}

.subnav a:hover,
.subnav a:focus-visible{
  color:var(--ink);
  background:var(--soft);
  outline:none;
}

/* ---------- 首屏 ---------- */
.hero{
  display:grid;
  grid-template-columns:minmax(0,1.06fr) minmax(0,1fr);
  min-height:70vh;
  border-bottom:2px solid var(--ink);
}

.hero-art{
  position:relative;
  overflow:hidden;
  display:flex;
  background:var(--soft);
  border-right:2px solid var(--ink);
}

.hero-art .shot{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  object-fit:cover;
  opacity:0;
  filter:grayscale(.14) contrast(1.05);
  animation:cycle 21s linear infinite;
}

.hero-art .shot:first-child{opacity:1}
.hero-art .shot:nth-child(2){animation-delay:-7s}
.hero-art .shot:nth-child(3){animation-delay:-14s}
.hero-art .shot:only-child{animation:none;opacity:1}

@keyframes cycle{
  0%{opacity:1}
  28%{opacity:1}
  33%{opacity:0}
  95%{opacity:0}
  100%{opacity:1}
}

.doodle{
  flex:1;
  background-image:
    repeating-linear-gradient(48deg, transparent 0 24px, rgba(26,26,26,.10) 24px 25px),
    repeating-linear-gradient(-48deg, transparent 0 24px, rgba(26,26,26,.07) 24px 25px);
}

.stamp{
  position:absolute;
  left:16px;
  bottom:18px;
  z-index:3;
  padding:8px 12px;
  background:var(--ink);
  color:var(--paper);
  font-family:var(--mono);
  font-size:16px;
  border-radius:5px 3px 5px 3px;
  transform:rotate(-2.5deg);
}

.hero-copy{
  align-self:center;
  display:flex;
  flex-direction:column;
  align-items:flex-end;
  gap:14px;
  padding:52px 34px;
  text-align:right;
}

.hero-copy h1{
  margin:0;
  font-family:var(--head);
  font-size:clamp(30px,5vw,52px);
  line-height:1.14;
  letter-spacing:-.01em;
}

.hero-copy h1 span{
  background:linear-gradient(transparent 64%, #e5e2d9 64% 92%, transparent 92%);
  padding:0 2px;
}

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

/* ---------- 主体 ---------- */
.wrap{
  display:grid;
  grid-template-columns:minmax(0,1fr) 246px;
  gap:26px;
  align-items:start;
  max-width:1180px;
  margin:0 auto;
  padding:30px 18px 56px;
}

.sheet{min-width:0}

.prose{max-width:70ch}

.prose section[id]{
  scroll-margin-top:104px;
  padding-bottom:28px;
  margin-bottom:32px;
  border-bottom:1px dashed var(--line);
}

.prose section[id]:last-child{
  border-bottom:0;
  margin-bottom:0;
  padding-bottom:0;
}

.prose h2{
  margin:0 0 14px;
  font-family:var(--head);
  font-size:clamp(24px,3.2vw,32px);
  line-height:1.24;
  letter-spacing:-.01em;
}

.prose h2 span{
  border-bottom:3px solid var(--ink);
  padding-bottom:2px;
  display:inline-block;
  transform:rotate(-.3deg);
}

.prose h3{
  margin:26px 0 10px;
  font-family:var(--head);
  font-size:20px;
  line-height:1.35;
}

.prose h3 span{
  border-bottom:1px solid var(--gray);
  padding-bottom:1px;
}

.prose p{margin:0 0 16px}

.prose a{
  color:var(--ink);
  text-decoration:underline;
  text-decoration-style:wavy;
  text-decoration-thickness:1px;
  text-underline-offset:3px;
}

.prose ul,
.prose ol{
  margin:0 0 18px;
  padding-left:1.35em;
}

.prose li{margin:0 0 8px}

.prose blockquote{
  margin:0 0 18px;
  padding:12px 16px;
  border-left:4px solid var(--ink);
  background:var(--soft);
  border-radius:var(--hand);
}

.prose blockquote p:last-child{margin:0}

.prose img{
  max-width:100%;
  height:auto;
  border:2px solid var(--ink);
  border-radius:var(--hand);
  transform:rotate(-.4deg);
}

.prose strong{font-weight:600}

.prose code,
.prose pre{
  font-family:var(--mono);
  font-size:15px;
}

.prose pre{
  overflow-x:auto;
  padding:14px;
  background:var(--soft);
  border-radius:var(--hand);
}

.reveal-ready .prose section[id]{
  opacity:.001;
  transform:translateY(7px) rotate(.15deg);
}

.reveal-ready .prose section[id].inked{
  opacity:1;
  transform:none;
  transition:opacity 180ms steps(2), transform 180ms steps(2);
}

/* ---------- 侧栏 ---------- */
.side{
  position:sticky;
  top:66px;
  padding:14px 14px 10px;
  background:#fffefb;
  border:2px solid var(--ink);
  border-radius:var(--hand);
  transform:rotate(.5deg);
}

.side-h{
  margin:0 0 10px;
  font-family:var(--mono);
  font-size:16px;
  letter-spacing:.12em;
}

.side-h span{
  border-bottom:2px solid var(--ink);
  padding-bottom:2px;
}

.toc{display:flex; flex-direction:column}

.toc-a{
  display:flex;
  align-items:center;
  min-height:42px;
  padding:8px 4px;
  font-size:16px;
  color:var(--gray);
  text-decoration:none;
  border-bottom:1px dotted var(--line);
}

.toc-a:last-child{border-bottom:0}

.toc-a:hover,
.toc-a:focus-visible{
  color:var(--ink);
  background:var(--soft);
  outline:none;
}

.side-back{
  margin:12px 0 4px;
  font-family:var(--mono);
  font-size:16px;
  font-weight:500;
}

.side-back span{border-bottom:1px dashed var(--gray)}

.side-back a{
  display:inline-flex;
  align-items:center;
  min-height:40px;
  text-decoration:none;
  color:var(--gray);
}

.side-back a:hover{color:var(--ink)}

/* ---------- 页脚 ---------- */
.foot{
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:10px 16px;
  max-width:1180px;
  margin:0 auto;
  padding:16px 18px 26px;
  border-top:2px solid var(--ink);
}

.foot-brand{flex:none}

.foot-nav{
  flex:1 1 260px;
  min-width:0;
}

.foot-nav p{
  display:flex;
  flex-wrap:wrap;
  gap:0 2px;
  margin:0;
}

.foot-nav a{
  display:inline-flex;
  align-items:center;
  min-height:42px;
  padding:9px 8px;
  font-size:16px;
  color:var(--gray);
  text-decoration:none;
}

.foot-nav a:hover,
.foot-nav a:focus-visible{
  color:var(--ink);
  background:var(--soft);
  outline:none;
}

.foot-legal{
  margin-left:auto;
  text-align:center;
}

.foot-legal p{
  margin:0;
  font-family:var(--mono);
  font-size:16px;
  color:var(--gray);
}

/* ---------- 窄屏 ---------- */
@media (max-width:900px){
  .hero{
    grid-template-columns:1fr;
    min-height:0;
  }

  .hero-art{
    height:clamp(170px,32vh,320px);
    border-right:0;
    border-bottom:2px solid var(--ink);
  }

  .hero-copy{
    align-items:flex-start;
    text-align:left;
    padding:26px 18px 30px;
  }

  .lede{max-width:none}

  .wrap{
    grid-template-columns:1fr;
    gap:22px;
    padding:22px 18px 44px;
  }

  .side{
    position:static;
    transform:none;
    order:2;
  }

  .rail{flex:1 1 100%}

  .rail p,
  .subnav p{
    flex-wrap:nowrap;
    overflow-x:auto;
  }

  .rail a{flex:none; white-space:nowrap}

  .foot-legal{
    flex:1 1 100%;
    margin-left:0;
    padding-top:10px;
    border-top:1px dashed var(--line);
  }
}

@media (max-width:420px){
  body{font-size:16px}
  .hero-copy h1{font-size:29px}
  .prose h2{font-size:23px}
  .stamp{font-size:15px; padding:7px 10px}
}

@media (prefers-reduced-motion:reduce){
  html{scroll-behavior:auto}
  *{animation:none !important; transition:none !important}
  .hero-art .shot{opacity:0}
  .hero-art .shot:first-child{opacity:1}
  .reveal-ready .prose section[id]{opacity:1; transform:none}
}

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