/*
 * docs.css — search page query box, AI answer panel on the search results page
 * Requires cx-base.css and a theme file loaded before this (the docs site
 * serves light, but nothing here assumes it any more).
 *
 * Covers: docs shell (topnav, sidebar, content area), typography
 * for long-form reading, breadcrumb, search, "open tool" buttons,
 * landing page section cards, code blocks, AI answer panel.
 *
 * B.2.11 — .docs-video, for narrated how-to videos in a page.
 *
 * B.2.10 — the topnav's "Light theme" button is replaced by a menu like the
 * tool pages' (burger above the search box, in a right-hand column), and
 * Walkthroughs / Questions are marked as featured links.
 */

:root { --cx-docs-version: 'B.2.11'; }

/* ── Body override ── */
/* cx-base default is flex column, 100vh, overflow:hidden — docs needs scroll */
body {
    height: auto;
    min-height: 100vh;
    overflow-y: auto;
}

/* ── Top navigation bar ── */
.docs-topnav {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--cx-surface);
    border-bottom: 1px solid var(--cx-border);
    padding: 0;
    flex-shrink: 0;
    overflow: visible;
}

.docs-brand {
    font-family: var(--cx-font-serif-title);
    font-size: 1.15rem;
    color: var(--cx-text-strong);
    text-decoration: none;
    padding: 0.65rem 1.25rem;
    border-right: 1px solid var(--cx-border);
    white-space: nowrap;
    flex-shrink: 0;
}
.docs-brand span { color: var(--cx-brand); }
.docs-brand:hover { text-decoration: none; background: var(--cx-bg-mid); }

.docs-nav-links {
    display: flex;
    align-items: stretch;
    flex-wrap: wrap;
    gap: 0;
    flex: 1;
    padding: 0 0.5rem;
}

.docs-nav-link {
    font-family: var(--cx-font-body);
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    color: var(--cx-text-mid);
    text-decoration: none;
    /* 0.45rem, down from 0.65: the links nearly always wrap to two or three
       rows, and the old padding made the bar most of a screenful on a laptop. */
    padding: 0.45rem 0.9rem;
    border-bottom: 2px solid transparent;
    transition: color var(--cx-transition-fast), border-color var(--cx-transition-fast);
    white-space: nowrap;
}
.docs-nav-link:hover { color: var(--cx-text-strong); text-decoration: none; }
.docs-nav-link[aria-current="section"] {
    color: var(--cx-brand);
    border-bottom-color: var(--cx-brand);
}

/* Walkthroughs and Questions — the two places most readers should start.
 * Brand-coloured and a little heavier, but no underline, so they never look
 * like the current section (which is brand colour plus the underline). */
.docs-nav-link-featured {
    color: var(--cx-brand);
    font-weight: 600;
}
.docs-nav-link-featured:hover { color: var(--cx-text-strong); }

/* Right-hand column: the menu, then the search box beneath it. */
.docs-topnav-tools {
    align-self: stretch;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 0.3rem;
    padding: 0.35rem 1rem;
    border-left: 1px solid var(--cx-border);
    flex-shrink: 0;
}

.docs-search-wrap {
    flex-shrink: 0;
}

/* ── Topnav menu ──
 * Repeats the tool pages' burger and menu (cx-admin.css: .cx-hdr-burger,
 * .cx-hdr-menu, .cx-menu-*), which docs pages do not load. Scoped under
 * .docs-menu-wrap so nothing leaks if a page ever loads both. If one changes,
 * change the other. The docs burger is a <button>; the menu shows and hides
 * with the hidden attribute rather than the tools' checkbox. */
