* {
    box-sizing: border-box;
}

:root {
    --bg: #111113;
    --bg-soft: #151517;
    --bg-hover: #1b1b1f;
    --bg-code: #151519;

    --border: #29292e;
    --border-soft: #232328;

    --text: #f1f1f3;
    --text-soft: #a1a1aa;
    --text-muted: #6e6e78;

    --accent: #7676ff;
    --accent-soft: rgba(118, 118, 255, 0.12);

    --topbar: 64px;
    --sidebar: 280px;
    --toc: 230px;
    --content: 780px;
}

html {
    scroll-behavior: smooth;
    background: var(--bg);
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

body.modal-open {
    overflow: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input {
    font: inherit;
}

svg {
    display: block;
}

.topbar {
    position: fixed;
    inset: 0 0 auto;
    height: var(--topbar);
    z-index: 100;

    display: grid;
    grid-template-columns: var(--sidebar) minmax(0, var(--content)) var(--toc);
    justify-content: center;
    align-items: center;

    padding: 0 24px;

    background: rgba(17, 17, 19, 0.88);
    border-bottom: 1px solid var(--border-soft);
    backdrop-filter: blur(18px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    width: max-content;
    font-weight: 650;
    letter-spacing: -0.2px;
}

.brand-mark {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--accent);
    box-shadow: 0 0 24px rgba(118, 118, 255, 0.18);
}

.brand-mark svg {
    width: 18px;
    height: 18px;
    fill: white;
}

.brand-separator {
    width: 1px;
    height: 18px;
    margin: 0 1px;
    background: var(--border);
}

.brand-docs {
    color: var(--text-soft);
    font-weight: 500;
}

.search-button {
    justify-self: center;
    width: min(380px, calc(100% - 48px));
    height: 36px;

    display: flex;
    align-items: center;
    gap: 9px;

    padding: 0 10px;

    border: 1px solid #333339;
    border-radius: 9px;
    background: #17171a;
    color: #8f8f99;

    cursor: pointer;
    transition: border-color 120ms ease, background 120ms ease;
}

.search-button:hover {
    background: #1a1a1e;
    border-color: #404047;
}

.search-button svg,
.search-input-container svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
}

.search-button span {
    flex: 1;
    text-align: left;
    font-size: 13px;
}

kbd {
    padding: 2px 6px;
    color: #8a8a94;
    background: #202024;
    border: 1px solid #35353b;
    border-radius: 5px;
    font-size: 10px;
    font-family: inherit;
    line-height: 1.5;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.02);
}

.mobile-menu-button {
    display: none;
}

.docs-layout {
    width: 100%;
    display: grid;
    grid-template-columns: var(--sidebar) minmax(0, var(--content)) var(--toc);
    justify-content: center;
    min-height: 100vh;
    padding: var(--topbar) 24px 0;
}

.sidebar {
    position: sticky;
    top: var(--topbar);
    height: calc(100vh - var(--topbar));

    padding: 30px 28px 28px 6px;
    border-right: 1px solid var(--border-soft);
    overflow-y: auto;
}

.sidebar nav {
    padding-right: 20px;
}

.sidebar-heading {
    margin: 25px 10px 8px;
    color: #7e7e88;
    font-size: 10px;
    font-weight: 750;
    letter-spacing: 0.09em;
}

.sidebar-heading:first-child {
    margin-top: 0;
}

.sidebar-link {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 36px;
    gap: 9px;
    margin: 1px 0;
    padding: 7px 10px;
    border-radius: 7px;
    color: #9b9ba5;
    font-size: 13.5px;
    transition: color 120ms ease, background 120ms ease;
}

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

.sidebar-link.active {
    color: #dcdcff;
    background: var(--accent-soft);
}

.sidebar-link.active::before {
    content: "";
    position: absolute;
    left: -6px;
    top: 9px;
    bottom: 9px;
    width: 2px;
    border-radius: 2px;
    background: var(--accent);
}

.sidebar-icon {
    width: 17px;
    height: 17px;
    flex: 0 0 17px;
    opacity: 0.85;
}

