/* Docs layout: fixed sidebar + scrollable content pane. */

.landing-main:has(.docs-layout) {
    background: var(--color-surface);
}

.docs-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 0;
    max-width: 1200px;
    margin: 0 auto;
    min-height: calc(100vh - 64px);
}

/* Sidebar */
.docs-sidebar {
    border-right: 1px solid var(--color-border);
    padding: 32px 24px 64px;
    position: sticky;
    top: 0;
    align-self: start;
    max-height: 100vh;
    overflow-y: auto;
}

.docs-search {
    position: relative;
    margin-bottom: 20px;
}

.docs-search-input {
    width: 100%;
    padding: 8px 36px 8px 12px;
    font-family: inherit;
    font-size: 14px;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

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

.docs-search-input:focus {
    outline: none;
    border-color: var(--color-brand);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-brand) 12%, transparent);
}

.docs-search-input:focus + .docs-search-hint {
    display: none;
}

.docs-search-hint {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    padding: 2px 6px;
    font-family: ui-monospace, monospace;
    font-size: 11px;
    color: var(--color-text-muted);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    pointer-events: none;
}

.docs-search-empty {
    margin: 12px 8px 0;
    color: var(--color-text-muted);
    font-size: 13px;
}

.docs-nav {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.docs-nav-section[hidden],
.docs-nav-page[hidden] {
    display: none;
}

/* Collapsible section toggle. Defensively reset against the global
   `button` rule so the heading doesn't render as a navy pill. */
.docs-nav-section-toggle,
.docs-nav-section-toggle:hover,
.docs-nav-section-toggle:focus {
    background: transparent;
}

.docs-nav-section-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 4px 8px;
    margin: 0 0 8px;
    border: 0;
    border-radius: 0;
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    text-align: left;
    cursor: pointer;
}

.docs-nav-section-toggle:hover {
    color: var(--color-text);
}

.docs-nav-section-chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 12px;
    height: 12px;
    color: var(--color-text-subtle);
    transform: rotate(90deg);
    transition: transform 120ms ease;
}

/* When the section has an IndexPage, the header is split: the title
   is a link, the chevron sits in a small toggle button next to it.
   Both elements live inside .docs-nav-section-header. Inherit the
   same overall shape (padding, margin, typography) as the single-
   button form so the section heading is visually identical apart
   from the title being clickable. */
.docs-nav-section-header {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 4px 8px;
    margin: 0 0 8px;
}
.docs-nav-section-toggle-chevron {
    width: auto;
    padding: 0;
    margin: 0;
    background: transparent;
    border: 0;
    cursor: pointer;
    color: var(--color-text-muted);
}
.docs-nav-section-toggle-chevron:hover,
.docs-nav-section-toggle-chevron:focus {
    background: transparent;
    color: var(--color-text);
}
.docs-nav-section-title-link {
    flex: 1;
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    text-decoration: none;
    cursor: pointer;
}
.docs-nav-section-title-link:hover {
    color: var(--color-text);
}
.docs-nav-section-title-link.active {
    color: var(--color-text);
}

.docs-nav-section.collapsed .docs-nav-section-chevron {
    transform: rotate(0deg);
}

.docs-nav-section.collapsed .docs-nav-pages {
    display: none;
}