.docs-menu-wrap {
    position: relative;
}
.docs-menu-wrap .cx-hdr-burger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 28px;
    height: 28px;
    padding: 4px;
    cursor: pointer;
    border: 1px solid var(--cx-border);
    border-radius: var(--cx-radius);
    background: var(--cx-surface);
}
.docs-menu-wrap .cx-hdr-burger:hover,
.docs-menu-wrap .cx-hdr-burger[aria-expanded="true"] { background: var(--cx-surface-mid); }
.docs-menu-wrap .cx-hdr-burger:focus-visible { outline: 2px solid var(--cx-brand); outline-offset: 2px; }
.docs-menu-wrap .cx-hdr-burger span {
    display: block;
    height: 2px;
    width: 100%;
    background: var(--cx-text-mid);
    border-radius: 1px;
}
.docs-menu-wrap .cx-hdr-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 200px;
    background: var(--cx-surface);
    border: 1px solid var(--cx-border);
    border-radius: var(--cx-radius);
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    z-index: 9500;           /* above the search results dropdown (9000) */
    padding: 0.35rem 0;
    text-align: left;
}
.docs-menu-wrap .cx-hdr-menu[hidden] { display: none; }
.docs-menu-wrap .cx-menu-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.5rem 1rem;
    font-family: var(--cx-font-body);
    font-size: 0.85rem;
    color: var(--cx-text);
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
}
.docs-menu-wrap .cx-menu-item:hover { background: var(--cx-surface-mid); text-decoration: none; }
.docs-menu-wrap .cx-menu-who {
    padding: 0.5rem 1rem;
    font-family: var(--cx-font-mono);
    font-size: 0.72rem;
    color: var(--cx-text-dim);
    border-top: 1px solid var(--cx-border);
    margin-top: 0.35rem;
    word-break: break-all;
}
.docs-menu-wrap .cx-menu-logout { margin: 0; }
.docs-menu-wrap .cx-menu-logout-btn { color: var(--cx-negative); }

#docs-search {
    background: var(--cx-bg);
    border: 1px solid var(--cx-border-dim);
    color: var(--cx-text);
    padding: 0.3rem 0.65rem;
    font-family: var(--cx-font-body);
    font-size: 0.8rem;
    width: 200px;
    border-radius: var(--cx-radius);
    transition: border-color var(--cx-transition-fast), width var(--cx-transition-mid);
}
#docs-search:focus {
    border-color: var(--cx-brand);
    outline: none;
    width: 260px;
}
#docs-search::placeholder { color: var(--cx-text-muted); }

/* ── Page shell: sidebar + content ── */
.docs-shell {
    display: flex;
    align-items: flex-start;
    min-height: calc(100vh - var(--docs-nav-height, 45px));
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    padding: 0 1rem;
    gap: 0;
}

/* ── Sidebar ── */
.docs-sidebar {
    width: 160px;
    flex-shrink: 0;
    position: fixed;
    top: var(--docs-nav-height, 45px);
    height: calc(100vh - var(--docs-nav-height, 45px));
    overflow-y: auto;
    padding: 2rem 0;
    border-right: 1px solid var(--cx-border-dim);
    z-index: 50;
}

/* Spacer so content doesn't hide behind fixed sidebar */
.docs-sidebar-spacer {
    width: 160px;
    flex-shrink: 0;
}

.docs-sidebar-section {
    margin-bottom: 1.5rem;
}

.docs-sidebar-heading {
    font-size: 0.62rem;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: var(--cx-brand);
    padding: 0 0.75rem 0.4rem;
    border-bottom: 1px solid var(--cx-border-dim);
    margin-bottom: 0.35rem;
}

.docs-sidebar-link {
    display: block;
    font-family: var(--cx-font-body);
    font-size: 0.78rem;
    color: var(--cx-text-mid);
    text-decoration: none;
    padding: 0.25rem 0.75rem;
    border-left: 2px solid transparent;
    transition: color var(--cx-transition-fast), background var(--cx-transition-fast);
    line-height: 1.3;
}
.docs-sidebar-link:hover {
    color: var(--cx-text-strong);
    background: var(--cx-bg-mid);
    text-decoration: none;
}
.docs-sidebar-link[aria-current="page"] {
    color: var(--cx-brand);
    border-left-color: var(--cx-brand);
    background: var(--cx-surface-mid);
    font-weight: 600;
}

