/* Documentation pages — extends landing theme */

:root {
    --docs-sidebar-w: 17rem;
    --docs-toc-w: 14rem;
}

.docs-page {
    background: var(--landing-bg, #020617);
    color: #f1f5f9;
    min-height: 100vh;
}

html.light .docs-page {
    background: #eef2f7;
    color: #0f172a;
}

/* Header */
.docs-header {
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 1px solid var(--landing-border, rgba(255, 255, 255, 0.08));
    background: rgba(2, 6, 23, 0.9);
    backdrop-filter: blur(12px);
}

html.light .docs-header {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(15, 23, 42, 0.1);
}

.docs-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    max-width: 90rem;
    margin-inline: auto;
    min-height: 3.75rem;
    padding: 0.5rem clamp(1rem, 4vw, 2rem);
}

.docs-header-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: inherit;
    min-width: 0;
}

.docs-header-brand span {
    font-weight: 700;
    font-size: 1rem;
    white-space: nowrap;
}

.docs-header-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

html.light .docs-header-badge {
    background: #eef2ff;
    color: #4338ca;
    border-color: #c7d2fe;
}

.docs-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.docs-sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.625rem;
    border: 1px solid var(--landing-border, rgba(255, 255, 255, 0.1));
    background: transparent;
    color: inherit;
    cursor: pointer;
}

/* Shell layout */
.docs-shell {
    display: grid;
    grid-template-columns: var(--docs-sidebar-w) minmax(0, 1fr);
    max-width: 90rem;
    margin-inline: auto;
    min-height: calc(100vh - 3.75rem);
}

.docs-with-toc .docs-shell {
    grid-template-columns: var(--docs-sidebar-w) minmax(0, 1fr) var(--docs-toc-w);
}

/* Sidebar */
.docs-sidebar {
    position: sticky;
    top: 3.75rem;
    align-self: start;
    height: calc(100vh - 3.75rem);
    overflow-y: auto;
    padding: 1.25rem 0.75rem 2rem 1rem;
    border-right: 1px solid var(--landing-border, rgba(255, 255, 255, 0.08));
}

html.light .docs-sidebar {
    border-color: rgba(15, 23, 42, 0.08);
}

.docs-sidebar-label {
    padding: 0 0.75rem;
    margin-bottom: 0.5rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
}

.docs-nav-link {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.625rem 0.75rem;
    margin-bottom: 0.125rem;
    border-radius: 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.35;
    color: #94a3b8;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.docs-nav-link:hover {
    color: #f8fafc;
    background: rgba(255, 255, 255, 0.05);
}

html.light .docs-nav-link {
    color: #475569;
}

html.light .docs-nav-link:hover {
    color: #0f172a;
    background: #f1f5f9;
}

.docs-nav-link.is-active {
    color: #86efac;
    background: rgba(34, 197, 94, 0.12);
    font-weight: 600;
}

html.light .docs-nav-link.is-active {
    color: #15803d;
    background: #ecfdf5;
}

.docs-nav-icon {
    flex-shrink: 0;
    width: 1.125rem;
    height: 1.125rem;
    margin-top: 0.1rem;
    opacity: 0.75;
}

.docs-nav-link.is-active .docs-nav-icon {
    opacity: 1;
}

/* Main content */
.docs-main {
    min-width: 0;
    padding: 2rem clamp(1.25rem, 4vw, 2.5rem) 4rem;
}

.docs-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
    margin-bottom: 1.25rem;
    font-size: 0.75rem;
    color: #64748b;
}

.docs-breadcrumb a {
    color: #94a3b8;
    text-decoration: none;
}

.docs-breadcrumb a:hover {
    color: #22c55e;
}

html.light .docs-breadcrumb a {
    color: #64748b;
}

.docs-breadcrumb-sep {
    opacity: 0.5;
}

.docs-hero {
    margin-bottom: 2.5rem;
}

.docs-hero h1 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin-bottom: 0.75rem;
}

.docs-hero p {
    font-size: 1.05rem;
    line-height: 1.6;
    color: #94a3b8;
    max-width: 42rem;
}

html.light .docs-hero p {
    color: #475569;
}

/* Index grid */
.docs-index-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
    gap: 1rem;
}

