@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@300;400;500;600;700&family=Share+Tech+Mono&display=swap');

:root {
  --paper: #fafaf8;
  --mid: #4a4a4a;
  --ink: #1a1a1a;
  --line: rgba(26, 26, 26, .28);
  color-scheme: light;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  padding-bottom: 180px;
  overflow-x: hidden;
  background-color: var(--paper);
  background-image:
    repeating-linear-gradient(0deg, rgba(26, 26, 26, .028) 0 1px, transparent 1px 3px),
    radial-gradient(rgba(26, 26, 26, .055) 1px, transparent 1px),
    radial-gradient(rgba(74, 74, 74, .045) 1px, transparent 1px);
  background-size: auto, 13px 13px, 29px 29px;
  background-position: 0 0, 3px 5px, 17px 9px;
  color: var(--ink);
  font-family: 'Fira Code', 'Share Tech Mono', ui-monospace, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", monospace;
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

/* ---------- 底部固定条 ---------- */
.dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  padding: 8px 10px calc(9px + env(safe-area-inset-bottom, 0px));
  background: var(--paper);
  border-top: 3px solid var(--ink);
  box-shadow: 0 -7px 0 rgba(26, 26, 26, .07);
}
.dock::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 4px;
  height: 0;
  border-top: 2px dashed var(--line);
  pointer-events: none;
}

.find {
  display: flex;
  gap: 6px;
  align-items: center;
  max-width: 480px;
  margin: 2px auto 7px;
}
.find-in {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 40px;
  padding: 0 12px;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 14px 10px 16px 12px;
}
.find-in::placeholder { color: var(--mid); }
.find-in:focus { outline: 2px dashed var(--mid); outline-offset: 2px; }
.find-btn {
  flex: 0 0 auto;
  min-height: 40px;
  min-width: 46px;
  font: inherit;
  font-size: 16px;
  color: var(--paper);
  background: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 10px 16px 10px 16px;
  cursor: pointer;
}
.find-btn:hover { background: var(--mid); }

.dock-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: space-between;
}
.dock-side {
  display: flex;
  flex: 1 1 0;
  flex-wrap: wrap;
  justify-content: space-evenly;
  gap: 0 2px;
  margin: 0;
}
.dock-side a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 4px 6px;
  font-size: 16px;
  line-height: 1.35;
  color: var(--mid);
  text-decoration: none;
  border-bottom: 2px dashed transparent;
}
.dock-side a:hover,
.dock-side a:focus-visible {
  color: var(--ink);
  border-bottom-color: var(--ink);
}
.dock-brand {
  flex: 0 0 auto;
  padding: 7px 11px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
  text-decoration: none;
  color: var(--ink);
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 12px 20px 12px 20px;
  transform: rotate(-1.8deg);
  box-shadow: 3px 3px 0 rgba(26, 26, 26, .12);
}

/* ---------- 头图 ---------- */
.deck { display: block; }

.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
  padding: 66px 20px 34px;
  text-align: center;
}
.hero h1 {
  margin: 0 0 22px;
  font-size: clamp(2rem, 9.5vw, 4.5rem);
  line-height: 1.1;
  letter-spacing: .01em;
  word-break: break-word;
}
.hero h1::after {
  content: "";
  display: block;
  width: 74%;
  height: 0;
  margin: 18px auto 0;
  border-bottom: 4px dashed var(--ink);
  transform: rotate(-.7deg);
  opacity: .75;
}
.lede {
  max-width: 44ch;
  margin: 0;
  color: var(--mid);
  font-size: 16px;
  line-height: 1.7;
}
.scribble {
  width: min(320px, 74vw);
  margin: 30px 0 0;
}
.scribble svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.scribble path {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.4;
  stroke-linecap: round;
  opacity: .5;
  stroke-dasharray: 460;
  stroke-dashoffset: 460;
  animation: scribble-draw 1.3s steps(16) forwards;
}
.scribble path:nth-child(2) { animation-delay: .16s; }
.scribble path:nth-child(3) { animation-delay: .32s; }
@keyframes scribble-draw {
  to { stroke-dashoffset: 0; }
}

/* ---------- 主体骨架 ---------- */
.shell {
  display: grid;
  grid-template-columns: 226px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  max-width: 1080px;
  margin: 0 auto;
  padding: 8px 18px 0;
}

.rail {
  position: sticky;
  top: 18px;
  padding: 14px 14px 20px;
  background: #fff;
  border: 2px solid var(--ink);
  border-bottom: 6px solid var(--ink);
  border-radius: 20px 26px 18px 24px;
  transform: rotate(-.7deg);
  box-shadow: 4px 5px 0 rgba(26, 26, 26, .09);
}
.rail small {
  display: block;
  font-size: 12px;
  letter-spacing: .26em;
  color: var(--mid);
}
.rail h2 {
  margin: 2px 0 10px;
  padding-bottom: 7px;
  font-size: 17px;
  line-height: 1.4;
  border-bottom: 2px dashed var(--ink);
}
.rail ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1px;
}
.rail a {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 5px 3px;
  font-size: 16px;
  line-height: 1.4;
  color: var(--mid);
  text-decoration: none;
  border-bottom: 1px dotted rgba(74, 74, 74, .45);
}
.rail a:hover,
.rail a:focus-visible {
  color: var(--ink);
  background: rgba(26, 26, 26, .05);
}

.content { min-width: 0; }