.sidebar-icon[data-icon="home"]::before { content: "⌂"; }
.sidebar-icon[data-icon="bolt"]::before { content: "ϟ"; }
.sidebar-icon[data-icon="code"]::before { content: "</>"; font-size: 9px; font-weight: 700; }
.sidebar-icon[data-icon="box"]::before { content: "◇"; }
.sidebar-icon[data-icon="events"]::before { content: "▧"; color: #777781; }
.sidebar-icon[data-icon="variables"]::before { content: "⚙"; color: #6e8790; font-size: 14px; }

.sidebar-icon::before {
    width: 17px;
    height: 17px;
    display: grid;
    place-items: center;
}

.sidebar-chevron {
    margin-left: auto;
    color: #62626b;
}

.sidebar-children {
    margin: 4px 0 8px 17px;
    padding-left: 12px;
    border-left: 1px solid #2c2c31;
}

.sidebar-link.child {
    min-height: 31px;
    padding-top: 5px;
    padding-bottom: 5px;
    font-size: 13px;
}

.sidebar-link.child.active {
    background: transparent;
    color: var(--accent);
}

.sidebar-link.child.active::before {
    left: -13px;
    top: 5px;
    bottom: 5px;
}

.sidebar-footer {
    margin: 36px 10px 0;
    padding-top: 18px;
    border-top: 1px solid var(--border-soft);
    color: #5f5f68;
    font-size: 11px;
}

.docs-content {
    min-width: 0;
    padding: 54px 58px 120px;
}

.docs-article {
    width: 100%;
    max-width: var(--content);
    margin: 0 auto;
}

.page-eyebrow {
    margin-bottom: 13px;
    color: var(--accent);
    font-size: 10px;
    font-weight: 750;
    letter-spacing: 0.11em;
}

.docs-page-header {
    padding-bottom: 30px;
    border-bottom: 1px solid var(--border-soft);
}

.docs-page-header h1 {
    margin: 0 0 12px;
    font-size: 40px;
    line-height: 1.08;
    letter-spacing: -1.5px;
    font-weight: 720;
}

.docs-page-header p {
    max-width: 680px;
    margin: 0;
    color: var(--text-soft);
    font-size: 16px;
    line-height: 1.7;
}

.docs-article > p {
    color: #b0b0b8;
}

.docs-article h2 {
    margin: 46px 0 14px;
    padding-top: 4px;
    color: #ececef;
    font-size: 21px;
    line-height: 1.3;
    letter-spacing: -0.45px;
}


.docs-article h2[id] {
    scroll-margin-top: 90px;
}

.docs-article p {
    margin: 0 0 17px;
}

.docs-article code {
    padding: 2px 5px;
    border: 1px solid #303036;
    border-radius: 5px;
    background: #1a1a1e;
    color: #d7d7ff;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 0.9em;
}

.docs-article pre {
    position: relative;
    margin: 16px 0 24px;
    overflow: auto;
    padding: 18px 20px;
    border: 1px solid #2a2a30;
    border-radius: 9px;
    background: var(--bg-code);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.015);
}

.docs-article pre code {
    padding: 0;
    border: 0;
    background: transparent;
    color: #d8d8df;
    font-size: 13px;
    line-height: 1.7;
}

.signature {
    margin: 26px 0 8px;
    padding: 13px 15px;
    border: 1px solid #2d2d34;
    border-radius: 8px;
    background: #17171b;
}

.signature code {
    border: 0;
    background: transparent;
    color: #dadaff;
}

.docs-card {
    display: flex;
    align-items: center;
    gap: 13px;
    min-height: 76px;
    margin: 12px 0;
    padding: 15px 17px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #151517;
    transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}

.docs-card:hover {
    border-color: #3a3a43;
    background: #18181b;
    transform: translateY(-1px);
}

.docs-card-icon {
    width: 35px;
    height: 35px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(118,118,255,0.24);
    border-radius: 8px;
    background: rgba(118,118,255,0.08);
    font-size: 15px;
}

.docs-card-copy {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.docs-card strong {
    font-size: 14px;
    font-weight: 650;
}

.docs-card small {
    margin-top: 2px;
    color: var(--text-soft);
    font-size: 12px;
}

.docs-card-arrow {
    margin-left: auto;
    color: #666670;
    font-size: 22px;
}

.docs-table {
    overflow: hidden;
    margin: 17px 0 25px;
    border: 1px solid var(--border);
    border-radius: 9px;
}

.docs-table-header,
.docs-table-row {
    display: grid;
    grid-template-columns: minmax(130px, 0.7fr) minmax(0, 1.7fr);
    gap: 20px;
    padding: 11px 14px;
}

.docs-table-header {
    color: #777781;
    background: #151517;
    border-bottom: 1px solid var(--border);
    font-size: 10px;
    font-weight: 750;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.docs-table-row {
    color: #a9a9b1;
    background: #121214;
    border-bottom: 1px solid var(--border-soft);
    font-size: 13px;
}

.docs-table-row:last-child {
    border-bottom: 0;
}

a.docs-table-row:hover {
    background: #17171a;
    color: var(--text);
}

.docs-table-row code {
    border: 0;
    background: transparent;
}

.docs-note {
    margin: 24px 0;
    padding: 14px 16px;
    border: 1px solid rgba(118, 118, 255, 0.24);
    border-left: 3px solid var(--accent);
    border-radius: 8px;
    background: rgba(118, 118, 255, 0.055);
}

.docs-note strong {
    color: #ddddff;
    font-size: 13px;
}

.docs-note p {
    margin: 4px 0 0;
    color: #a8a8b4;
    font-size: 13px;
}

.page-navigation {
    position: sticky;
    top: var(--topbar);
    height: calc(100vh - var(--topbar));
    padding: 54px 0 30px 28px;
    border-left: 1px solid var(--border-soft);
}

.page-navigation-title {
    margin-bottom: 10px;
    color: #65656f;
    font-size: 9px;
    font-weight: 750;
    letter-spacing: 0.11em;
}

.page-navigation a {
    position: relative;
    display: block;
    padding: 5px 0 5px 12px;
    color: #75757f;
    font-size: 12px;
    transition: color 120ms ease;
}

.page-navigation a:hover,
.page-navigation a.active {
    color: #c8c8d0;
}

.page-navigation a.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 2px;
    border-radius: 2px;
    background: var(--accent);
}

.search-overlay {
    position: fixed;
    inset: 0;
    z-index: 500;

    display: flex;
    justify-content: center;
    align-items: flex-start;

    padding: 110px 20px 20px;

    background: rgba(7, 7, 9, 0.69);
    backdrop-filter: blur(8px);

    opacity: 0;
    visibility: hidden;
    transition: opacity 120ms ease, visibility 120ms ease;
}

.search-overlay.open {
    opacity: 1;
    visibility: visible;
}

.search-modal {
    width: min(640px, 100%);
    overflow: hidden;
    border: 1px solid #34343b;
    border-radius: 12px;
    background: #151517;
    box-shadow: 0 24px 90px rgba(0, 0, 0, 0.52);
    transform: translateY(-8px);
    transition: transform 120ms ease;
}

.search-overlay.open .search-modal {
    transform: translateY(0);
}

.search-input-container {
    height: 54px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    border-bottom: 1px solid var(--border);
    color: #767680;
}

.search-input-container input {
    min-width: 0;
    flex: 1;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font-size: 14px;
}

.search-input-container input::placeholder {
    color: #686872;
}

.search-results {
    max-height: min(520px, calc(100vh - 210px));
    overflow-y: auto;
    padding: 7px;
}

.search-result {
    display: flex;
    gap: 12px;
    padding: 11px;
    border-radius: 8px;
}

.search-result:hover {
    background: #1d1d21;
}

.search-result-icon {
    width: 27px;
    height: 27px;
    display: grid;
    place-items: center;
    flex: 0 0 27px;
    border: 1px solid #303036;
    border-radius: 6px;
    color: #777780;
    font-size: 11px;
}

.search-result-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.search-result strong {
    color: #d9d9de;
    font-size: 13px;
    font-weight: 620;
}

.search-result small {
    margin-top: 2px;
    overflow: hidden;
    color: #797983;
    font-size: 11px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.search-empty {
    padding: 30px 18px;
    color: #72727c;
    text-align: center;
    font-size: 13px;
}

@media (max-width: 1120px) {
    :root {
        --sidebar: 250px;
        --toc: 0px;
    }

    .topbar,
    .docs-layout {
        grid-template-columns: var(--sidebar) minmax(0, 1fr);
    }

    .page-navigation {
        display: none;
    }

    .docs-content {
        padding-right: 34px;
        padding-left: 42px;
    }
}

@media (max-width: 760px) {
    .topbar {
        display: flex;
        justify-content: space-between;
        padding: 0 16px;
    }

    .brand-separator,
    .brand-docs {
        display: none;
    }

    .search-button {
        width: auto;
        min-width: 0;
        margin-left: auto;
        margin-right: 10px;
    }

    .search-button span,
    .search-button kbd {
        display: none;
    }

    .mobile-menu-button {
        width: 34px;
        height: 34px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 4px;
        padding: 8px;
        border: 1px solid #303036;
        border-radius: 8px;
        background: #17171a;
    }

    .mobile-menu-button span {
        width: 100%;
        height: 1px;
        background: #aaaab2;
    }

    .docs-layout {
        display: block;
        padding-right: 0;
        padding-left: 0;
    }

    .sidebar {
        position: fixed;
        top: var(--topbar);
        left: 0;
        bottom: 0;
        z-index: 90;
        width: min(310px, 88vw);
        height: calc(100vh - var(--topbar));
        padding-left: 18px;
        background: #121214;
        transform: translateX(-102%);
        transition: transform 160ms ease;
        box-shadow: 15px 0 50px rgba(0,0,0,0.28);
    }

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

    .docs-content {
        padding: 36px 22px 90px;
    }

    .docs-page-header h1 {
        font-size: 34px;
    }

    .docs-table-header,
    .docs-table-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }
}


.sidebar-icon[data-icon="console"]::before {
    content: ">_";
    color: #8a8a94;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: -1px;
}

.sidebar-link.child .sidebar-icon {
    margin-right: 2px;
}

.docs-card-code {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 11px;
    font-weight: 800;
}

.page-navigation-group {
    margin: 14px 0 3px;
    color: #8d8d96;
    font-size: 12px;
    font-weight: 560;
}

.docs-article h3 {
    margin: 28px 0 10px;
    color: #dddddf;
    font-size: 15px;
    font-weight: 650;
}

.docs-table-header:has(+ .docs-table-row.docs-table-three) {
    grid-template-columns: minmax(90px, 0.55fr) minmax(90px, 0.55fr) minmax(0, 1.7fr);
}

.docs-table-row.docs-table-three {
    grid-template-columns: minmax(90px, 0.55fr) minmax(90px, 0.55fr) minmax(0, 1.7fr);
}


.docs-table-header-three,
.docs-table-row.docs-table-three {
    grid-template-columns: minmax(110px, 0.7fr) minmax(100px, 0.65fr) minmax(0, 1.65fr);
}


.sidebar-children.depth-1 {
    margin-left: 16px;
}

.sidebar-children.depth-2 {
    margin-left: 16px;
}

.sidebar-item.depth-1 > .sidebar-link {
    padding-left: 9px;
}

.sidebar-item.depth-2 > .sidebar-link {
    padding-left: 9px;
    font-size: 13px;
}


.sidebar-icon[data-icon="math"]::before {
    content: "∑";
    color: #8b79ff;
    font-size: 15px;
    font-weight: 800;
}

.sidebar-icon[data-icon="globals"]::before {
    content: "◉";
    color: #7399ff;
    font-size: 13px;
    font-weight: 800;
}

.docs-card-math {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 18px;
    font-weight: 700;
}

.docs-card-globals {
    font-size: 15px;
    font-weight: 800;
}


.sidebar-icon[data-icon="cvar"]::before {
    content: "🎲";
    font-size: 13px;
}

.docs-card-cvar {
    font-size: 15px;
}
