/* =============================================================================
   documentation.css — styles for the signed-in Documentation area (/docs).
   Uses theme tokens (themes.css) / Bootstrap variables rather than hardcoded
   colors so the area follows any future theme change. Layout: sidebar + content
   + on-this-page TOC, responsive down to mobile.
   ============================================================================= */

.docs-page {
    /* Never let wide content push the page body sideways. */
    overflow-x: hidden;
}

/* ---- Sidebar --------------------------------------------------------------*/
.docs-sidebar {
    position: sticky;
    top: 1.5rem;
    max-height: calc(100vh - 3rem);
    overflow-y: auto;
    padding-right: .25rem;
}

.docs-sidebar-nav {
    font-size: .925rem;
}

.docs-sidebar-home {
    display: block;
    font-weight: 600;
    color: var(--text-primary, var(--bs-body-color));
    text-decoration: none;
    padding: .35rem .5rem;
    border-radius: .375rem;
}

.docs-sidebar-home:hover,
.docs-sidebar-home.active {
    color: var(--brand-primary, var(--bs-primary));
    background-color: var(--bg-secondary, var(--bs-tertiary-bg));
}

.docs-sidebar-category {
    margin-top: 1rem;
}

.docs-sidebar-category-title {
    display: flex;
    align-items: center;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted, var(--bs-secondary-color));
    padding: .25rem .5rem;
    margin-bottom: .15rem;
}

.docs-sidebar-articles {
    margin: 0;
    border-left: 2px solid var(--border-light, var(--bs-border-color));
    padding-left: 0;
}

.docs-sidebar-link {
    display: flex;
    align-items: center;
    gap: .25rem;
    color: var(--text-secondary, var(--bs-body-color));
    text-decoration: none;
    padding: .35rem .75rem;
    margin-left: -2px;
    border-left: 2px solid transparent;
    line-height: 1.3;
}

.docs-sidebar-link:hover {
    color: var(--brand-primary, var(--bs-primary));
    background-color: var(--bg-secondary, var(--bs-tertiary-bg));
}

.docs-sidebar-link.active {
    color: var(--brand-primary, var(--bs-primary));
    border-left-color: var(--brand-primary, var(--bs-primary));
    font-weight: 600;
}

.docs-sidebar-manage {
    display: block;
    margin-top: 1.25rem;
    padding: .4rem .5rem;
    font-size: .85rem;
    color: var(--text-muted, var(--bs-secondary-color));
    text-decoration: none;
    border-top: 1px solid var(--border-light, var(--bs-border-color));
}

.docs-sidebar-manage:hover {
    color: var(--brand-primary, var(--bs-primary));
}

/* ---- On-this-page TOC -----------------------------------------------------*/
.docs-toc {
    position: sticky;
    top: 1.5rem;
    max-height: calc(100vh - 3rem);
    overflow-y: auto;
    font-size: .85rem;
    border-left: 1px solid var(--border-light, var(--bs-border-color));
    padding-left: 1rem;
}

.docs-toc-title {
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted, var(--bs-secondary-color));
    margin-bottom: .5rem;
}

.docs-toc-list a {
    display: block;
    color: var(--text-secondary, var(--bs-body-color));
    text-decoration: none;
    padding: .2rem 0;
    border-left: 2px solid transparent;
    padding-left: .6rem;
    margin-left: -.6rem;
    line-height: 1.35;
}

.docs-toc-list a:hover {
    color: var(--brand-primary, var(--bs-primary));
}

.docs-toc-list a.active {
    color: var(--brand-primary, var(--bs-primary));
    border-left-color: var(--brand-primary, var(--bs-primary));
    font-weight: 600;
}

.docs-toc-list a.toc-h3 {
    padding-left: 1.4rem;
    font-size: .8rem;
}

.docs-toc-empty {
    color: var(--text-muted, var(--bs-secondary-color));
    font-style: italic;
}

/* ---- Article content ------------------------------------------------------*/
.docs-content {
    color: var(--text-primary, var(--bs-body-color));
    line-height: 1.7;
    /* Long words / URLs must wrap rather than force horizontal scroll. */
    overflow-wrap: break-word;
}

.docs-content h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-top: 2rem;
    margin-bottom: .75rem;
    padding-bottom: .35rem;
    border-bottom: 1px solid var(--border-light, var(--bs-border-color));
    scroll-margin-top: 1.5rem;
}

