/* ─── Design tokens ────────────────────────────────────────────────────── */
:root {
  --brand:        #0051ff;
  --brand-soft:   #eff4ff;
  --brand-line:   #c8d7f8;
  --ink:          #0f172a;
  --ink-2:        #1e293b;
  --ink-3:        #475569;
  --ink-4:        #94a3b8;
  --ink-5:        #cbd5e1;
  --bg:           #ffffff;
  --bg-sunken:    #f8fafc;
  --line:         #e2e8f0;
  --line-soft:    #f1f5f9;
  --panel:        #ffffff;
  --good:         #16a34a;
  --good-soft:    #f0fdf4;
  --warn:         #d97706;
  --warn-soft:    #fffbeb;
  --bad:          #dc2626;
  --bad-soft:     #fef2f2;
  --radius-sm:    6px;
  --radius:       10px;
  --radius-lg:    14px;
  --font: "Geist", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --mono: "Geist Mono", "JetBrains Mono", ui-monospace, monospace;
  --max-w:        1120px;
  --art-w:        720px;
}

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

html {
  font-family: var(--font);
  font-size: 15px;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.006em;
}

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

img { max-width: 100%; }

/* ─── Top nav ───────────────────────────────────────────────────────────── */
.topnav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 56px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}
.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.brand-mark.sm { width: 22px; height: 22px; font-size: 11px; border-radius: 5px; }
.brand-name { font-weight: 600; font-size: 14px; color: var(--ink); }
.brand-sep { color: var(--ink-5); font-size: 16px; }
.brand-sub { font-size: 13px; color: var(--ink-4); }

.topnav-links a {
  font-size: 13px;
  color: var(--ink-3);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  transition: background 0.1s, color 0.1s;
}
.topnav-links a:hover { background: var(--bg-sunken); color: var(--ink); text-decoration: none; }

/* ─── Hero ──────────────────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(180deg, #f8faff 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--line-soft);
  padding: 64px 24px 48px;
  text-align: center;
}

.hero-title {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ink);
  margin-bottom: 12px;
}

.hero-sub {
  font-size: 16px;
  color: var(--ink-3);
  margin-bottom: 28px;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.5;
}

.search-wrap {
  position: relative;
  max-width: 520px;
  margin: 0 auto;
}
.search-ico {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--ink-4);
  pointer-events: none;
}
.search-input {
  width: 100%;
  height: 48px;
  padding: 0 52px 0 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  font-family: var(--font);
  font-size: 14px;
  color: var(--ink);
  outline: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}
.search-input::placeholder { color: var(--ink-4); }
.search-kbd {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-4);
  background: var(--bg-sunken);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 6px;
}

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
  z-index: 200;
  overflow: hidden;
  max-height: 360px;
  overflow-y: auto;
}
.search-result-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid var(--line-soft);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--bg-sunken); text-decoration: none; }
.sr-section { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-4); margin-bottom: 2px; }
.sr-title { font-size: 13px; font-weight: 500; color: var(--ink); }
.sr-desc  { font-size: 12px; color: var(--ink-4); margin-top: 1px; }
.sr-ico { font-size: 18px; margin-top: 2px; flex-shrink: 0; }
.search-empty { padding: 24px; text-align: center; color: var(--ink-4); font-size: 13px; }

/* ─── Container ─────────────────────────────────────────────────────────── */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

