/* ===== DOCS PAGE — frame layout, scroll-inside-content ===== */

:root {
    --docs-header-height: 80px;
    --docs-outer-pad-y: 16px;
    --docs-outer-pad-x: 24px;
    --docs-gap: 16px;
    --docs-sidebar-width: 268px;
    --docs-toc-width: 200px;
    --docs-inner-pad: 48px;
    --docs-scrollbar-width: 10px;
    --docs-frame-radius: 20px;
}

html, body {
    height: 100%;
    margin: 0;
}

.docs-body {
    background-color: var(--background-color);
    overflow: hidden;
}

/* ===== LAYOUT ===== */

.docs__layout {
    display: flex;
    gap: var(--docs-gap);
    padding: var(--docs-outer-pad-y) var(--docs-outer-pad-x);
    padding-top: calc(var(--docs-header-height) + var(--docs-outer-pad-y));
    height: 100vh;
    box-sizing: border-box;
}

/* ===== SIDEBAR ===== */

.docs__sidebar {
    display: flex;
    flex-direction: column;
    width: var(--docs-sidebar-width);
    flex-shrink: 0;
    padding: 16px;
    gap: 16px;
    background: var(--gradient-12, linear-gradient(90deg, rgba(79, 70, 229, 0.12) 0%, rgba(40, 148, 236, 0.12) 100%));
    border-radius: var(--docs-frame-radius);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-sizing: border-box;
    min-height: 0;
    overflow-y: auto;
    position: relative;
}

.docs__sidebar-title {
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(225, 241, 255, 0.4);
    padding: 8px 12px 4px;
}

.docs__nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.docs__nav-section {
    display: flex;
    flex-direction: column;
}

.docs__nav-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    font-size: 15px;
    color: rgba(225, 241, 255, 0.85);
    text-align: left;
    transition: background 0.2s ease, color 0.2s ease;
}

.docs__nav-heading:hover {
    color: var(--text-color, #fff);
    background: var(--gradient-12, linear-gradient(90deg, rgba(79, 70, 229, 0.12) 0%, rgba(40, 148, 236, 0.12) 100%));
}

.docs__nav-heading.expanded {
    color: var(--text-color, #fff);
}

.docs__nav-arrow {
    flex-shrink: 0;
    opacity: 0.5;
    transform: rotate(-90deg);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.docs__nav-arrow.expanded {
    transform: rotate(0deg);
    opacity: 0.9;
}

.docs__nav-items {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, margin 0.3s ease-out;
}

.docs__nav-items.expanded {
    max-height: 1200px;
    margin-top: 4px;
    margin-bottom: 4px;
}

.docs__nav-link {
    position: relative;
    display: block;
    padding: 8px 12px 8px 20px;
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    font-size: 14px;
    color: rgba(225, 241, 255, 0.65);
    text-decoration: none;
    border-radius: 8px;
    line-height: 1.4;
    transition: background 0.2s ease, color 0.2s ease;
}

.docs__nav-link:hover {
    color: var(--text-color, #fff);
    background: var(--gradient-12, linear-gradient(90deg, rgba(79, 70, 229, 0.12) 0%, rgba(40, 148, 236, 0.12) 100%));
}

.docs__nav-link.active {
    color: var(--text-color, #fff);
    background: var(--gradient-20, linear-gradient(90deg, rgba(79, 70, 229, 0.20) 0%, rgba(40, 148, 236, 0.20) 100%));
    font-weight: 600;
}

.docs__nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: linear-gradient(180deg, #4F46E5 0%, #2894EC 100%);
}

/* ===== CONTENT FRAME ===== */

.docs__content-frame {
    flex: 1;
    min-width: 0;
    background-color: #0d1117;
    background-image: radial-gradient(circle, rgba(225, 241, 255, 0.05) 1px, transparent 1px);
    background-size: 24px 24px;
    border-radius: var(--docs-frame-radius);
    border: 1px solid rgba(225, 241, 255, 0.06);
    overflow-y: auto;
    position: relative;
    /* Firefox custom scrollbar */
    scrollbar-width: thin;
    scrollbar-color: rgba(79, 70, 229, 0.45) transparent;
}

/* WebKit/Blink custom scrollbar — gradient thumb */
.docs__content-frame::-webkit-scrollbar {
    width: 10px;
}
.docs__content-frame::-webkit-scrollbar-track {
    background: transparent;
    margin: 8px 0;
}
.docs__content-frame::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(79, 70, 229, 0.5) 0%, rgba(40, 148, 236, 0.5) 100%);
    border-radius: 6px;
    border: 2px solid transparent;
    background-clip: padding-box;
}
.docs__content-frame::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(79, 70, 229, 0.85) 0%, rgba(40, 148, 236, 0.85) 100%);
    background-clip: padding-box;
}

.docs__sidebar {
    scrollbar-width: thin;
    scrollbar-color: rgba(79, 70, 229, 0.35) transparent;
}

.docs__sidebar::-webkit-scrollbar {
    width: 8px;
}
.docs__sidebar::-webkit-scrollbar-track {
    background: transparent;
    margin: 8px 0;
}
.docs__sidebar::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(79, 70, 229, 0.4) 0%, rgba(40, 148, 236, 0.4) 100%);
    border-radius: 5px;
    border: 2px solid transparent;
    background-clip: padding-box;
}
.docs__sidebar::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(79, 70, 229, 0.7) 0%, rgba(40, 148, 236, 0.7) 100%);
    background-clip: padding-box;
}

