html {
  font-size: 17px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

:root {
  --paper: #fafaf8;
  --gray: #4a4a4a;
  --ink: #1a1a1a;
  --hair: rgba(26, 26, 26, 0.2);
  --faint: rgba(26, 26, 26, 0.12);
  --soft: rgba(74, 74, 74, 0.1);
  --tape: rgba(74, 74, 74, 0.14);
  --title: 'Amatic SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --body: 'Cabin', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --stick: 172px;
}

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

body {
  margin: 0;
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.75;
  color: var(--ink);
  background-color: var(--paper);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.07'/%3E%3C/svg%3E");
  overflow-x: hidden;
}

a {
  color: var(--ink);
}

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

/* ---------- 页头：两行，品牌独占一行 ---------- */

.masthead {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: 12px 20px 10px;
  background: var(--paper);
  border-bottom: 1.5px dashed var(--hair);
}

.masthead > * {
  max-width: 1080px;
  margin-left: auto;
  margin-right: auto;
}

.brandline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  font-family: var(--title);
  font-weight: 700;
  font-size: clamp(1.9rem, 6vw, 2.7rem);
  line-height: 1;
  letter-spacing: 0.07em;
  color: var(--ink);
  text-decoration: none;
  padding-bottom: 4px;
  border-bottom: 2.5px solid var(--ink);
  transform: rotate(-0.6deg);
  display: inline-block;
}

.brand:hover {
  transform: rotate(0.8deg);
}

.blot {
  width: 14px;
  height: 14px;
  margin-right: 4px;
  border: 2px solid var(--gray);
  border-radius: 60% 40% 55% 45%;
  transform: rotate(12deg);
  opacity: 0.7;
}

