:root {
    --bg: #f4f6fb;
    --ink: #0f172a;
    --muted: #55617a;
    --faint: #8b95ab;
    --card: #ffffff;
    --stroke: #e3e8f0;
    --stroke-soft: #edf0f6;
    --accent: #0284c7;
    --accent-soft: rgba(2, 132, 199, 0.09);
    --accent-strong: #0369a1;
    --code-bg: #0f172a;
    --code-ink: #e2e8f0;
    --code-caption-bg: #1e293b;
    --tok-comment: #34d399;
    --tok-keyword: #7dd3fc;
    --tok-string: #fda4af;
    --tok-type: #5eead4;
    --shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 12px 32px rgba(15, 23, 42, 0.07);
    --radius: 14px;
    --mono: "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--ink);
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

::selection {
    background: rgba(2, 132, 199, 0.18);
}

.shell {
    max-width: 1240px;
    margin: 0 auto;
    padding: 28px 24px 120px;
}

/* ---------------------------------------------------------------- header */

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    background: linear-gradient(120deg, #0f172a 0%, #16233f 100%);
    border-radius: var(--radius);
    padding: 18px 26px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.header__brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.header__brand h1 {
    margin: 0;
    font-family: "Space Grotesk", "DM Sans", sans-serif;
    font-size: 21px;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: #fff;
}

.header__divider {
    width: 1px;
    height: 22px;
    background: rgba(255, 255, 255, 0.22);
}

.header__subtitle {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.72);
    font-weight: 500;
}

.header__endpoint {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.header__endpoint-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
}

.header__endpoint code {
    display: block;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 14px;
    border-radius: 8px;
    color: #7dd3fc;
    font-size: 13px;
    font-family: var(--mono);
    white-space: nowrap;
    overflow-x: auto;
    max-width: 100%;
}

/* ---------------------------------------------------------------- layout */

.layout {
    display: grid;
    grid-template-columns: 264px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

/* ------------------------------------------------------------------- toc */

.toc {
    background: var(--card);
    border: 1px solid var(--stroke);
    border-radius: var(--radius);
    padding: 20px 16px 16px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    scrollbar-width: thin;
}

.toc__title {
    font-family: "Space Grotesk", "DM Sans", sans-serif;
    font-weight: 700;
    font-size: 16px;
    margin: 0 4px 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--stroke);
}

.toc__group {
    margin-bottom: 18px;
}

.toc__group-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--faint);
    margin: 0 4px 6px;
}

.toc ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.toc li a {
    display: block;
    padding: 6px 10px;
    border-radius: 7px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--muted);
    border-left: 2px solid transparent;
    transition: background-color 0.12s ease, color 0.12s ease;
}

.toc li a:hover {
    background: var(--stroke-soft);
    color: var(--ink);
    text-decoration: none;
}

.toc li.active a {
    background: var(--accent-soft);
    border-left-color: var(--accent);
    color: var(--accent-strong);
    font-weight: 600;
}

.toc__footer {
    border-top: 1px dashed var(--stroke);
    margin-top: 4px;
    padding: 12px 4px 0;
    color: var(--faint);
    font-size: 12px;
    line-height: 1.5;
}

.toc__footer p {
    margin: 0 0 8px;
}

.toc__footer kbd {
    background: var(--ink);
    color: #fff;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 11px;
    font-family: var(--mono);
}

.toc__source a {
    color: var(--muted);
    text-decoration: underline;
    text-decoration-color: var(--stroke);
}

/* --------------------------------------------------------------- content */

.content {
    display: flex;
    flex-direction: column;
    gap: 28px;
    min-width: 0;
}

.content-group {
    background: var(--card);
    border: 1px solid var(--stroke);
    border-radius: var(--radius);
    padding: 28px 34px 34px;
    box-shadow: var(--shadow);
}

.group-title {
    font-family: "Space Grotesk", "DM Sans", sans-serif;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent-strong);
    margin: 0 0 26px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--accent);
}

.doc-section {
    padding: 26px 0 30px;
    border-bottom: 1px solid var(--stroke-soft);
    scroll-margin-top: 20px;
}

.doc-section:first-of-type {
    padding-top: 0;
}

.doc-section:last-child {
    padding-bottom: 0;
    border-bottom: none;
}

.section-title {
    font-family: "Space Grotesk", "DM Sans", sans-serif;
    font-size: 21px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--ink);
    margin: 0 0 4px;
}

.section-lead {
    margin: 0 0 18px;
    color: var(--muted);
    font-size: 14px;
}

/* ----------------------------------------------------------- doc content */

.doc-content {
    line-height: 1.7;
    font-size: 15px;
}

.doc-content > :first-child {
    margin-top: 0;
}

.doc-content br {
    line-height: 1.9;
}

.doc-content .doc-h {
    font-family: "Space Grotesk", "DM Sans", sans-serif;
    font-size: 16.5px;
    font-weight: 600;
    margin: 26px 0 10px;
    color: var(--ink);
}

