/* ClassMata docs — built entirely from tokens.css (--brand-primary, --brand-secondary,
   --neutral-*, --font-heading, --font-body, --radius, --shadow). No new palette. */

/* ---------- Search box (shared by hub + article) ---------- */
.docs-search {
    position: relative;
    max-width: 560px;
}
.docs-hub-search {
    display: flex;
    justify-content: center;
    margin-top: 1.75rem;
}
.docs-search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--neutral-500);
    pointer-events: none;
}
.docs-search-input {
    width: 100%;
    padding: 0.7rem 1rem 0.7rem 2.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.95rem;
    background: #fff;
    color: var(--text);
}
.docs-search-input:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(0, 77, 150, 0.12);
}
.docs-search-results {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 0.4rem);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    max-height: 360px;
    overflow-y: auto;
    z-index: 20;
    text-align: left;
}
.docs-search-hit {
    display: block;
    padding: 0.65rem 1rem;
    text-decoration: none;
    border-bottom: 1px solid var(--neutral-200);
}
.docs-search-hit:last-child { border-bottom: none; }
.docs-search-hit:hover,
.docs-search-hit:focus { background: var(--neutral-50); }
.docs-search-hit-title {
    display: block;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--brand-primary);
}
.docs-search-hit-snippet {
    display: block;
    font-size: 0.82rem;
    color: var(--muted);
    margin-top: 0.15rem;
}
.docs-search-empty {
    padding: 0.85rem 1rem;
    font-size: 0.88rem;
    color: var(--muted);
}

/* ---------- Hub ---------- */
.docs-category-heading {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--neutral-900);
    margin: 0 0 1.25rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--neutral-200);
}
a.docs-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
}
a.docs-card p {
    color: var(--muted);
    font-size: 0.92rem;
    margin: 0;
}

/* ---------- Article shell: sidebar / prose / on-this-page ---------- */
.docs-shell {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr) 220px;
    gap: 2.5rem;
    padding: 2.5rem 1rem 5rem;
    align-items: start;
}

.docs-sidebar {
    position: sticky;
    top: 1.5rem;
    align-self: start;
}
.docs-sidebar-cat {
    font-family: var(--font-heading);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--neutral-500);
    margin: 1.5rem 0 0.5rem;
}
.docs-sidebar-cat:first-of-type { margin-top: 1.5rem; }
.docs-sidebar-list {
    list-style: none;
    margin: 0 0 0.5rem;
    padding: 0;
}
.docs-sidebar-list a {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.4rem 0.6rem;
    margin: 0 -0.6rem;
    border-radius: 8px;
    text-decoration: none;
    color: var(--neutral-700);
    font-size: 0.9rem;
}
.docs-sidebar-list a:hover { background: var(--neutral-50); color: var(--brand-primary); }
.docs-sidebar-list a.active {
    background: rgba(0, 77, 150, 0.08);
    color: var(--brand-primary);
    font-weight: 600;
}
.docs-sidebar-list a i { color: var(--brand-primary); font-size: 0.95rem; }

.docs-back {
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--brand-primary);
    text-decoration: none;
    margin-bottom: 1.25rem;
}
.docs-back:hover { text-decoration: underline; }

/* ---------- Rendered Markdown prose ---------- */
.docs-prose {
    min-width: 0;
    font-family: var(--font-body);
    color: var(--text);
    line-height: 1.7;
    max-width: 72ch;
}
.docs-prose h1 {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 1rem;
}
.docs-prose h2 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    margin: 2.5rem 0 1rem;
    scroll-margin-top: 1.5rem;
}
.docs-prose h3 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 600;
    margin: 1.75rem 0 0.75rem;
    scroll-margin-top: 1.5rem;
}
.docs-prose p { margin: 0 0 1rem; }
.docs-prose ul, .docs-prose ol { margin: 0 0 1.1rem; padding-left: 1.3rem; }
.docs-prose li { margin-bottom: 0.35rem; }
.docs-prose strong { color: var(--neutral-900); }
.docs-prose code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.85em;
    background: var(--neutral-50);
    border: 1px solid var(--neutral-200);
    border-radius: 4px;
    padding: 0.1em 0.35em;
}
.docs-prose img {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin: 0.5rem 0 1.5rem;
}

/* ---------- On-this-page rail ---------- */
.docs-toc {
    position: sticky;
    top: 1.5rem;
    align-self: start;
    font-size: 0.85rem;
}
.docs-toc-label {
    font-family: var(--font-heading);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--neutral-500);
    margin: 0 0 0.6rem;
}
.docs-toc ul { list-style: none; margin: 0; padding: 0; }
.docs-toc li { margin-bottom: 0.5rem; }
.docs-toc a {
    color: var(--neutral-700);
    text-decoration: none;
}
.docs-toc a:hover { color: var(--brand-primary); }
.docs-toc .toc-level-3 { padding-left: 0.9rem; }

@media (max-width: 992px) {
    .docs-shell { grid-template-columns: 220px minmax(0, 1fr); }
    .docs-toc { display: none; }
}

@media (max-width: 768px) {
    .docs-shell { grid-template-columns: 1fr; gap: 1.5rem; padding: 1.5rem 1rem 3rem; }
    .docs-sidebar { position: static; }
}
