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

:root {
  --paper: #fafaf8;
  --mid: #4a4a4a;
  --ink: #1a1a1a;
  --dot: rgba(26, 26, 26, 0.10);
  --font: "Atkinson Hyperlegible", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.7;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: radial-gradient(var(--dot) 1.1px, transparent 1.2px);
  background-size: 14px 14px;
}

body.menu-open { overflow: hidden; }

.frame {
  position: relative;
  z-index: 1;
}

section[id] { scroll-margin-top: 92px; }

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

/* 顶栏 */
.masthead {
  position: sticky;
  top: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(250, 250, 248, 0.95);
  border-bottom: 2px solid var(--ink);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 4px 2px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
  border-bottom: 2px solid transparent;
}
.brand:hover { border-bottom-color: var(--ink); }

.brand-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  filter: grayscale(1) contrast(1.2);
}

.tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cta {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 14px;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  color: var(--paper);
  background: var(--ink);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 rgba(26, 26, 26, 0.28);
}
.cta:hover {
  transform: translate(-1px, -1px);
  box-shadow: 5px 5px 0 rgba(26, 26, 26, 0.32);
}

.burger {
  min-height: 44px;
  padding: 8px 12px;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
  cursor: pointer;
}
.burger:hover { transform: rotate(1deg); }
.burger[aria-expanded="true"] { color: var(--paper); background: var(--ink); }

/* 首屏 */
.hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 100vh;
  min-height: 100svh;
  padding: 110px 18px 86px;
  background: var(--paper);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 38px), 0 100%);
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(26, 26, 26, 0.18) 1px, transparent 1px);
  background-size: 16px 16px;
  opacity: 0.55;
}

.hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.15) brightness(0.92);
}

.hero-in {
  position: relative;
  z-index: 2;
  max-width: 760px;
}

h1 {
  display: inline-block;
  max-width: 100%;
  margin: 0;
  padding: 18px 20px;
  font-size: clamp(28px, 7vw, 54px);
  line-height: 1.24;
  letter-spacing: 0.01em;
  background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: 7px 7px 0 rgba(26, 26, 26, 0.16);
  transform: rotate(-0.6deg);
}

/* 主体 */
.wrap {
  position: relative;
  display: grid;
  gap: 30px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 44px 16px 64px;
}

.sheet {
  min-width: 0;
  padding: 22px 16px 28px;
  background: rgba(250, 250, 248, 0.66);
  border: 2px solid var(--ink);
  border-radius: 0;
  box-shadow: 8px 8px 0 rgba(26, 26, 26, 0.10);
  backdrop-filter: blur(4px) saturate(0.95);
  transform: rotate(-0.2deg);
}

/* 侧栏 / 菜单 */
.rail {
  position: fixed;
  inset: 0;
  z-index: 60;
  padding: 84px 18px 30px;
  overflow-y: auto;
  background: var(--paper);
  transform: translateY(-104%);
  transition: transform 0.26s steps(5);
}
.rail.open { transform: none; }

.rail ul {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rail a {
  display: block;
  min-height: 46px;
  padding: 11px 14px;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  background: var(--paper);
  border: 2px solid var(--ink);
}
.rail a:hover {
  color: var(--paper);
  background: var(--ink);
  transform: rotate(-0.5deg);
}

/* 正文 */
.prose {
  min-width: 0;
  font-size: 17px;
}

.prose h2 {
  margin: 44px 0 12px;
  font-size: clamp(22px, 4.6vw, 30px);
  line-height: 1.3;
  letter-spacing: 0.01em;
}
.prose > h2:first-child { margin-top: 4px; }

.prose .subtitle {
  margin: 0 0 22px;
  padding-bottom: 14px;
  font-size: 17px;
  color: var(--mid);
  border-bottom: 2px dashed rgba(26, 26, 26, 0.28);
}

.prose h3 {
  margin: 28px 0 8px;
  font-size: 19px;
  line-height: 1.4;
}

.prose p { margin: 0 0 16px; }

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

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

.prose strong {
  background: linear-gradient(transparent 62%, rgba(26, 26, 26, 0.16) 62%);
}

.prose time {
  font-size: 16px;
  color: var(--mid);
  border-bottom: 2px solid rgba(26, 26, 26, 0.22);
}

.prose img {
  max-width: 100%;
  height: auto;
  border: 2px solid var(--ink);
  filter: grayscale(0.2) contrast(1.03);
}

.prose blockquote {
  margin: 0 0 18px;
  padding: 14px 18px;
  background: rgba(26, 26, 26, 0.045);
  border-left: 5px solid var(--ink);
  transform: rotate(-0.3deg);
}

.prose table {
  width: 100%;
  margin-bottom: 18px;
  font-size: 16px;
  border-collapse: collapse;
}
.prose th, .prose td {
  padding: 10px;
  text-align: left;
  border: 2px solid var(--ink);
}
.prose th { background: rgba(26, 26, 26, 0.07); }

.prose hr {
  height: 0;
  margin: 26px 0;
  border: 0;
  border-top: 2px dashed rgba(26, 26, 26, 0.3);
}

/* 页脚 */
footer {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px 26px;
  margin-top: 20px;
  padding: 34px max(16px, calc((100% - 1060px) / 2)) 26px;
  background: var(--paper);
  border-top: 2px solid var(--ink);
}

footer p {
  margin: 0;
  font-size: 16px;
  color: var(--mid);
}

footer .fcol strong {
  font-size: 18px;
  letter-spacing: 0.04em;
  color: var(--ink);
}

footer .fcol a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 4px 12px 4px 0;
  color: var(--mid);
  text-decoration: none;
  border-bottom: 2px solid transparent;
}
footer .fcol a:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

footer .fend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 16px;
  grid-column: 1 / -1;
  padding-top: 14px;
  border-top: 2px dashed rgba(26, 26, 26, 0.26);
}
footer .fend small { font-size: 16px; }
footer .fend a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  border-bottom: 2px solid var(--ink);
}

/* 滚动显现 */
.js-rev {
  opacity: 0.001;
  transform: translateY(12px);
  transition: opacity 0.32s steps(4), transform 0.32s steps(3);
}
.js-rev.in {
  opacity: 1;
  transform: none;
}

/* 桌面 */
@media (min-width: 700px) {
  footer { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sheet { padding: 30px 28px 34px; }
}

@media (min-width: 900px) {
  .masthead { padding: 12px 26px; }
  .hero { padding: 130px 40px 100px; }
  .wrap {
    grid-template-columns: minmax(0, 1fr) 246px;
    gap: 42px;
    padding: 60px 26px 78px;
  }
  .rail {
    position: sticky;
    inset: auto;
    top: 96px;
    grid-column: 2;
    grid-row: 1;
    align-self: start;
    padding: 0;
    overflow: visible;
    background: transparent;
    transform: none;
  }
  .rail.open {
    position: fixed;
    inset: 0;
    padding: 92px 26px 32px;
    overflow-y: auto;
    background: var(--paper);
  }
  .rail.open ul {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 720px;
    margin: 0 auto;
    gap: 12px;
  }
  .sheet {
    grid-column: 1;
    grid-row: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .rail, .js-rev { transition: none; }
  .cta:hover, .burger:hover, .rail a:hover, .sheet, h1 { transform: none; }
}

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