/* On-page nav — lives inside the sidebar below section links */
.docs-sidebar-onpage {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--cx-border-dim);
}

.docs-sidebar-onpage-heading {
    font-size: 0.62rem;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: var(--cx-text-dim);
    padding: 0 0.75rem 0.4rem;
    display: block;
}

.docs-sidebar-onpage-link {
    display: block;
    font-size: 0.75rem;
    color: var(--cx-text-dim);
    text-decoration: none;
    padding: 0.2rem 0.75rem;
    border-left: 2px solid transparent;
    transition: color var(--cx-transition-fast);
    line-height: 1.3;
}
.docs-sidebar-onpage-link-sub {
    padding-left: 1.5rem;
    font-size: 0.7rem;
}
.docs-sidebar-onpage-link:hover { color: var(--cx-text); text-decoration: none; }
.docs-sidebar-onpage-link.active {
    color: var(--cx-brand);
    border-left-color: var(--cx-brand);
}

/* ── Main content area ── */
.docs-content {
    flex: 1;
    min-width: 0;
    padding: 2.5rem 3rem 6rem;
    max-width: 760px;
}
.docs-content-wide {
    max-width: 1100px;
}

/* ── Breadcrumb ── */
.docs-breadcrumb {
    font-size: 0.75rem;
    color: var(--cx-text-dim);
    margin-bottom: 1.75rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}
.docs-breadcrumb a {
    color: var(--cx-text-dim);
    text-decoration: none;
}
.docs-breadcrumb a:hover { color: var(--cx-brand); text-decoration: none; }
.docs-breadcrumb-sep { color: var(--cx-text-muted); }
.docs-breadcrumb-current { color: var(--cx-text-mid); }

/* ── Prose typography ── */
/* Long-form reading uses EB Garamond; chrome/labels stay Source Sans 3 */

.docs-content h1 {
    font-family: var(--cx-font-serif-title);
    font-size: 2rem;
    color: var(--cx-text-strong);
    font-weight: normal;
    margin-bottom: 0.4rem;
    line-height: 1.2;
}

.docs-content .docs-lead {
    font-family: var(--cx-font-serif-display);
    font-size: 1.15rem;
    color: var(--cx-text-mid);
    line-height: 1.6;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--cx-border-dim);
    padding-bottom: 1.5rem;
}

.docs-content h2 {
    font-family: var(--cx-font-serif-title);
    font-size: 1.35rem;
    color: var(--cx-text-strong);
    font-weight: normal;
    margin: 2.5rem 0 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--cx-border-dim);
    scroll-margin-top: calc(var(--docs-nav-height, 45px) + 15px);   /* clear sticky topnav on anchor jumps */
}

.docs-content h3 {
    font-family: var(--cx-font-body);
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--cx-brand);
    margin: 2rem 0 0.6rem;
    font-weight: 600;
    scroll-margin-top: calc(var(--docs-nav-height, 45px) + 15px);   /* clear sticky topnav on anchor jumps */
}

.docs-content p {
    font-family: var(--cx-font-serif-display);
    font-size: 1rem;
    color: var(--cx-text);
    line-height: 1.75;
    margin-bottom: 1.1rem;
}

.docs-content ul,
.docs-content ol {
    font-family: var(--cx-font-serif-display);
    font-size: 1rem;
    color: var(--cx-text);
    line-height: 1.75;
    margin-bottom: 1.1rem;
    padding-left: 1.5rem;
}

.docs-content li { margin-bottom: 0.3rem; }

.docs-content a {
    color: var(--cx-brand);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}
.docs-content a:hover { text-decoration: none; }

.docs-content strong {
    font-weight: 600;
    color: var(--cx-text-strong);
}

.docs-content em { font-style: italic; }

/* ── Section label (small uppercase above h2) ── */
.docs-section-label {
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--cx-text-dim);
    display: block;
    margin-top: 2.5rem;
    margin-bottom: 0.2rem;
}

