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

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

:root {
  --paper: #fdfbf7;
  --card: #f5f5f5;
  --ink: #1a1a1a;
  --line: #e0e0e0;
  --muted: #56534f;
  --sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --serif: Georgia, 'Songti SC', 'Noto Serif SC', 'Source Han Serif SC', serif;
}

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

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

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.07'/%3E%3C/svg%3E");
}

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

/* 顶栏 */
.bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.5rem;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0.45rem 1.25rem;
  background: var(--paper);
  border-bottom: 1px solid var(--ink);
}

.bar-left,
.bar-right {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  min-width: 0;
}

.bar-right { justify-content: flex-end; }

.bar-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0.5rem 0.5rem;
  font-size: 0.95rem;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.bar-link:hover { background: var(--card); }

.brand {
  padding: 0.55rem 0.35rem;
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.brand:hover { background: var(--card); }

/* 汉堡 + 全屏菜单 */
.drawer { display: block; }

.burger {
  display: grid;
  place-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  margin-left: 0.2rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  cursor: pointer;
  list-style: none;
}

.burger::-webkit-details-marker { display: none; }
.burger span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--ink);
}

.drawer[open] .burger {
  position: relative;
  z-index: 50;
  border-color: var(--ink);
}

.drawer[open] .burger span:first-child { transform: translateY(3.5px) rotate(45deg); }
.drawer[open] .burger span:last-child { transform: translateY(-3.5px) rotate(-45deg); }

.menu { display: none; }

.drawer[open] .menu {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 5.5rem 1.5rem 3rem;
  overflow-y: auto;
  list-style: none;
  background: var(--paper);
}

.menu li { border-bottom: 1px solid var(--line); }
.menu li:first-child { border-top: 1px solid var(--line); }
.menu li:nth-child(2) { padding-top: 0.2rem; }

.menu a {
  display: block;
  padding: 0.9rem 0.2rem;
  font-size: 1.12rem;
  color: var(--ink);
  text-decoration: none;
}

.menu a:hover { background: var(--card); }

/* 栅格 */
.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 13rem;
  gap: 2rem 3rem;
  align-items: start;
}

/* 头图区 */
.hero {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  min-height: 70vh;
  padding: 2.5rem 0 3rem;
  border-bottom: 1px solid var(--line);
}

.hero-in {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 2.5rem;
  align-items: center;
  width: 100%;
}

.hero-in.solo { grid-template-columns: 1fr; }

.hero h1 {
  margin: 0 0 1.1rem;
  font-size: clamp(2rem, 4.6vw, 3.2rem);
  line-height: 1.14;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.hero-lead {
  max-width: 32ch;
  margin: 0;
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--muted);
}

.hero-fig { margin: 0; }

.hero-fig img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 4px;
  filter: grayscale(1) contrast(1.05);
}

/* 正文 */
.content {
  min-width: 0;
  padding: 1.5rem 0 3rem;
}

.prose {
  max-width: 40em;
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.9;
}

.prose > *:first-child { margin-top: 0; }

.prose h2,
.prose h3 {
  font-family: var(--sans);
  letter-spacing: -0.01em;
}

.prose h2 {
  margin: 2.8rem 0 1rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
  font-size: 1.4rem;
  line-height: 1.35;
  font-weight: 600;
}

.prose h2 > span {
  padding-bottom: 0.1rem;
  border-bottom: 2px solid var(--ink);
}

.prose h3 {
  margin: 1.8rem 0 0.6rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.prose h3 > span {
  padding-bottom: 0.1rem;
  border-bottom: 1px solid var(--line);
}

.prose p { margin: 0 0 1.15rem; }

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

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

.prose ul,
.prose ol {
  margin: 0 0 1.2rem;
  padding-left: 1.4rem;
}

.prose li { margin: 0.35rem 0; }

.prose blockquote {
  margin: 1.5rem 0;
  padding: 0 0 0 1rem;
  border-left: 3px solid var(--ink);
  color: var(--muted);
}

.prose blockquote p:last-child { margin: 0; }

.prose img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.4rem 0;
  border-radius: 4px;
  filter: grayscale(1);
}

.prose figure { margin: 1.4rem 0; }

.prose table {
  width: 100%;
  margin: 1.2rem 0;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 0.95rem;
}

.prose th,
.prose td {
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--line);
  text-align: left;
}

.prose hr {
  margin: 2rem 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.prose code {
  padding: 0.1em 0.35em;
  background: var(--card);
  border-radius: 3px;
  font-size: 0.92em;
}

.prose pre {
  padding: 0.9rem 1rem;
  overflow: auto;
  background: var(--card);
  border-radius: 4px;
}

.prose pre code { padding: 0; background: none; }

main [id] { scroll-margin-top: 5.5rem; }

/* 侧栏 */
.side {
  position: sticky;
  top: 5.5rem;
  min-width: 0;
  padding: 0.25rem 0 0.25rem 1rem;
  border-left: 1px solid var(--line);
}

.side-h {
  margin: 0 0 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.side-h > span {
  padding-bottom: 0.1rem;
  border-bottom: 1px solid var(--ink);
  color: var(--ink);
}

.side-list {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.92rem;
}

.side-list a {
  display: block;
  min-height: 40px;
  padding: 0.5rem 0.2rem;
  color: var(--ink);
  text-decoration: none;
}

.side-list a:hover { background: var(--card); }

/* 页脚 */
footer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.6rem 1.5rem;
  max-width: 1080px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
  border-top: 1px solid var(--ink);
  font-size: 0.88rem;
}

.f-brand {
  margin: 0;
  max-width: 34ch;
  color: var(--muted);
  line-height: 1.7;
}

.f-brand strong {
  color: var(--ink);
  font-weight: 600;
}

.f-links {
  margin: 0;
  text-align: right;
  line-height: 2;
}

.f-links a {
  text-decoration: none;
  padding: 0.2rem 0;
}

.f-links a:hover { background: var(--card); }

.f-copy,
.f-top {
  font-size: 0.78rem;
  color: var(--muted);
}

.f-top { text-align: right; }
.f-top a { text-decoration: none; color: var(--muted); }
.f-top a:hover { color: var(--ink); }

@media (max-width: 900px) {
  .bar-left { display: none; }
  .bar-right .bar-link { display: none; }

  .wrap {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .hero {
    min-height: 0;
    padding: 1.75rem 0 2rem;
  }

  .hero-in { grid-template-columns: 1fr; gap: 1.5rem; }

  .side {
    position: static;
    margin-top: 0.5rem;
    padding: 1.25rem 0 2.5rem;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .side-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 0.8rem;
  }

  .content { padding-bottom: 1.5rem; }
}

@media (max-width: 560px) {
  body { font-size: 16px; }
  .brand { font-size: 0.95rem; }
  .hero h1 { font-size: 1.75rem; }
  .hero-lead { font-size: 1rem; }
  footer { grid-template-columns: 1fr; }
  .f-links { text-align: left; }
  .f-top { text-align: left; }
  .menu a { font-size: 1.05rem; }
}

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

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