:root {
  --bg: #ffffff;
  --fg: #111827;
  --muted: #5b6472;
  --accent: #2563eb;
  --accent2: #7c3aed;
  --card: #f6f7f9;
  --border: #e4e7ec;
  --dark: #0f172a;
  --ok: #047857;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 1000;
  padding: 8px 14px;
  background: #fff;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  line-height: 1.65;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

header {
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, .97);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(8px);
}

.nav {
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand { font-weight: 750; font-size: 19px; letter-spacing: .4px; }
.brand span { color: var(--accent); }
.nav .grow { flex: 1; }
.nav-links { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.nav-links a { color: var(--fg); font-size: 14px; }
.nav-links a:hover { color: var(--accent); text-decoration: none; }
.nav-links a.active {
  color: var(--accent);
  font-weight: 650;
}

.hero {
  padding: 78px 0 58px;
  text-align: center;
}

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

.hero h1 {
  max-width: 940px;
  margin: 0 auto 20px;
  font-size: clamp(36px, 6vw, 58px);
  line-height: 1.08;
  letter-spacing: -.025em;
}

.grad {
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero p {
  max-width: 820px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 19px;
}

.badges, .cta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 11px;
}

.badges { margin-top: 26px; }
.badge {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px;
  color: var(--muted);
  font-size: 13px;
}
.badge.hl { color: var(--accent); border-color: var(--accent); }
.badge.ok { color: var(--ok); border-color: #a7f3d0; background: #ecfdf5; }

.cta { margin-top: 32px; }
.cta a {
  padding: 11px 23px;
  border-radius: 10px;
  font-weight: 650;
  font-size: 15px;
}
.cta a:hover { text-decoration: none; }
.cta .primary { background: var(--accent); color: #fff; }
.cta .primary:hover { background: #1d4ed8; }
.cta .ghost { border: 1px solid var(--accent); color: var(--accent); }
.cta .ghost:hover { background: #eff6ff; }

section { padding: 56px 0; }
section.alt {
  background: var(--card);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.sec-head { text-align: center; margin-bottom: 30px; }
.sec-head h2 { font-size: 30px; line-height: 1.2; margin-bottom: 10px; }
.sec-head p { max-width: 760px; margin: 0 auto; color: var(--muted); }

.grid { display: grid; gap: 16px; }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }

.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
}
.card h3 { font-size: 17px; margin-bottom: 7px; }
.card p { color: var(--muted); font-size: 14px; }
.card .n {
  display: inline-flex;
  width: 26px;
  height: 26px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: 12px;
  font-weight: 750;
  margin-bottom: 10px;
}

.flow {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
  align-items: stretch;
  margin: 24px 0;
}
.flow .node {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 15px 13px;
}
.flow .node:not(:last-child)::after {
  content: "→";
  position: absolute;
  right: -11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
  font-weight: 800;
  background: var(--card);
  padding: 0 2px;
  z-index: 2;
}
.flow b { display: block; font-size: 14px; margin-bottom: 4px; }
.flow span { color: var(--muted); font-size: 12.5px; }

.example {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 16px;
  margin-top: 26px;
}

pre {
  margin: 0;
  background: var(--dark);
  color: #e2e8f0;
  border-radius: 13px;
  padding: 19px 21px;
  overflow-x: auto;
  font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.decision {
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 20px;
  background: var(--bg);
}
.decision .row {
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}
.decision .row:last-child { border-bottom: none; }
.decision code {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.allow { color: var(--ok); font-weight: 700; }
.deny { color: #b91c1c; font-weight: 700; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 14px;
  margin-top: 26px;
}
.stat {
  text-align: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 20px 14px;
}
.stat .v { color: var(--accent); font-weight: 750; font-size: 28px; }
.stat .k { color: var(--muted); font-size: 13px; }

.note {
  max-width: 850px;
  margin: 26px auto 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: 18px 21px;
  color: var(--muted);
  font-size: 14px;
}

.scope {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px;
  margin-top: 24px;
}
.scope div {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 17px;
  background: var(--bg);
}
.scope b { display: block; margin-bottom: 5px; }
.scope span { color: var(--muted); font-size: 14px; }

.final {
  text-align: center;
  background: linear-gradient(135deg, #eef4ff, #f7f2ff);
  border-top: 1px solid var(--border);
}
.final h2 { font-size: 31px; margin-bottom: 10px; }
.final p { color: var(--muted); max-width: 720px; margin: 0 auto 24px; }

footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  padding: 28px 0 40px;
  font-size: 13px;
}
footer .row { margin: 4px 0; }

@media (max-width: 860px) {
  .flow { grid-template-columns: 1fr; }
  .flow .node:not(:last-child)::after {
    content: "↓";
    right: 50%;
    top: auto;
    bottom: -18px;
    transform: translateX(50%);
  }
  .example { grid-template-columns: 1fr; }
  .hero { padding: 56px 0 42px; }
}

@media (max-width: 640px) {
  .nav { align-items: flex-start; flex-direction: column; padding: 13px 0; }
  .nav-links { gap: 12px; }
  .hero p { font-size: 17px; }
}