/* ===== CONTENT INNER ===== */

.docs__content-inner {
    padding: var(--docs-inner-pad);
}

.docs__article {
    min-width: 0;
}

/* Hero block (h1 + lead paragraph) avoids the fixed TOC on wide screens */
@media (min-width: 1101px) {
    .docs__article > h1,
    .docs__article > h1 + p {
        max-width: calc(100% - var(--docs-toc-width) - var(--docs-inner-pad));
    }
}

/* ===== TOC (fixed in viewport, top aligned with article heading, right matches content padding) ===== */

.docs__toc {
    position: fixed;
    top: calc(var(--docs-header-height) + var(--docs-outer-pad-y) + var(--docs-inner-pad));
    /* right = outer page padding + scrollbar width + inner content padding — TOC right edge aligns with text right edge */
    right: calc(var(--docs-outer-pad-x) + var(--docs-scrollbar-width) + var(--docs-inner-pad));
    width: var(--docs-toc-width);
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    background: var(--gradient-12, linear-gradient(90deg, rgba(79, 70, 229, 0.12) 0%, rgba(40, 148, 236, 0.12) 100%));
    border: 1px solid rgba(225, 241, 255, 0.06);
    border-radius: 12px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 50;
}

.docs__toc-title {
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(225, 241, 255, 0.4);
    margin-bottom: 4px;
}

.docs__toc-link {
    font-family: 'Roboto', sans-serif;
    font-size: 13px;
    color: rgba(225, 241, 255, 0.55);
    text-decoration: none;
    line-height: 1.5;
    transition: color 0.2s ease;
}