.navline {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.pills ul {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 5px 15px;
  font-size: 0.95rem;
  line-height: 1.2;
  color: var(--gray);
  text-decoration: none;
  border: 1.5px solid var(--hair);
  border-radius: 999px;
  transition: color 0.08s linear, background-color 0.08s linear, border-color 0.08s linear,
    transform 0.08s linear;
}

.pills li:nth-child(3n) .pill {
  transform: rotate(-1.2deg);
}

.pills li:nth-child(4n) .pill {
  transform: rotate(0.9deg);
}

.pill:hover,
.pill:focus-visible {
  color: var(--paper);
  background: var(--ink);
  border-color: var(--ink);
  transform: rotate(-1.6deg);
}

.pills li.muted,
.toc li.muted {
  opacity: 0.26;
}

.finder {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.finder-label {
  font-size: 0.94rem;
  letter-spacing: 0.16em;
  color: var(--gray);
}

.finder input {
  height: 40px;
  width: 150px;
  padding: 0 15px;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  background: transparent;
  border: 1.5px solid var(--hair);
  border-radius: 999px;
}

.finder input:focus {
  outline: 2px dashed var(--gray);
  outline-offset: 2px;
}

/* ---------- 主区 ---------- */

.stack {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 14px;
  min-height: 70vh;
  padding: 44px 0 44px;
  text-align: right;
}

.hero h1 {
  margin: 0;
  max-width: 22ch;
  font-family: var(--title);
  font-weight: 700;
  font-size: clamp(2.5rem, 10.5vw, 5.4rem);
  line-height: 1.02;
  letter-spacing: 0.02em;
}

.hero .subtitle {
  margin: 0;
  max-width: 34ch;
  font-size: 1.02rem;
  color: var(--gray);
}

.scrawl {
  margin: 6px 0 0;
  color: var(--gray);
  opacity: 0.7;
}

.scrawl svg {
  display: block;
  width: min(240px, 62vw);
  height: auto;
}

.columns {
  display: grid;
  grid-template-columns: 198px minmax(0, 1fr);
  gap: 42px;
  align-items: start;
  padding: 34px 0 64px;
}

/* ---------- 侧栏 ---------- */

.toc {
  position: sticky;
  top: var(--stick);
  padding: 16px 14px 18px;
  background: rgba(255, 255, 255, 0.55);
  border: 1.5px solid var(--hair);
  border-radius: 18px 8px 20px 10px;
  transform: rotate(-0.5deg);
}

.toc::before {
  content: "";
  position: absolute;
  top: -9px;
  left: 26px;
  width: 62px;
  height: 17px;
  background: var(--tape);
  border-radius: 2px;
  transform: rotate(-2.5deg);
}

.toc h2 {
  margin: 0 0 2px;
  font-family: var(--title);
  font-weight: 700;
  font-size: 1.75rem;
  line-height: 1.1;
  letter-spacing: 0.08em;
}

.toc .subtitle {
  margin: 0 0 12px;
  font-size: 0.94rem;
  letter-spacing: 0.14em;
  color: var(--gray);
}

.toc ul {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.toc li {
  animation: slip 0.3s steps(3, end) both;
}

.toc li:nth-child(2) { animation-delay: 0.04s; }
.toc li:nth-child(3) { animation-delay: 0.08s; }
.toc li:nth-child(4) { animation-delay: 0.12s; }
.toc li:nth-child(5) { animation-delay: 0.16s; }
.toc li:nth-child(6) { animation-delay: 0.2s; }
.toc li:nth-child(7) { animation-delay: 0.24s; }

@keyframes slip {
  from {
    opacity: 0;
    transform: translateX(-6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.toc-link {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 4px 6px;
  font-size: 0.95rem;
  color: var(--gray);
  text-decoration: none;
  border-bottom: 1px dotted var(--faint);
  transition: color 0.08s linear, background-color 0.08s linear;
}

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

/* ---------- 正文 ---------- */

.prose {
  max-width: 68ch;
  font-size: 1.02rem;
}

.prose article {
  padding: 34px 0;
  border-top: 1.5px dashed var(--hair);
  scroll-margin-top: var(--stick);
}

.prose article:first-child {
  padding-top: 0;
  border-top: 0;
}

.prose h2 {
  margin: 0 0 10px;
  font-family: var(--title);
  font-weight: 700;
  font-size: clamp(1.8rem, 4.8vw, 2.5rem);
  line-height: 1.15;
  letter-spacing: 0.03em;
}

.prose h3 {
  margin: 26px 0 8px;
  font-size: 1.16rem;
  letter-spacing: 0.02em;
}

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

.prose p.subtitle,
.prose p.subhead,
.prose p.desc,
.prose p.lead {
  color: var(--gray);
  font-size: 1.02rem;
}

.prose a {
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}

.prose a:hover {
  background: var(--soft);
}

.prose ul,
.prose ol {
  margin: 0 0 1em;
  padding-left: 1.25em;
}

.prose li {
  margin: 0.3em 0;
}

.prose strong {
  font-weight: 600;
  background-image: linear-gradient(var(--soft), var(--soft));
  background-repeat: no-repeat;
  background-size: 100% 0.4em;
  background-position: 0 88%;
}

.prose blockquote {
  margin: 1.2em 0;
  padding: 8px 18px;
  font-size: 1rem;
  color: var(--gray);
  border-left: 3px solid var(--gray);
  transform: rotate(-0.3deg);
}

.prose figure {
  margin: 1.2em 0;
}

.prose img {
  display: block;
  border: 1.5px solid var(--hair);
  border-radius: 18px;
  margin: 1em 0;
}

.prose hr {
  border: 0;
  border-top: 1.5px dashed var(--hair);
  margin: 1.6em 0;
}

.prose aside {
  margin: 1.2em 0;
  padding: 12px 16px;
  border: 1.5px dashed var(--hair);
  border-radius: 18px 8px 20px 10px;
}

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

.foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 18px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 22px 20px 44px;
  font-size: 0.94rem;
  color: var(--gray);
  border-top: 1.5px dashed var(--hair);
}

.foot-brand a {
  font-family: var(--title);
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: 0.06em;
  color: var(--ink);
  text-decoration: none;
}

.foot nav ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.foot-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 2px 3px;
  color: var(--gray);
  text-decoration: none;
  border-bottom: 1px dotted transparent;
  transition: color 0.08s linear, border-color 0.08s linear;
}

.foot-link:hover,
.foot-link:focus-visible {
  color: var(--ink);
  border-bottom-color: var(--gray);
}

.foot-copy {
  letter-spacing: 0.1em;
}

:focus-visible {
  outline: 2px dashed var(--gray);
  outline-offset: 2px;
}

/* ---------- 窄屏 ---------- */

@media (max-width: 760px) {
  .navline {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .pills ul {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }

  .pills li {
    flex: 0 0 auto;
  }

  .finder {
    margin-left: 0;
  }

  .finder-label {
    display: none;
  }

  .finder input {
    flex: 1 1 auto;
    width: auto;
  }

  .hero {
    min-height: 62vh;
    align-items: flex-end;
    padding: 32px 0 28px;
  }

  .hero .subtitle {
    max-width: 100%;
  }

  .columns {
    grid-template-columns: minmax(0, 1fr);
    gap: 26px;
    padding-top: 24px;
  }

  .toc {
    position: static;
    transform: none;
  }

  .toc ul {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
  }

  .toc-link {
    padding: 4px 10px;
    border: 1px dotted var(--hair);
    border-radius: 14px;
  }

  .prose article {
    scroll-margin-top: 210px;
  }
}

@media (max-width: 420px) {
  .brand {
    font-size: 1.9rem;
  }

  .foot {
    gap: 6px 14px;
  }
}

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