.docs .layout {
  display: grid;
  grid-template-columns: minmax(286px, var(--sidebar-width)) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 1.25rem 0 1.25rem 1.25rem;
}

.sidebar-inner {
  position: relative;
  height: calc(100vh - 2.5rem);
  border-radius: var(--radius-lg);
  padding: 1.1rem 0.9rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  overflow: hidden;
  background:
    radial-gradient(circle at 100% 0%, rgba(var(--ambient-cyan-rgb), 0.075), transparent 32%),
    linear-gradient(180deg, rgba(12, 22, 18, 0.9) 0%, rgba(5, 9, 7, 0.94) 100%);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(255, 255, 255, 0.045);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.sidebar-inner::before {
  content: '';
  position: absolute;
  inset: 0 var(--radius-lg) auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(100, 255, 150, 0.5), rgba(111, 229, 255, 0.34), transparent);
  pointer-events: none;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.1rem 0.25rem 0.85rem;
  border-bottom: 1px solid rgba(171, 255, 206, 0.08);
  flex-shrink: 0;
}

.sidebar-brand .brand-lockup {
  gap: 0.8rem;
}

.sidebar-brand .logo-img {
  width: 40px;
  height: 40px;
}

.sidebar-close {
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-secondary);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-height: 0;
  flex: 1;
}

.sidebar-nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  min-height: 34px;
  padding: 0 0.45rem;
}

.sidebar-nav-title {
  color: var(--primary);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.sidebar-home-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 30px;
  padding: 0.32rem 0.48rem;
  border-radius: var(--radius-xs);
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 600;
  transition: color 0.18s ease, background 0.18s ease;
}

.sidebar-home-link:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.045);
}

.sidebar-links {
  list-style: none;
  margin: 0;
  padding: 0 0.12rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.16rem;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(100, 255, 150, 0.16) transparent;
}

.sidebar-links::-webkit-scrollbar {
  width: 4px;
}

.sidebar-links::-webkit-scrollbar-thumb {
  background: rgba(100, 255, 150, 0.16);
  border-radius: 999px;
}

.sidebar-link-group {
  min-width: 0;
}

.sidebar-section-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 42px;
  padding: 0.48rem 0.68rem 0.48rem 0.74rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.87rem;
  line-height: 1.3;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
  border: 1px solid transparent;
  background: transparent;
}

.sidebar-section-link:hover {
  color: var(--text-primary);
  background: rgba(100, 255, 150, 0.045);
  border-color: rgba(100, 255, 150, 0.1);
}