.docs-nav-pages {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.docs-nav-page {
    border-radius: 6px;
}

.docs-nav-link {
    display: block;
    padding: 6px 8px 6px 28px;
    position: relative;
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 14px;
    border-radius: 6px;
    line-height: 1.4;
}

.docs-nav-link::before {
    content: "";
    position: absolute;
    left: 14px;
    top: 50%;
    width: 4px;
    height: 4px;
    margin-top: -2px;
    background: var(--color-text-subtle);
    border-radius: 50%;
    transition: background 120ms ease;
}

.docs-nav-link:hover {
    background: var(--color-bg);
    color: var(--color-text);
}

.docs-nav-link:hover::before {
    background: var(--color-text-muted);
}

.docs-nav-page.active > .docs-nav-link {
    background: color-mix(in srgb, var(--color-brand) 8%, transparent);
    color: var(--color-brand);
    font-weight: 600;
}

.docs-nav-page.active > .docs-nav-link::before {
    background: var(--color-brand);
}

/* Unclickable parent label inside a sidebar section. Styled like a
   regular page link (same prominence as siblings) but with the cursor
   and hover affordances that say "this isn't clickable". Grouped pages
   below it render at the anchor-link indent so the heading visually
   parents them. */
.docs-nav-group {
    list-style: none;
    margin: 1px 0;
    padding: 0;
}

.docs-nav-group-heading {
    display: block;
    padding: 6px 8px 6px 28px;
    position: relative;
    color: var(--color-text-secondary);
    font-size: 14px;
    line-height: 1.4;
    cursor: default;
}

.docs-nav-group-heading::before {
    content: "";
    position: absolute;
    left: 14px;
    top: 50%;
    width: 4px;
    height: 4px;
    margin-top: -2px;
    background: var(--color-text-subtle);
    border-radius: 50%;
}

/* Grouped pages — visually anchor-children of their group heading. */
.docs-nav-page-grouped > .docs-nav-link {
    padding: 4px 8px 4px 44px;
    font-size: 13px;
    color: var(--color-text-muted);
    font-weight: 400;
}

.docs-nav-page-grouped > .docs-nav-link::before {
    left: 32px;
    width: 3px;
    height: 3px;
    margin-top: -1.5px;
    opacity: 0.8;
}

/* When a grouped page itself has anchor children, nest those one level
   deeper so the three-tier hierarchy reads cleanly. */
.docs-nav-page-grouped .docs-nav-anchor-link {
    padding-left: 60px;
}

.docs-nav-page-grouped .docs-nav-anchor-link::before {
    left: 48px;
}

/* H3 sub-anchors nested under an H2 anchor (e.g. Dashboard's Searching →
   Filters / Prompt / Query). Indents one notch further than its parent. */
/* Higher specificity (two classes) so these rules beat the later
   `.docs-nav-anchor-link` shorthand padding declaration. */
.docs-nav-anchor-link.docs-nav-anchor-link-nested {
    padding-left: 68px;
    font-size: 12px;
}

.docs-nav-anchor-link.docs-nav-anchor-link-nested::before {
    left: 56px;
}

.docs-nav-page-grouped .docs-nav-anchor-link.docs-nav-anchor-link-nested {
    padding-left: 84px;
}

.docs-nav-page-grouped .docs-nav-anchor-link.docs-nav-anchor-link-nested::before {
    left: 72px;
}

/* Generic collapsible page/anchor — chevron toggle at the right edge of
   the link row, rotates 90° when expanded. .collapsed hides the direct
   child anchor list. */
.docs-collapsible {
    position: relative;
}

.docs-collapsible > .docs-nav-link {
    padding-right: 32px;
}

.docs-nav-toggle,
.docs-nav-toggle:hover,
.docs-nav-toggle:focus,
.docs-nav-toggle:active {
    background: transparent;
}

.docs-nav-toggle {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    padding: 0;
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 4px;
    color: var(--color-text-subtle);
    cursor: pointer;
    z-index: 1;
}

.docs-nav-toggle:hover {
    background: var(--color-bg);
    color: var(--color-text-secondary);
}

.docs-nav-toggle svg {
    transform: rotate(90deg);
    transition: transform 120ms ease;
}

.docs-collapsible.collapsed > .docs-nav-toggle svg {
    transform: rotate(0deg);
}

.docs-collapsible.collapsed > .docs-nav-anchors,
.docs-collapsible.collapsed > .docs-nav-anchors-nested,
.docs-collapsible.collapsed > .docs-nav-pages-nested {
    display: none;
}

/* docs-nav-pages-nested — the page list that lives inside a sub-anchor
   when the anchor has Pages (e.g. AI-assisted setup → Hosted AI agent,
   BYOK skill, Behavior reference). Indents one level deeper than the
   peer-anchor's anchor list so the hierarchy reads:
   section → peer-anchor (Pick a setup path) → sub-anchor (AI-assisted
   setup) → page (Hosted AI agent) → page-anchor (Install + connect
   GitHub). Each step adds depth so the nesting reads visually. */
.docs-nav-pages-nested {
    list-style: none;
    margin: 2px 0 4px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

/* Page row inside a nested-pages list: deeper indent than the
   parent sub-anchor (which sits at .docs-nav-anchor-link's 44px).
   Bullet dot follows by the same offset. */
.docs-nav-pages-nested > .docs-nav-page > .docs-nav-link {
    padding-left: 68px;
    font-size: 13px;
}
.docs-nav-pages-nested > .docs-nav-page > .docs-nav-link::before {
    left: 56px;
    width: 3px;
    height: 3px;
    margin-top: -1.5px;
}

/* H2 anchor list rendered under a nested page (e.g. Hosted AI agent's
   "Install + connect GitHub", "Scan repo", …). One level deeper than
   the page link above. */
.docs-nav-pages-nested .docs-nav-anchor-link {
    padding-left: 92px;
}
.docs-nav-pages-nested .docs-nav-anchor-link::before {
    left: 80px;
}

/* Anchors that are themselves collapsible (e.g. Initialize the Recorder
   inside Recording Events) need a slightly smaller toggle and tighter
   vertical alignment with the smaller anchor-link row. */
.docs-nav-anchor.docs-collapsible > .docs-nav-toggle {
    top: 2px;
    width: 20px;
    height: 20px;
}

/* Group heading is also a collapsible. The chevron sits absolutely on
   the right, so pad the heading text to leave room. Grouped pages get
   the .group-collapsed marker class from JS when their group toggles
   shut; that's what actually hides them. */
.docs-nav-group.docs-collapsible .docs-nav-group-heading {
    padding-right: 32px;
}

.docs-nav-page.group-collapsed {
    display: none;
}

/* Nested in-page anchor entries (one level deeper than a page link). */
.docs-nav-anchors {
    list-style: none;
    margin: 2px 0 4px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.docs-nav-anchor-link {
    padding: 4px 8px 4px 44px;
    font-size: 13px;
    color: var(--color-text-muted);
    font-weight: 400;
}

.docs-nav-anchor-link::before {
    left: 32px;
    width: 3px;
    height: 3px;
    margin-top: -1.5px;
    opacity: 0.8;
}

/* Content pane */
.docs-content {
    padding: 48px 48px 96px;
    min-width: 0;
}

.docs-article {
    max-width: 760px;
}

.docs-title {
    font-size: 36px;
    font-weight: 700;
    margin: 0 0 24px;
    color: var(--color-text);
    line-height: 1.2;
}

.docs-body {
    color: var(--color-text-secondary);
    line-height: 1.7;
    font-size: 16px;
}

.docs-body h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--color-text);
    margin: 40px 0 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--color-border);
    scroll-margin-top: 24px;
}

