:root {
    --docs-bg: #0d0d0d;
    --docs-card: #121212;
    --docs-border: rgba(255, 255, 255, 0.06);
    --docs-text: #ffffff;
    --docs-muted: rgba(255, 255, 255, 0.65);
    --docs-accent: rgba(34, 90, 122, 0.75);
    --docs-prose-width: 780px;
    --docs-sidebar-width: 240px;
}

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    height: 100%;
    overflow: hidden;
    background-color: var(--docs-bg);
    color: var(--docs-text);
    font-family: 'Poppins', sans-serif;
}

body {
    position: relative;
}

.pattern-layer {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
    opacity: 0.78;
}

.pattern-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    justify-content: center;
    min-height: 100dvh;
}

.pattern-row {
    width: 100%;
    overflow: hidden;
    display: flex;
    flex-shrink: 0;
    contain: layout paint;
}

.marquee-track {
    display: flex;
    width: max-content;
    will-change: transform;
    backface-visibility: hidden;
}

.to-right { animation: scroll-right 165s linear infinite; }
.to-left { animation: scroll-left 165s linear infinite; }

@keyframes scroll-left {
    0% { transform: translate3d(0, 0, 0); }
    100% { transform: translate3d(-50%, 0, 0); }
}

@keyframes scroll-right {
    0% { transform: translate3d(-50%, 0, 0); }
    100% { transform: translate3d(0, 0, 0); }
}

.pattern-text {
    font-family: 'NATS', sans-serif;
    font-weight: 500;
    color: #121212;
    letter-spacing: 0.25em;
    margin-right: 0.25em;
    font-size: 2.2rem;
    line-height: 1;
    white-space: nowrap;
    flex-shrink: 0;
}

.docs-shell {
    position: relative;
    z-index: 1;
    height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    scrollbar-width: none;
}

.docs-shell::-webkit-scrollbar {
    display: none;
}

/* Floating chrome — matches marketing site */
.brand-badge {
    position: fixed;
    top: max(14px, env(safe-area-inset-top));
    left: max(14px, env(safe-area-inset-left));
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background-color: #121212;
    padding: 8px 18px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.02);
    z-index: 100;
    pointer-events: auto;
    cursor: pointer;
    height: 38px;
    box-sizing: border-box;
    text-decoration: none;
    color: inherit;
}

.badge-icon {
    width: 26px;
    height: auto;
    object-fit: contain;
    margin-right: -2px;
}

.badge-text {
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    font-size: 0.85rem;
    color: #ffffff;
    letter-spacing: 0.02em;
    line-height: 1;
}

.action-header {
    position: fixed;
    top: max(14px, env(safe-area-inset-top));
    right: max(14px, env(safe-area-inset-right));
    display: flex;
    gap: 10px;
    z-index: 100;
    pointer-events: auto;
}

.action-header-more {
    position: relative;
    display: none;
}

.action-button--more[aria-expanded="true"] {
    background-color: #1a1a1a;
    border-color: rgba(255, 255, 255, 0.12);
}

.action-more-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
    background-color: #121212;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
    z-index: 110;
}

.action-more-menu[hidden] {
    display: none;
}

.action-more-item {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 6px;
    color: #ffffff;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    font-size: 0.82rem;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.action-more-item:hover {
    background-color: #1a1a1a;
}

.action-more-item svg {
    width: 1em;
    height: 1em;
    flex-shrink: 0;
}

button.action-button {
    font: inherit;
    appearance: none;
    -webkit-appearance: none;
}

.action-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background-color: #121212;
    color: #ffffff;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    font-size: 0.82rem;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.8s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
    border: 1px solid rgba(255, 255, 255, 0.02);
    cursor: pointer;
    user-select: none;
}

.action-button * {
    pointer-events: none;
}

.action-button:hover {
    transform: scale(1.05);
    background-color: #161616;
    border-color: rgba(255, 255, 255, 0.08);
}

.action-button:active {
    transform: scale(0.98);
}

.action-button svg {
    font-size: 1rem;
    width: 1em;
    height: 1em;
    flex-shrink: 0;
}

.action-button--current {
    background-color: rgba(34, 90, 122, 0.5);
    border-color: rgba(34, 90, 122, 0.75);
    cursor: default;
    pointer-events: none;
    transform: none;
}

.docs-layout {
    display: grid;
    grid-template-columns: var(--docs-sidebar-width) 1fr;
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: max(68px, calc(54px + env(safe-area-inset-top))) max(20px, env(safe-area-inset-right)) 48px max(20px, env(safe-area-inset-left));
    gap: 32px;
}

.docs-sidebar {
    position: sticky;
    top: max(68px, calc(54px + env(safe-area-inset-top)));
    align-self: start;
    max-height: calc(100dvh - max(84px, calc(70px + env(safe-area-inset-top))));
    overflow-y: auto;
    scrollbar-width: thin;
}

.docs-nav-title {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.4);
    margin: 0 0 12px;
    padding: 0 12px;
}

.docs-nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.docs-nav-link {
    display: block;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.docs-nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.docs-nav-link.active {
    color: #fff;
    background: rgba(34, 90, 122, 0.35);
    border: 1px solid rgba(34, 90, 122, 0.5);
}

.docs-mobile-nav {
    display: none;
    margin-bottom: 20px;
}

.docs-mobile-select {
    width: 100%;
    padding: 12px 14px;
    border-radius: 8px;
    background: var(--docs-card);
    border: 1px solid var(--docs-border);
    color: #fff;
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
}

.docs-main {
    min-width: 0;
}

.docs-breadcrumb {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.45);
    margin-bottom: 20px;
}

.docs-breadcrumb a {
    color: rgba(255, 255, 255, 0.55);
    text-decoration: none;
}

.docs-breadcrumb a:hover {
    color: #fff;
}

