

body.gb-notes {
    margin: 0;
    padding: 0;
    max-width: none;
    display: flex;
    min-height: 100vh;
    background: #ffffff;
    color: #1c1d1e;
    line-height: 1.7;
    background-image: none;
}

/* Mobile toggle control (hidden by default; drawer via pure CSS) */
.gb-nav-toggle {
    display: none;
}

.gb-burger {
    display: none;
}

/* Sidebar */
.gb-sidebar {
    width: 288px;
    flex-shrink: 0;
    background: #ffffff;
    border-right: 1px solid #e2e6ea;
    padding: 16px 12px 40px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    box-sizing: border-box;
}

.gb-brand {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: #1c1d1e;
    padding: 4px 12px 20px;
    letter-spacing: -0.01em;
}

.gb-brand:hover {
    color: #0464ac;
}

/* Search box (GitBook-style) */
.gb-search {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 4px 12px;
    padding: 6px 10px;
    border: 1px solid #d7dbe0;
    border-radius: 8px;
    background: #ffffff;
    color: #6a6f75;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.gb-search:focus-within {
    border-color: #0464ac;
    box-shadow: 0 0 0 3px rgba(4, 100, 172, 0.12);
}

.gb-search-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: #8b949e;
}

.gb-search input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    padding: 0;
    font-size: 13.5px;
    font-family: inherit;
    color: #1c1d1e;
    background: transparent;
    appearance: none;
    -webkit-appearance: none;
}

.gb-search input::-webkit-search-cancel-button {
    -webkit-appearance: none;
}

.gb-search input::placeholder {
    color: #8b949e;
}

.gb-search-kbd {
    flex-shrink: 0;
    font-family: inherit;
    font-size: 11px;
    line-height: 1;
    color: #6a6f75;
    background: #f6f7f9;
    border: 1px solid #e2e6ea;
    border-radius: 4px;
    padding: 3px 5px;
    white-space: nowrap;
}

/* Search-hide state */
.gb-search-hidden {
    display: none !important;
}

.gb-sidebar[data-gb-search-active="1"][data-gb-has-results="0"]::after {
    content: "No results";
    display: block;
    padding: 12px 16px;
    font-size: 13px;
    color: #8b949e;
}

.gb-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.gb-nav-link {
    position: relative;
    display: block;
    padding: 6px 10px 6px 16px;
    font-size: 13.5px;
    color: #3f4650;
    border-radius: 6px;
    line-height: 1.6;
}

.gb-nav-link::before {
    content: "";
    position: absolute;
    left: 2px;
    top: 8px;
    bottom: 8px;
    width: 1px;
    background: transparent;
}

.gb-nav-link:hover {
    background: #f6f7f9;
    color: #1c1d1e;
}

.gb-nav-link.active {
    background: #eef6ff;
    color: #0464ac;
    font-weight: 600;
}

.gb-nav-link.active::before {
    background: #0464ac;
}

.gb-back {
    display: inline-block;
    margin-top: 28px;
    padding: 0 12px;
    font-size: 13.5px;
    color: #8b949e;
}

.gb-back:hover {
    color: #0464ac;
}

/* Main column */
.gb-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: #ffffff;
}

.gb-topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 48px;
    padding: 0 24px;
    font-size: 13.5px;
    color: #6a6f75;
    background: rgba(255, 255, 255, 0.92);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid #e6e8ea;
}

.gb-topbar a {
    color: #6a6f75;
}

.gb-topbar a:hover {
    color: #0464ac;
}

.gb-crumb-sep {
    color: #c8cdd3;
}

.gb-scroll {
    flex: 1;
}

.gb-content {
    margin: 0 auto;
    padding: 40px 40px 72px;
}

.gb-content > h1 {
    font-size: 36px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: #1c1d1e;
    margin: 0 0 8px;
    border-bottom: none;
}

.gb-lead {
    color: #57606a;
    font-size: 17px;
    margin: 0 0 32px;
}

/* Rendered markdown uses the official gitbook-markdown-body stylesheet.
   Keep only top spacing here and let gitbook-markdown.css drive typography. */
.gb-content .content {
    margin-top: 24px;
}

/* The site's base stylesheet turns ul/ol into decorative list markers;
   inside the GitBook markdown body restore ordinary list styling. */
