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

:root {
  --ink: #1f1f1f;
  --paper: #ffffff;
  --mist: #f5f5f5;
  --ink-70: rgba(31, 31, 31, 0.7);
  --ink-55: rgba(31, 31, 31, 0.55);
  --ink-30: rgba(31, 31, 31, 0.3);
  --line: rgba(31, 31, 31, 0.12);
  --line-strong: rgba(31, 31, 31, 0.26);
  --e1: 0 1px 2px rgba(31, 31, 31, 0.06);
  --e2: 0 8px 18px -8px rgba(31, 31, 31, 0.2);
  --e3: 0 20px 44px -20px rgba(31, 31, 31, 0.3);
  --e4: 0 38px 76px -30px rgba(31, 31, 31, 0.38);
  --r: 28px;
  --serif: 'Crimson Pro', Georgia, 'Songti SC', 'SimSun', serif;
  --sans: 'Atkinson Hyperlegible', system-ui, -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --shell: 1180px;
}

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

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

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.72;
  color: var(--ink);
  background-color: var(--mist);
  background-image: radial-gradient(1100px 520px at 84% -10%, #ffffff 0%, rgba(255, 255, 255, 0) 62%),
    radial-gradient(900px 640px at 4% 2%, #ffffff 0%, rgba(255, 255, 255, 0) 58%);
  background-repeat: no-repeat;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
}

a {
  -webkit-tap-highlight-color: transparent;
}

/* ---------- 顶栏 ---------- */
.masthead {
  position: relative;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px clamp(16px, 4vw, 46px);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--e1);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 8px 0 0;
  color: var(--ink);
  text-decoration: none;
}

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  object-fit: cover;
}

