/* ============================================================
   NORTHSTAR DOCS — design system mirrors marketing/styles.css
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy-950:#060B18; --navy-900:#0A1530; --navy-800:#0C1B3A; --navy-700:#0F2545;
  --navy-600:#1A2F5A; --navy-500:#243A6A;
  --gold-600:#C8881C; --gold-500:#F5B13D; --gold-400:#FFD073; --gold-300:#FFE0A0;
  --aurora-600:#00B4B8; --aurora-500:#00D4D8; --aurora-400:#22D3EE; --aurora-300:#67E8F9;
  --steel-100:#F3F4F6; --steel-200:#E5E7EB; --steel-300:#D1D5DB; --steel-400:#9CA3AF;
  --steel-500:#6B7280; --steel-600:#4B5563; --steel-700:#374151;
  --ok:#10B981; --warn:#F59E0B; --error:#EF4444; --info:#3B82F6;

  --sb-w: 260px;
  --toc-w: 220px;
  --header-h: 60px;
  --content-max: 760px;
}

html, body { height: 100%; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  background: var(--navy-950);
  color: var(--steel-200);
  font-family: 'DM Sans', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.65;
  overflow-x: hidden;
}
body::before {
  content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: var(--aurora-400); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--aurora-300); }

/* ============================================================
   HEADER — mirrors the marketing-site nav
   ============================================================ */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  background: rgba(6, 11, 24, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  height: var(--header-h);
}
.site-header-inner {
  height: 100%;
  max-width: 1440px; margin: 0 auto;
  display: flex; align-items: center; gap: 32px; padding: 0 24px;
}
.brand {
  display: flex; align-items: center; gap: 12px;
  color: var(--steel-100);
  text-decoration: none !important;
}
.brand svg { flex-shrink: 0; }
.brand-text {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.04em;
  color: var(--steel-100);
}
.site-nav { display: flex; gap: 28px; flex: 1; margin-left: 16px; }
.nav-link {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-weight: 500;
  font-size: 14px;
  color: var(--steel-300);
  text-decoration: none !important;
  border-bottom: none !important;
  position: relative;
  padding: 6px 0;
  transition: color 0.18s;
}
.nav-link:hover { color: var(--gold-500); }
.nav-link.active { color: var(--gold-500); }
.nav-link.active::after {
  content: ''; position: absolute;
  bottom: -18px; left: 0; right: 0;
  height: 2px; background: var(--gold-500);
}
.nav-secondary {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-weight: 500; font-size: 14px;
  color: var(--steel-300);
  padding: 9px 14px;
  text-decoration: none !important;
  border-bottom: none !important;
  transition: color 0.18s;
}
.nav-secondary:hover { color: var(--steel-100); }
.nav-cta {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--gold-500); color: var(--navy-950) !important;
  padding: 9px 18px; border-radius: 8px;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-weight: 600; font-size: 14px;
  text-decoration: none !important;
  border: 1px solid var(--gold-500);
  border-bottom: 1px solid var(--gold-500) !important;
  transition: all 0.18s;
}
.nav-cta:hover {
  background: var(--gold-400);
  box-shadow: 0 0 24px -4px rgba(245,177,61,0.45);
}

.menu-toggle {
  display: none;
  background: transparent; color: var(--steel-300); font-size: 22px;
  padding: 6px 10px; border-radius: 6px;
  margin-left: 8px;
}
.menu-toggle:hover { color: var(--gold-500); background: rgba(255,255,255,0.04); }

@media (max-width: 980px) {
  .site-nav { display: none; }
  .nav-secondary { display: none; }
  .nav-cta { padding: 8px 14px; font-size: 13px; margin-left: auto; }
  .menu-toggle { display: block; }
}

/* ============================================================
   SIDEBAR SEARCH (search lives at the top of the sidebar now,
   not in the page header)
   ============================================================ */
.sidebar .search-box {
  position: relative;
  margin-bottom: 18px;
}
.sidebar .search-box input {
  width: 100%; height: 36px; padding: 0 12px 0 34px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  color: var(--steel-100); font-size: 13px;
  font-family: inherit;
  transition: all 0.15s;
}
.sidebar .search-box input:focus {
  outline: none;
  border-color: var(--gold-500);
  background: rgba(255,255,255,0.06);
}
.sidebar .search-box::before {
  content: '⌕'; position: absolute; left: 11px; top: 50%;
  transform: translateY(-50%); color: var(--steel-500); font-size: 15px;
  pointer-events: none;
}
#search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--navy-900);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  max-height: 60vh; overflow-y: auto;
  box-shadow: 0 12px 36px rgba(0,0,0,0.6);
  z-index: 60;
}
#search-results .hit {
  display: block; padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
#search-results .hit:last-child { border-bottom: none; }
#search-results .hit:hover { background: rgba(255,255,255,0.04); }
#search-results .hit-title { color: var(--gold-500); font-weight: 600; font-size: 13px; margin-bottom: 2px; }
#search-results .hit-cat { color: var(--steel-500); font-size: 11px; font-family: 'JetBrains Mono', monospace; text-transform: uppercase; }
#search-results .hit-snippet { color: var(--steel-400); font-size: 12px; margin-top: 4px; line-height: 1.5; }
#search-results .empty { padding: 14px; color: var(--steel-500); font-size: 13px; text-align: center; }

