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

:root {
  --paper: #fafaf8;
  --ink: #1a1a1a;
  --mid: #4a4a4a;
  --soft: rgba(74, 74, 74, 0.1);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: 'DM Sans', system-ui, -apple-system, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: 16.5px;
  line-height: 1.7;
  color: var(--ink);
  background-color: var(--paper);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='170' height='170'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='170' height='170' filter='url(%23n)' opacity='0.32'/%3E%3C/svg%3E");
  background-size: 170px 170px;
  overflow-x: hidden;
}

img { max-width: 100%; }
h1, h2, h3 { font-weight: 700; }
a { color: var(--ink); }

/* ---- 顶栏 ---- */
.mast {
  position: sticky;
  top: -58px;
  z-index: 30;
  background: rgba(250, 250, 248, 0.96);
  border-bottom: 2px solid var(--ink);
}

.mast-bar {
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  border-bottom: 2px dashed rgba(26, 26, 26, 0.45);
}

.mark {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--ink);
}

.stamp {
  width: 15px;
  height: 15px;
  background: var(--ink);
  border-radius: 3px 9px 4px 8px;
  transform: rotate(11deg);
}

.say {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  font-size: 16px;
  font-weight: 500;
  text-decoration: none;
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 20px 12px 19px 10px;
  transform: rotate(-1deg);
}

.say:hover,
.say:focus-visible { background: var(--ink); color: var(--paper); }

/* ---- 锚点条 ---- */
.anchors {
  background: rgba(250, 250, 248, 0.96);
}

