:root {
  --paper: #ffffff;
  --mist: #f5f5f5;
  --ink: #1f1f1f;
  --ink-soft: #4a4a4a;
  --line: #d9d9d9;
  --e-sm: 0 1px 0 rgba(31, 31, 31, 0.16);
  --e-md: 0 6px 0 -3px rgba(31, 31, 31, 0.14), 0 12px 22px -14px rgba(31, 31, 31, 0.45);
  --e-lg: 0 12px 0 -6px rgba(31, 31, 31, 0.16), 0 26px 44px -26px rgba(31, 31, 31, 0.5);
  --e-xl: 0 20px 0 -10px rgba(31, 31, 31, 0.18), 0 44px 70px -40px rgba(31, 31, 31, 0.55);
  --bar: 70px;
  --cond: "Barlow Condensed", "Barlow", system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", 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: "Barlow", system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 17px;
  line-height: 1.72;
  letter-spacing: 0.01em;
  overflow-x: clip;
}

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

a {
  color: inherit;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--cond);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: 0.01em;
}

:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.jump {
  position: absolute;
  top: -70px;
  left: 14px;
  z-index: 90;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  transition: top 0.16s ease;
}

.jump:focus {
  top: 12px;
}

/* 顶栏：品牌居中，菜单分列两侧，层叠浮起 */
.masthead {
  position: fixed;
  inset: 0 0 auto;
  z-index: 40;
  background: rgba(255, 255, 255, 0.84);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--e-sm);
  backdrop-filter: blur(14px) saturate(150%);
}

.topbar {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  max-width: 1240px;
  min-height: var(--bar);
  margin: 0 auto;
  padding: 0 18px;
}

.brand {
  position: relative;
  z-index: 3;
  justify-self: center;
  display: inline-flex;
  align-items: center;
  padding: 10px 6px;
  text-decoration: none;
}

.brand-word {
  font-family: var(--cond);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.brand-logo {
  width: 88px;
  height: auto;
}

.wing {
  display: flex;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.wing-l {
  justify-self: start;
}

.wing-r {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
}

.wing a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 9px;
  font-size: 0.95rem;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: transform 0.16s ease, border-color 0.16s ease;
}

.wing a:hover {
  transform: translateY(-2px);
  border-bottom-color: var(--ink);
}

/* 汉堡全屏遮罩：details / summary / menu */
.drawer {
  position: relative;
  z-index: 3;
}

.drawer > summary {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  list-style: none;
  cursor: pointer;
  border: 1px solid var(--ink);
  font-family: var(--cond);
  font-size: 0.95rem;
  letter-spacing: 0.2em;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.drawer > summary::-webkit-details-marker {
  display: none;
}

.drawer > summary:hover {
  transform: translateY(-2px);
  box-shadow: var(--e-md);
}

.drawer[open] > summary {
  position: relative;
  z-index: 3;
  background: var(--ink);
  color: var(--paper);
}

.drawer-menu {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: grid;
  align-content: start;
  margin: 0;
  padding: calc(var(--bar) + 26px) clamp(18px, 6vw, 64px) 48px;
  list-style: none;
  counter-reset: m;
  background: rgba(245, 245, 245, 0.96);
  backdrop-filter: blur(16px);
  overflow-y: auto;
}

.drawer-menu > li {
  counter-increment: m;
}

.drawer-menu > li > a {
  display: flex;
  align-items: center;
  min-height: 58px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  font-family: var(--cond);
  font-size: clamp(1.45rem, 4.4vw, 2.3rem);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: transform 0.16s ease, color 0.16s ease;
}

.drawer-menu > li > a::before {
  content: counter(m, decimal-leading-zero);
  width: 2.6em;
  font-family: "Barlow", system-ui, sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
}

.drawer-menu > li > a:hover {
  transform: translateX(9px);
}

.drawer-search {
  padding-top: 24px;
}

.search {
  display: flex;
  max-width: 460px;
  border: 1px solid var(--ink);
  background: var(--paper);
  box-shadow: var(--e-md);
}

.search input {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  padding: 0 14px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
}

.search input:focus {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--ink);
}

.search button {
  min-height: 48px;
  padding: 0 22px;
  border: 0;
  border-left: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  font: inherit;
  letter-spacing: 0.12em;
  cursor: pointer;
}

/* 版面 */
.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 44px;
  max-width: 1240px;
  margin: 0 auto;
  padding: calc(var(--bar) + 28px) 18px 72px;
}

.hero {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: calc(100vh - var(--bar) - 40px);
  min-height: calc(100svh - var(--bar) - 40px);
  padding: 48px 22px;
  background: var(--mist);
  border: 1px solid var(--line);
  box-shadow: var(--e-xl);
}

