/* || Docs layout */
.docs-wrap {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: var(--space-7);
  max-width: 1000px;
  margin: 0 auto;
  padding: var(--space-6);
}

.docs-sidebar {
  position: sticky;
  top: 5rem;
  align-self: start;
}

.docs-nav {
  list-style: none;
}

.docs-nav li {
  margin-bottom: 0.4rem;
}

.docs-nav a {
  font-size: var(--fs-base);
  color: var(--faint);
  text-decoration: none;
  display: flex;
  align-items: center;
  padding: 0.5rem 0;
  min-height: 44px;
  transition: color 0.25s ease;
}

.docs-nav a:hover { color: var(--accent); }

.docs-nav a.active { color: var(--text); }

.docs-nav-label {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--text);
  margin: 1.2rem 0 0.4rem;
}

/* || Body typography */
.docs-body h2 {
  font-size: 1.3rem;
  font-weight: 600;
  margin: 2rem 0 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.docs-body h2:first-child {
  border-top: none;
  margin-top: 0;
  padding-top: 0;
}

.docs-body h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 1.5rem 0 0.75rem;
}

.docs-body h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 1.25rem 0 0.6rem;
  color: var(--muted);
}

.docs-body p {
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 1rem;
}

.citation-capsule {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text);
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--accent);
  background: rgba(255,255,255,0.04);
}

.citation-capsule em {
  color: var(--muted);
  font-size: 0.85rem;
  display: block;
  margin-top: 0.4rem;
}

.docs-table-wrap {
  overflow-x: auto;
  max-width: 100%;
  width: 100%;
}

.docs-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: var(--fs-md);
}

.docs-body th,
.docs-body td {
  padding: 0.6rem 0.8rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.docs-body th {
  font-weight: 600;
  color: var(--text);
  font-size: var(--fs-base);
  font-family: var(--font-sans);
}

.docs-body td { color: var(--muted); }

.docs-body ul {
  margin-left: 1.2rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.7;
  margin-bottom: 1rem;
}

.docs-body ol {
  margin-left: 1.2rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.7;
  margin-bottom: 1rem;
}

.docs-body li { margin-bottom: 0.4rem; }

.docs-body code {
  font-family: var(--font-sans);
  font-weight: 500;
  color: var(--accent);
  word-break: break-word;
  overflow-wrap: break-word;
}

.docs-body pre {
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
  background: var(--elevated);
  padding: 1rem 1.2rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow-x: auto;
  margin: 1rem 0;
}

.docs-body pre code { background: none; padding: 0; }

.docs-body a {
  color: var(--faint);
  text-decoration: underline;
  transition: color 0.25s ease;
}

.docs-body a:hover { color: var(--accent); }

.docs-body strong { color: var(--text); font-weight: 600; }

/* || Divider */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-8) 0;
}

/* || Mobile collapsible nav */
.docs-nav-toggle {
  display: none;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.75rem 1rem;
  font-family: var(--font-sans);
  font-size: var(--fs-2xl);
  font-weight: 600;
  color: var(--text);
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  gap: 0.75rem;
  transition: border-color 0.15s, background 0.15s;
}

.docs-nav-toggle:hover { border-color: var(--accent); }

.docs-nav-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.docs-nav-toggle[aria-expanded="true"] { background: var(--card); }

.docs-nav-toggle .icon-open { display: block; }

.docs-nav-toggle .icon-close { display: none; }

.docs-nav-toggle[aria-expanded="true"] .icon-open { display: none; }

.docs-nav-toggle[aria-expanded="true"] .icon-close { display: block; }

/* || Responsive */
@media (max-width: 760px) {
  .docs-wrap {
    grid-template-columns: 1fr;
    padding: 1.5rem;
    gap: 1.5rem;
  }

  .docs-sidebar {
    position: static;
    margin-bottom: 0;
    min-width: 0;
  }

  .docs-body { min-width: 0; }

  .docs-body table {
    display: block;
    overflow-x: auto;
    font-size: var(--fs-sm);
  }

  .docs-body th,
  .docs-body td { padding: 0.5rem 0.6rem; }

  .docs-nav-toggle { display: flex; }

  .docs-nav {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.35s ease, opacity 0.25s ease;
    padding-top: 0.75rem;
    margin-top: 0;
  }

  .docs-nav.is-open {
    max-height: 600px;
    opacity: 1;
    padding-bottom: 0.5rem;
  }
}
