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

/* ---- Tokens ---- */
:root {
  --bg:         #0d0d12;
  --surface:    #13131a;
  --surface-2:  #1a1a26;
  --border:     #252533;
  --primary:    #e07b39;
  --primary-dim: #b86228;
  --blue:       #7aa2f7;
  --green:      #9ece6a;
  --purple:     #bb9af7;
  --red:        #f7768e;
  --yellow:     #e0af68;
  --text:       #c9d1d9;
  --text-2:     #8b949e;
  --text-3:     #555870;
  --code-bg:    #0d1117;
  --nav-w:      260px;
  --radius:     8px;
  --font-mono:  "Fira Code", "Cascadia Code", ui-monospace, monospace;
}

/* ---- Base ---- */
html { scroll-behavior: smooth; }

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 15px;
}

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

/* ---- Layout ---- */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
  width: var(--nav-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.sidebar-header {
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sidebar-logo svg { flex-shrink: 0; }

.sidebar-version {
  font-size: 0.72rem;
  color: var(--text-3);
  margin-top: 0.25rem;
  font-family: var(--font-mono);
}

.sidebar-links {
  padding: 0.75rem 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-group-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 0.75rem 1.25rem 0.3rem;
}

.sidebar-link {
  display: block;
  padding: 0.35rem 1.25rem;
  font-size: 0.875rem;
  color: var(--text-2);
  border-left: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.sidebar-link:hover {
  color: var(--text);
  background: var(--surface-2);
  text-decoration: none;
}

.sidebar-link.active {
  color: var(--primary);
  border-left-color: var(--primary);
  background: rgba(224, 123, 57, 0.06);
}

.sidebar-link.sub {
  padding-left: 2rem;
  font-size: 0.83rem;
}

/* ---- Content ---- */
.content {
  flex: 1;
  width: 100%;
  min-width: 0;
  max-width: 860px;
  margin: 0 auto;
  padding: 3rem 3.5rem;
}

/* ---- Hero ---- */
.hero {
  margin-bottom: 3.5rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
}

.hero-name {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #fff;
  margin-bottom: 0.5rem;
  line-height: 1.1;
}

.hero-name span { color: var(--primary); }

.hero-tagline {
  font-size: 1.1rem;
  color: var(--text-2);
  margin-bottom: 1.25rem;
  max-width: 560px;
}

.badges { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-weight: 600;
}

.badge-orange { background: rgba(224,123,57,.15); color: var(--primary); border: 1px solid rgba(224,123,57,.3); }
.badge-blue   { background: rgba(122,162,247,.12); color: var(--blue);   border: 1px solid rgba(122,162,247,.25); }
.badge-green  { background: rgba(158,206,106,.12); color: var(--green);  border: 1px solid rgba(158,206,106,.25); }

/* ---- Sections ---- */
.section {
  margin-bottom: 3.5rem;
  scroll-margin-top: 1.5rem;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-title::before {
  content: '';
  display: block;
  width: 3px;
  height: 1.2em;
  background: var(--primary);
  border-radius: 2px;
  flex-shrink: 0;
}

.subsection { margin: 2rem 0; scroll-margin-top: 1.5rem; }

.subsection-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #dde;
  margin-bottom: 0.75rem;
}

p { margin: 0.85rem 0; color: var(--text); }

/* ---- Callouts ---- */
.callout {
  display: flex;
  gap: 0.75rem;
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius);
  margin: 1.25rem 0;
  font-size: 0.9rem;
  line-height: 1.6;
}

.callout-icon { flex-shrink: 0; margin-top: 1px; line-height: 0; }
.callout-tip  { background: rgba(158,206,106,.08); border: 1px solid rgba(158,206,106,.2); }
.callout-info { background: rgba(122,162,247,.08); border: 1px solid rgba(122,162,247,.2); }
.callout-warn { background: rgba(224,175,104,.08); border: 1px solid rgba(224,175,104,.2); }

.callout-icon svg {
  width: 1.1rem;
  height: 1.1rem;
  display: block;
}

.callout-tip  .callout-icon { color: var(--green);  }
.callout-info .callout-icon { color: var(--blue);   }
.callout-warn .callout-icon { color: var(--yellow); }

/* ---- Code ---- */
code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--surface-2);
  color: var(--primary);
  padding: 0.15em 0.45em;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.code-block {
  position: relative;
  margin: 1.25rem 0;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 1rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.code-lang {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
}

.code-filename {
  font-size: 0.8rem;
  font-family: var(--font-mono);
  color: var(--text-2);
}

.copy-btn {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--text-3);
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.2rem 0.55rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.copy-btn:hover { color: var(--text); border-color: var(--text-3); }
.copy-btn.copied { color: var(--green); border-color: var(--green); }

pre {
  background: var(--code-bg);
  padding: 1.1rem 1.25rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.65;
  tab-size: 4;
}

pre::-webkit-scrollbar { height: 4px; }
pre::-webkit-scrollbar-track { background: transparent; }
pre::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Syntax colors */
.kw  { color: var(--red); }
.ty  { color: var(--blue); }
.fn  { color: #73daca; }
.st  { color: var(--green); }
.cm  { color: var(--text-3); font-style: italic; }
.at  { color: var(--yellow); }
.nm  { color: var(--purple); }
.op  { color: var(--text-2); }
.ym  { color: var(--primary); }  /* yaml key */
.yv  { color: var(--green); }    /* yaml value */
.md-h { color: var(--blue); font-weight: bold; }
.md-b { color: var(--text); }
.md-fm { color: var(--text-3); }

/* ---- Tables ---- */
.api-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  margin: 1.25rem 0;
}

.api-table th {
  text-align: left;
  padding: 0.55rem 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.api-table td {
  padding: 0.55rem 1rem;
  border: 1px solid var(--border);
  vertical-align: top;
  line-height: 1.5;
}

.api-table tr:nth-child(even) td { background: rgba(255,255,255,0.015); }
.api-table code { font-size: 0.82em; }

.check-yes { color: var(--green); }
.check-no  { color: var(--text-3); }

/* ---- Steps ---- */
.steps { display: flex; flex-direction: column; gap: 0; margin: 1.5rem 0; }

.step {
  display: flex;
  gap: 1.25rem;
  position: relative;
}

.step-line {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 2px solid var(--primary);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  z-index: 1;
}

.step-connector {
  width: 2px;
  flex: 1;
  background: var(--border);
  margin: 4px 0;
  min-height: 16px;
}

.step:last-child .step-connector { display: none; }

.step-body { flex: 1; padding-bottom: 1.75rem; }
.step-body:last-child { padding-bottom: 0; }

.step-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #dde;
  margin-bottom: 0.5rem;
  padding-top: 3px;
}

/* ---- Feature pills ---- */
.feat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1.25rem 0;
}

.feat-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
}