.docs-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.25rem;
    border-radius: 1rem;
    border: 1px solid var(--landing-border, rgba(255, 255, 255, 0.08));
    background: rgba(15, 23, 42, 0.5);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

html.light .docs-card {
    background: #ffffff;
    border-color: rgba(15, 23, 42, 0.1);
    box-shadow: 0 4px 20px -8px rgba(15, 23, 42, 0.12);
}

.docs-card:hover {
    border-color: rgba(34, 197, 94, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 12px 32px -12px rgba(34, 197, 94, 0.15);
}

.docs-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.75rem;
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

html.light .docs-card-icon {
    background: #ecfdf5;
    color: #16a34a;
}

.docs-card h2 {
    font-size: 1rem;
    font-weight: 700;
}

.docs-card p {
    font-size: 0.8125rem;
    line-height: 1.5;
    color: #94a3b8;
    flex: 1;
}

html.light .docs-card p {
    color: #64748b;
}

.docs-card-arrow {
    font-size: 0.75rem;
    font-weight: 600;
    color: #22c55e;
}

/* Prose content */
.docs-prose h2 {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 2.5rem 0 1rem;
    padding-top: 0.5rem;
    scroll-margin-top: 5rem;
}

.docs-prose h2:first-child {
    margin-top: 0;
}

.docs-prose h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 1.75rem 0 0.75rem;
    scroll-margin-top: 5rem;
}

.docs-prose p {
    font-size: 0.9375rem;
    line-height: 1.7;
    color: #cbd5e1;
    margin-bottom: 1rem;
}

html.light .docs-prose p {
    color: #334155;
}

.docs-prose ul,
.docs-prose ol {
    margin: 0 0 1rem 1.25rem;
    font-size: 0.9375rem;
    line-height: 1.7;
    color: #cbd5e1;
}

html.light .docs-prose ul,
html.light .docs-prose ol {
    color: #334155;
}

.docs-prose li {
    margin-bottom: 0.375rem;
}

.docs-prose a {
    color: #4ade80;
    text-decoration: underline;
    text-underline-offset: 2px;
}

html.light .docs-prose a {
    color: #15803d;
}

.docs-prose code:not(pre code) {
    padding: 0.15rem 0.4rem;
    border-radius: 0.375rem;
    font-size: 0.85em;
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
}

html.light .docs-prose code:not(pre code) {
    background: #e2e8f0;
    color: #0f172a;
}

.docs-prose pre {
    margin: 1rem 0 1.25rem;
    padding: 1rem 1.125rem;
    border-radius: 0.875rem;
    font-size: 0.8125rem;
    line-height: 1.55;
    overflow-x: auto;
    background: rgba(2, 6, 23, 0.85);
    color: #cbd5e1;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

html.light .docs-prose pre {
    background: #f1f5f9;
    color: #334155;
    border-color: #dbeafe;
}

.docs-prose table {
    width: 100%;
    margin: 1rem 0 1.5rem;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.docs-prose th,
.docs-prose td {
    padding: 0.625rem 0.875rem;
    text-align: left;
    border-bottom: 1px solid var(--landing-border, rgba(255, 255, 255, 0.08));
}

html.light .docs-prose th,
html.light .docs-prose td {
    border-color: rgba(15, 23, 42, 0.1);
}

.docs-prose th {
    font-weight: 600;
    color: #f1f5f9;
    background: rgba(255, 255, 255, 0.04);
}

html.light .docs-prose th {
    color: #0f172a;
    background: #f8fafc;
}

/* Callouts */
.docs-callout {
    display: flex;
    gap: 0.875rem;
    padding: 1rem 1.125rem;
    margin: 1.25rem 0;
    border-radius: 0.875rem;
    font-size: 0.875rem;
    line-height: 1.55;
    border: 1px solid;
}

.docs-callout-icon {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.1rem;
}

.docs-callout-tip {
    background: rgba(34, 197, 94, 0.08);
    border-color: rgba(34, 197, 94, 0.25);
    color: #bbf7d0;
}

html.light .docs-callout-tip {
    background: #ecfdf5;
    border-color: #6ee7b7;
    color: #065f46;
}

.docs-callout-warn {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.3);
    color: #fde68a;
}

html.light .docs-callout-warn {
    background: #fffbeb;
    border-color: #fcd34d;
    color: #92400e;
}

.docs-callout-info {
    background: rgba(99, 102, 241, 0.08);
    border-color: rgba(99, 102, 241, 0.25);
    color: #c7d2fe;
}

html.light .docs-callout-info {
    background: #eef2ff;
    border-color: #a5b4fc;
    color: #3730a3;
}

.docs-callout-danger {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.3);
    color: #fecaca;
}