/* ── Code / inline mono ── */
.docs-content code {
    font-family: var(--cx-font-mono);
    font-size: 0.85em;
    background: var(--cx-surface-mid);
    color: var(--cx-text-strong);
    padding: 0.1em 0.35em;
    border-radius: var(--cx-radius);
    border: 1px solid var(--cx-border-dim);
}

.docs-content pre {
    background: var(--cx-surface);
    border: 1px solid var(--cx-border);
    border-radius: var(--cx-radius);
    padding: 1rem 1.25rem;
    overflow-x: auto;
    margin-bottom: 1.5rem;
}

.docs-content pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--cx-text);
}

/* ── Callout / note box ── */
.docs-note {
    background: var(--cx-surface-mid);
    border-left: 3px solid var(--cx-brand);
    padding: 0.85rem 1.1rem;
    margin-bottom: 1.5rem;
    border-radius: 0 var(--cx-radius) var(--cx-radius) 0;
}
.docs-note p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--cx-text-mid);
}
.docs-note p strong { color: var(--cx-text-strong); }

.docs-note.tip  { border-left-color: var(--cx-ok); }
.docs-note.warn { border-left-color: var(--cx-warn); }

/* ── "Open tool" button ── */
.docs-open-tool {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.85rem;
    background: var(--cx-surface);
    border: 1px solid var(--cx-border);
    border-radius: var(--cx-radius);
    font-family: var(--cx-font-body);
    font-size: 0.8rem;
    color: var(--cx-text);
    text-decoration: none;
    transition: background var(--cx-transition-fast), border-color var(--cx-transition-fast);
    cursor: pointer;
    margin: 0.15rem 0;
}
.docs-open-tool:hover {
    background: var(--cx-bg-mid);
    border-color: var(--cx-border);
    color: var(--cx-text-strong);
    text-decoration: none;
}
.docs-open-tool::before {
    content: '↗';
    font-size: 0.75rem;
    color: var(--cx-brand);
}

/* ── Screenshot placeholder ── */
.docs-screenshot {
    background: var(--cx-surface);
    border: 1px solid var(--cx-border);
    border-radius: var(--cx-radius);
    aspect-ratio: 16 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1.5rem 0;
    color: var(--cx-text-muted);
    font-size: 0.8rem;
    font-family: var(--cx-font-body);
    letter-spacing: 0.05em;
}

/* Once a real screenshot is in place, size to the image instead of the 16:9 placeholder box */
.docs-screenshot:has(img) {
    aspect-ratio: auto;
    display: block;
    padding: 0;
}
.docs-screenshot img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: inherit;
}

/* ── Video ──
 * A narrated how-to beside the steps it shows. Sized like a screenshot:
 * full content width, its own aspect ratio, the same border and radius. */
.docs-video {
    margin: 1.5rem 0;
}
.docs-video video {
    display: block;
    width: 100%;
    height: auto;
    background: var(--cx-surface);
    border: 1px solid var(--cx-border);
    border-radius: var(--cx-radius);
}
.docs-video figcaption {
    font-family: var(--cx-font-body);
    font-size: 0.78rem;
    color: var(--cx-text-dim);
    line-height: 1.45;
    margin-top: 0.5rem;
}

