:root {
  color-scheme: light;
  --ink: #18181b;
  --muted: #71717a;
  --soft: #f4f4f5;
  --line: #e4e4e7;
  --paper: #ffffff;
  --accent: #5b5bd6;
  --accent-soft: #eef0ff;
  --warm: #fff7ed;
  --warm-line: #fed7aa;
  --max-width: 1180px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: #fafafa;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 80% -10%, rgba(224, 231, 255, .7), transparent 32rem),
    #fafafa;
  font-size: 16px;
  line-height: 1.75;
}

a {
  color: inherit;
}

.site-header {
  position: sticky;
  z-index: 10;
  top: 0;
  border-bottom: 1px solid rgba(228, 228, 231, .86);
  background: rgba(250, 250, 250, .86);
  backdrop-filter: blur(18px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(100% - 40px, var(--max-width));
  min-height: 68px;
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  font-weight: 750;
  text-decoration: none;
  letter-spacing: -.02em;
}

.brand-mark {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 10px;
  color: white;
  background: linear-gradient(145deg, #7778ef, #4f46b7);
  box-shadow: 0 8px 20px rgba(91, 91, 214, .25);
  font-size: 14px;
  font-weight: 800;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.header-nav a {
  padding: 6px 10px;
  border-radius: 8px;
  text-decoration: none;
}

.header-nav a:hover,
.header-nav a:focus-visible {
  color: var(--ink);
  background: var(--soft);
}

.header-nav .primary-link {
  color: white;
  background: var(--accent);
}

.header-nav .primary-link:hover,
.header-nav .primary-link:focus-visible {
  color: white;
  background: #4b4bc1;
}

.page-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 56px;
  width: min(100% - 40px, var(--max-width));
  margin: 0 auto;
}

.toc {
  position: sticky;
  top: 92px;
  align-self: start;
  max-height: calc(100vh - 120px);
  padding: 28px 0 24px;
  overflow: auto;
  font-size: 13px;
}

.toc-title {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.toc a {
  display: block;
  padding: 5px 10px;
  border-left: 1px solid transparent;
  color: var(--muted);
  text-decoration: none;
}

.toc a:hover,
.toc a:focus-visible {
  border-left-color: var(--accent);
  color: var(--accent);
  background: rgba(238, 240, 255, .7);
}

.toc .sub {
  padding-left: 22px;
  font-size: 12px;
}

.content {
  min-width: 0;
  padding: 84px 0 110px;
}

.hero {
  max-width: 780px;
  padding-bottom: 76px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 18px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 750;
  letter-spacing: .08em;
}

.eyebrow::before {
  width: 22px;
  height: 1px;
  background: currentColor;
  content: "";
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--ink);
  line-height: 1.2;
  letter-spacing: -.035em;
}

h1 {
  max-width: 760px;
  font-size: clamp(42px, 7vw, 76px);
  font-weight: 780;
}

h2 {
  margin-bottom: 20px;
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 760;
}

h3 {
  margin-bottom: 10px;
  font-size: 21px;
  font-weight: 720;
}

p {
  margin: 0 0 16px;
}

.hero-lead {
  max-width: 660px;
  margin-top: 24px;
  color: #52525b;
  font-size: clamp(18px, 2.4vw, 22px);
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: #3f3f46;
  background: var(--paper);
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.button:hover,
.button:focus-visible {
  border-color: #c7c7ef;
  box-shadow: 0 8px 22px rgba(24, 24, 27, .07);
  transform: translateY(-1px);
}

.button.primary {
  border-color: var(--accent);
  color: white;
  background: var(--accent);
}

.section {
  max-width: 820px;
  margin-top: 82px;
  scroll-margin-top: 96px;
}

.section-intro {
  max-width: 690px;
  margin-bottom: 28px;
  color: var(--muted);
}

.section-kicker {
  margin-bottom: 12px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, .82);
  box-shadow: 0 10px 30px rgba(24, 24, 27, .035);
}

.card p:last-child,
.card ul:last-child {
  margin-bottom: 0;
}

.card h3 {
  font-size: 19px;
}

.card p,
.card li {
  color: #52525b;
  font-size: 15px;
}

.card strong {
  color: var(--ink);
}

.feature-grid .card {
  min-height: 174px;
}

.numbered {
  display: grid;
  gap: 12px;
  padding: 0;
  margin: 0;
  list-style: none;
  counter-reset: steps;
}

.numbered li {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  counter-increment: steps;
}

.numbered li::before {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  color: var(--accent);
  background: var(--accent-soft);
  content: counter(steps);
  font-size: 13px;
  font-weight: 750;
}

.numbered li strong {
  display: block;
  margin: 2px 0 2px;
  color: var(--ink);
}

.numbered li span {
  display: block;
  color: var(--muted);
  font-size: 14px;
}

.callout {
  padding: 20px 22px;
  border: 1px solid #d8d9ff;
  border-radius: 14px;
  color: #3f3f78;
  background: var(--accent-soft);
}

.callout strong {
  color: #292966;
}

.callout.warning {
  border-color: var(--warm-line);
  color: #7c4a18;
  background: var(--warm);
}

.callout.warning strong {
  color: #653b11;
}

.definition-list {
  display: grid;
  gap: 0;
  margin: 0;
}

.definition-list > div {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 20px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.definition-list > div:first-child {
  padding-top: 0;
}

.definition-list dt {
  color: var(--ink);
  font-weight: 700;
}

.definition-list dd {
  margin: 0;
  color: #52525b;
}

.mermaid-wrap {
  padding: 18px;
  margin: 24px 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.mermaid {
  min-width: 620px;
  margin: 0;
  color: var(--ink);
  text-align: center;
}

code {
  padding: 2px 5px;
  border-radius: 5px;
  color: #4141a0;
  background: var(--accent-soft);
  font-size: .9em;
}

ul,
ol {
  padding-left: 22px;
}

li + li {
  margin-top: 6px;
}

.small {
  color: var(--muted);
  font-size: 13px;
}

.footer {
  padding: 42px 0 0;
  margin-top: 90px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.mobile-toc {
  display: none;
}

@media (max-width: 860px) {
  .page-shell {
    display: block;
    width: min(100% - 32px, 760px);
  }

  .toc {
    display: none;
  }

  .mobile-toc {
    display: block;
    margin: 0 0 30px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, .86);
  }

  .mobile-toc summary {
    padding: 12px 15px;
    cursor: pointer;
    color: var(--ink);
    font-size: 14px;
    font-weight: 700;
  }

  .mobile-toc nav {
    display: grid;
    gap: 2px;
    padding: 0 10px 12px;
  }

  .mobile-toc a {
    padding: 6px;
    color: var(--muted);
    font-size: 13px;
    text-decoration: none;
  }

  .content {
    padding-top: 54px;
  }
}

@media (max-width: 560px) {
  .header-inner {
    width: min(100% - 28px, var(--max-width));
    min-height: 60px;
  }

  .header-nav a:not(.primary-link) {
    display: none;
  }

  .page-shell {
    width: min(100% - 28px, 760px);
  }

  .content {
    padding-bottom: 72px;
  }

  .hero {
    padding-bottom: 48px;
  }

  h1 {
    font-size: 44px;
  }

  .section {
    margin-top: 58px;
  }

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

  .definition-list > div {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .mermaid {
    min-width: 560px;
  }
}
