@import url('https://fonts.googleapis.com/css2?family=Karla:wght@300;400;500;600;700&family=Playfair+Display+SC:wght@400;700&display=swap');

:root {
  --paper: #fafaf8;
  --ink: #1a1a1a;
  --soft: #4a4a4a;
  --line: #cecbc3;
  --faint: #eceae3;
  --bar: 64px;
  --shadow: 0 14px 26px -18px rgba(26, 26, 26, 0.6);
  --title: 'Playfair Display SC', 'Songti SC', Georgia, serif;
  --body: 'Karla', system-ui, -apple-system, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', 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: 400 17px/1.65 var(--body);
  letter-spacing: 0.005em;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.78' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.3'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  background-attachment: scroll;
}

img {
  max-width: 100%;
  height: auto;
}

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

a:hover {
  text-decoration-style: solid;
}

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

/* 顶栏 */
.bar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--bar);
  padding: 0 16px;
  background-color: var(--paper);
  border-bottom: 2px dashed var(--line);
}

.mark,
.foot-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  text-decoration: none;
  border: 2px solid var(--ink);
  border-radius: 3px;
  transform: rotate(-3deg);
  background-color: var(--paper);
  overflow: hidden;
}

.mark-img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.mark-txt {
  font-family: var(--title);
  font-size: 20px;
  line-height: 1;
}

.find {
  flex: 1 1 auto;
  min-width: 0;
  transform: rotate(-0.35deg);
}

.find input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  font: 400 16px/1.4 var(--body);
  color: var(--ink);
  background-color: transparent;
  border: 2px solid var(--soft);
  border-radius: 2px;
}

.find input::placeholder {
  color: var(--soft);
  letter-spacing: 0.12em;
}

.burger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 12px;
  font: 500 16px/1 var(--body);
  color: var(--ink);
  background-color: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 2px;
  cursor: pointer;
  transform: rotate(1deg);
}

.burger-i {
  display: block;
  width: 18px;
  height: 2px;
  background-color: var(--ink);
  box-shadow: 0 -6px 0 var(--ink), 0 6px 0 var(--ink);
}

/* 全屏遮罩菜单 */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 72px 20px 32px;
  background-color: var(--paper);
  background-image: radial-gradient(var(--line) 1px, transparent 1px);
  background-size: 20px 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s linear, visibility 0.22s linear;
  overflow-y: auto;
}

.sheet-open .sheet {
  opacity: 1;
  visibility: visible;
}

.sheet-nav {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: min(520px, 100%);
}

.sheet-link {
  display: block;
  width: 100%;
  padding: 12px 6px;
  font-family: var(--title);
  font-size: clamp(22px, 5vw, 34px);
  line-height: 1.2;
  text-decoration: none;
  border-bottom: 2px dashed var(--line);
}

.sheet-link:nth-child(odd) {
  transform: rotate(-0.6deg);
}

.sheet-link:nth-child(even) {
  transform: rotate(0.5deg);
}

/* 首屏 */
.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-end;
  text-align: right;
  min-height: calc(100vh - var(--bar));
  padding: 40px clamp(18px, 6vw, 72px) 56px;
  background-image: radial-gradient(var(--line) 1px, transparent 1px);
  background-size: 22px 22px;
  overflow: hidden;
}

.scribble {
  position: absolute;
  left: clamp(10px, 6vw, 64px);
  top: 12%;
  width: clamp(180px, 40vw, 380px);
  fill: none;
  stroke: var(--soft);
  stroke-width: 2.4;
  stroke-linecap: round;
  opacity: 0.55;
  will-change: transform;
}

.hero-h1 {
  position: relative;
  margin: 0 0 22px;
  max-width: 15ch;
  font-family: var(--title);
  font-weight: 700;
  font-size: clamp(38px, 8.6vw, 112px);
  line-height: 0.98;
  letter-spacing: 0.01em;
  text-shadow: 3px 3px 0 var(--faint);
  transform: rotate(-0.9deg);
}

.hero-jump {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 20px;
  font-size: 16px;
  letter-spacing: 0.2em;
  text-decoration: none;
  border: 2px dashed var(--soft);
  border-radius: 2px;
  transform: rotate(1.4deg);
  background-color: var(--paper);
}

/* 粘性锚点条 */
.rail-wrap {
  position: sticky;
  top: var(--bar);
  z-index: 45;
  background-color: var(--paper);
  border-top: 2px dashed var(--line);
  border-bottom: 2px dashed var(--line);
}