/* ── Source/screenshot pairing ── */
.docs-pair {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: 1.5rem;
    align-items: start;
    margin: 1.5rem 0;
}
.docs-pair pre {
    margin: 0;
    font-size: 0.78rem;
    white-space: pre-wrap;
    word-break: break-word;
}
.docs-pair img {
    width: 100%;
    height: auto;
    display: block;
    border: 1px solid var(--cx-border);
    border-radius: var(--cx-radius);
}
@media (max-width: 700px) {
    .docs-pair { grid-template-columns: 1fr; }
}
.docs-pair-missing {
    border: 1px dashed var(--cx-border);
    border-radius: var(--cx-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 8rem;
    color: var(--cx-text-muted);
    font-size: 0.8rem;
    font-family: var(--cx-font-body);
    letter-spacing: 0.05em;
}

/* ── Long source: compact link + scrollable pop-up instead of inline code ── */
.docs-source-view {
    border: 1px solid var(--cx-border);
    border-radius: var(--cx-radius);
    background: var(--cx-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 8rem;
    cursor: pointer;
    color: var(--cx-brand);
    font-family: var(--cx-font-body);
    font-size: 0.85rem;
    text-align: center;
    transition: background var(--cx-transition-fast);
}
.docs-source-view:hover { background: var(--cx-bg-mid); }
.docs-source-view span {
    display: block;
    font-size: 0.7rem;
    color: var(--cx-text-muted);
    margin-top: 0.3rem;
}

.docs-source-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0,0,0,0.7);
    align-items: center;
    justify-content: center;
    padding: 2rem;
}
.docs-source-overlay.active { display: flex; }
.docs-source-overlay-box {
    background: var(--cx-surface);
    border-radius: var(--cx-radius);
    max-width: 900px;
    max-height: 85vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.docs-source-overlay-title {
    padding: 0.9rem 1.25rem;
    font-family: var(--cx-font-body);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--cx-text-strong);
    border-bottom: 1px solid var(--cx-border);
    flex-shrink: 0;
}
.docs-source-overlay pre {
    margin: 0;
    padding: 1.25rem;
    overflow: auto;
    font-size: 0.78rem;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ── Source highlighting — shared between inline pairs and the overlay ── */
.hl-datacx { color: var(--cx-code-datacx); }
.hl-class  { color: var(--cx-code-class); }

.docs-source-overlay-close {
    padding: 0.6rem 1.25rem;
    font-size: 0.75rem;
    color: var(--cx-text-muted);
    border-top: 1px solid var(--cx-border);
    cursor: pointer;
    flex-shrink: 0;
}

/* ── Step list ── */
.docs-steps {
    counter-reset: docs-step;
    list-style: none;
    padding: 0;
    margin-bottom: 1.5rem;
}

.docs-steps li {
    counter-increment: docs-step;
    display: flex;
    gap: 1rem;
    margin-bottom: 1.25rem;
    align-items: flex-start;
}

.docs-steps li::before {
    content: counter(docs-step);
    font-family: var(--cx-font-mono);
    font-size: 0.75rem;
    min-width: 1.6rem;
    height: 1.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cx-brand);
    color: var(--cx-on-brand);
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 0.25rem;
}

.docs-steps li > div {
    font-family: var(--cx-font-serif-display);
    font-size: 1rem;
    line-height: 1.7;
    color: var(--cx-text);
}

.docs-steps li > div strong {
    display: block;
    font-family: var(--cx-font-body);
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--cx-text-strong);
    margin-bottom: 0.2rem;
}

/* ── Landing page: audience cards ── */
.docs-audience-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1px;
    margin: 2rem 0;
}

.docs-content .docs-audience-card {
    background: var(--cx-surface);
    border: 1px solid var(--cx-border);
    padding: 1.4rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    cursor: pointer;
    text-decoration: none;
    transition: border-color var(--cx-transition-fast), background var(--cx-transition-fast);
    color: inherit;
}
.docs-content .docs-audience-card:hover {
    border-color: var(--cx-brand);
    background: var(--cx-bg-mid);
    text-decoration: none;
    color: inherit;
}

.docs-audience-role {
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--cx-brand);
}

.docs-audience-title {
    font-family: var(--cx-font-serif-title);
    font-size: 1.2rem;
    color: var(--cx-text-strong);
    font-weight: normal;
}

.docs-audience-desc {
    font-family: var(--cx-font-serif-display);
    font-size: 0.92rem;
    color: var(--cx-text-mid);
    line-height: 1.55;
}

.docs-audience-cta {
    font-family: var(--cx-font-body);
    font-size: 0.75rem;
    color: var(--cx-brand);
    margin-top: auto;
    padding-top: 0.5rem;
}