.docs-body h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text);
    margin: 32px 0 12px;
    scroll-margin-top: 24px;
}

.docs-body h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text);
    margin: 24px 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.docs-body p {
    margin: 0 0 16px;
}

.docs-body a {
    color: var(--color-brand);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.docs-body a:hover {
    color: var(--color-brand-hover);
}

.docs-body ul,
.docs-body ol {
    margin: 0 0 16px;
    padding-left: 24px;
}

.docs-body li {
    margin-bottom: 6px;
}

.docs-body code {
    font-family: ui-monospace, monospace;
    font-size: 0.9em;
    background: var(--color-bg);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--color-border);
    color: var(--color-text);
}

/* Code blocks. Chroma sets background + token colors inline; we own the
   box (padding, radius, scroll). Right padding leaves room for the
   copy-button overlay injected by docs.js. */
.docs-body pre {
    padding: 16px 48px 16px 20px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 16px 0 20px;
    font-size: 14px;
    line-height: 1.5;
}

.docs-body pre code {
    background: transparent;
    border: 0;
    padding: 0;
    color: inherit;
    font-size: inherit;
}

/* When docs.js wraps a pre in .code-block-wrap, the wrap inherits the
   outer margin so block spacing matches the un-wrapped state, and the
   pre itself drops its margin (now lives on the wrap). */