.rail {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.rail::-webkit-scrollbar {
  display: none;
}

.rail-list {
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rail-list li.off {
  opacity: 0.28;
}

.rail-list a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  font-size: 16px;
  white-space: nowrap;
  text-decoration: none;
  border-bottom: 3px solid transparent;
}

.rail-list a:hover {
  border-bottom-color: var(--ink);
}

/* 版心：左栏 + 正文 */
main {
  display: block;
}

.spread {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 34px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 44px 18px 8px;
  align-items: start;
}

.margin {
  position: sticky;
  top: calc(var(--bar) + 54px);
  padding: 16px 14px;
  border: 2px dashed var(--line);
  border-radius: 16px;
  background-color: var(--paper);
  transform: rotate(-0.7deg);
}

.margin-h {
  margin: 0;
  font-family: var(--title);
  font-size: 21px;
  line-height: 1.25;
  font-weight: 700;
}

.subtitle {
  margin: 6px 0 14px;
  font-size: 16px;
  font-style: italic;
  color: var(--soft);
  line-height: 1.5;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 4px;
}

.margin-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.margin-list a {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 4px 0;
  font-size: 16px;
  text-decoration: none;
  border-bottom: 1px dashed var(--line);
}

.margin-list li:last-child a {
  border-bottom: 0;
}

/* 正文 */
.prose {
  min-width: 0;
  padding-bottom: 40px;
}

.prose > section {
  --rot: 0deg;
  position: relative;
  margin: 0 0 30px;
  padding: clamp(18px, 2.6vw, 32px);
  background-color: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.prose > section:nth-child(3n + 1) {
  --rot: -0.5deg;
}

.prose > section:nth-child(3n + 2) {
  --rot: 0.45deg;
}

.prose > section:nth-child(3n + 3) {
  --rot: -0.2deg;
}

.prose > section::before {
  content: "";
  position: absolute;
  top: -11px;
  left: 26px;
  width: 68px;
  height: 20px;
  background-color: rgba(74, 74, 74, 0.14);
  border-left: 1px dashed var(--soft);
  border-right: 1px dashed var(--soft);
  transform: rotate(-2deg);
  pointer-events: none;
}

.prose > div[id] {
  scroll-margin-top: calc(var(--bar) + 70px);
}

.prose h2 {
  margin: 0 0 8px;
  font-family: var(--title);
  font-weight: 700;
  font-size: clamp(23px, 3vw, 32px);
  line-height: 1.25;
  letter-spacing: 0.01em;
}

.prose h3 {
  margin: 1.4em 0 0.4em;
  font-family: var(--title);
  font-size: clamp(19px, 2.2vw, 23px);
  line-height: 1.3;
}

.prose p {
  margin: 0.75em 0;
  max-width: 66ch;
}

.prose p.subtitle {
  margin: 0 0 1em;
}

.prose ul,
.prose ol {
  margin: 0.8em 0;
  padding-left: 1.3em;
}

.prose li {
  margin: 0.35em 0;
}

.prose blockquote {
  margin: 1em 0;
  padding: 4px 0 4px 16px;
  border-left: 3px dashed var(--soft);
  color: var(--soft);
}

.prose figure {
  margin: 1.2em 0;
}

.prose figcaption {
  font-size: 16px;
  color: var(--soft);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
}

.prose th,
.prose td {
  padding: 8px;
  border: 1px dashed var(--line);
  text-align: left;
}

.prose code {
  padding: 1px 5px;
  background-color: var(--faint);
  border-radius: 3px;
  font-size: 16px;
}

.prose strong {
  font-weight: 700;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 4px;
}

/* 页脚 */
.foot {
  margin-top: 40px;
  padding: 0 18px 22px;
  border-top: 2px dashed var(--line);
}

.foot-cta {
  max-width: 1140px;
  margin: 0 auto;
  padding: 46px 0 34px;
  border-bottom: 2px solid var(--ink);
}

.cta-h {
  margin: 0;
  font-family: var(--title);
  font-weight: 700;
  font-size: clamp(30px, 6vw, 64px);
  line-height: 1.05;
  transform: rotate(-0.7deg);
  text-shadow: 3px 3px 0 var(--faint);
}

.foot-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  max-width: 1140px;
  margin: 18px auto 0;
}

.foot-nav dl {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 14px;
  margin: 0;
}

.foot-nav dt {
  font-size: 16px;
  letter-spacing: 0.16em;
  color: var(--soft);
}

.foot-nav dd {
  margin: 0;
}

.foot-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 2px;
  font-size: 16px;
  text-decoration: none;
  border-bottom: 1px dashed var(--line);
}

.copy {
  margin: 0;
  font-size: 16px;
  color: var(--soft);
}

/* 滚动出现 */
.anim .prose > div,
.anim .foot-cta,
.anim .margin {
  opacity: 0;
  transform: translateY(14px) rotate(var(--rot, 0deg));
  transition: opacity 0.26s steps(4), transform 0.26s ease-out;
}

.anim .prose > div.in,
.anim .foot-cta.in,
.anim .margin.in {
  opacity: 1;
  transform: translateY(0) rotate(var(--rot, 0deg));
}

.anim .foot-cta,
.anim .margin {
  --rot: -0.7deg;
}

@media (max-width: 900px) {
  .spread {
    grid-template-columns: minmax(0, 1fr);
    gap: 22px;
    padding-top: 26px;
  }

  .margin {
    position: static;
    transform: rotate(-0.5deg);
  }

  .margin-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 16px;
  }

  .margin-list li:last-child a {
    border-bottom: 1px dashed var(--line);
  }
}

@media (max-width: 520px) {
  body {
    font-size: 17px;
  }

  .bar {
    gap: 8px;
    padding: 0 10px;
  }

  .burger-t {
    display: none;
  }

  .burger {
    width: 44px;
    justify-content: center;
    padding: 0;
  }

  .hero {
    align-items: flex-start;
    text-align: left;
    padding: 60px 16px 44px;
  }

  .hero-h1 {
    max-width: 100%;
    transform: rotate(-0.6deg);
  }

  .scribble {
    top: 8%;
    left: auto;
    right: 10px;
    width: 190px;
    opacity: 0.4;
  }

  .foot-nav dl {
    gap: 0 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .anim .prose > div,
  .anim .foot-cta,
  .anim .margin {
    transition: none;
  }

  .scribble {
    transform: none !important;
  }
}

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