.brand-name {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.pills {
  display: flex;
  gap: 8px;
  flex: 1 1 320px;
  min-width: 0;
  margin-left: auto;
  padding: 4px 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.pills::-webkit-scrollbar {
  display: none;
}

.pill {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  text-decoration: none;
  font-size: 16px;
  white-space: nowrap;
  box-shadow: var(--e1);
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.pill:hover,
.pill:focus-visible {
  background: var(--ink);
  color: var(--paper);
  transform: translateY(-1px);
  box-shadow: var(--e2);
}

/* ---------- 粘性章节条 ---------- */
.bar {
  position: sticky;
  top: 0;
  z-index: 35;
  background: rgba(245, 245, 245, 0.84);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}

.bar-track {
  display: flex;
  gap: 6px;
  max-width: var(--shell);
  margin: 0 auto;
  padding: 8px clamp(12px, 4vw, 46px);
  overflow-x: auto;
  scrollbar-width: none;
}

.bar-track::-webkit-scrollbar {
  display: none;
}

.bar-item {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  color: var(--ink-55);
  text-decoration: none;
  font-size: 16px;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.bar-item:hover,
.bar-item:focus-visible {
  color: var(--ink);
  background: var(--paper);
  box-shadow: var(--e2);
}

/* ---------- 首屏 ---------- */
.hero {
  position: relative;
  z-index: 2;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 70vh;
  max-width: var(--shell);
  margin: 0 auto;
  padding: clamp(26px, 6vw, 62px) clamp(16px, 4vw, 46px) 0;
  overflow: hidden;
}

.hero-ghost {
  position: absolute;
  z-index: 0;
  right: clamp(8px, 3vw, 30px);
  top: 46%;
  transform: translateY(-50%);
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(48px, 14vw, 180px);
  line-height: 0.88;
  letter-spacing: -0.03em;
  color: rgba(31, 31, 31, 0.07);
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
  will-change: transform;
}

.hero-copy {
  position: relative;
  z-index: 2;
  max-width: min(100%, 700px);
  margin-left: auto;
  text-align: right;
}

.hero-h1 {
  margin: 0 0 14px;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(30px, 5vw, 56px);
  line-height: 1.16;
  letter-spacing: -0.01em;
}

.hero-lede {
  margin: 0;
  color: var(--ink-55);
  font-size: clamp(16px, 1.6vw, 19px);
  line-height: 1.66;
}

.hero-art {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  height: clamp(150px, 26vh, 280px);
  margin: clamp(20px, 4vw, 40px) 0 0;
  border: 1px solid var(--line);
  border-radius: var(--r) var(--r) 0 0;
  border-bottom: 0;
  overflow: hidden;
  background: linear-gradient(158deg, #ffffff 0%, var(--mist) 100%);
  box-shadow: var(--e3);
  will-change: transform;
}

.hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ---------- 正文与侧栏 ---------- */
.stack {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 270px;
  align-items: start;
  gap: clamp(20px, 3vw, 40px);
  max-width: var(--shell);
  margin: clamp(34px, 6vw, 72px) auto 0;
  padding: 0 clamp(16px, 4vw, 46px) clamp(40px, 7vw, 88px);
}

.article {
  position: relative;
  z-index: 2;
  padding: clamp(22px, 3.4vw, 46px);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  box-shadow: none;
}

.article > section + section {
  margin-top: clamp(28px, 4vw, 52px);
  padding-top: clamp(24px, 3.6vw, 44px);
  border-top: 1px solid var(--line);
}

.article section[id] {
  scroll-margin-top: 118px;
}

.article h2 {
  margin: 0 0 14px;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(22px, 2.9vw, 31px);
  line-height: 1.28;
}

.article h3 {
  margin: 1.4em 0 10px;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(19px, 2.2vw, 23px);
  line-height: 1.34;
}

.article p {
  margin: 0 0 1em;
}

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

.article a {
  color: var(--ink);
  text-decoration-color: var(--ink-30);
  text-underline-offset: 3px;
}

.article a:hover {
  text-decoration-color: var(--ink);
}

.article ul,
.article ol {
  margin: 0 0 1em;
  padding-left: 1.3em;
}

.article li {
  margin: 0 0 0.45em;
}

.article blockquote {
  margin: 1.3em 0;
  padding: 14px 18px;
  background: var(--mist);
  border-left: 3px solid var(--ink);
  border-radius: 0 18px 18px 0;
}

.article figure {
  margin: 1.3em 0;
}

.article img {
  height: auto;
  border-radius: 18px;
}

.article table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1em;
  font-size: 16px;
}

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

.article code,
.article pre {
  font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: 15px;
}

.article pre {
  overflow-x: auto;
  padding: 14px 16px;
  background: var(--mist);
  border-radius: 16px;
}

.rail {
  position: sticky;
  top: 76px;
  z-index: 3;
  padding: 22px 18px;
  background: rgba(255, 255, 255, 0.76);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--e2);
}

.rail-tag {
  display: block;
  font-size: 16px;
  letter-spacing: 0.24em;
  color: var(--ink-55);
}

.rail-title {
  margin: 2px 0 14px;
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 600;
  line-height: 1.3;
}

.rail-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rail-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 14px;
  color: var(--ink);
  text-decoration: none;
  font-size: 16px;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.rail-link:hover,
.rail-link:focus-visible {
  background: var(--paper);
  border-color: var(--line);
  box-shadow: var(--e1);
}

.rail-idx {
  font-family: var(--serif);
  font-size: 16px;
  color: var(--ink-30);
}

/* ---------- 页脚 ---------- */
.colophon {
  position: relative;
  z-index: 5;
  margin-top: clamp(24px, 5vw, 64px);
  background: var(--paper);
  border-top: 1px solid var(--line-strong);
  box-shadow: 0 -24px 54px -38px rgba(31, 31, 31, 0.55);
}

.foot-grid {
  display: grid;
  grid-template-columns: 1.35fr repeat(3, minmax(0, 1fr));
  gap: clamp(22px, 3vw, 40px);
  align-items: start;
  max-width: var(--shell);
  margin: 0 auto;
  padding: clamp(30px, 5vw, 60px) clamp(16px, 4vw, 46px) clamp(18px, 3vw, 28px);
}

.foot-cta {
  position: relative;
  z-index: 2;
  padding: 24px 22px;
  background: var(--mist);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  box-shadow: var(--e3);
}

.foot-cta small {
  display: block;
  font-size: 16px;
  letter-spacing: 0.24em;
  color: var(--ink-55);
}

.cta-title {
  margin: 4px 0 16px;
  font-family: var(--serif);
  font-size: clamp(22px, 2.7vw, 28px);
  font-weight: 600;
  line-height: 1.26;
}

.cta-btn {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  padding: 0 22px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  font-size: 16px;
  box-shadow: var(--e2);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cta-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--e4);
}

.foot-nav {
  display: contents;
}

.foot-nav dl {
  margin: 0;
}

.foot-nav dt {
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
}

.foot-nav dd {
  margin: 0;
}

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

.foot-nav a:hover,
.foot-nav a:focus-visible {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.foot-base {
  grid-column: 1 / -1;
  margin-top: clamp(14px, 3vw, 26px);
  padding-top: 16px;
  border-top: 1px solid var(--line);
  text-align: center;
}

.copy {
  margin: 0;
  font-size: 16px;
}

.fine {
  margin: 4px 0 0;
  font-size: 16px;
  letter-spacing: 0.08em;
  color: var(--ink-55);
}

/* ---------- 滚动显现 ---------- */
.js .rv {
  opacity: 0;
  transform: translate3d(0, 18px, 0);
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.js .rv.in {
  opacity: 1;
  transform: none;
}

/* ---------- 断点 ---------- */
@media (max-width: 880px) {
  .stack {
    grid-template-columns: minmax(0, 1fr);
  }

  .rail {
    position: static;
    order: 2;
  }

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

  .foot-cta {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  body {
    background-attachment: scroll;
  }

  .masthead {
    padding: 10px 14px;
  }

  .brand-name {
    font-size: 18px;
  }

  .hero {
    min-height: 0;
    padding: 24px 16px 0;
  }

  .hero-copy {
    margin-left: 0;
  }

  .hero-art {
    height: 150px;
    border-radius: 22px 22px 0 0;
  }

  .stack {
    margin-top: 26px;
    padding: 0 14px 44px;
  }

  .article {
    padding: 22px 18px;
    border-radius: 22px;
  }

  .foot-grid {
    grid-template-columns: 1fr;
    padding: 28px 16px 20px;
  }

  .foot-nav a {
    min-height: 42px;
  }
}

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

  .js .rv {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .hero-ghost,
  .hero-art {
    transform: none !important;
  }
}

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