/* 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; }
}

/* ---------- Lightbox (documentation screenshots) ---------- */
.docs-prose img.docs-zoomable {
    cursor: zoom-in;
    transition: box-shadow .15s ease, transform .15s ease;
}
.docs-prose img.docs-zoomable:hover,
.docs-prose img.docs-zoomable:focus-visible {
    box-shadow: 0 6px 24px rgba(0, 0, 0, .18);
}
.docs-lightbox {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(10, 18, 32, .88);
    cursor: zoom-out;
}
.docs-lightbox.open { display: flex; }
body.docs-lightbox-lock { overflow: hidden; }
.docs-lightbox-figure {
    margin: 0;
    max-width: 94vw;
    max-height: 94vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.docs-lightbox-figure img {
    max-width: 94vw;
    max-height: calc(94vh - 2.4rem);
    width: auto;
    height: auto;
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .5);
}
.docs-lightbox-figure figcaption {
    color: #e5e9f0;
    font-size: .9rem;
    margin-top: .6rem;
    text-align: center;
}
.docs-lightbox-btn {
    position: absolute;
    border: 0;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    width: 2.8rem;
    height: 2.8rem;
    border-radius: 50%;
    font-size: 1.8rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.docs-lightbox-btn:hover, .docs-lightbox-btn:focus-visible { background: rgba(255, 255, 255, .3); }
.docs-lightbox-close { top: 1rem; right: 1rem; }
.docs-lightbox-prev { left: 1rem; top: 50%; transform: translateY(-50%); }
.docs-lightbox-next { right: 1rem; top: 50%; transform: translateY(-50%); }
.docs-lightbox-btn[hidden] { display: none; }
.docs-lightbox.single .docs-lightbox-prev,
.docs-lightbox.single .docs-lightbox-next { display: none; }
@media (max-width: 600px) {
    .docs-lightbox-prev, .docs-lightbox-next { top: auto; bottom: 1rem; transform: none; }
}

/* ---------- Tables (Markdown pipe tables) ---------- */
.docs-prose .docs-table-wrap {
    overflow-x: auto;
    margin: 1.25rem 0 1.9rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    -webkit-overflow-scrolling: touch;
}
.docs-prose table {
    width: 100%;
    min-width: 30rem;
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.92rem;
    line-height: 1.5;
}
.docs-prose thead th {
    background: linear-gradient(135deg, var(--brand-primary) 0%, #0a63b8 100%);
    color: #fff;
    font-family: var(--font-heading);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-align: left;
    padding: 0.8rem 1rem;
    border: 0;
    white-space: nowrap;
}
.docs-prose tbody td,
.docs-prose tbody th {
    padding: 0.7rem 1rem;
    vertical-align: top;
    border-top: 1px solid var(--neutral-200);
    border-right: 1px solid var(--neutral-200);
}
.docs-prose tbody td:last-child,
.docs-prose tbody th:last-child { border-right: 0; }
.docs-prose tbody tr:first-child td,
.docs-prose tbody tr:first-child th { border-top: 0; }
.docs-prose tbody tr:nth-child(even) { background: var(--neutral-50); }
.docs-prose tbody tr { transition: background-color .12s ease; }
.docs-prose tbody tr:hover { background: rgba(0, 77, 150, 0.07); }
.docs-prose tbody td:first-child { color: var(--neutral-900); font-weight: 500; }
.docs-prose table p { margin: 0 0 0.35rem; }
.docs-prose table p:last-child { margin-bottom: 0; }
.docs-prose table ul, .docs-prose table ol { margin: 0.2rem 0 0; padding-left: 1.1rem; }
.docs-prose table code { white-space: nowrap; }
@media (max-width: 575px) {
    .docs-prose table { font-size: 0.86rem; }
    .docs-prose thead th, .docs-prose tbody td, .docs-prose tbody th { padding: 0.6rem 0.75rem; }
}