.docs-body .code-block-wrap {
    margin: 16px 0 20px;
}

.docs-body .code-block-wrap pre {
    margin: 0;
}

/* Tabs */
.docs-tabs {
    margin: 16px 0 24px;
}

.docs-tab-headers {
    display: flex;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--color-border);
}

/* Defensively reset against the global `button` rule in style.css, which
   sets a brand-colored fill, white text, and a top margin meant for form
   buttons. Tab headers are text-only nav controls. */
.docs-tab-header,
.docs-tab-header:hover,
.docs-tab-header:focus,
.docs-tab-header.active {
    background: transparent;
}

.docs-tab-header {
    appearance: none;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    margin: 0 0 -1px;
    padding: 12px 18px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    color: var(--color-text);
    opacity: 0.55;
    cursor: pointer;
    transition: opacity 120ms ease, color 120ms ease, border-color 120ms ease;
}

.docs-tab-header:hover {
    opacity: 0.85;
    color: var(--color-text);
}

.docs-tab-header.active {
    opacity: 1;
    color: var(--color-brand);
    border-bottom-color: var(--color-brand);
}

.docs-tab-header:focus-visible {
    outline: 2px solid var(--color-brand);
    outline-offset: -2px;
    border-radius: 4px;
}

.docs-tab-panels {
    padding-top: 16px;
}

.docs-tab-panel[hidden] {
    display: none;
}

.docs-tab-panel > *:first-child {
    margin-top: 0;
}

.docs-tab-panel > *:last-child {
    margin-bottom: 0;
}

.docs-tab-panel pre,
.docs-tab-panel .code-block-wrap {
    margin: 0;
}

.docs-body blockquote {
    margin: 16px 0;
    padding: 12px 16px;
    border-left: 3px solid var(--color-brand);
    background: var(--color-bg);
    color: var(--color-text-secondary);
    border-radius: 0 6px 6px 0;
}

.docs-body blockquote p:last-child {
    margin-bottom: 0;
}

.docs-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0 24px;
    font-size: 14px;
}

.docs-body th,
.docs-body td {
    text-align: left;
    padding: 8px 12px;
    border-bottom: 1px solid var(--color-border);
}

.docs-body th {
    font-weight: 600;
    color: var(--color-text);
    background: var(--color-bg);
}

.docs-body hr {
    border: 0;
    border-top: 1px solid var(--color-border);
    margin: 32px 0;
}

.docs-body img {
    max-width: 100%;
    border-radius: 6px;
    margin: 16px 0;
}

/* Prev / Next pager at the bottom of each page */
.docs-pager {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--color-border);
}

.docs-pager-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: var(--color-text-secondary);
    text-decoration: none;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    transition: border-color 120ms ease, color 120ms ease, background 120ms ease;
    max-width: 48%;
}

.docs-pager-link:hover {
    border-color: var(--color-brand);
    color: var(--color-brand);
    background: color-mix(in srgb, var(--color-brand) 5%, transparent);
}

.docs-pager-next {
    margin-left: auto;
    text-align: right;
}

.docs-pager-content {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
    min-width: 0;
}

.docs-pager-eyebrow {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

.docs-pager-title {
    font-size: 14px;
    font-weight: 600;
    color: inherit;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.docs-pager-chevron {
    display: inline-flex;
    flex: 0 0 auto;
    color: var(--color-text-subtle);
}

.docs-pager-link:hover .docs-pager-chevron {
    color: var(--color-brand);
}

/* Mobile: stack sidebar above content */
@media (max-width: 768px) {
    .docs-layout {
        grid-template-columns: 1fr;
    }

    .docs-sidebar {
        position: static;
        max-height: none;
        border-right: 0;
        border-bottom: 1px solid var(--color-border);
        padding: 24px 16px;
    }

    .docs-content {
        padding: 24px 16px 64px;
    }

    .docs-title {
        font-size: 28px;
    }
}