.docs-prose {
    max-width: var(--docs-prose-width);
    background: var(--docs-card);
    border: 1px solid var(--docs-border);
    border-radius: 12px;
    padding: 32px 28px 40px;
}

.docs-prose > h1 {
    margin: 0 0 16px;
    font-size: clamp(1.6rem, 4vw, 2.1rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.docs-prose > p:first-of-type {
    color: var(--docs-muted);
    font-weight: 300;
    line-height: 1.65;
}

.docs-prose h2 {
    margin: 36px 0 14px;
    font-size: clamp(1.15rem, 2.5vw, 1.45rem);
    font-weight: 600;
    letter-spacing: -0.01em;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.docs-prose h2:first-of-type {
    border-top: none;
    padding-top: 0;
    margin-top: 24px;
}

.docs-prose h3 {
    margin: 24px 0 10px;
    font-size: 1.05rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.92);
}

.docs-prose p {
    margin: 0 0 14px;
    font-size: 0.92rem;
    font-weight: 300;
    line-height: 1.7;
    color: var(--docs-muted);
}

.docs-prose strong {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

.docs-prose ul, .docs-prose ol {
    margin: 0 0 16px;
    padding-left: 1.4rem;
    color: var(--docs-muted);
    font-size: 0.92rem;
    line-height: 1.65;
}

.docs-prose li {
    margin-bottom: 6px;
}

.docs-prose hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin: 28px 0;
}

.docs-prose code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.84em;
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 6px;
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.88);
}

.docs-prose pre {
    margin: 0 0 18px;
    padding: 16px 18px;
    background: #0a0a0a;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    overflow-x: auto;
}

.docs-prose pre code {
    background: none;
    padding: 0;
    font-size: 0.82rem;
    line-height: 1.55;
    white-space: pre;
    display: block;
}

.docs-prose pre.mermaid {
    background: transparent;
    border: none;
    padding: 8px 0 20px;
    text-align: center;
}

.docs-table-wrap {
    overflow-x: auto;
    margin: 0 0 18px;
}

.docs-prose table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.docs-prose th,
.docs-prose td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    vertical-align: top;
}

.docs-prose th {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.03);
}

.docs-prose td {
    color: var(--docs-muted);
    font-weight: 300;
}

.docs-prose td code {
    font-size: 0.8rem;
}

/* Hub */
.docs-hub {
    max-width: 900px;
    margin: 0 auto;
    padding: max(68px, calc(54px + env(safe-area-inset-top))) max(20px, env(safe-area-inset-right)) 64px max(20px, env(safe-area-inset-left));
    position: relative;
    z-index: 1;
}

.docs-hub-hero {
    text-align: center;
    margin-bottom: 40px;
}

.docs-hub-hero h1 {
    margin: 0 0 10px;
    font-size: clamp(2rem, 6vw, 2.75rem);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.docs-hub-hero p {
    margin: 0;
    font-size: 1rem;
    font-weight: 300;
    color: var(--docs-muted);
    line-height: 1.6;
}

.docs-hub-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.docs-hub-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 24px;
    background: var(--docs-card);
    border: 1px solid var(--docs-border);
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.25s ease, transform 0.25s ease, background-color 0.25s ease;
}

.docs-hub-card:hover {
    border-color: rgba(34, 90, 122, 0.5);
    background: #151515;
    transform: translateY(-2px);
}

.docs-hub-card h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.docs-hub-card p {
    margin: 0;
    flex: 1;
    font-size: 0.88rem;
    font-weight: 300;
    line-height: 1.55;
    color: var(--docs-muted);
}

.docs-hub-card-arrow {
    font-size: 0.8rem;
    font-weight: 500;
    color: rgba(34, 90, 122, 0.9);
    letter-spacing: 0.02em;
}

/* Accordions */
.docs-accordion {
    margin: 16px 0 20px;
    border: 1px solid var(--docs-border);
    border-radius: 8px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
}

.docs-accordion-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.docs-accordion-item:last-child {
    border-bottom: none;
}

.docs-accordion-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.9);
    font-family: 'Poppins', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.docs-accordion-trigger:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.03);
}

.docs-accordion-item.active .docs-accordion-trigger {
    background: rgba(255, 255, 255, 0.04);
    padding-bottom: 12px;
}

.docs-accordion-arrow {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    stroke: currentColor;
    stroke-width: 2.5;
    fill: none;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.docs-accordion-item.active .docs-accordion-arrow {
    transform: rotate(180deg);
}

.docs-accordion-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.docs-accordion-inner {
    padding: 0 18px 18px;
    opacity: 0;
    transform: translate3d(0, -8px, 0);
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.docs-accordion-item.active .docs-accordion-inner {
    opacity: 1;
    transform: translate3d(0, 0, 0);
}

.docs-accordion-inner h3 {
    margin-top: 0;
}

.docs-accordion-inner .docs-table-wrap:first-child {
    margin-top: 0;
}

@media (max-width: 900px) {
    .docs-layout {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .docs-sidebar {
        display: none;
    }

    .docs-mobile-nav {
        display: block;
    }

    .docs-hub-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .brand-badge .badge-text {
        display: none;
    }

    .brand-badge {
        padding: 8px;
        width: 38px;
        justify-content: center;
        border-radius: 50%;
    }
}

@media (max-width: 520px) {
    .action-button--desktop-only {
        display: none !important;
    }

    .action-header-more {
        display: block;
    }

    .docs-prose {
        padding: 24px 18px 32px;
    }
}

@media (max-width: 480px) {
    .action-header {
        gap: 6px;
    }

    .action-button span {
        display: none;
    }

    .action-button {
        padding: 8px;
        width: 36px;
        height: 36px;
        justify-content: center;
        border-radius: 50%;
    }
}
