:root {
  --bg: #fafbfd;
  --surface: #ffffff;
  --surface-alt: #f1f5f9;
  --ink: #0f172a;
  --ink-muted: #475569;
  --ink-subtle: #64748b;
  --border: #e2e8f0;
  --primary: #1d4ed8;
  --primary-soft: #eff6ff;
  --primary-hover: #1e40af;
  --emerald: #059669;
  --emerald-soft: #ecfdf5;
  --amber: #d97706;
  --amber-soft: #fffbeb;
  --rose: #dc2626;
  --rose-soft: #fef2f2;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 6px 20px rgba(15, 23, 42, 0.04);
  --font-sans: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Code", Consolas, monospace;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

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

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

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 68px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 18px;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #1d4ed8, #0ea5e9);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.nav-links a {
  padding: 8px 13px;
  border-radius: 8px;
  color: var(--ink-muted);
  font-weight: 500;
  font-size: 14.5px;
  transition: background 0.15s, color 0.15s;
}
.nav-links a:hover, .nav-links a.active {
  background: var(--primary-soft);
  color: var(--primary);
  text-decoration: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14.5px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  font-family: inherit;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: #fff; color: var(--ink); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-alt); }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }

/* Hero */
.hero {
  padding: 56px 0 42px;
  background: radial-gradient(circle at top right, #e0f2fe 0%, transparent 45%),
              radial-gradient(circle at top left, #eff6ff 0%, transparent 45%);
  border-bottom: 1px solid var(--border);
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid #bfdbfe;
}
.hero h1 {
  margin: 16px 0 14px;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.25;
  letter-spacing: -0.02em;
}
.hero-lead {
  max-width: 780px;
  color: var(--ink-muted);
  font-size: 17px;
  margin: 0 0 24px;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 32px;
}

/* Metric Cards */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
}
.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.metric-label { font-size: 13px; color: var(--ink-subtle); font-weight: 500; }
.metric-value { font-size: 28px; font-weight: 800; color: var(--ink); margin: 4px 0; line-height: 1.2; }
.metric-sub { font-size: 12.5px; color: var(--emerald); font-weight: 600; }

/* Sections */
.section { padding: 48px 0; }
.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.section-header h2 { margin: 0 0 6px; font-size: 24px; }
.section-header p { margin: 0; color: var(--ink-muted); font-size: 15px; }

/* Cards & Grids */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 20px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.article-card { transition: transform 0.15s ease, border-color 0.15s ease; }
.article-card:hover { transform: translateY(-2px); border-color: #93c5fd; }

.card-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge-blue { background: var(--primary-soft); color: var(--primary); }
.badge-green { background: var(--emerald-soft); color: var(--emerald); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-rose { background: var(--rose-soft); color: var(--rose); }
.badge-slate { background: var(--surface-alt); color: var(--ink-muted); }

.article-card h3 { margin: 0; font-size: 18px; line-height: 1.4; }
.article-card h3 a { color: var(--ink); }
.article-card h3 a:hover { color: var(--primary); text-decoration: none; }
.tldr-snippet {
  margin: 0;
  color: var(--ink-muted);
  font-size: 14px;
  background: #f8fafc;
  border-left: 3px solid var(--primary);
  padding: 10px 12px;
  border-radius: 0 8px 8px 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.card-footer-row {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--ink-subtle);
}

/* 8 Strategies Blueprint Grid */
.strategy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.strategy-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.strategy-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 800;
  font-size: 13px;
  margin-right: 8px;
}
.strategy-card h3 {
  display: flex;
  align-items: center;
  font-size: 16px;
  margin: 0 0 8px;
}
.strategy-card p { margin: 0 0 10px; font-size: 14px; color: var(--ink-muted); }
.strategy-impl { font-size: 12.5px; color: var(--emerald); font-weight: 600; }

/* Visibility Snapshot Bars */
.engine-bars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}
.engine-bar-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}
.bar-track {
  height: 9px;
  background: var(--surface-alt);
  border-radius: 999px;
  overflow: hidden;
  margin: 8px 0 6px;
}
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #059669);
  border-radius: 999px;
}

/* Article Detail Layout */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13.5px;
  color: var(--ink-subtle);
  margin: 24px 0 16px;
}
.article-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}
.article-header h1 { margin: 12px 0 10px; font-size: clamp(24px, 3vw, 34px); line-height: 1.3; }
.article-subtitle { margin: 0 0 18px; color: var(--ink-muted); font-size: 17px; }