/* ── Search highlight ── */
mark.docs-highlight {
    background: var(--cx-highlight-bg);
    /* Explicit, not inherit — inherited text is near-white under a dark theme,
     * which made search hits unreadable on the yellow marker. */
    color: var(--cx-highlight-color);
    border-radius: 2px;
    padding: 0 0.1em;
}

/* ── Search results overlay ── */
.docs-search-results {
    display: none;
    position: fixed;
    background: var(--cx-surface);
    border: 1px solid var(--cx-border);
    border-radius: var(--cx-radius);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    z-index: 9000;
    max-height: 420px;
    
    /* Force proper hardware-accelerated scrolling container rules */
    overflow-x: hidden;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}
.docs-search-results.active { 
    display: block; 
}

.docs-search-result {
    display: block;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--cx-border-dim);
    text-decoration: none;
    color: inherit;
    transition: background var(--cx-transition-fast);
}
.docs-search-result:last-child { border-bottom: none; }
.docs-search-result:hover,
.docs-search-result:focus {
    background: var(--cx-bg-mid);
    text-decoration: none;
    outline: none;
}

.docs-result-title {
    font-family: var(--cx-font-body);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--cx-text-strong);
    margin-bottom: 0.15rem;
}

.docs-result-section {
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--cx-brand);
    margin-bottom: 0.25rem;
}

.docs-result-summary {
    font-size: 0.78rem;
    color: var(--cx-text-mid);
    line-height: 1.4;
}

.docs-search-empty {
    padding: 1rem;
    font-size: 0.82rem;
    color: var(--cx-text-dim);
    text-align: center;
}

/* ── Landing page hero ── */
.docs-hero {
    text-align: center;
    padding: 4rem 2rem 3rem;
    border-bottom: 1px solid var(--cx-border-dim);
    margin-bottom: 3rem;
}

.docs-hero-brand {
    font-family: var(--cx-font-serif-title);
    font-size: 2.6rem;
    color: var(--cx-text-strong);
    font-weight: normal;
    margin-bottom: 0.5rem;
}
.docs-hero-brand span { color: var(--cx-brand); }

.docs-hero-sub {
    font-family: var(--cx-font-serif-display);
    font-size: 1.2rem;
    color: var(--cx-text-mid);
    margin-bottom: 0.5rem;
}

.docs-hero-tagline {
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--cx-text-dim);
    margin-top: 0.75rem;
}

/* ── Landing page section chooser ── */
.docs-sections {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0 4rem;
    padding: 0 1rem;
}

.docs-section-card {
    background: var(--cx-surface);
    border: 1px solid var(--cx-border);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    text-decoration: none;
    color: inherit;
    transition: border-color var(--cx-transition-fast), background var(--cx-transition-fast);
    border-radius: var(--cx-radius);
}
.docs-section-card:hover {
    border-color: var(--cx-brand);
    background: var(--cx-bg-mid);
    text-decoration: none;
    color: inherit;
}

.docs-section-eyebrow {
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--cx-brand);
}

.docs-section-name {
    font-family: var(--cx-font-serif-title);
    font-size: 1.3rem;
    color: var(--cx-text-strong);
    font-weight: normal;
}

.docs-section-desc {
    font-family: var(--cx-font-serif-display);
    font-size: 0.9rem;
    color: var(--cx-text-mid);
    line-height: 1.55;
    flex: 1;
}

.docs-section-pages {
    font-size: 0.72rem;
    color: var(--cx-text-dim);
    font-family: var(--cx-font-body);
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--cx-border-dim);
}