.anchors p {
  display: flex;
  gap: 2px;
  margin: 0;
  padding: 5px 10px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.anchors a {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  font-size: 16px;
  font-weight: 500;
  text-decoration: none;
  color: var(--ink);
  border-radius: 14px 8px 16px 6px;
  transform: rotate(-0.7deg);
}

.anchors a:nth-child(even) { transform: rotate(0.8deg); }
.anchors a:hover,
.anchors a:focus-visible { background: var(--ink); color: var(--paper); }

/* ---- 首屏 ---- */
.hero {
  min-height: 45vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 16px 0;
  text-align: right;
  background-image: radial-gradient(rgba(74, 74, 74, 0.3) 1px, transparent 1px);
  background-size: 15px 15px;
  background-position: 0 0;
}

.hero h1 {
  margin: 0;
  font-size: clamp(27px, 6.4vw, 52px);
  line-height: 1.16;
  letter-spacing: -0.035em;
  text-shadow: 2px 2px 0 rgba(250, 250, 248, 0.95);
}

.hero h1::after {
  content: "";
  display: block;
  width: min(210px, 54%);
  height: 8px;
  margin: 12px 0 0 auto;
  background: repeating-linear-gradient(90deg, var(--ink) 0 10px, transparent 10px 17px);
}

.plate-wrap {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

.plate {
  display: block;
  width: 100%;
  height: auto;
  border: 2px solid var(--ink);
  border-radius: 28px 20px 32px 16px;
  filter: grayscale(1) contrast(1.07);
  transform: rotate(-0.6deg);
}

/* ---- 版面 ---- */
.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 34px 16px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 264px;
  gap: 28px;
  align-items: start;
}

.sheet {
  position: relative;
  padding: clamp(16px, 3vw, 34px);
  background: rgba(250, 250, 248, 0.84);
  border: 2px solid var(--ink);
  border-radius: 28px 20px 30px 22px;
  box-shadow: 0 24px 44px -30px rgba(26, 26, 26, 0.9);
  transform: rotate(-0.25deg);
}

.sheet::before {
  content: "";
  position: absolute;
  top: -13px;
  left: 7%;
  width: 98px;
  height: 24px;
  background: rgba(74, 74, 74, 0.16);
  border-left: 2px dashed rgba(26, 26, 26, 0.3);
  border-right: 2px dashed rgba(26, 26, 26, 0.3);
  transform: rotate(-2.6deg);
}

.prose {
  font-size: 17px;
  line-height: 1.78;
}

.prose > article { padding: 2px 0 4px; }

.prose > article + article {
  margin-top: 34px;
  padding-top: 26px;
  border-top: 2px dashed rgba(26, 26, 26, 0.5);
}

.prose h2 {
  margin: 0;
  font-size: clamp(22px, 3.3vw, 30px);
  line-height: 1.26;
  letter-spacing: -0.02em;
}

.prose h3 {
  margin: 0;
  font-size: 20px;
  line-height: 1.35;
}

.prose p { margin: 0 0 14px; }
.prose p:last-child { margin-bottom: 0; }

.prose a {
  text-decoration: underline;
  text-decoration-style: wavy;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.prose ul,
.prose ol { margin: 0 0 16px; padding-left: 22px; }
.prose li { margin-bottom: 8px; }

.prose blockquote {
  margin: 18px 0;
  padding: 10px 16px;
  border-left: 4px solid var(--mid);
  background: rgba(74, 74, 74, 0.08);
  border-radius: 0 16px 16px 0;
}

.prose img {
  height: auto;
  border: 2px solid var(--ink);
  border-radius: 18px;
  filter: grayscale(1);
}

.prose code {
  font-size: 15px;
  padding: 1px 5px;
  background: rgba(26, 26, 26, 0.09);
  border-radius: 4px;
}

.prose hr,
.rail hr,
.foot hr {
  border: 0;
  height: 2px;
  margin: 10px 0 16px;
  background: repeating-linear-gradient(90deg, var(--ink)道德的 0 9px, transparent 9px 15px);
}

/* ---- 右侧跳转 ---- */
.rail {
  position: sticky;
  top: 74px;
  padding: 16px 14px;
  background: rgba(250, 250, 248, 0.92);
  border: 2px solid var(--ink);
  border-radius: 22px 28px 18px 26px;
  box-shadow: 0 18px 32px -26px rgba(26, 26, 26, 0.9);
  transform: rotate(0.5deg);
}

.rail h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0.05em;
}

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

.rail li { margin: 0 0 3px; }

.rail a {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  padding: 2px 6px;
  font-size: 16px;
  text-decoration: none;
  color: var(--ink);
  border-radius: 10px 6px 12px 8px;
}

.rail a i {
  font-style: normal;
  font-size: 12px;
  width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 50%;
  transform: rotate(-7deg);
}

.rail a:hover,
.rail a:focus-visible { background: var(--ink); color: var(--paper); }
.rail a:hover i,
.rail a:focus-visible i { background: var(--paper); color: var(--ink); }

/* ---- 页脚 ---- */
.foot {
  margin-top: 56px;
  border-top: 3px solid var(--ink);
  background: rgba(74, 74, 74, 0.07);
  display: grid;
  grid-template-columns: 1.3fr 1fr 0.9fr;
  gap: 22px;
  padding: 30px clamp(16px, 7vw, 120px) 18px;
}

.col h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0.02em;
}

.col p { margin: 0; }

.stack a {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 2px 0;
  font-size: 16px;
  text-decoration: none;
  color: var(--ink);
}

.stack a:hover,
.stack a:focus-visible {
  text-decoration: underline;
  text-decoration-style: wavy;
  text-underline-offset: 4px;
}

.bar {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 2px dashed rgba(26, 26, 26, 0.4);
  font-size: 15px;
}

.bar a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 4px;
  color: var(--ink);
}

main article[id] { scroll-margin-top: 64px; }

/* ---- 出现动画 ---- */
.js .reveal {
  opacity: 0;
  transform: translateY(18px) rotate(-0.4deg);
}

.js .reveal.in { animation: slap 340ms steps(4, end) forwards; }

@keyframes slap {
  to { opacity: 1; transform: none; }
}

/* ---- 窄屏 ---- */
@media (max-width: 880px) {
  .wrap { grid-template-columns: minmax(0, 1fr); }
  .rail { position: static; transform: none; }
  .foot { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
  .foot { grid-template-columns: 1fr; }
  .mast-bar { padding: 0 12px; }
  .mark { font-size: 18px; }
  .say { padding: 0 11px; font-size: 15.5px; }
  .hero { min-height: 42vh; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; animation: none; }
  .anchors a,
  .rail,
  .sheet,
  .say { transform: none; }
}

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