/* AdAstra knowledge base: three-column docs layout in the light AdAstra theme.
   Reuses base.css tokens. No web fonts, no inline styles (strict CSP). */

.kb-shell { padding: 40px 0 80px; }

.kb-cols {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 220px;
  gap: 44px;
  align-items: start;
}

/* ---------- Breadcrumb ---------- */

.kb-breadcrumb {
  grid-column: 2;
  min-width: 0;
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}
.kb-breadcrumb a { color: var(--muted); text-decoration: none; }
.kb-breadcrumb a:hover { color: var(--ink); }

/* ---------- Left aside: category nav ---------- */

.kb-aside, .kb-rail {
  grid-row: 1 / -1;
  position: sticky;
  top: 96px;
  align-self: start;
  font-size: 0.9rem;
  max-height: calc(100vh - 116px);
  overflow-y: auto;
}

.kb-aside-title {
  font-weight: 700;
  color: var(--ink-2);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 12px;
}
.kb-aside-list {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.kb-aside-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  text-decoration: none;
  line-height: 1.3;
}
.kb-aside-list a:hover { color: var(--ink); background: var(--bg-tint); }
.kb-aside-list a.active {
  color: var(--blue-btn);
  background: var(--bg-tint);
  font-weight: 600;
}
.kb-aside-n {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--muted-2);
  font-size: 0.72rem;
  font-weight: 700;
}
.kb-aside-list a.active .kb-aside-n {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.kb-aside-all { margin: 0; }
.kb-aside-all a {
  display: inline-block;
  padding: 6px 10px;
  font-weight: 600;
  color: var(--purple-text);
  text-decoration: none;
}
.kb-aside-all a:hover { text-decoration: underline; }

/* ---------- Main article column ---------- */

.kb-main { grid-column: 2; min-width: 0; max-width: 46rem; line-height: 1.75; overflow-wrap: break-word; }
.kb-main h1 { font-size: clamp(2rem, 3.4vw, 2.6rem); letter-spacing: -0.02em; }
.kb-main h2 { scroll-margin-top: 96px; margin-top: 2.2em; }
.kb-main h3 { scroll-margin-top: 96px; margin-top: 1.6em; }
.kb-main ul, .kb-main ol { color: var(--muted); padding-left: 1.3em; }
.kb-main li { margin-bottom: 0.4em; }
.kb-main a { color: var(--blue-btn); }

.kb-eyebrow {
  color: var(--purple-text);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  display: inline-block;
  margin-bottom: 10px;
}
.kb-lead { font-size: 1.15rem; color: var(--muted); }
.kb-meta {
  color: var(--muted-2);
  font-size: 0.85rem;
  padding-bottom: 18px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* ---------- Callouts ---------- */

.kb-callout {
  border-left: 3px solid var(--blue);
  background: var(--bg-tint);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin: 1.2em 0;
  color: var(--ink);
}
.kb-callout p:last-child { margin-bottom: 0; }
.kb-callout-note { border-left-color: var(--blue); }
.kb-callout-warn { border-left-color: var(--purple); }

/* ---------- Code blocks ---------- */

.kb-code {
  background: var(--ink);
  color: #eaf1ff;
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin: 1.2em 0;
}
.kb-code-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  background: rgb(255 255 255 / 6%);
}
.kb-code-lang {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgb(234 241 255 / 65%);
}
.kb-code-copy {
  background: transparent;
  border: 1px solid rgb(255 255 255 / 25%);
  color: inherit;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  padding: 2px 10px;
}
.kb-code-copy:hover { border-color: rgb(255 255 255 / 45%); }
.kb-code pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.88rem;
  line-height: 1.6;
}
.kb-code code { font-family: inherit; }

/* ---------- Metrics ---------- */

.kb-metric { display: flex; align-items: center; gap: 12px; margin: 0.6em 0; }
.kb-metric-label { color: var(--ink); font-weight: 600; min-width: 12ch; }
.kb-metric-bar { width: 160px; height: 12px; accent-color: var(--blue); }
.kb-metric-value { color: var(--muted-2); font-size: 0.9rem; }