/* ── Landing page (no sidebar layout) ── */
.docs-landing {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* ── Page meta block (hidden, for search) ── */
#page-meta { display: none; }

/* ── Responsive ── */
@media (max-width: 860px) {
    .docs-shell { padding: 0; }
    .docs-sidebar { display: none; }
    .docs-sidebar-spacer { display: none; }
    .docs-content { padding: 1.5rem 1.25rem 4rem; }
    .docs-topnav { flex-wrap: wrap; }
    /* Brand and the menu/search share the first row; the links take the
       whole of the next, rather than the tools dropping below everything. */
    .docs-topnav-tools {
        order: 2;
        margin-left: auto;
        flex-direction: row;
        align-items: center;
        border-left: 0;
    }
    .docs-nav-links {
        order: 3;
        flex: 1 0 100%;
        padding: 0.25rem 0.5rem;
        border-top: 1px solid var(--cx-border);
    }
    #docs-search { width: 150px; }
    #docs-search:focus { width: 180px; }
}

@media (max-width: 580px) {
    .docs-nav-link { padding: 0.4rem 0.7rem; }
    #docs-search,
    #docs-search:focus { width: 120px; }
    .docs-sections { grid-template-columns: 1fr; }
}

/* ── Search results page ─────────────────────────────────────────────────── */

/* .docs-search-page-count removed in B.2.6 — the result count and query echo it
   styled are gone. The query is in the editable box above, and a count of keyword
   matches was not something anyone acted on. */

.docs-search-page-empty,
.docs-search-page-loading {
    font-size: 0.9rem;
    color: var(--cx-text-mid);
    margin-top: 1rem;
}

a.docs-search-page-result,
a.docs-search-page-result:hover {
    text-decoration: none;
    color: inherit;
}

.docs-search-page-result {
    display: block;
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    border: 1px solid var(--cx-border-dim);
    border-radius: var(--cx-radius);
    background: var(--cx-surface);
    transition: border-color var(--cx-transition-fast), background var(--cx-transition-fast);
}

.docs-search-page-result:hover {
    border-color: var(--cx-brand);
    background: var(--cx-surface-mid);
}

.docs-search-page-result .docs-result-section {
    display: block;
    font-size: 0.65rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--cx-brand);
    margin-bottom: 0.2rem;
}

.docs-search-page-result .docs-result-title {
    display: block;
    font-family: var(--cx-font-serif-display);
    font-size: 1.1rem;
    color: var(--cx-text-strong);
    margin-bottom: 0.35rem;
}

.docs-result-page-summary {
    display: block;
    font-size: 0.85rem;
    color: var(--cx-text-mid);
    line-height: 1.5;
    margin-bottom: 0.4rem;
}

.docs-result-page-snippet {
    display: block;
    font-size: 0.82rem;
    color: var(--cx-text);
    line-height: 1.6;
    border-left: 2px solid var(--cx-border);
    padding-left: 0.75rem;
    margin-top: 0.4rem;
}

.docs-result-page-snippet strong {
    color: var(--cx-brand);
    font-weight: 600;
}

/* ── AI answer panel (cx-docs) ───────────────────────────────────────────── */
/*
 * Sits above the keyword results on the search page. Built and inserted by
 * docs.js, which removes it entirely when cx-docs is unavailable — so nothing
 * here should assume the panel exists, and nothing below it should depend on it.
 *
 * Deliberately quieter than the result cards: the answer is generated, and the
 * pages beneath it are the authority. It reads as a helpful summary rather than
 * the headline.
 */

.docs-ask {
    border: 1px solid var(--cx-border-dim);
    border-left: 3px solid var(--cx-brand);
    border-radius: var(--cx-radius);
    background: var(--cx-surface);
    padding: 0.8rem 1.25rem 1rem;
    margin-bottom: 1.75rem;
}

.docs-ask-head {
    display: flex;
    align-items: baseline;
    justify-content: flex-start;
    gap: 0.6rem;
    margin-bottom: 0;
}

/* An h2, so it reads as a section heading alongside "Search results" below —
   but reset off the docs-content h2 styling, which is sized for long-form prose
   and would dwarf the panel. */
.docs-ask-label {
    font-family: var(--cx-font-body);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--cx-brand);
    /* line-height must be reset explicitly: this is an h2, and the docs-content
       h2 rule sets a loose line-height for long-form prose, which at this size
       adds most of a blank line above and below a one-line label. */
    line-height: 1;
    margin: 0;
    padding: 0;
    border: 0;
}