.hero h1 {
  max-width: 15em;
  font-size: clamp(2.5rem, 7.4vw, 4.6rem);
  line-height: 1.02;
  text-wrap: balance;
}

.hero .lede {
  max-width: 44ch;
  margin: 22px 0 0;
  color: var(--ink-soft);
  font-size: 1.05rem;
}

.hero-go {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  margin-top: 34px;
  padding: 0 26px;
  background: var(--paper);
  border: 1px solid var(--ink);
  box-shadow: var(--e-md);
  font-family: var(--cond);
  font-size: 1.05rem;
  letter-spacing: 0.18em;
  text-decoration: none;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.hero-go:hover {
  transform: translate(-2px, -3px);
  box-shadow: var(--e-lg);
}

/* 正文 */
.prose {
  position: relative;
  z-index: 2;
  min-width: 0;
}

.prose > div:not(.hero) {
  position: relative;
  margin-top: 60px;
  padding: 54px 0 6px;
  border-top: 1px solid var(--line);
  scroll-margin-top: calc(var(--bar) + 26px);
}

.prose > div:not(.hero)::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  width: 60px;
  height: 3px;
  background: var(--ink);
}

.prose h1 + p {
  margin-top: 0;
}

.prose h2 {
  max-width: 22em;
  font-size: clamp(1.7rem, 3.6vw, 2.5rem);
}

.prose h2 + hr {
  width: 74px;
  height: 3px;
  margin: 14px 0 26px;
  border: 0;
  background: var(--ink);
}

.prose h3 {
  margin: 36px 0 12px;
  font-size: clamp(1.25rem, 2.4vw, 1.62rem);
}

.prose p {
  max-width: 68ch;
  margin: 0 0 18px;
}

.prose ul,
.prose ol {
  max-width: 66ch;
  margin: 0 0 20px;
  padding-left: 1.35em;
}

.prose li {
  margin: 0.42em 0;
}

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

.prose img {
  margin: 28px 0;
  border: 1px solid var(--line);
  box-shadow: var(--e-lg);
}

.prose blockquote {
  margin: 26px 0;
  padding: 18px 22px;
  background: var(--mist);
  border-left: 3px solid var(--ink);
  box-shadow: var(--e-sm);
}

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

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

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

.prose th {
  background: var(--mist);
}

.prose pre {
  overflow-x: auto;
  padding: 16px;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.94rem;
  line-height: 1.6;
}

.prose code {
  font-size: 0.94em;
}

.prose hr {
  height: 1px;
  margin: 32px 0;
  border: 0;
  background: var(--line);
}

/* 右侧栏 */
.rail {
  position: relative;
  z-index: 1;
  align-self: start;
  padding: 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--e-lg);
  transform: translate(5px, 8px);
}

.rail-title {
  margin: 0 0 10px;
  font-family: var(--cond);
  font-size: 0.95rem;
  letter-spacing: 0.24em;
  color: var(--ink-soft);
}

.rail-list {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: r;
}

.rail-list li {
  counter-increment: r;
  border-top: 1px solid var(--line);
}

.rail-list li:first-child {
  border-top: 0;
}

.rail-list a {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-height: 40px;
  padding: 8px 0;
  font-size: 0.98rem;
  line-height: 1.4;
  text-decoration: none;
}

.rail-list a::before {
  content: counter(r, decimal-leading-zero);
  font-family: "Barlow", system-ui, sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
}

.rail-list a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* 页脚：单行极简 */
.foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 20px;
  padding: 22px 18px;
  background: var(--mist);
  border-top: 1px solid var(--line);
  font-size: 0.95rem;
}

.foot p {
  margin: 0;
}

.foot small {
  font-size: 0.95rem;
}

.foot small a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 2px;
  text-decoration: none;
  border-bottom: 1px solid var(--ink);
}

@media (min-width: 900px) {
  .hero {
    margin-left: -18px;
    padding: 64px clamp(28px, 4vw, 56px);
  }
}

@media (min-width: 1080px) {
  .shell {
    grid-template-columns: minmax(0, 1fr) 258px;
    gap: 52px;
    padding-top: calc(var(--bar) + 44px);
  }

  .rail {
    position: sticky;
    top: calc(var(--bar) + 26px);
  }
}

@media (max-width: 899px) {
  :root {
    --bar: 62px;
  }

  .wing-l,
  .wing-r-menu {
    display: none;
  }

  .brand-word {
    font-size: 1.25rem;
  }
}

@media (max-width: 420px) {
  .topbar {
    padding: 0 12px;
  }
}

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

  *,
  *::before,
  *::after {
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
  }
}

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