/* ---------- Tables ---------- */

.kb-table-wrap { overflow-x: auto; margin: 1.2em 0; }
.kb-table { border-collapse: collapse; width: 100%; font-size: 0.94rem; }
.kb-table th, .kb-table td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.kb-table th { background: var(--bg-tint); color: var(--ink-2); font-weight: 700; }
.kb-table td { color: var(--muted); }

/* ---------- Card grids (index + related) ---------- */

.kb-card-grid, .kb-related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.kb-card, .kb-related-card {
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  background: #fff;
  transition: box-shadow 0.16s ease, transform 0.16s ease;
}
.kb-card:hover, .kb-related-card:hover { box-shadow: var(--shadow-card); transform: translateY(-2px); }
.kb-card-tag, .kb-related-tag {
  display: block;
  color: var(--purple-text);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.kb-card-title, .kb-related-title {
  display: block;
  font-weight: 700;
  color: var(--ink);
  font-size: 1.02rem;
  margin-bottom: 6px;
}
.kb-card-lead, .kb-related-lead {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}
.kb-related { margin-top: 2.5em; }

/* ---------- CTA ---------- */

.kb-cta {
  background: var(--grad);
  color: #fff;
  border-radius: var(--radius-xl);
  padding: 28px;
  margin: 2.5em 0 1.5em;
}
.kb-cta-title { color: #fff; margin-top: 0; }
.kb-cta p { color: rgb(255 255 255 / 90%); }
.kb-cta .btn { background: #fff; color: var(--blue-btn); }

/* ---------- Helpful widget ---------- */

.kb-helpful {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 2em;
  color: var(--muted);
  font-size: 0.92rem;
}
.kb-helpful button {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: var(--radius-pill);
  padding: 4px 16px;
  cursor: pointer;
  font: inherit;
}
.kb-helpful button:hover { border-color: var(--blue); color: var(--blue-btn); }

/* ---------- Search (docs index) ---------- */

.kb-search { position: relative; max-width: 420px; margin: 0 auto; }
.kb-search input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font: inherit;
  color: var(--ink);
  background: #fff;
}
.kb-search input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgb(66 133 244 / 18%);
}
.kb-search-results {
  position: absolute;
  z-index: 5;
  width: 100%;
  margin: 6px 0 0;
  padding: 6px;
  list-style: none;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  text-align: left;
}
.kb-search-results li { margin: 0; }
.kb-search-results a {
  display: block;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--ink);
  text-decoration: none;
}
.kb-search-results a:hover { background: var(--bg-tint); }

/* ---------- Right rail: TOC + related ---------- */

.kb-rail-title {
  font-weight: 700;
  color: var(--ink-2);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 12px;
}
.kb-rail-toc, .kb-rail-related {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kb-rail-toc a, .kb-rail-related a {
  color: var(--muted);
  text-decoration: none;
  line-height: 1.4;
  display: block;
  padding: 2px 0;
}
.kb-rail-toc a:hover, .kb-rail-related a:hover { color: var(--ink); }
.kb-rail-toc a.active { color: var(--blue); font-weight: 600; }

/* ---------- /docs/ index page ---------- */

.kb-index-head { text-align: center; max-width: 620px; margin: 0 auto 56px; }
.kb-index-head .kb-lead { margin-bottom: 24px; }
.kb-index-cat { margin-bottom: 48px; }
.kb-index-cat h2 { margin-bottom: 20px; }

/* ---------- Mobile: collapse to a single column ---------- */

@media (max-width: 900px) {
  .kb-cols { grid-template-columns: 1fr; gap: 20px; }
  .kb-aside, .kb-rail {
    position: static;
    max-height: none;
    overflow-y: visible;
  }
  .kb-breadcrumb, .kb-main { grid-column: 1; }
}
