/* ── Docs layout – 3-column Scalar / Mintlify-style ─────────────────────── */

/* ---------- Layout grid ---------- */
.docs-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr) 200px;
    min-height: calc(100vh - 4rem);    /* below navbar */
}

@media (max-width: 1279px) {
    .docs-layout { grid-template-columns: 260px minmax(0, 1fr); }
    .docs-toc { display: none; }
}
@media (max-width: 1023px) {
    .docs-layout { grid-template-columns: minmax(0, 1fr); }
    .docs-sidebar { display: none; }
    .docs-sidebar.open { display: block; }
}

/* ---------- Sidebar ---------- */
.docs-sidebar {
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    background: color-mix(in srgb, var(--surface-900) 80%, transparent);
    position: sticky;
    top: 4rem;
    height: calc(100vh - 4rem);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.08) transparent;
}
.docs-sidebar::-webkit-scrollbar { width: 4px; }
.docs-sidebar::-webkit-scrollbar-track { background: transparent; }
.docs-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 4px; }

/* Mobile overlay sidebar */
@media (max-width: 1023px) {
    .docs-sidebar.open {
        display: block;
        position: fixed;
        top: 4rem;
        left: 0;
        z-index: 40;
        width: 280px;
        height: calc(100vh - 4rem);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
    }
}

/* Collapsible groups */
.collapsed .docs-nav-items { display: none; }
.collapsed .docs-chevron { transform: rotate(-90deg); }

.docs-nav-row {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}
.docs-nav-parent-trigger {
    width: 100%;
    border: 0;
    background: transparent;
    padding: 0;
    text-align: left;
    cursor: pointer;
}
.docs-nav-row .docs-nav-link {
    flex: 1;
    min-width: 0;
}
.docs-nav-link-parent {
    letter-spacing: -0.01em;
}
.docs-nav-parent-trigger:hover .docs-nav-link-parent {
    background: rgba(255, 255, 255, 0.05);
}
.docs-nav-item-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem;
    color: rgba(156, 163, 175, 0.85);
    border-radius: 0.375rem;
    transition: color 0.15s, background 0.15s;
}
.docs-nav-parent-trigger:hover .docs-nav-item-toggle,
.docs-nav-item-toggle:hover {
    color: #f3f4f6;
    background: rgba(255, 255, 255, 0.05);
}
.docs-nav-children {
    margin-left: 1rem;
    padding-left: 0.55rem;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
}
.docs-nav-parent.collapsed > .docs-nav-children {
    display: none;
}
.docs-nav-link-child {
    padding-left: 0.85rem;
    font-size: 0.875rem;
}

/* ---------- Main content ---------- */
.docs-content {
    padding: 2.5rem 3rem 4rem;
    max-width: 52rem;
    width: 100%;
    justify-self: center;
}
@media (max-width: 640px) {
    .docs-content { padding: 1.5rem 1.25rem 3rem; }
}

/* ---------- Right TOC ---------- */
.docs-toc {
    position: sticky;
    top: 4rem;
    height: calc(100vh - 4rem);
    overflow-y: auto;
    border-left: 1px solid rgba(255, 255, 255, 0.06);
}
.docs-toc-inner { padding: 2rem 1rem 2rem 1.25rem; }

/* TOC list styling — generated by markdown toc extension */
.docs-toc-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.docs-toc-list li { margin: 0; }
.docs-toc-list > ul > li > ul { padding-left: 0.75rem; }
.docs-toc-list a {
    display: block;
    padding: 0.25rem 0;
    font-size: 0.8125rem;
    line-height: 1.4;
    color: rgba(156, 163, 175, 0.8);
    text-decoration: none;
    border-left: 2px solid transparent;
    padding-left: 0.625rem;
    transition: color 0.15s, border-color 0.15s;
}
.docs-toc-list a:hover {
    color: #e5e7eb;
}
.docs-toc-list a.active {
    color: var(--brand-400);
    border-left-color: var(--brand-400);
}

/* ---------- Prev / Next navigation ---------- */
.docs-page-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.docs-page-nav-link {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.875rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0.5rem;
    text-decoration: none;
    transition: border-color 0.2s, background 0.2s;
}
.docs-page-nav-link:hover {
    border-color: var(--brand-500);
    background: rgba(99, 102, 241, 0.04);
}

