:root {
  --bg: #05050f;
  --bg-elevated: #0b0b1a;
  --bg-card: #101026;
  --border: rgba(255,255,255,0.08);
  --border-soft: rgba(255,255,255,0.05);
  --text: #eceaf6;
  --text-dim: #9694ab;
  --text-faint: #625f78;
  --accent: #5865F2;
  --accent2: #eb459e;
  --accent-soft: rgba(88,101,242,0.12);
  --mono: "JetBrains Mono", monospace;
  --radius: 10px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 900px 500px at 15% -10%, rgba(88,101,242,0.16), transparent 60%),
    radial-gradient(ellipse 700px 500px at 100% 0%, rgba(235,69,158,0.10), transparent 60%);
  background-attachment: fixed;
  color: var(--text);
  font-family: "DM Sans", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

code, .mono { font-family: var(--mono); }

/* ---------- Scrollbar ---------- */

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.18) rgba(255,255,255,0.03);
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.03);
}
::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.16);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}
::-webkit-scrollbar-corner {
  background: transparent;
}

/* ---------- Topbar ---------- */

.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0 1.25rem;
  background: rgba(5,5,15,0.85);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 0.4rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-family: "Syne", sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  white-space: nowrap;
}
.brand-icon { width: 26px; height: 26px; border-radius: 7px; }
.brand em {
  font-style: normal;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.search-wrap {
  position: relative;
  flex: 1;
  max-width: 460px;
  margin: 0 auto;
}
.search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-faint); pointer-events: none;
}
#searchInput {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  padding: 0.55rem 2.4rem 0.55rem 2.2rem;
  outline: none;
  transition: border-color 0.2s;
}
#searchInput:focus { border-color: var(--accent); }
.search-kbd {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-faint);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  pointer-events: none;
}
.search-results {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  max-height: 380px;
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  padding: 0.4rem;
}
.search-results.open { display: block; }
.search-result-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.7rem;
  border-radius: 7px;
  cursor: pointer;
}
.search-result-item:hover { background: var(--accent-soft); }
.search-result-name { font-weight: 600; font-size: 0.88rem; }
.search-result-cat { margin-left: auto; font-size: 0.72rem; color: var(--text-faint); }
.search-empty { padding: 1rem; color: var(--text-faint); font-size: 0.85rem; text-align: center; }

.topbar-link {
  font-size: 0.82rem;
  color: var(--text-dim);
  white-space: nowrap;
  border: 1px solid var(--border);
  padding: 0.4rem 0.8rem;
  border-radius: 7px;
  transition: color 0.2s, border-color 0.2s;
}
.topbar-link:hover { color: var(--text); border-color: var(--accent); }

/* ---------- Layout ---------- */

.layout {
  display: grid;
  grid-template-columns: 250px 220px minmax(0, 1fr);
  max-width: 1440px;
  margin: 0 auto;
  padding-top: 60px;
}

.sidebar {
  grid-column: 1;
  grid-row: 1;
  height: calc(100vh - 60px);
  position: sticky;
  top: 60px;
  overflow-y: auto;
  border-right: 1px solid var(--border-soft);
  padding: 1.5rem 0.9rem;
}
.sidebar-inner { display: flex; flex-direction: column; gap: 1.6rem; }

.nav-group { display: flex; flex-direction: column; gap: 0.15rem; }

.nav-section { display: flex; flex-direction: column; }
.nav-section + .nav-section { margin-top: 1.2rem; }
.nav-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  padding: 0.4rem 0.7rem;
  margin: 0.4rem 0 0.15rem;
  text-transform: uppercase;
  transition: color 0.15s;
}
.nav-section-header:hover { color: var(--text-dim); }
.nav-section-header .chevron { flex-shrink: 0; transition: transform 0.2s ease; }
.nav-section.collapsed .nav-section-header .chevron { transform: rotate(-90deg); }
.nav-section-body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  overflow: hidden;
}
.nav-section.collapsed .nav-section-body {
  display: none;
}
.nav-link {
  padding: 0.45rem 0.7rem;
  border-radius: 7px;
  font-size: 0.86rem;
  color: var(--text-dim);
  border-left: 2px solid transparent;
  transition: background 0.15s, color 0.15s;
}
.nav-link:hover { background: var(--bg-card); color: var(--text); }
.nav-link.active {
  background: var(--accent-soft);
  color: #fff;
  border-left: 2px solid var(--accent);
  font-weight: 600;
}
.nav-count {
  float: right;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-faint);
}

.toc {
  grid-column: 2;
  grid-row: 1;
  height: calc(100vh - 60px);
  position: sticky;
  top: 60px;
  overflow-y: auto;
  border-right: 1px solid var(--border-soft);
  padding: 1.5rem 1rem;
}
.toc-label {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin-bottom: 0.8rem;
}
.toc-link {
  display: block;
  font-size: 0.82rem;
  color: var(--text-dim);
  padding: 0.3rem 0;
  border-left: 2px solid var(--border);
  padding-left: 0.7rem;
  transition: color 0.15s, border-color 0.15s;
}
.toc-link:hover, .toc-link.active { color: var(--text); border-color: var(--accent); }