/* ─── Quick links ────────────────────────────────────────────────────────── */
.quick { padding: 32px 24px 0; }
.quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}
.quick-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.12s, box-shadow 0.12s, transform 0.12s;
}
.quick-card:hover {
  border-color: var(--brand-line);
  box-shadow: 0 2px 12px rgba(37,99,235,0.08);
  transform: translateY(-1px);
  text-decoration: none;
}
.quick-ico {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.quick-ico svg { width: 20px; height: 20px; }
.quick-title { font-weight: 600; font-size: 14px; color: var(--ink); }
.quick-desc  { font-size: 12px; color: var(--ink-4); margin-top: 2px; }
.quick-arrow { width: 16px; height: 16px; color: var(--ink-5); margin-left: auto; flex-shrink: 0; }

/* ─── Categories ─────────────────────────────────────────────────────────── */
.categories { padding: 40px 24px 64px; }
.section-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-4);
  margin-bottom: 20px;
}
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.cat-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  background: var(--panel);
  transition: border-color 0.12s, box-shadow 0.12s;
}
.cat-card:hover { border-color: var(--ink-5); box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.cat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.cat-ico {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.cat-ico svg { width: 20px; height: 20px; }
.cat-name  { font-weight: 600; font-size: 14px; color: var(--ink); }
.cat-count { font-size: 11px; color: var(--ink-4); margin-top: 1px; }
.cat-links { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.cat-links a {
  font-size: 13px;
  color: var(--ink-3);
  text-decoration: none;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  display: block;
  transition: background 0.08s, color 0.08s;
}
.cat-links a:hover { background: var(--bg-sunken); color: var(--ink); text-decoration: none; }
.cat-links a.highlight { color: var(--brand); font-weight: 500; }
.cat-links a.highlight:hover { background: var(--brand-soft); }

/* ─── Article layout ─────────────────────────────────────────────────────── */
.page-wrap {
  display: grid;
  grid-template-columns: 240px 1fr;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
  gap: 48px;
  align-items: flex-start;
}

/* Sidebar nav */
.art-sidebar {
  position: sticky;
  top: 72px;
  padding: 32px 0;
}
.art-sidebar-section {
  margin-bottom: 24px;
}
.art-sidebar-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-4);
  padding: 0 8px;
  margin-bottom: 6px;
}
.art-sidebar-links { list-style: none; }
.art-sidebar-links a {
  display: block;
  padding: 6px 8px;
  font-size: 13px;
  color: var(--ink-3);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background 0.08s, color 0.08s;
}
.art-sidebar-links a:hover { background: var(--bg-sunken); color: var(--ink); text-decoration: none; }
.art-sidebar-links a.active { background: var(--brand-soft); color: var(--brand); font-weight: 500; }

/* Article content */
.article {
  padding: 40px 0 80px;
  max-width: var(--art-w);
}

.art-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-4);
  margin-bottom: 20px;
}
.art-breadcrumb a { color: var(--ink-4); text-decoration: none; }
.art-breadcrumb a:hover { color: var(--ink); }
.art-breadcrumb .sep { color: var(--ink-5); }

.art-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brand);
  background: var(--brand-soft);
  border: 1px solid var(--brand-line);
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 12px;
}

.art-title {
  font-size: clamp(22px, 3vw, 32px);
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--ink);
  line-height: 1.2;
  margin-bottom: 12px;
}

.art-lead {
  font-size: 16px;
  color: var(--ink-3);
  line-height: 1.6;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

/* Headings */
.article h2 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 40px 0 12px;
}
.article h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  margin: 28px 0 10px;
}

/* Paragraphs & lists */
.article p { font-size: 15px; line-height: 1.7; color: var(--ink-2); margin-bottom: 16px; }
.article ul, .article ol {
  padding-left: 20px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.article li { font-size: 15px; line-height: 1.6; color: var(--ink-2); }
.article code {
  font-family: var(--mono);
  font-size: 13px;
  background: var(--bg-sunken);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--ink);
}

