/* ===== Docs Layout ===== */
.docs-layout {
  display: flex;
  min-height: 100vh;
  padding-top: var(--nav-h);
}

/* ===== Sidebar ===== */
.docs-sidebar {
  position: fixed;
  top: var(--nav-h);
  left: 0;
  bottom: 0;
  width: 280px;
  background: var(--bg-section);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  z-index: 50;
  transition: transform .25s ease;
}

.docs-sidebar-inner {
  padding: 1.5rem 0;
}

.docs-sidebar-close {
  display: none;
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.docs-sidebar-close:hover {
  color: var(--text-primary);
}

/* Sidebar scrollbar */
.docs-sidebar::-webkit-scrollbar {
  width: 6px;
}
.docs-sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.docs-sidebar::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
.docs-sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--border-light);
}

/* ===== Search ===== */
.docs-search {
  padding: 0 1.25rem 1rem;
}

.docs-search input {
  width: 100%;
  padding: .5rem .75rem;
  font-size: .88rem;
  font-family: var(--font-sans);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  outline: none;
  transition: border-color .15s;
}
.docs-search input::placeholder {
  color: var(--text-muted);
}
.docs-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

/* ===== Nav sections ===== */
.docs-nav-section {
  margin-bottom: .5rem;
}

.docs-nav-heading {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  padding: .6rem 1.25rem .35rem;
  margin: 0;
}

.docs-nav-link {
  display: block;
  padding: .4rem 1.25rem .4rem 1.75rem;
  font-size: .88rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: color .15s, background .15s, border-color .15s;
}
.docs-nav-link:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, .03);
}
.docs-nav-link.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: rgba(0, 220, 199, .06);
  font-weight: 600;
}

.docs-nav-link.hidden {
  display: none;
}

/* ===== Mobile menu toggle ===== */
.docs-menu-toggle {
  display: none;
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 60;
  background: var(--accent);
  color: #0d0f17;
  border: none;
  border-radius: 999px;
  padding: .65rem 1.1rem;
  font-size: .85rem;
  font-weight: 700;
  font-family: var(--font-sans);
  cursor: pointer;
  box-shadow: 0 4px 20px var(--accent-glow);
  align-items: center;
  gap: .4rem;
  transition: transform .15s;
}
.docs-menu-toggle:hover {
  transform: scale(1.05);
}
.docs-menu-toggle svg {
  flex-shrink: 0;
}

/* ===== Main Content ===== */
.docs-content {
  flex: 1;
  margin-left: 280px;
  min-width: 0;
}

.docs-content-inner {
  max-width: 820px;
  margin: 0 auto;
  padding: 2.5rem 2rem 4rem;
}

/* ===== Loading ===== */
.docs-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 0;
  color: var(--text-muted);
  gap: 1rem;
}

.docs-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: docs-spin .8s linear infinite;
}

@keyframes docs-spin {
  to { transform: rotate(360deg); }
}

/* ===== Error ===== */
.docs-error {
  text-align: center;
  padding: 4rem 0;
}
.docs-error h2 {
  font-size: 1.3rem;
  margin-bottom: .75rem;
}
.docs-error p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.hidden {
  display: none !important;
}

/* ===== Article — Markdown Rendered Content ===== */
.docs-article {
  line-height: 1.75;
  font-size: 1rem;
}

.docs-article h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -.02em;
  margin-bottom: 1rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--border);
}

.docs-article h2 {
  font-size: 1.45rem;
  font-weight: 700;
  margin-top: 2.5rem;
  margin-bottom: .75rem;
  padding-bottom: .4rem;
  border-bottom: 1px solid var(--border);
}

.docs-article h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: .5rem;
}

.docs-article h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: .5rem;
  color: var(--text-secondary);
}

.docs-article p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

.docs-article a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(0, 220, 199, .3);
  text-underline-offset: 2px;
  transition: text-decoration-color .15s;
}
.docs-article a:hover {
  text-decoration-color: var(--accent);
}

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

.docs-article ul,
.docs-article ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
  color: var(--text-secondary);
}
.docs-article li {
  margin-bottom: .35rem;
}
.docs-article li > ul,
.docs-article li > ol {
  margin-top: .35rem;
  margin-bottom: .35rem;
}

/* Code — inline */
.docs-article code {
  font-family: var(--font-mono);
  font-size: .88em;
  background: rgba(0, 220, 199, .08);
  padding: .15em .4em;
  border-radius: var(--radius-xs);
  color: var(--accent);
}

/* Code — blocks */
.docs-article pre {
  margin-bottom: 1.25rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  border: 1px solid var(--border);
}
.docs-article pre code {
  display: block;
  padding: 1rem 1.25rem;
  font-size: .85rem;
  line-height: 1.6;
  background: var(--bg-terminal);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  overflow-x: auto;
}

/* Tables */
.docs-article table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.25rem;
  font-size: .9rem;
  overflow-x: auto;
  display: block;
}
.docs-article thead {
  border-bottom: 2px solid var(--border);
}
.docs-article th {
  text-align: left;
  font-weight: 600;
  padding: .6rem .75rem;
  color: var(--text-primary);
  white-space: nowrap;
}
.docs-article td {
  padding: .5rem .75rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}
.docs-article tr:last-child td {
  border-bottom: none;
}

/* Blockquotes */
.docs-article blockquote {
  border-left: 3px solid var(--accent);
  padding: .75rem 1.25rem;
  margin: 0 0 1.25rem;
  background: rgba(0, 220, 199, .05);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary);
}
.docs-article blockquote p {
  margin-bottom: .5rem;
}
.docs-article blockquote p:last-child {
  margin-bottom: 0;
}

/* Horizontal rules */
.docs-article hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* Images */
.docs-article img {
  max-width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* Details/summary */
.docs-article details {
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.docs-article details summary {
  padding: .75rem 1rem;
  cursor: pointer;
  font-weight: 600;
  background: var(--bg-card);
  transition: color .15s;
}
.docs-article details summary:hover {
  color: var(--accent);
}
.docs-article details[open] summary {
  border-bottom: 1px solid var(--border);
}
.docs-article details > *:not(summary) {
  padding: 0 1rem;
}

/* ===== Docs Footer ===== */
.docs-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.docs-footer a {
  font-size: .88rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color .15s;
}
.docs-footer a:hover {
  color: var(--accent);
}

/* ===== Active nav highlighting ===== */
.nav-active {
  color: var(--accent) !important;
  font-weight: 600;
}

/* ===== Responsive ===== */

/* Tablet */
@media (max-width: 900px) {
  .docs-sidebar {
    transform: translateX(-100%);
  }
  .docs-sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(0, 0, 0, .5);
  }
  .docs-sidebar-close {
    display: block;
  }
  .docs-content {
    margin-left: 0;
  }
  .docs-content-inner {
    padding: 2rem 1.5rem 4rem;
  }
  .docs-menu-toggle {
    display: flex;
  }
}

/* Mobile */
@media (max-width: 600px) {
  .docs-sidebar {
    width: 100%;
  }
  .docs-content-inner {
    padding: 1.5rem 1rem 3rem;
  }
  .docs-article h1 {
    font-size: 1.5rem;
  }
  .docs-article h2 {
    font-size: 1.2rem;
  }
  .docs-article h3 {
    font-size: 1.05rem;
  }
  .docs-article pre code {
    font-size: .78rem;
  }
  .docs-article table {
    font-size: .8rem;
  }
}

/* Sidebar overlay backdrop for mobile */
.docs-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  z-index: 45;
}
.docs-overlay.visible {
  display: block;
}