.sidebar-section-link.active {
  color: var(--text-primary);
  background: linear-gradient(135deg, rgba(100, 255, 150, 0.105), rgba(111, 229, 255, 0.055));
  border-color: rgba(100, 255, 150, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.sidebar-num {
  display: inline-flex;
  align-items: center;
  flex: 0 0 1.55rem;
  color: var(--primary);
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  opacity: 0.82;
  transition: opacity 0.18s ease, text-shadow 0.18s ease;
  font-size: 0.86rem;
}



.sidebar-section-link:hover .sidebar-num {
  opacity: 1;
}

.sidebar-section-link.active .sidebar-num {
  text-shadow: 0 0 10px rgba(100, 255, 150, 0.36);
  opacity: 1;
  color: var(--primary-strong);
}

.sidebar-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.sidebar-subsection-links {
  list-style: none;
  margin: 0.32rem 0 0.42rem 0.72rem;
  padding: 0.04rem 0 0.04rem 0.68rem;
  display: grid;
  gap: 0.06rem;
  border-left: 1px solid rgba(161, 255, 199, 0.12);
  position: relative;
}

.sidebar-subsection-links a.sidebar-subsection-link {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 32px;
  padding: 0.3rem 0.58rem;
  border-radius: var(--radius-xs);
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.3;
  border: 1px solid transparent;
  transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease;
  background: transparent;
}

.sidebar-subsection-links a.sidebar-subsection-link.level-3 {
  padding-left: 1.1rem;
  font-size: 0.76rem;
}

.sidebar-subsection-links a.sidebar-subsection-link:hover {
  color: var(--text-primary);
  background: rgba(100, 255, 150, 0.045);
}

.sidebar-subsection-links a.sidebar-subsection-link.active {
  color: var(--text-primary);
  background: rgba(100, 255, 150, 0.08);
  border-color: rgba(100, 255, 150, 0.12);
}

.docs-main {
  width: 100%;
  max-width: none;
  min-width: 0;
  padding: var(--page-header-content-gap) 2rem 3rem;
}
@media (max-width: 1024px) {
  .docs-main {
    padding-top: var(--page-header-content-gap);
  }
}

.docs-header-simple {
  max-width: 860px;
  margin: 0 auto var(--section-heading-content-gap);
  width: 100%;
  display: flex;
  align-items: center;
}

.docs-card {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  padding: 0 !important;
  border-radius: 0 !important;
  transform: none !important;
}

.docs-card:hover {
  transform: none !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

.docs .article-body {
  line-height: 1.45;
}

.docs .article-body h1 {
  margin-bottom: 0.75rem;
}

.docs .article-body h1+p {
  margin-top: -0.15rem;
  margin-bottom: 0.9rem;
  line-height: 1.35;
}

.docs .article-body h2 {
  margin: 1.4rem 0 0.55rem;
}

.docs .article-body h3 {
  margin: 1rem 0 0.48rem;
}

.docs .article-body h4 {
  margin: 0.88rem 0 0.4rem;
}

.docs .article-body h5 {
  margin: 0.8rem 0 0.4rem;
}

.docs .article-body h6 {
  margin: 0.7rem 0 0.4rem;
}

.docs .article-body p,
.docs .article-body ul,
.docs .article-body ol,
.docs .article-body blockquote,
.docs .article-body pre,
.docs .article-body table,
.docs .article-body hr {
  margin-top: 0.45rem;
}

.docs .article-body ul,
.docs .article-body ol {
  gap: 0.4rem;
}

.docs .article-body ul > li,
.docs .article-body ol > li,
.docs .article-body blockquote p {
  line-height: 1.4;
}

.docs .article-body ul ul,
.docs .article-body ul ol,
.docs .article-body ol ul,
.docs .article-body ol ol {
  margin-top: 0.3rem;
  gap: 0.3rem;
}

.docs .article-body blockquote,
.docs .article-body pre {
  margin: 0.9rem 0;
}

.docs .article-body table {
  margin: 1rem 0;
}

.docs .article-body hr {
  margin: 1.75rem 0;
}

.docs .article-body img {
  margin: 0.9rem auto 0.25rem;
}

.docs .article-body p:has(> img) {
  margin-bottom: 0;
  line-height: 0;
}

.docs .article-body p:has(> img) + p {
  margin-top: 0.8rem;
}

.docs .article-body p>img~em {
  margin-top: 0.4rem;
  margin-bottom: 1.2rem;
}

.docs .article-body p>em:only-child {
  margin-top: 0.4rem;
  margin-bottom: 1.2rem;
  line-height: 1.35;
}



.mobile-header {
  position: sticky;
  top: 0.6rem;
  z-index: 1001;
  height: auto;
  min-height: var(--header-height);
  margin: 0 0.6rem;
  width: min(calc(100% - 1.2rem), var(--content-width));
  padding: 0.8rem 1.4rem;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  background: linear-gradient(180deg, rgba(12, 22, 18, 0.88) 0%, rgba(5, 9, 7, 0.82) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(255, 255, 255, 0.045);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.mobile-header::before {
  content: '';
  position: absolute;
  inset: 0 var(--radius-lg) auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(100, 255, 150, 0.5), rgba(111, 229, 255, 0.34), transparent);
  pointer-events: none;
}

.menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.menu-toggle:hover,
.sidebar-close:hover {
  border-color: var(--line-cyan);
  background: rgba(111, 229, 255, 0.07);
  color: var(--text-primary);
}

.menu-toggle:focus-visible,
.sidebar-close:focus-visible,
.sidebar-home-link:focus-visible,
.sidebar-links a:focus-visible {
  outline: 2px solid rgba(100, 255, 150, 0.6);
  outline-offset: 2px;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 1000;
}

.overlay.visible {
  opacity: 1;
  pointer-events: auto;
}


@media (max-width: 1024px) {
  .docs,
  .docs .layout {
    overflow-x: hidden;
  }

  .docs {
    padding-top: 0.6rem;
  }

  .docs .layout {
    grid-template-columns: 1fr;
  }

  .mobile-header,
  .overlay {
    display: flex;
  }

  .overlay {
    display: block;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: min(88vw, 320px);
    height: 100vh;
    padding: 0.65rem;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1002;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-inner {
    height: 100%;
    padding: 1rem 0.78rem 0.75rem;
  }

  .sidebar-close {
    display: inline-flex;
    cursor: pointer;
  }

  .docs-main {
    padding: 1.25rem 1.25rem 2rem;
  }

  .docs-main .site-footer {
    margin-top: var(--page-header-content-gap) !important;
    margin-left: -1.25rem !important;
    margin-right: -1.25rem !important;
    margin-bottom: -2rem !important;
    width: calc(100% + 2.5rem) !important;
    border-radius: 0 !important;
  }

}

@media (max-width: 720px) {
  .docs {
    padding-top: 0.5rem;
  }

  .docs-main {
    padding-top: var(--page-header-content-gap);
  }

  .mobile-header {
    top: 0.5rem;
    margin: 0 0.5rem;
    width: calc(100% - 1rem);
    max-width: calc(100vw - 1rem);
    padding: 0.75rem 1rem;
    gap: 0.85rem;
  }
}