/* Code blocks */
.article pre {
  background: #0f172a;
  border-radius: var(--radius);
  padding: 18px 20px;
  overflow-x: auto;
  margin: 16px 0;
  position: relative;
}
.article pre code {
  font-family: var(--mono);
  font-size: 13px;
  background: none;
  border: none;
  padding: 0;
  color: #e2e8f0;
  line-height: 1.6;
}
.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 5px;
  color: #94a3b8;
  font-size: 11px;
  font-family: var(--font);
  padding: 3px 10px;
  cursor: pointer;
  transition: background 0.1s;
}
.copy-btn:hover { background: rgba(255,255,255,0.18); color: #e2e8f0; }

/* Callouts */
.callout {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border-left: 3px solid;
  margin: 20px 0;
  font-size: 14px;
  line-height: 1.5;
}
.callout.info    { background: var(--brand-soft); border-color: var(--brand); color: #1e3a8a; }
.callout.warn    { background: var(--warn-soft);  border-color: var(--warn);  color: #78350f; }
.callout.success { background: var(--good-soft);  border-color: var(--good);  color: #14532d; }
.callout.danger  { background: var(--bad-soft);   border-color: var(--bad);   color: #7f1d1d; }
.callout-ico { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.callout strong { font-weight: 600; display: block; margin-bottom: 3px; }

/* Troubleshooting cards */
.trouble-list { display: flex; flex-direction: column; gap: 12px; margin: 20px 0; }
.trouble-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.trouble-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
  background: var(--panel);
  transition: background 0.1s;
}
.trouble-header:hover { background: var(--bg-sunken); }
.trouble-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 999px;
  flex-shrink: 0;
}
.tb-error  { background: #fee2e2; color: #991b1b; }
.tb-warn   { background: #fef3c7; color: #92400e; }
.tb-info   { background: #dbeafe; color: #1e40af; }
.trouble-q { font-size: 14px; font-weight: 500; color: var(--ink); flex: 1; }
.trouble-chevron { color: var(--ink-4); transition: transform 0.15s; }
.trouble-card.open .trouble-chevron { transform: rotate(180deg); }
.trouble-body {
  display: none;
  padding: 0 16px 16px 42px;
  font-size: 14px;
  color: var(--ink-2);
  line-height: 1.6;
  border-top: 1px solid var(--line-soft);
  background: var(--bg-sunken);
}
.trouble-card.open .trouble-body { display: block; padding-top: 14px; }

/* Steps */
.steps-list { counter-reset: steps; list-style: none; padding: 0; margin: 20px 0; display: flex; flex-direction: column; gap: 0; }
.step-item {
  display: flex;
  gap: 16px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line-soft);
}
.step-item:last-child { border-bottom: none; }
.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  margin-top: 2px;
}
.step-content { flex: 1; min-width: 0; }
.step-title { font-size: 15px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.step-desc  { font-size: 14px; color: var(--ink-3); line-height: 1.5; }

/* Table */
.article table { width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 14px; }
.article th {
  text-align: left;
  padding: 10px 14px;
  background: var(--bg-sunken);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.article td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-2);
  vertical-align: top;
}
.article tr:last-child td { border-bottom: none; }

/* Tags */
.tag-req  { display: inline-block; background: #fee2e2; color: #991b1b; font-size: 11px; font-weight: 600; border-radius: 4px; padding: 1px 6px; }
.tag-opt  { display: inline-block; background: #f1f5f9; color: #475569;  font-size: 11px; font-weight: 600; border-radius: 4px; padding: 1px 6px; }
.tag-code { font-family: var(--mono); background: var(--bg-sunken); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; font-size: 12px; }

/* Nav footer */
.art-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.art-nav-btn {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  transition: border-color 0.1s, box-shadow 0.1s;
  max-width: 240px;
  flex: 1;
}
.art-nav-btn:hover { border-color: var(--brand-line); box-shadow: 0 2px 8px rgba(37,99,235,0.08); text-decoration: none; }
.art-nav-btn.next { align-items: flex-end; }
.art-nav-label { font-size: 11px; color: var(--ink-4); font-weight: 500; }
.art-nav-title { font-size: 14px; font-weight: 600; color: var(--ink); }

/* TOC (table of contents) */
.toc {
  position: sticky;
  top: 72px;
  padding: 32px 0;
  font-size: 12px;
}
.toc-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-4); margin-bottom: 10px; }
.toc-links { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.toc-links a {
  display: block;
  padding: 4px 8px;
  color: var(--ink-4);
  border-radius: 4px;
  text-decoration: none;
  transition: color 0.1s, background 0.1s;
  border-left: 2px solid transparent;
}
.toc-links a:hover { color: var(--ink); background: var(--bg-sunken); }
.toc-links a.active { color: var(--brand); border-left-color: var(--brand); background: var(--brand-soft); }

/* 3-col article layout: sidebar | content | toc */
.art-layout {
  display: grid;
  grid-template-columns: 220px 1fr 180px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  gap: 40px;
  align-items: flex-start;
}

/* ─── Footer ─────────────────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--line);
  background: var(--bg-sunken);
  padding: 24px 0;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-3);
}
.footer-links {
  display: flex;
  gap: 20px;
}
.footer-links a { font-size: 13px; color: var(--ink-4); text-decoration: none; }
.footer-links a:hover { color: var(--ink); }

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .art-layout { grid-template-columns: 1fr; }
  .art-sidebar, .toc { display: none; }
  .art-layout > .article { max-width: 100%; padding: 24px 0 48px; }
}

@media (max-width: 768px) {
  .topnav { padding: 0 16px; }
  .hero { padding: 40px 16px 32px; }
  .quick { padding: 24px 16px 0; }
  .categories { padding: 32px 16px 48px; }
  .cat-grid { grid-template-columns: 1fr; }
  .quick-grid { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; align-items: flex-start; gap: 12px; }
  .brand-sub { display: none; }
}