/* ---------- 正文卡片 ---------- */
.content > section {
  --rot: -.35deg;
  position: relative;
  margin: 0 0 30px;
  padding: 26px 22px 30px;
  background: #fff;
  border: 2px solid var(--ink);
  border-bottom: 8px solid var(--ink);
  border-radius: 28px 24px 28px 22px;
  box-shadow: 5px 6px 0 rgba(26, 26, 26, .08);
  transform: rotate(var(--rot));
  scroll-margin-top: 26px;
}
.content > section:nth-child(even) { --rot: .3deg; }
.content > section::before {
  content: "";
  position: absolute;
  top: -12px;
  left: 50%;
  width: 76px;
  height: 21px;
  margin-left: -38px;
  background: rgba(74, 74, 74, .15);
  border-left: 1px dashed rgba(26, 26, 26, .3);
  border-right: 1px dashed rgba(26, 26, 26, .3);
  transform: rotate(-2.4deg);
  pointer-events: none;
}
.content > section:target {
  box-shadow: 0 0 0 3px rgba(74, 74, 74, .3), 5px 6px 0 rgba(26, 26, 26, .08);
}
.content > section.hit { animation: hit-pulse .7s steps(4) 1; }
@keyframes hit-pulse {
  0% { background: #f1f1ec; }
  100% { background: #fff; }
}

.content h2 {
  margin: .1em 0 .65em;
  padding-bottom: .26em;
  font-size: 23px;
  line-height: 1.35;
  border-bottom: 3px solid var(--ink);
}
.content h3 {
  margin: 1.4em 0 .5em;
  font-size: 18px;
  line-height: 1.4;
}
.content h3::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border: 2px solid var(--ink);
  transform: rotate(12deg);
  vertical-align: 1px;
}
.content ul,
.content ol { padding-left: 1.3em; }
.content li { margin-bottom: .35em; }
.content a {
  color: var(--ink);
  text-decoration: underline wavy var(--mid);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.content blockquote {
  margin: 1.2em 0;
  padding: 10px 14px;
  color: var(--mid);
  background: rgba(74, 74, 74, .07);
  border-left: 5px solid var(--ink);
  border-radius: 0 14px 14px 0;
}
.content img {
  max-width: 100%;
  height: auto;
  border-radius: 18px;
  border: 2px solid var(--ink);
}
.content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
.content th,
.content td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px dashed var(--line);
}
.content hr {
  height: 0;
  margin: 1.6em 0;
  border: 0;
  border-top: 2px dashed var(--line);
}
.content code {
  padding: 1px 5px;
  background: rgba(26, 26, 26, .07);
  border-radius: 5px;
}

/* ---------- 页脚 ---------- */
.foot {
  max-width: 1080px;
  margin: 26px auto 0;
  padding: 30px 20px 26px;
  background: #fff;
  border-top: 3px solid var(--ink);
  border-bottom: 1px solid var(--line);
  box-shadow: inset 0 9px 0 -6px rgba(26, 26, 26, .1);
}
.foot-cols {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 30px;
  align-items: start;
}
.foot-id {
  font-style: normal;
  padding-left: 13px;
  border-left: 7px solid var(--ink);
}
.foot-id strong {
  display: block;
  margin-bottom: 6px;
  font-size: 18px;
  letter-spacing: .02em;
  transform: rotate(-.5deg);
  transform-origin: left center;
}
.foot-id span {
  display: block;
  color: var(--mid);
  font-size: 16px;
  line-height: 1.7;
}
.foot-links small {
  display: block;
  font-size: 12px;
  letter-spacing: .26em;
  color: var(--mid);
}
.foot-links h2 {
  margin: 2px 0 10px;
  padding-bottom: 6px;
  font-size: 17px;
  line-height: 1.4;
  border-bottom: 2px dashed var(--ink);
}
.foot-links ul {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 12px;
  margin: 0;
  padding: 0;
}
.foot-links a {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 4px 2px;
  font-size: 16px;
  color: var(--mid);
  text-decoration: none;
  border-bottom: 1px dotted rgba(74, 74, 74, .4);
}
.foot-links a:hover,
.foot-links a:focus-visible { color: var(--ink); }
.copy {
  margin: 24px 0 0;
  padding-top: 12px;
  text-align: center;
  color: var(--mid);
  font-size: 15px;
  border-top: 2px dashed rgba(26, 26, 26, .3);
}

/* ---------- 进场 ---------- */
.js .content > section {
  opacity: 0;
  transform: translateY(18px) rotate(var(--rot));
  transition: opacity .38s steps(4) , transform .38s steps(4);
}
.js .content > section.in {
  opacity: 1;
  transform: translateY(0) rotate(var(--rot));
}
.js .rail li {
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity .3s steps(3), transform .3s steps(3);
}
.js .rail li.in {
  opacity: 1;
  transform: translateX(0);
}

/* ---------- 窄屏 ---------- */
@media (max-width: 820px) {
  body { padding-bottom: 236px; }

  .dock-side a { font-size: 16px; padding: 4px 5px; }
  .dock-brand { font-size: 16px; padding: 6px 9px; }

  .hero { min-height: 62vh; padding-top: 52px; }
  .lede { font-size: 16px; }

  .shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    padding: 6px 14px 0;
  }
  .rail {
    position: static;
    transform: rotate(-.5deg);
    padding: 12px 12px 14px;
  }
  .rail ul {
    grid-template-columns: 1fr 1fr;
    gap: 0 10px;
  }
  .content > section {
    padding: 22px 16px 26px;
    border-radius: 24px 20px 24px 18px;
  }
  .content h2 { font-size: 21px; }

  .foot { padding: 24px 16px 22px; }
  .foot-cols { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .foot-links ul { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 380px) {
  .rail ul { grid-template-columns: minmax(0, 1fr); }
  .dock-side a { padding: 4px 4px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .content > section,
  .js .rail li {
    opacity: 1;
    transition: none;
  }
  .js .content > section { transform: rotate(var(--rot)); }
  .js .rail li { transform: none; }
  .scribble path {
    animation: none;
    stroke-dashoffset: 0;
  }
  .content > section.hit { animation: none; }
}

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