/* ============================================================
   LAYOUT
   ============================================================ */
.layout {
  display: grid;
  grid-template-columns: var(--sb-w) 1fr var(--toc-w);
  gap: 48px;
  max-width: 1440px; margin: 0 auto;
  padding: calc(var(--header-h) + 32px) 32px 64px;
  position: relative; z-index: 1;
}
@media (max-width: 1200px) {
  .layout { grid-template-columns: var(--sb-w) 1fr; }
  .toc { display: none; }
}
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; padding: calc(var(--header-h) + 20px) 20px 48px; gap: 24px; }
  .sidebar { display: none; position: fixed; inset: var(--header-h) 0 0 0; z-index: 40; background: var(--navy-950); }
  .sidebar.open { display: block; }
  .sidebar-inner { padding: 24px; max-height: calc(100vh - var(--header-h)); overflow-y: auto; }
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  position: sticky; top: calc(var(--header-h) + 32px);
  align-self: start;
  height: calc(100vh - var(--header-h) - 64px);
  overflow-y: auto;
  padding-right: 8px;
  scrollbar-width: thin; scrollbar-color: var(--steel-700) transparent;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--steel-700); border-radius: 3px; }

.sb { list-style: none; }
.sb-home a {
  display: block; padding: 8px 12px; border-radius: 6px;
  color: var(--steel-300); font-size: 13px; font-weight: 600;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  margin-bottom: 18px;
}
.sb-home a:hover { background: rgba(255,255,255,0.04); color: var(--gold-500); }

.sb-cat { margin-bottom: 18px; }
.sb-cat-label {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--steel-500);
  padding: 0 12px 6px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  margin-bottom: 6px;
}
.sb-cat ul { list-style: none; }
.sb-cat li { line-height: 1.4; }
.sb-cat li a {
  display: block; padding: 6px 12px; border-radius: 6px;
  color: var(--steel-300); font-size: 13px;
  border-left: 2px solid transparent;
}
.sb-cat li a:hover { background: rgba(255,255,255,0.04); color: var(--steel-100); }
.sb-cat li.active a {
  color: var(--gold-500);
  background: rgba(245, 177, 61, 0.08);
  border-left-color: var(--gold-500);
  font-weight: 600;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.content { min-width: 0; max-width: var(--content-max); }
.crumbs {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; color: var(--steel-500);
  margin-bottom: 20px;
  display: flex; align-items: center; gap: 8px;
}
.crumbs a { color: var(--steel-400); }
.crumbs a:hover { color: var(--gold-500); }
.crumbs span { color: var(--steel-600); }

article h1 {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-weight: 700;
  font-size: clamp(28px, 4vw, 38px);
  line-height: 1.15;
  letter-spacing: -0.025em;
  color: var(--steel-100);
  margin-bottom: 28px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
article h2 {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-weight: 700;
  font-size: 24px;
  letter-spacing: -0.015em;
  color: var(--steel-100);
  margin: 48px 0 14px;
  padding-top: 8px;
}
article h3 {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-weight: 600;
  font-size: 18px;
  color: var(--steel-100);
  margin: 28px 0 10px;
}
article h4 {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-weight: 600;
  font-size: 15px;
  color: var(--steel-200);
  margin: 20px 0 8px;
  text-transform: uppercase; letter-spacing: 0.06em;
}
article p { margin-bottom: 14px; color: var(--steel-300); font-size: 15px; }
article p strong { color: var(--steel-100); font-weight: 600; }
article ul, article ol { margin: 0 0 18px 22px; }
article li { margin-bottom: 6px; color: var(--steel-300); font-size: 15px; }
article li::marker { color: var(--gold-500); }

article code {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.88em;
  background: rgba(245, 177, 61, 0.08);
  color: var(--gold-400);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(245, 177, 61, 0.16);
}
article pre {
  background: var(--navy-900);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  padding: 16px 18px;
  overflow-x: auto;
  margin: 14px 0 18px;
  font-size: 13px; line-height: 1.6;
}
article pre code {
  background: transparent;
  border: none; padding: 0;
  color: var(--steel-200);
  font-size: inherit;
}

article .table-wrap { overflow-x: auto; margin: 16px 0 22px; }
article table {
  width: 100%; border-collapse: collapse;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  overflow: hidden;
  font-size: 13px;
}
article th, article td {
  text-align: left; padding: 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
article th {
  background: rgba(245, 177, 61, 0.08);
  color: var(--gold-500);
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-weight: 600;
  letter-spacing: 0.02em;
}
article tr:last-child td { border-bottom: none; }

article a {
  color: var(--aurora-400);
  border-bottom: 1px solid rgba(34, 211, 238, 0.3);
}
article a:hover { color: var(--aurora-300); border-bottom-color: var(--aurora-300); }

/* Anchor offset for sticky header */
article h2[id], article h3[id], article h4[id] { scroll-margin-top: calc(var(--header-h) + 24px); }

/* ============================================================
   ON-PAGE TOC
   ============================================================ */
.toc {
  position: sticky; top: calc(var(--header-h) + 32px);
  align-self: start;
  font-size: 12px;
}
.toc h2 {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--steel-500);
  margin-bottom: 12px;
}
.toc ul { list-style: none; border-left: 1px solid rgba(255,255,255,0.06); padding-left: 12px; }
.toc li { line-height: 1.4; margin-bottom: 6px; }
.toc li a { color: var(--steel-400); font-size: 12px; }
.toc li a:hover { color: var(--gold-500); }
.toc-l3 { padding-left: 12px; }
.toc-l4 { padding-left: 24px; font-size: 11px; }
.toc-empty { color: var(--steel-600); font-size: 11px; }

/* ============================================================
   PAGER
   ============================================================ */
.pager {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  margin-top: 64px; padding-top: 32px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.pager > * {
  padding: 14px 18px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  text-decoration: none !important;
  border-bottom: 1px solid rgba(255,255,255,0.06) !important;
  transition: all 0.15s;
  display: flex; flex-direction: column; gap: 4px;
}
.pager > a:hover {
  border-color: var(--gold-500);
  background: rgba(245, 177, 61, 0.04);
}
.pager span { font-family: 'JetBrains Mono', monospace; font-size: 10px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--steel-500); }
.pager strong { color: var(--steel-100); font-family: 'Space Grotesk', sans-serif; font-size: 14px; font-weight: 600; }
.pager-next { text-align: right; }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 24px 32px;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: var(--steel-500);
  position: relative; z-index: 2;
}
.footer-right { display: flex; gap: 18px; }
.footer-right a { color: var(--steel-400); }
.footer-right a:hover { color: var(--gold-500); }
@media (max-width: 600px) {
  .site-footer { flex-direction: column; gap: 10px; text-align: center; }
}

/* ============================================================
   LANDING PAGE
   ============================================================ */
.hero { margin-bottom: 56px; }
.hero .eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--gold-500);
  margin-bottom: 18px;
}
.hero .eyebrow::before { content: ''; width: 28px; height: 1px; background: var(--gold-500); }
.hero h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: clamp(34px, 5vw, 52px);
  line-height: 1.05;
  letter-spacing: -0.025em;
  background: linear-gradient(180deg, #FFFFFF 0%, #C0C8D8 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  margin-bottom: 22px;
  border: none; padding: 0;
}
.hero .lede {
  font-size: 17px; line-height: 1.6;
  color: var(--steel-300);
  max-width: 640px;
  margin-bottom: 28px;
}
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.btn-primary, .btn-secondary {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 12px 22px; border-radius: 9px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 14px; font-weight: 600;
  border-bottom: none !important;
  transition: all 0.18s;
}
.btn-primary {
  background: var(--gold-500); color: var(--navy-950) !important;
  border: 1px solid var(--gold-500);
}
.btn-primary:hover { background: var(--gold-400); box-shadow: 0 0 28px -4px rgba(245,177,61,0.45); }
.btn-secondary {
  background: transparent; color: var(--steel-100) !important;
  border: 1px solid rgba(255,255,255,0.16);
}
.btn-secondary:hover { border-color: var(--aurora-500); color: var(--aurora-300) !important; }