.author-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.author-info { display: flex; align-items: center; gap: 12px; }
.avatar-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tldr-card {
  background: linear-gradient(135deg, #eff6ff, #f0fdf4);
  border: 1.5px solid #93c5fd;
  border-left: 5px solid var(--primary);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 24px;
}
.tldr-title {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.tldr-card p { margin: 0; font-size: 16px; color: var(--ink); font-weight: 500; overflow-wrap: anywhere; word-break: break-word; }

.article-layout {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}
@media (max-width: 960px) {
  .article-layout { grid-template-columns: 1fr; }
}

.article-sidebar {
  position: sticky;
  top: 86px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.toc-card, .score-mini-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.toc-card h4, .score-mini-card h4 { margin: 0 0 10px; font-size: 14.5px; }
.toc-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.toc-list a { font-size: 13.5px; color: var(--ink-muted); display: block; padding: 3px 6px; border-radius: 6px; }
.toc-list a:hover, .toc-list a.active { background: var(--primary-soft); color: var(--primary); text-decoration: none; }
.toc-lvl-3 { padding-left: 14px; font-size: 13px; }

.article-body-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
}
.markdown-body h2 { margin: 30px 0 12px; font-size: 22px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.markdown-body h2:first-child { margin-top: 0; }
.markdown-body h3 { margin: 22px 0 8px; font-size: 18px; }
.markdown-body p { margin: 0 0 14px; color: #1e293b; }
.markdown-body ul, .markdown-body ol { margin: 0 0 16px; padding-left: 24px; }
.markdown-body li { margin-bottom: 6px; }
.markdown-body blockquote {
  margin: 16px 0;
  padding: 12px 16px;
  background: var(--surface-alt);
  border-left: 4px solid var(--ink-subtle);
  border-radius: 0 8px 8px 0;
}
.markdown-body pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 16px;
  border-radius: 10px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13.5px;
}
.markdown-body code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--surface-alt);
  padding: 2px 6px;
  border-radius: 5px;
}
.markdown-body pre code { background: transparent; padding: 0; }

.table-wrap { overflow-x: auto; margin: 18px 0; border-radius: 10px; border: 1px solid var(--border); }
.geo-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.geo-table th { background: #f8fafc; text-align: left; padding: 11px 14px; font-weight: 700; border-bottom: 1px solid var(--border); }
.geo-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.geo-table tr:last-child td { border-bottom: none; }

.md-figure {
  margin: 20px 0;
  padding: 14px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.md-figure figcaption {
  margin-top: 10px;
  font-size: 13px;
  color: var(--ink-muted);
  text-align: center;
}

.article-extra-block {
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}
.faq-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 12px;
  background: #fafbfd;
}
.faq-q { font-weight: 700; color: var(--ink); margin-bottom: 6px; }
.faq-a { color: var(--ink-muted); font-size: 14.5px; margin: 0; }

.chapter-list { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 8px; }
.chapter-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: #f8fafc; border-radius: 8px; font-size: 14px; }
.chapter-time { font-family: var(--font-mono); font-weight: 700; color: var(--primary); background: var(--primary-soft); padding: 2px 8px; border-radius: 6px; font-size: 12.5px; }

/* Filter & Forms */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 24px;
}
.pill-link {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink-muted);
  font-size: 13.5px;
  font-weight: 600;
}
.pill-link.active, .pill-link:hover { background: var(--primary); color: #fff; border-color: var(--primary); text-decoration: none; }

.input, .textarea, .select {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font-size: 14.5px;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
}
.input:focus, .textarea:focus, .select:focus { outline: 2px solid #bfdbfe; border-color: var(--primary); }

/* Audit Tool */
.audit-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.tab-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.tab-btn {
  padding: 8px 16px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--ink-muted);
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.tab-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.audit-score-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 20px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid var(--border);
  margin: 20px 0;
}
.dim-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
}
.dim-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  background: #fff;
}
.dim-card.pass { border-left: 4px solid var(--emerald); }
.dim-card.warn { border-left: 4px solid var(--amber); }

.code-box {
  background: #0f172a;
  color: #e2e8f0;
  padding: 14px;
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  overflow-x: auto;
  white-space: pre-wrap;
  max-height: 300px;
}

/* Footer */
.site-footer {
  margin-top: 60px;
  background: #0f172a;
  color: #cbd5e1;
  padding: 40px 0 28px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr;
  gap: 28px;
}
@media (max-width: 760px) {
  .footer-grid { grid-template-columns: 1fr; }
}
.site-footer h4 { color: #fff; margin: 0 0 12px; font-size: 15px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 7px; font-size: 14px; }
.site-footer a { color: #93c5fd; }
.footer-bottom {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid #1e293b;
  font-size: 13px;
  color: #94a3b8;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