body.gb-notes .gitbook-markdown-body ul {
    list-style-type: disc;
}

body.gb-notes .gitbook-markdown-body ol {
    list-style-type: decimal;
}

body.gb-notes .gitbook-markdown-body ul,
body.gb-notes .gitbook-markdown-body ol {
    padding-left: 2em;
}

body.gb-notes .gitbook-markdown-body li {
    position: static;
    padding-left: 0;
    margin-bottom: 0;
}

body.gb-notes .gitbook-markdown-body li::before,
body.gb-notes .gitbook-markdown-body li::after {
    content: none;
}

body.gb-notes .gitbook-markdown-body .hljs {
    border-radius: 6px;
}

/* Note list on the index page (flat, Git-style rows) */
.gb-note-list {
    display: flex;
    flex-direction: column;
    border-top: 1px solid #ececf0;
    margin-top: 8px;
}

.gb-note-card {
    display: block;
    padding: 14px 4px;
    border-bottom: 1px solid #ececf0;
    color: #1c1d1e;
    transition: color 0.1s ease;
}

.gb-note-card:hover {
    color: #0464ac;
}

.gb-note-card h2 {
    font-size: 16.5px;
    font-weight: 600;
    margin: 0 0 4px;
    color: #1c1d1e;
}

.gb-note-card:hover h2 {
    color: #0464ac;
}

.gb-note-card p {
    margin: 0;
    font-size: 14px;
    color: #57606a;
    line-height: 1.5;
}

/* Prev / next pager */
.gb-pager {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    max-width: 768px;
    margin: 0 auto;
    padding: 16px 40px 56px;
    border-top: 1px solid #ececf0;
}

.gb-pager a,
.gb-pager a.disabled {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 16px;
    border: 1px solid #e2e6ea;
    border-radius: 16px;
    text-decoration: none;
    color: #1c1d1e;
}

.gb-pager-next {
    align-items: flex-end;
    text-align: right;
}

.gb-pager a:hover {
    border-color: #0464ac;
}

.gb-pager a.disabled {
    color: #b6bcc4;
    pointer-events: none;
    border-color: #f0f0f2;
}

.gb-pager-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #8b949e;
}

.gb-pager-title {
    font-size: 15.5px;
    font-weight: 600;
    color: #1c1d1e;
}

.gb-pager a.disabled .gb-pager-label,
.gb-pager a.disabled .gb-pager-title {
    color: #c6c9cc;
}

/* Responsive: collapse sidebar into a CSS-only drawer */
@media (max-width: 720px) {
    body.gb-notes {
        flex-direction: column;
    }

    .gb-burger {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        position: fixed;
        top: 10px;
        right: 14px;
        z-index: 20;
        font-size: 13.5px;
        font-weight: 600;
        color: #fff;
        background: #0464ac;
        border-radius: 6px;
        padding: 6px 12px;
        cursor: pointer;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    }

    .gb-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 280px;
        z-index: 15;
        transform: translateX(-100%);
        transition: transform 0.22s ease;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.12);
    }

    .gb-nav-toggle:checked ~ .gb-sidebar {
        transform: translateX(0);
    }

    .gb-main {
        width: 100%;
    }

    .gb-topbar {
        padding: 0 16px;
    }

    .gb-content {
        padding: 28px 20px 48px;
    }

    .gb-content > h1 {
        font-size: 30px;
    }

    .gb-pager {
        padding: 16px 20px 48px;
    }
}

@media (max-width: 440px) {
    .gb-pager {
        flex-direction: column;
    }

    .gb-pager a,
    .gb-pager a.disabled {
        align-items: flex-start;
        text-align: left;
    }
}

/* ------------------------------------------------------------------
   Experiments tree navigation (same GitBook chrome)
   ------------------------------------------------------------------ */

/* Topic group: a <details>/<summary> node */
.gb-tree {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.gb-tree-dir {
    border: none;
    margin: 0;
}

.gb-tree-dir > summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
    position: relative;
    padding: 6px 12px 6px 16px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #57606a;
    border-radius: 6px;
}

.gb-tree-dir > summary::-webkit-details-marker {
    display: none;
}