.doc-content .doc-h--sub {
    font-size: 15px;
    margin: 22px 0 8px;
}

.doc-content .doc-h:first-child,
.doc-content .doc-h--sub:first-child {
    margin-top: 0;
}

.doc-content p {
    margin: 10px 0;
}

.doc-content ul,
.doc-content ol {
    padding-left: 22px;
    margin: 10px 0;
}

.doc-content li {
    margin: 5px 0;
}

.doc-content a.xref {
    color: var(--accent-strong);
    font-weight: 500;
    border-bottom: 1px dotted rgba(2, 132, 199, 0.5);
}

.doc-content a.xref:hover {
    text-decoration: none;
    border-bottom-style: solid;
}

.doc-content a.ext-link {
    color: var(--accent);
    font-weight: 500;
}

.doc-content strong,
.doc-content b {
    font-weight: 600;
}

.doc-content .indent {
    padding-left: 16px;
    margin: 8px 0;
}

.doc-content .note {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 10px 14px;
    margin: 10px 0;
    color: #713f12;
    font-size: 14px;
}

.doc-content kbd {
    background: var(--ink);
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-family: var(--mono);
}

/* -------------------------------------------------------------- commands */

.doc-content dl.cmd-list {
    margin: 14px 0;
    display: grid;
    gap: 2px;
}

.doc-content dl.cmd-list dt {
    font-family: var(--mono);
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-strong);
    padding-top: 12px;
}

.doc-content dl.cmd-list dt:first-child {
    padding-top: 0;
}

.doc-content dl.cmd-list dt a {
    color: inherit;
    border-bottom: none;
}

.doc-content dl.cmd-list dt a:hover {
    text-decoration: underline;
}

.doc-content dl.cmd-list dd {
    margin: 2px 0 10px;
    padding: 0 0 12px 18px;
    border-left: 2px solid var(--stroke-soft);
    color: var(--muted);
    font-size: 14px;
}

.doc-content dl.cmd-list dd:last-child {
    padding-bottom: 0;
    margin-bottom: 0;
}

/* ------------------------------------------------------------------ code */

.doc-content code {
    background: var(--stroke-soft);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--mono);
    font-size: 13px;
}

.doc-content .code-group {
    margin: 14px 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.doc-content figure.code-sample {
    margin: 14px 0;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #1e293b;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.15);
}

.doc-content .code-group figure.code-sample {
    margin: 0;
}

.doc-content figure.code-sample figcaption {
    background: var(--code-caption-bg);
    color: #cbd5e1;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 8px 16px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.doc-content figure.code-sample pre,
.doc-content pre.code-block {
    margin: 0;
    background: var(--code-bg);
    color: var(--code-ink);
    padding: 14px 18px;
    overflow-x: auto;
    font-family: var(--mono);
    font-size: 13px;
    line-height: 1.6;
    tab-size: 4;
}

.doc-content pre.code-block {
    border-radius: 10px;
    margin: 14px 0;
    border: 1px solid #1e293b;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.15);
}

.doc-content pre code {
    background: none;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
    color: inherit;
}

.doc-content pre a,
.doc-content pre a.ext-link {
    color: var(--tok-keyword);
    text-decoration: underline;
    text-decoration-color: rgba(125, 211, 252, 0.4);
}

.tok-comment { color: var(--tok-comment); }
.tok-keyword { color: var(--tok-keyword); }
.tok-string  { color: var(--tok-string); }
.tok-type    { color: var(--tok-type); }

/* ---------------------------------------------------------------- tables */

.doc-content .table-wrap {
    margin: 16px 0;
    overflow-x: auto;
    border: 1px solid var(--stroke);
    border-radius: 10px;
}

.doc-content table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    background: var(--card);
}

.doc-content th,
.doc-content td {
    border: 1px solid var(--stroke-soft);
    padding: 9px 12px;
    text-align: left;
    vertical-align: top;
    line-height: 1.55;
}

.doc-content th {
    background: #f0f4fa;
    font-weight: 650;
    font-size: 12.5px;
    color: var(--ink);
    white-space: nowrap;
}

.doc-content tr:nth-child(even) td {
    background: #fafbfe;
}

.doc-content td:first-child {
    font-family: var(--mono);
    font-size: 12.5px;
    font-weight: 500;
    color: var(--accent-strong);
}

.doc-content tr.tr-divider td {
    background: #eef2f8 !important;
    font-family: "DM Sans", sans-serif;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.doc-content td .indent {
    padding-left: 12px;
    margin: 4px 0;
    border-left: 2px solid var(--stroke-soft);
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 980px) {
    .shell {
        padding: 16px 14px 80px;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
        padding: 16px 20px;
    }

    .header__endpoint {
        width: 100%;
    }

    .header__endpoint code {
        font-size: 12px;
    }

    .layout {
        grid-template-columns: 1fr;
    }

    .toc {
        position: static;
        max-height: none;
    }

    .content-group {
        padding: 20px 18px 24px;
    }

    .doc-content th {
        white-space: normal;
    }
}