.docs-content h3 {
    font-size: 1.15rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: .5rem;
    scroll-margin-top: 1.5rem;
}

.docs-content h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-top: 1.25rem;
    margin-bottom: .5rem;
}

.docs-content p,
.docs-content ul,
.docs-content ol {
    margin-bottom: 1rem;
}

.docs-content img {
    max-width: 100%;
    height: auto;
    border: 1px solid var(--border-light, var(--bs-border-color));
    border-radius: .5rem;
    margin: .5rem 0;
    display: block;
}

.docs-content a {
    color: var(--brand-primary, var(--bs-link-color));
}

.docs-content blockquote {
    border-left: 4px solid var(--brand-primary, var(--bs-primary));
    background-color: var(--bg-secondary, var(--bs-tertiary-bg));
    padding: .5rem 1rem;
    margin: 0 0 1rem;
    border-radius: 0 .375rem .375rem 0;
}

.docs-content pre {
    background-color: var(--bg-tertiary, var(--bs-tertiary-bg));
    border: 1px solid var(--border-light, var(--bs-border-color));
    border-radius: .5rem;
    padding: 1rem;
    overflow-x: auto; /* wide code scrolls within its own box */
    margin-bottom: 1rem;
}

.docs-content code {
    background-color: var(--bg-tertiary, var(--bs-tertiary-bg));
    padding: .1rem .35rem;
    border-radius: .25rem;
    font-size: .875em;
}

.docs-content pre code {
    background: none;
    padding: 0;
}

/* Tables scroll within their own container, never widen the page. */
.docs-content .table-responsive,
.docs-content table {
    margin-bottom: 1rem;
}

.docs-content table {
    width: 100%;
    display: block;
    overflow-x: auto;
    border-collapse: collapse;
}

.docs-content th,
.docs-content td {
    border: 1px solid var(--border-light, var(--bs-border-color));
    padding: .5rem .75rem;
}

.docs-content th {
    background-color: var(--bg-secondary, var(--bs-tertiary-bg));
    text-align: left;
}

/* ---- Clickable images (full-size lightbox) --------------------------------*/
/* The zoom cursor is added by JS (via .docs-zoomable), so without JS the images
   still render inline and don't imply a click affordance they can't fulfil. */
.docs-content img.docs-zoomable {
    cursor: zoom-in;
}

.docs-lightbox {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background-color: rgba(0, 0, 0, .85);
    cursor: zoom-out;
    opacity: 0;
    transition: opacity .18s ease;
}

.docs-lightbox.is-open {
    opacity: 1;
}

.docs-lightbox img {
    max-width: 95vw;
    max-height: 92vh;
    height: auto;
    border-radius: .4rem;
    box-shadow: 0 12px 48px rgba(0, 0, 0, .55);
}

.docs-lightbox-close {
    position: absolute;
    top: .75rem;
    right: 1.25rem;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    background: transparent;
    border: 0;
    color: #fff;
    font-size: 2.25rem;
    line-height: 1;
    cursor: pointer;
    opacity: .85;
}

.docs-lightbox-close:hover {
    opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
    .docs-lightbox {
        transition: none;
    }
}

/* ---- Breadcrumb -----------------------------------------------------------*/
.docs-page .breadcrumb {
    font-size: .85rem;
    padding: .1rem 0 .5rem;
    margin-bottom: .5rem;
}

/* Muted trail; the current page (.active) is emphasised below. */
.docs-page .breadcrumb-item {
    color: var(--text-muted, var(--bs-secondary-color));
}

.docs-page .breadcrumb-item + .breadcrumb-item {
    padding-left: .5rem;
}

/* Themed chevron separator instead of Bootstrap's default slash. */
.docs-page .breadcrumb-item + .breadcrumb-item::before {
    content: "\203A";
    float: none;
    padding-right: .5rem;
    color: var(--text-muted, var(--bs-secondary-color));
}

.docs-page .breadcrumb-item a {
    color: var(--text-muted, var(--bs-secondary-color));
    text-decoration: none;
    font-weight: 500;
}

.docs-page .breadcrumb-item a:hover,
.docs-page .breadcrumb-item a:focus-visible {
    color: var(--brand-primary, var(--bs-primary));
    text-decoration: underline;
}

.docs-page .breadcrumb-item.active {
    color: var(--text-primary, var(--bs-body-color));
    font-weight: 600;
}
