/* ==================================================================
   Docs area (/docs) — product picker, sidebar navigation, rendered
   markdown article and the "On this page" anchor list.

   Only --gapfy-* tokens are used for color/surface, so light and dark
   themes both work without local overrides (the tokens themselves flip
   in brand.css through both dark activation paths).
   ================================================================== */

.docs-layout {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr) 210px;
    gap: 3.5rem;
    align-items: start;
    padding-top: 2.5rem;
    padding-bottom: 6rem;
}

/* --- Sidebar ------------------------------------------------------ */

.docs-sidebar {
    position: sticky;
    top: calc(var(--gapfy-header-height) + 2rem);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    min-width: 0;
}

.docs-home-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--gapfy-muted);
    font-size: var(--gapfy-text-sm);
    font-weight: 600;
    text-decoration: none;
}

.docs-home-link:hover {
    color: var(--gapfy-primary);
}

.docs-home-link .material-symbols-outlined {
    font-size: 18px;
}

.docs-product-head {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-weight: 700;
    color: var(--gapfy-ink);
    font-size: var(--gapfy-text-lg);
}

.docs-product-head img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.docs-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    border-left: 1px solid var(--gapfy-line);
}

.docs-nav a {
    display: block;
    padding: 0.375rem 0.875rem;
    margin-left: -1px;
    color: var(--gapfy-ink-soft);
    font-size: var(--gapfy-text-sm);
    line-height: 1.4;
    text-decoration: none;
    border-left: 2px solid transparent;
}

.docs-nav a:hover {
    color: var(--gapfy-primary);
}

.docs-nav a.is-active {
    color: var(--gapfy-primary);
    font-weight: 600;
    border-left-color: var(--gapfy-primary);
}

.docs-sidebar-foot {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gapfy-line);
}

.docs-sidebar-foot a {
    color: var(--gapfy-muted);
    font-size: var(--gapfy-text-sm);
    text-decoration: none;
}

.docs-sidebar-foot a:hover {
    color: var(--gapfy-primary);
}

/* --- Article ------------------------------------------------------ */

.docs-article {
    min-width: 0;
    color: var(--gapfy-ink-soft);
    font-size: var(--gapfy-text-base);
    line-height: 1.7;
}

.docs-article h1 {
    font-size: clamp(1.875rem, 3vw, 2.5rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
    color: var(--gapfy-ink);
    margin: 0 0 1.5rem;
}

.docs-article h2 {
    font-size: var(--gapfy-text-2xl);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--gapfy-ink);
    margin: 2.75rem 0 1rem;
    /* Anchor jumps land below the fixed navbar. */
    scroll-margin-top: calc(var(--gapfy-header-height) + 1.5rem);
}

.docs-article h3 {
    font-size: var(--gapfy-text-lg);
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--gapfy-ink);
    margin: 1.75rem 0 0.75rem;
    scroll-margin-top: calc(var(--gapfy-header-height) + 1.5rem);
}

.docs-article p {
    margin: 0 0 1rem;
}

.docs-article ul,
.docs-article ol {
    padding-left: 1.375rem;
    margin: 0 0 1rem;
}

.docs-article li {
    margin-bottom: 0.375rem;
}

.docs-article a {
    color: var(--gapfy-primary);
    text-decoration: none;
}

.docs-article a:hover {
    text-decoration: underline;
}

.docs-article pre {
    background: var(--gapfy-bg-soft);
    border: 1px solid var(--gapfy-line);
    border-radius: var(--gapfy-radius);
    padding: 1rem 1.25rem;
    overflow-x: auto;
    margin: 0 0 1rem;
    font-size: var(--gapfy-text-sm);
    line-height: 1.6;
}

.docs-article code {
    font-family: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, monospace;
}

.docs-article :not(pre) > code {
    background: var(--gapfy-bg-soft);
    border: 1px solid var(--gapfy-line);
    border-radius: var(--gapfy-radius-sm);
    padding: 0.1em 0.35em;
    font-size: 0.9em;
}

.docs-article blockquote {
    border-left: 3px solid var(--gapfy-primary);
    background: var(--gapfy-bg-soft);
    border-radius: var(--gapfy-radius);
    margin: 0 0 1rem;
    padding: 0.75rem 1.25rem;
}

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

/* Wide tables scroll inside their own box instead of widening the page. */
.docs-article table {
    display: block;
    overflow-x: auto;
    border-collapse: collapse;
    margin: 0 0 1rem;
    font-size: var(--gapfy-text-sm);
}

.docs-article th,
.docs-article td {
    border: 1px solid var(--gapfy-line);
    padding: 0.5rem 0.875rem;
    text-align: left;
}

.docs-article th {
    background: var(--gapfy-bg-soft);
    color: var(--gapfy-ink);
    font-weight: 700;
}

/* --- On this page ------------------------------------------------- */

.docs-toc {
    position: sticky;
    top: calc(var(--gapfy-header-height) + 2rem);
    min-width: 0;
}

.docs-toc-title {
    font-size: var(--gapfy-text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gapfy-muted);
    margin-bottom: 0.625rem;
}

.docs-toc ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.docs-toc a {
    color: var(--gapfy-ink-soft);
    font-size: var(--gapfy-text-sm);
    line-height: 1.4;
    text-decoration: none;
}

.docs-toc a:hover {
    color: var(--gapfy-primary);
}

/* --- Responsive --------------------------------------------------- */

@media (max-width: 1100px) {
    .docs-layout {
        grid-template-columns: 230px minmax(0, 1fr);
    }

    .docs-toc {
        display: none;
    }
}

@media (max-width: 880px) {
    .docs-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding-top: 1.5rem;
    }

    .docs-sidebar {
        position: static;
    }
}