/* The caveat, inline beside the heading on the same row. Quiet enough not to
   compete with the answer, present enough to be read. */
.docs-ask-caveat {
    font-size: 0.72rem;
    font-style: italic;
    line-height: 1.2;
    color: var(--cx-text-muted);
    margin: 0;
}

/* Empty most of the time — it carries "Reading the docs…" then "Writing…" and is
   cleared once the first tokens arrive, so it must not reserve visible space. */
.docs-ask-status {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.78rem;
    color: var(--cx-text-muted);
    font-style: italic;
}

.docs-ask-status:empty {
    margin: 0;
}

/*
 * FIXED height, not a max: the box is full size and empty from the moment the
 * panel appears, and fills in as the answer streams. A box that grows word by
 * word reflows the page continuously while the reader is trying to read it, and
 * shoves the search results down as it goes.
 *
 * num_predict caps answers at roughly 1600 characters, which normally fits in
 * this height; the scroll is for the occasional long one.
 */
.docs-ask-body {
    height: 16rem;
    overflow-y: auto;
    font-size: 0.9rem;
    line-height: 1.65;
    color: var(--cx-text);
}

.docs-ask-body p {
    margin: 0 0 0.7rem;
}

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

.docs-ask-body ol,
.docs-ask-body ul {
    margin: 0 0 0.7rem;
    padding-left: 1.4rem;
}

.docs-ask-body li {
    margin-bottom: 0.35rem;
}

.docs-ask-body strong {
    color: var(--cx-text-strong);
    font-weight: 600;
}

.docs-ask-body code {
    font-family: var(--cx-font-mono);
    font-size: 0.85em;
    background: var(--cx-surface-mid);
    color: var(--cx-text-strong);
    padding: 0.1em 0.35em;
    border-radius: var(--cx-radius);
    border: 1px solid var(--cx-border-dim);
}

.docs-ask-note {
    font-size: 0.78rem;
    color: var(--cx-text-mid);
    margin-top: 0.75rem;
}

.docs-ask-note:empty {
    margin-top: 0;
}

.docs-ask-note a {
    color: var(--cx-brand);
}

/*
 * The pages the answer was drawn from, promoted to the top of the results by
 * docs.js. Marked so the connection between panel and list is visible — without
 * it the reordering looks arbitrary.
 */
.docs-search-page-result-cited {
    border-left: 3px solid var(--cx-brand);
}

/* Sibling heading to the panel's "AI Answer", so the two blocks read as
   separate sections rather than one run of results. Matches the panel label
   rather than the long-form h2 used in docs content. */
.docs-search-page-heading {
    font-family: var(--cx-font-body);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--cx-brand);
    line-height: 1;
    margin: 0 0 0.5rem;
    padding: 0;
    border: 0;
}

/* ── Search page query box ───────────────────────────────────────────────── */
/*
 * The query above the answer, editable in place. Sized larger than the topnav
 * search: on this page it is the subject of the page, not a utility control.
 */

.docs-search-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.docs-search-form-input {
    flex: 1 1 auto;
    min-width: 0;
    font-family: var(--cx-font-body);
    font-size: 1rem;
    padding: 0.6rem 0.85rem;
    color: var(--cx-text);
    background: var(--cx-bg);
    border: 1px solid var(--cx-border);
    border-radius: var(--cx-radius);
    transition: border-color var(--cx-transition-fast);
}

.docs-search-form-input:focus {
    outline: none;
    border-color: var(--cx-brand);
}

.docs-search-form-button {
    flex: 0 0 auto;
    font-family: var(--cx-font-body);
    font-size: 0.9rem;
    padding: 0.6rem 1.1rem;
    color: var(--cx-on-brand);
    background: var(--cx-brand);
    border: 1px solid var(--cx-brand);
    border-radius: var(--cx-radius);
    cursor: pointer;
    transition: opacity var(--cx-transition-fast);
}

.docs-search-form-button:hover {
    opacity: 0.85;
}