.content {
  grid-column: 3;
  grid-row: 1;
  padding: 2.5rem 3rem 6rem;
  min-width: 0;
}

/* ---------- Content typography ---------- */

.page-eyebrow {
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 0.4rem;
}
.page-title {
  font-family: "Syne", sans-serif;
  font-weight: 800;
  font-size: 2rem;
  margin: 0 0 0.6rem;
  letter-spacing: -0.01em;
}
.page-lede {
  color: var(--text-dim);
  font-size: 1.02rem;
  max-width: 640px;
  margin: 0 0 2.2rem;
}

.content h2 {
  font-family: "Syne", sans-serif;
  font-weight: 700;
  font-size: 1.3rem;
  margin: 2.4rem 0 1rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--border-soft);
}
.content h2:first-of-type { border-top: none; padding-top: 0; margin-top: 0.5rem; }
.content h3 { font-family: "Syne", sans-serif; font-size: 1.05rem; margin: 1.6rem 0 0.6rem; }
.content p { color: var(--text-dim); max-width: 720px; }
.content ul { color: var(--text-dim); max-width: 720px; padding-left: 1.2rem; }
.content li { margin-bottom: 0.35rem; }
.content strong { color: var(--text); }

.meta-line {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.78rem;
  color: var(--text-faint);
  margin: 2.5rem 0 0.5rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border-soft);
}

/* ---------- Stat cards (home) ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.8rem;
  max-width: 720px;
  margin: 1.5rem 0 2.5rem;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}
.stat-num {
  font-family: "Syne", sans-serif;
  font-weight: 800;
  font-size: 1.7rem;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat-label { font-size: 0.78rem; color: var(--text-faint); margin-top: 0.15rem; }

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.7rem;
  margin: 1.5rem 0;
}
.category-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  transition: border-color 0.15s, transform 0.15s;
}
.category-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.category-card-name { font-weight: 600; font-size: 0.9rem; }
.category-card-count { font-size: 0.76rem; color: var(--text-faint); margin-top: 0.2rem; }

/* ---------- Command cards ---------- */

.cmd-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  margin-bottom: 0.9rem;
  scroll-margin-top: 80px;
}
.cmd-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 0.5rem;
}
.cmd-name {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.98rem;
  color: #fff;
}
.cmd-badge {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.15rem 0.5rem;
  border-radius: 100px;
  border: 1px solid;
}
.cmd-badge.slash { color: var(--accent); border-color: rgba(88,101,242,0.4); background: rgba(88,101,242,0.1); }
.cmd-badge.prefix { color: var(--accent2); border-color: rgba(235,69,158,0.4); background: rgba(235,69,158,0.1); }
.cmd-alias {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-faint);
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  padding: 0.1rem 0.45rem;
  border-radius: 5px;
}
.cmd-desc { color: var(--text-dim); font-size: 0.9rem; margin: 0.3rem 0 0; }
.cmd-options {
  margin-top: 0.7rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.cmd-option {
  display: flex;
  gap: 0.5rem;
  font-size: 0.82rem;
  align-items: baseline;
}
.cmd-option-name { font-family: var(--mono); color: var(--text); white-space: nowrap; }
.cmd-option-req { color: var(--accent2); font-size: 0.68rem; }
.cmd-option-desc { color: var(--text-faint); }

/* ---------- FAQ ---------- */

.faq-item {
  border-bottom: 1px solid var(--border-soft);
  padding: 1.1rem 0;
}
.faq-q {
  font-weight: 600;
  font-size: 0.98rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.faq-q::after { content: "+"; color: var(--accent); font-size: 1.2rem; flex-shrink: 0; }
.faq-item.open .faq-q::after { content: "–"; }
.faq-a {
  color: var(--text-dim);
  font-size: 0.88rem;
  max-width: 680px;
  margin-top: 0.6rem;
  display: none;
}
.faq-item.open .faq-a { display: block; }

/* ---------- Steps (getting started) ---------- */

.step {
  display: flex;
  gap: 1rem;
  margin: 1.3rem 0;
  max-width: 700px;
}
.step-num {
  font-family: "Syne", sans-serif;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--accent);
  border: 1px solid var(--border);
  background: var(--bg-card);
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.step-body h3 { margin: 0.1rem 0 0.3rem; }
.step-body p { margin: 0; }

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

.callout {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  background: var(--bg-card);
  border-radius: 8px;
  padding: 0.9rem 1.1rem;
  margin: 1.3rem 0;
  max-width: 680px;
  font-size: 0.86rem;
  color: var(--text-dim);
}
.callout strong { color: var(--text); }

/* ---------- Responsive ---------- */

@media (max-width: 1080px) {
  .layout { grid-template-columns: 230px minmax(0,1fr); }
  .toc { display: none; }
  .content { grid-column: 2; }
}

@media (max-width: 780px) {
  .menu-toggle { display: block; }
  .topbar-link { display: none; }
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0; top: 60px; bottom: 0;
    width: 260px;
    background: var(--bg-elevated);
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 90;
    box-shadow: 20px 0 40px rgba(0,0,0,0.4);
  }
  .sidebar.open { transform: translateX(0); }
  .content { grid-column: 1; padding: 2rem 1.25rem 5rem; }
  .search-wrap { max-width: none; }
}