/* ---------- Prose styles (rendered markdown) ---------- */
.docs-prose {
    color: #d1d5db;
    line-height: 1.75;
}
.docs-prose h1 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: #f9fafb;
    margin: 0 0 1rem;
    line-height: 1.2;
}
.docs-prose h2 {
    font-size: 1.375rem;
    font-weight: 700;
    color: #f3f4f6;
    margin: 2.5rem 0 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    line-height: 1.3;
}
.docs-prose h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #e5e7eb;
    margin: 1.75rem 0 0.5rem;
    line-height: 1.4;
}
.docs-prose h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #d1d5db;
    margin: 1.25rem 0 0.5rem;
}
.docs-prose p {
    margin: 0 0 1rem;
}
.docs-prose a {
    color: var(--brand-400);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.15s;
}
.docs-prose a:hover {
    border-bottom-color: var(--brand-400);
}

/* Anchor permalink (generated by toc extension) */
.docs-prose .anchor-link {
    margin-left: 0.375rem;
    opacity: 0;
    color: rgba(156, 163, 175, 0.5);
    font-size: 0.875em;
    transition: opacity 0.15s;
    border: none !important;
}
.docs-prose h2:hover .anchor-link,
.docs-prose h3:hover .anchor-link,
.docs-prose h4:hover .anchor-link {
    opacity: 1;
}

/* Inline code */
.docs-prose code {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.875em;
    background: rgba(255, 255, 255, 0.06);
    color: #e5e7eb;
    padding: 0.15em 0.35em;
    border-radius: 0.25rem;
    border: 1px solid rgba(255, 255, 255, 0.06);
}
/* Code inside pre blocks should not double-style */
.docs-prose pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.8125rem;
    color: inherit;
}

/* Fenced code blocks */
.docs-prose pre {
    background: #0d1117;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 0.5rem;
    padding: 1rem 1.25rem;
    overflow-x: auto;
    margin: 0 0 1.25rem;
    line-height: 1.6;
}

/* Lists */
.docs-prose ul {
    list-style: disc;
    padding-left: 1.5rem;
    margin: 0 0 1rem;
}
.docs-prose ol {
    list-style: decimal;
    padding-left: 1.5rem;
    margin: 0 0 1rem;
}
.docs-prose li {
    margin-bottom: 0.375rem;
}
.docs-prose li > p { margin: 0; }

/* Tables */
.docs-prose table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 1.25rem;
    font-size: 0.875rem;
}
.docs-prose th {
    text-align: left;
    padding: 0.625rem 0.75rem;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    font-weight: 600;
    color: #f3f4f6;
}
.docs-prose td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: #d1d5db;
}
.docs-prose tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Blockquotes */
.docs-prose blockquote {
    border-left: 3px solid var(--brand-500);
    padding: 0.5rem 1rem;
    margin: 0 0 1rem;
    color: #9ca3af;
    background: rgba(99, 102, 241, 0.04);
    border-radius: 0 0.375rem 0.375rem 0;
}
.docs-prose blockquote p:last-child { margin: 0; }

/* Admonitions (tip, note, warning) */
.docs-prose .admonition {
    padding: 1rem 1.25rem;
    margin: 0 0 1.25rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.06);
}
.docs-prose .admonition-title {
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.375rem;
}
.docs-prose .admonition.note,
.docs-prose .admonition.info {
    background: rgba(56, 189, 248, 0.06);
    border-color: rgba(56, 189, 248, 0.2);
}
.docs-prose .admonition.note .admonition-title,
.docs-prose .admonition.info .admonition-title { color: #38bdf8; }

.docs-prose .admonition.tip {
    background: rgba(74, 222, 128, 0.06);
    border-color: rgba(74, 222, 128, 0.2);
}
.docs-prose .admonition.tip .admonition-title { color: #4ade80; }

.docs-prose .admonition.warning,
.docs-prose .admonition.caution {
    background: rgba(251, 191, 36, 0.06);
    border-color: rgba(251, 191, 36, 0.2);
}
.docs-prose .admonition.warning .admonition-title,
.docs-prose .admonition.caution .admonition-title { color: #fbbf24; }

.docs-prose .admonition.danger,
.docs-prose .admonition.error {
    background: rgba(248, 113, 113, 0.06);
    border-color: rgba(248, 113, 113, 0.2);
}
.docs-prose .admonition.danger .admonition-title,
.docs-prose .admonition.error .admonition-title { color: #f87171; }

/* Horizontal rules */
.docs-prose hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    margin: 2rem 0;
}

/* Images */
.docs-prose img {
    max-width: 100%;
    border-radius: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.06);
    margin: 0.5rem 0 1rem;
}