.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
  margin-bottom: 64px;
}
.cat-card {
  display: block;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 22px 22px 18px;
  color: inherit !important; text-decoration: none !important;
  border-bottom: 1px solid rgba(255,255,255,0.06) !important;
  transition: all 0.18s;
}
.cat-card:hover {
  border-color: var(--gold-500);
  background: rgba(245, 177, 61, 0.03);
  transform: translateY(-2px);
}
.cat-icon {
  width: 36px; height: 36px; border-radius: 8px;
  background: rgba(245, 177, 61, 0.1);
  border: 1px solid rgba(245, 177, 61, 0.25);
  color: var(--gold-500);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700;
  margin-bottom: 12px;
  font-family: 'JetBrains Mono', monospace;
}
.cat-card h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700; font-size: 17px;
  color: var(--steel-100);
  margin-bottom: 12px;
}
.cat-links { list-style: none; }
.cat-links li { font-size: 13px; padding: 3px 0; }
.cat-links li a {
  color: var(--steel-400);
  display: block;
  padding: 2px 0;
  border-bottom: none !important;
}
.cat-links li a:hover { color: var(--gold-500); }
.cat-links li.more { margin-top: 6px; }
.cat-links li.more a { color: var(--aurora-400); font-weight: 600; }

.cta {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 32px;
  margin-bottom: 32px;
}
.cta h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700; font-size: 22px;
  color: var(--steel-100); margin-bottom: 10px;
  border: none; padding: 0;
}
.cta p { font-size: 14px; color: var(--steel-400); margin-bottom: 12px; }
.cta .callout {
  padding: 14px 16px;
  background: rgba(0, 212, 216, 0.04);
  border: 1px solid rgba(0, 212, 216, 0.18);
  border-radius: 8px;
  color: var(--steel-300);
  font-size: 13px;
}
.cta .callout a { color: var(--aurora-300); font-weight: 600; }