html.light .docs-callout-danger {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #991b1b;
}

.docs-callout strong {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 600;
}

/* Steps */
.docs-steps {
    counter-reset: docs-step;
    margin: 1.5rem 0;
    padding: 0;
    list-style: none;
}

.docs-steps li {
    position: relative;
    padding-left: 2.75rem;
    margin-bottom: 1.5rem;
    counter-increment: docs-step;
}

.docs-steps li::before {
    content: counter(docs-step);
    position: absolute;
    left: 0;
    top: 0.1rem;
    width: 1.75rem;
    height: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

html.light .docs-steps li::before {
    background: #dcfce7;
    color: #15803d;
}

.docs-steps li strong {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.9375rem;
}

.docs-steps li p {
    margin: 0;
    font-size: 0.875rem;
}

/* TOC sidebar */
.docs-toc {
    position: sticky;
    top: 3.75rem;
    align-self: start;
    height: calc(100vh - 3.75rem);
    overflow-y: auto;
    padding: 2rem 1rem 2rem 0.5rem;
    border-left: 1px solid var(--landing-border, rgba(255, 255, 255, 0.08));
}

html.light .docs-toc {
    border-color: rgba(15, 23, 42, 0.08);
}

.docs-toc-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    margin-bottom: 0.75rem;
}

.docs-toc a {
    display: block;
    padding: 0.35rem 0;
    font-size: 0.75rem;
    line-height: 1.4;
    color: #64748b;
    text-decoration: none;
    border-left: 2px solid transparent;
    padding-left: 0.75rem;
    margin-left: -2px;
    transition: color 0.15s, border-color 0.15s;
}

.docs-toc a:hover,
.docs-toc a.is-active {
    color: #4ade80;
    border-left-color: #22c55e;
}

html.light .docs-toc a:hover,
html.light .docs-toc a.is-active {
    color: #15803d;
}

/* Footer */
.docs-footer {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--landing-border, rgba(255, 255, 255, 0.08));
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.8125rem;
    color: #64748b;
}

.docs-footer-nav {
    display: flex;
    gap: 0.75rem;
}

.docs-footer-nav a {
    color: #94a3b8;
    text-decoration: none;
}

.docs-footer-nav a:hover {
    color: #22c55e;
}

/* Quick links bar on index */
.docs-quick-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.docs-quick-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.4375rem 0.875rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid var(--landing-border, rgba(255, 255, 255, 0.1));
    background: rgba(255, 255, 255, 0.03);
    color: #94a3b8;
    text-decoration: none;
    transition: border-color 0.15s, color 0.15s;
}

.docs-quick-pill:hover {
    border-color: rgba(34, 197, 94, 0.4);
    color: #4ade80;
}

html.light .docs-quick-pill {
    background: #ffffff;
    border-color: rgba(15, 23, 42, 0.12);
    color: #475569;
}

/* Mobile */
@media (max-width: 1023px) {
    .docs-with-toc .docs-shell {
        grid-template-columns: var(--docs-sidebar-w) minmax(0, 1fr);
    }

    .docs-toc {
        display: none;
    }
}

@media (max-width: 767px) {
    .docs-sidebar-toggle {
        display: inline-flex;
    }

    .docs-shell {
        grid-template-columns: 1fr;
    }

    .docs-sidebar {
        position: fixed;
        top: 3.75rem;
        left: 0;
        z-index: 40;
        width: min(18rem, 88vw);
        height: calc(100vh - 3.75rem);
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        background: #020617;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
    }

    html.light .docs-sidebar {
        background: #ffffff;
    }

    .docs-sidebar.is-open {
        transform: translateX(0);
    }

    .docs-sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 3.75rem 0 0 0;
        z-index: 35;
        background: rgba(0, 0, 0, 0.5);
    }

    .docs-sidebar-backdrop.is-open {
        display: block;
    }

    .docs-main {
        padding: 1.5rem 1rem 3rem;
    }
}
