@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,400;0,500;1,400&display=swap');

:root {
  --paper: #fdfbf7;
  --paper-2: #f5f5f5;
  --ink: #1a1a1a;
  --line: #e0e0e0;
  --muted: #5c5c5c;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --r: 10px;
}

*,
*::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(--mono);
  font-size: 1.0625rem;
  line-height: 1.7;
  letter-spacing: 0.008em;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: radial-gradient(var(--ink) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: 0.07;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: radial-gradient(#8d8a83 1px, transparent 1px);
  background-size: 6px 6px;
  opacity: 0.05;
}

main,
header,
nav,
footer,
.skip {
  position: relative;
  z-index: 1;
}

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

a:focus-visible,
.brand:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

h1,
h2,
h3 {
  font-weight: 500;
}

.skip {
  position: absolute;
  left: 12px;
  top: -120px;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
}

.skip:focus {
  top: 10px;
}

/* 页头：品牌居中，菜单分列两侧 */
.masthead {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 20px;
  position: relative;
  z-index: 4;
}

.rail p {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.rail-l p {
  justify-content: flex-start;
}

.rail-r p {
  justify-content: flex-end;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper-2);
  color: var(--ink);
  text-decoration: none;
  font-size: 1rem;
  line-height: 1.3;
  transition: background 90ms linear, color 90ms linear, border-color 90ms linear;
}

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

.brand {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  text-decoration: none;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  transition: background 90ms linear, color 90ms linear;
}

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

/* 二级粘性锚点条 */
.anchorbar {
  position: sticky;
  top: 0;
  z-index: 6;
  background: var(--paper);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.anchorbar p {
  max-width: 1180px;
  margin: 0 auto;
  padding: 7px 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.anchorbar .pill {
  min-height: 40px;
  padding: 6px 13px;
  font-size: 0.98rem;
  background: transparent;
}

/* 首屏 */
.hero {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 20px 34px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.85rem, 5.4vw, 3.3rem);
  line-height: 1.16;
  letter-spacing: -0.035em;
  max-width: 24ch;
}

.lede {
  margin: 0;
  max-width: 54ch;
  color: #3c3a36;
  font-size: 1.0625rem;
  line-height: 1.75;
  border-left: 3px solid var(--ink);
  padding-left: 14px;
}

.hero-media {
  margin: 0;
  border-radius: var(--r);
  overflow: hidden;
  background: var(--paper-2);
  min-height: 180px;
  max-height: 38vh;
  will-change: transform;
}

.hero-media img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 38vh;
  object-fit: cover;
  border-radius: var(--r);
}

.hero-media.is-empty {
  border: 1px solid var(--line);
  background-image: radial-gradient(var(--ink) 1.4px, transparent 1.4px);
  background-size: 15px 15px;
  opacity: 0.85;
}

/* 主体：正文 + 右侧栏 */
.stage {
  max-width: 1180px;
  margin: 0 auto;
  padding: 42px 20px 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 268px;
  gap: 36px;
  align-items: start;
  border-top: 1px solid var(--line);
}

.prose {
  min-width: 0;
}

.prose > article {
  background: var(--paper-2);
  border-radius: var(--r);
  padding: 26px 24px;
  margin: 0 0 22px;
  scroll-margin-top: 84px;
}

.prose h2 {
  margin: 0 0 14px;
  font-size: clamp(1.3rem, 3.2vw, 1.7rem);
  line-height: 1.32;
  letter-spacing: -0.02em;
}

.prose h3 {
  margin: 24px 0 8px;
  font-size: 1.16rem;
  line-height: 1.4;
}

.prose h2 > span::before,
.prose h3 > span::before,
.side-h > span::before,
.foot-h > span::before {
  content: "";
  display: inline-block;
  width: 0.48em;
  height: 0.48em;
  margin-right: 0.45em;
  border-radius: 2px;
  background: var(--ink);
  vertical-align: 0.02em;
}

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

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

.prose ul,
.prose ol {
  margin: 0 0 1em;
  padding-left: 1.3em;
  max-width: 64ch;
}

.prose li {
  margin-bottom: 0.45em;
}

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

.prose a:hover {
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
}

.prose strong {
  font-weight: 500;
  box-shadow: inset 0 -0.5em 0 #e7e4db;
}

.prose blockquote {
  margin: 0 0 1em;
  padding: 12px 16px;
  border-left: 3px solid var(--ink);
  background: var(--paper);
  border-radius: 0 8px 8px 0;
}

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

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.98rem;
  margin: 0 0 1em;
}

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

.prose th {
  font-weight: 500;
  background: var(--paper);
}

.prose img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

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

/* 右侧栏 */
.side {
  position: sticky;
  top: 78px;
  background: var(--paper-2);
  border-radius: var(--r);
  padding: 18px 16px;
  z-index: 2;
}

.side-h {
  margin: 0 0 12px;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

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

.side a {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper);
  text-decoration: none;
  font-size: 1rem;
  transition: background 90ms linear, color 90ms linear;
}

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

/* 页脚 */
.foot {
  margin-top: 40px;
  padding: 34px 20px 26px;
  background: var(--paper-2);
  border-top: 1px solid var(--line);
}

.foot-grid {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 28px;
}

.foot-h {
  margin: 0 0 12px;
  font-size: 1rem;
}

.foot address {
  font-style: normal;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

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

.foot ul a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper);
  text-decoration: none;
  transition: background 90ms linear, color 90ms linear;
}

.foot ul a:hover,
.foot ul a:focus-visible {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.colophon {
  max-width: 1180px;
  margin: 26px auto 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  text-align: center;
  color: var(--muted);
}

/* 回到顶部 */
.to-top {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 9;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  visibility: hidden;
  opacity: 0;
  transition: opacity 90ms linear, visibility 90ms linear;
}

.to-top.is-on {
  visibility: visible;
  opacity: 1;
}

@media (max-width: 900px) {
  .masthead {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px 14px;
  }

  .brand {
    order: -1;
    justify-self: center;
  }

  .rail-l p,
  .rail-r p {
    justify-content: center;
  }

  .anchorbar {
    display: none;
  }

  .hero {
    min-height: auto;
    padding: 22px 14px 28px;
    gap: 16px;
  }

  .hero-media,
  .hero-media img {
    max-height: none;
  }

  .stage {
    grid-template-columns: 1fr;
    gap: 22px;
    padding: 26px 14px 8px;
  }

  .side {
    position: static;
  }

  .side ul {
    grid-template-columns: 1fr;
  }

  .prose > article {
    padding: 20px 16px;
    scroll-margin-top: 20px;
  }

  .foot-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

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

  * {
    transition: none !important;
  }
}

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