.gb-tree-dir > summary::before {
    content: "";
    position: absolute;
    right: 1px;
    top: 50%;
    width: 7px;
    height: 7px;
    border-right: 2px solid #9aa4af;
    border-bottom: 2px solid #9aa4af;
    transform: translateY(-55%) rotate(-45deg);
    transition: transform 0.15s ease;
}

.gb-tree-dir[open] > summary::before {
    transform: translateY(-30%) rotate(45deg);
}

.gb-tree-dir > summary:hover {
    background: #f6f7f9;
}

.gb-tree-dir > summary.topic-active {
    background: #eef6ff;
    color: #0464ac;
}

.gb-tree-dir > .gb-tree-inner {
    padding: 2px 0 6px 12px;
    border-left: 1px solid #e6e8ea;
    margin: 0 0 0 14px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Directory node (subtopic) */
.gb-tree-sub {
    border: none;
    margin: 0;
}

.gb-tree-sub > summary {
    list-style: none;
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 500;
    color: #57606a;
    padding: 5px 10px 5px 14px;
    border-radius: 6px;
    position: relative;
}

.gb-tree-sub > summary::-webkit-details-marker {
    display: none;
}

.gb-tree-sub > summary::before {
    content: "\203A";
    position: absolute;
    left: 2px;
    top: 50%;
    transform: translateY(-50%) rotate(0deg);
    transition: transform 0.15s ease;
    color: #9aa4af;
}

.gb-tree-sub[open] > summary::before {
    transform: translateY(-50%) rotate(90deg);
}

.gb-tree-sub > summary:hover {
    background: #f6f6f6;
}

.gb-tree-sub > .gb-tree-inner {
    padding: 2px 0 4px 12px;
    border-left: 1px solid #e6e8ea;
    margin: 0 0 0 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Tree leaf links */
.gb-tree-file {
    position: relative;
    display: block;
    padding: 5px 10px 5px 16px;
    font-size: 13.5px;
    color: #3f4650;
    border-radius: 6px;
    line-height: 1.6;
}

.gb-tree-file::before {
    content: "";
    position: absolute;
    left: 2px;
    top: 8px;
    bottom: 8px;
    width: 1px;
    background: transparent;
}

.gb-tree-file:hover {
    background: #f6f7f9;
    color: #1c1d1e;
}

.gb-tree-file.active {
    background: #eef6ff;
    color: #0464ac;
    font-weight: 600;
}

.gb-tree-file.active::before {
    background: #0464ac;
}

/* Index content: topic cards */
.gb-topic-list {
    display: flex;
    flex-direction: column;
    border-top: 1px solid #ececf0;
    margin-top: 8px;
}

.gb-topic-card {
    display: block;
    padding: 14px 4px;
    border-bottom: 1px solid #ececf0;
    color: #1c1d1e;
    transition: color 0.1s ease;
}

.gb-topic-card:hover {
    color: #0464ac;
}

.gb-topic-card .gb-topic-title {
    font-size: 16.5px;
    font-weight: 600;
    color: #1c1d1e;
}

.gb-topic-card:hover .gb-topic-title {
    color: #0464ac;
}

.gb-topic-card .gb-topic-count {
    float: right;
    font-size: 13px;
    font-weight: 500;
    color: #8b949e;
}

.gb-topic-card .gb-topic-files {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #f1f1f1;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.gb-topic-card .gb-topic-files a {
    font-size: 12.5px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #57606a;
    background: #f6f7f9;
    border: 1px solid #ececf0;
    padding: 3px 9px;
    border-radius: 20px;
}

.gb-topic-card .gb-topic-files a:hover {
    color: #0464ac;
    border-color: #c3dcf5;
}

/* Index page file list (topic / subtopic index) */
.gb-file-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 4px;
}

.gb-file-link {
    display: block;
    padding: 10px 16px;
    border: 1px solid #ececf0;
    border-radius: 6px;
    font-size: 15px;
    color: #24292f;
}

.gb-file-link:hover {
    border-color: #0464ac;
    color: #0464ac;
}

.gb-file-meta {
    display: block;
    margin-top: 2px;
    font-size: 12.5px;
    color: #8b949e;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.gb-content .hljs,
.gb-content pre,
.gb-content .content > pre {
    border-radius: 6px;
}