.docs__toc-link:hover {
    color: var(--text-color, #fff);
}

.docs__toc-link.active {
    color: var(--accentcolor, #2894EC);
    font-weight: 500;
}

/* ===== ARTICLE TYPOGRAPHY ===== */

.docs__article h1 {
    font-size: 36px;
    font-weight: 700;
    margin: 0 0 12px 0;
    line-height: 1.25;
    letter-spacing: -0.5px;
    color: var(--text-color, #fff);
}

.docs__article h1 + p {
    font-size: 18px;
    color: rgba(225, 241, 255, 0.7);
    line-height: 1.6;
    margin-bottom: 32px;
}

.docs__article h2 {
    font-size: 22px;
    font-weight: 600;
    margin: 48px 0 16px 0;
    padding-top: 24px;
    border-top: 1px solid rgba(225, 241, 255, 0.08);
    scroll-margin-top: 100px;
    color: var(--text-color, #fff);
}

.docs__article h2:first-of-type {
    margin-top: 32px;
}

.docs__article h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 32px 0 10px 0;
    scroll-margin-top: 100px;
    color: var(--text-color, #fff);
}

.docs__article p {
    font-size: 16px;
    line-height: 1.75;
    margin: 0 0 16px 0;
    color: rgba(225, 241, 255, 0.7);
}

.docs__article a {
    color: var(--accentcolor, #2894EC);
    text-decoration: none;
}

.docs__article a:hover {
    color: #4FA8F5;
    text-decoration: underline;
}

.docs__article ul,
.docs__article ol {
    padding: 0 0 0 20px;
    margin: 0 0 20px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.docs__article li {
    font-size: 16px;
    line-height: 1.65;
    color: rgba(225, 241, 255, 0.7);
}

.docs__article ul li {
    list-style: disc;
}

.docs__article ol li {
    list-style: decimal;
}

.docs__article li::marker {
    color: rgba(225, 241, 255, 0.5);
}

.docs__article strong {
    color: var(--text-color, #fff);
    font-weight: 600;
}

/* Code */

.docs__article code {
    background: rgba(74, 74, 74, 0.4);
    padding: 2px 7px;
    border-radius: 4px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 14px;
    color: #c8b8e8;
    border: 1px solid rgba(225, 241, 255, 0.08);
}

.docs__article pre {
    background: rgba(13, 17, 23, 0.7);
    border-radius: 10px;
    padding: 20px 24px;
    margin: 0 0 20px 0;
    overflow-x: auto;
    border: 1px solid rgba(225, 241, 255, 0.08);
}

.docs__article pre code {
    background: none;
    padding: 0;
    border-radius: 0;
    border: none;
    font-size: 14px;
    line-height: 1.65;
    color: rgba(225, 241, 255, 0.85);
}

/* Tables */

.docs__article table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 20px 0;
    font-size: 14px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(225, 241, 255, 0.08);
}

.docs__article th {
    text-align: left;
    padding: 12px 16px;
    background: rgba(225, 241, 255, 0.04);
    border-bottom: 1px solid rgba(225, 241, 255, 0.08);
    color: var(--text-color, #fff);
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.docs__article td {
    padding: 11px 16px;
    border-bottom: 1px solid rgba(225, 241, 255, 0.05);
    color: rgba(225, 241, 255, 0.75);
}

.docs__article tr:last-child td {
    border-bottom: none;
}

/* Blockquote */

.docs__article blockquote {
    border-left: 3px solid var(--accentcolor, #2894EC);
    margin: 0 0 20px 0;
    padding: 14px 20px;
    color: rgba(225, 241, 255, 0.75);
    background: rgba(40, 148, 236, 0.06);
    border-radius: 0 10px 10px 0;
}

.docs__article blockquote p {
    margin: 0;
    color: rgba(225, 241, 255, 0.75);
}

.docs__article img {
    max-width: 100%;
    border-radius: 10px;
    border: 1px solid rgba(225, 241, 255, 0.08);
}

/* ===== FOOTER (minimal, inside content frame) ===== */

.docs__footer {
    margin-top: 40px;
    padding: 24px var(--docs-inner-pad) 32px;
    border-top: 1px solid rgba(225, 241, 255, 0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.docs__footer-links {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.docs__footer-links a {
    font-family: 'Roboto', sans-serif;
    font-size: 13px;
    color: rgba(225, 241, 255, 0.5);
    text-decoration: none;
    transition: color 0.2s ease;
}

.docs__footer-links a:hover {
    color: rgba(225, 241, 255, 0.9);
}

.docs__footer-copy {
    font-family: 'Roboto', sans-serif;
    font-size: 12px;
    color: rgba(225, 241, 255, 0.3);
}

/* ===== MOBILE FAB (sidebar opener) ===== */

.docs__sidebar-fab {
    display: none;
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 100;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    background: var(--gradient-20, linear-gradient(90deg, rgba(79, 70, 229, 0.2) 0%, rgba(40, 148, 236, 0.2) 100%));
    border: 1px solid rgba(225, 241, 255, 0.12);
    border-radius: 12px;
    color: rgba(225, 241, 255, 0.9);
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    transition: transform 0.2s ease, background 0.2s ease;
}

.docs__sidebar-fab:hover {
    background: var(--gradient, linear-gradient(90deg, rgba(79, 70, 229, 0.4) 0%, rgba(40, 148, 236, 0.4) 100%));
    transform: translateY(-2px);
}

.docs__sidebar-fab.active svg {
    transform: rotate(180deg);
}

.docs__sidebar-fab svg {
    transition: transform 0.2s ease;
}

.docs__sidebar-close {
    display: none;
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: rgba(225, 241, 255, 0.5);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.docs__sidebar-close:hover {
    background: rgba(225, 241, 255, 0.06);
    color: var(--text-color, #fff);
}

.docs__overlay {
    position: fixed;
    inset: 0;
    background: rgba(13, 19, 30, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.docs__overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

/* ===== RESPONSIVE ===== */

@media (max-width: 1100px) {
    .docs__toc {
        display: none;
    }
}

@media (max-width: 1024px) {
    .docs__layout {
        padding-left: 16px;
        padding-right: 16px;
        gap: 12px;
    }
    .docs__sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        height: 100vh;
        z-index: 150;
        border-radius: 0 var(--docs-frame-radius) var(--docs-frame-radius) 0;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        padding-top: 56px;
    }
    .docs__sidebar.open {
        transform: translateX(0);
    }
    .docs__sidebar-close {
        display: flex;
    }
    .docs__sidebar-fab {
        display: flex;
    }
    .docs__content-inner {
        padding: 40px 48px;
    }
    .docs__footer {
        padding: 24px 48px 32px;
    }
}

@media (max-width: 768px) {
    :root {
        --docs-outer-pad-x: 12px;
        --docs-outer-pad-y: 12px;
    }
    .docs__content-inner {
        padding: 32px 24px;
    }
    .docs__article h1 {
        font-size: 28px;
    }
    .docs__article h2 {
        font-size: 19px;
    }
    .docs__article h3 {
        font-size: 16px;
    }
    .docs__article p,
    .docs__article li {
        font-size: 15px;
    }
    .docs__article pre {
        padding: 16px;
    }
    .docs__article pre code {
        font-size: 13px;
    }
    .docs__article table {
        font-size: 13px;
    }
    .docs__article th,
    .docs__article td {
        padding: 8px 12px;
    }
    .docs__footer {
        padding: 20px 24px 28px;
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }
}

@media (max-width: 540px) {
    .docs__content-inner {
        padding: 24px 20px;
    }
    .docs__article h1 {
        font-size: 24px;
    }
    .docs__article h2 {
        font-size: 18px;
        margin: 32px 0 12px 0;
        padding-top: 16px;
    }
    .docs__article table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    .docs__footer-links {
        justify-content: center;
        gap: 16px;
    }
    .docs__sidebar {
        width: calc(100vw - 32px);
        max-width: 320px;
    }
}