.feat-card.default { border-color: rgba(224,123,57,.35); }

.feat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.feat-name {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
}

.feat-default {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(224,123,57,.15);
  color: var(--primary);
  border: 1px solid rgba(224,123,57,.3);
  border-radius: 20px;
  padding: 0.1rem 0.5rem;
}

.feat-desc { font-size: 0.875rem; color: var(--text-2); }

/* ---- Lang toggle ---- */
.lang-toggle {
  display: flex;
  gap: 4px;
  margin-top: 0.6rem;
}

.lang-btn {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-3);
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.lang-btn.active {
  background: rgba(224, 123, 57, 0.15);
  color: var(--primary);
  border-color: rgba(224, 123, 57, 0.35);
}

.lang-btn:hover:not(.active) {
  color: var(--text);
  border-color: var(--text-3);
}

/* ---- Nav badge (default pill inside link) ---- */
.nav-badge {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--primary);
  margin-left: 0.35rem;
  opacity: 0.85;
}

/* ---- Section title badge ---- */
.section-title-badge {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--primary);
  margin-left: 0.4rem;
  opacity: 0.9;
}

/* ---- Deps note ---- */
.deps-note {
  margin-top: 1.5rem;
  color: var(--text-3);
  font-size: 0.85rem;
}

/* ---- Mobile menu toggle ---- */
.menu-toggle {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 200;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.65rem;
  cursor: pointer;
  color: var(--text);
}

/* ---- Mobile ---- */
@media (max-width: 800px) {
  .menu-toggle { display: flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; }

  .sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    z-index: 100;
    transition: left 0.25s ease;
    width: 280px;
    padding-top: 4.25rem;
  }

  .sidebar.open { left: 0; }

  .overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    z-index: 99;
  }

  .overlay.visible { display: block; }

  .content { padding: 5rem 1.25rem 2rem; }
  .feat-grid { grid-template-columns: 1fr; }

  /* Code blocks responsive */
  .code-block { margin: 1rem 0; }
  pre {
    padding: 0.75rem 0.65rem;
    font-size: 0.7rem;
    line-height: 1.4;
    word-break: break-word;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
  }

  /* Steps responsive */
  .step { gap: 0.6rem; }
  .step-line { width: 20px; }
  .step-dot { width: 20px; height: 20px; font-size: 0.65rem; }
  .step-title { font-size: 0.8rem; margin-bottom: 0.3rem; }
  .step-body { padding-bottom: 1rem; }

  /* Tables responsive */
  .api-table {
    font-size: 0.7rem;
    margin: 1rem 0;
    table-layout: fixed;
    width: 100%;
  }
  .api-table th {
    padding: 0.35rem 0.5rem;
    font-size: 0.65rem;
    word-break: break-word;
    overflow-wrap: break-word;
  }
  .api-table td {
    padding: 0.35rem 0.5rem;
    word-break: break-word;
    overflow-wrap: break-word;
    line-height: 1.3;
  }
  .api-table code { 
    font-size: 0.7em;
    word-break: break-all;
  }
}
