:root {
    --bg: #f7f9fc;
    --bg-deep: #eef2f7;
    --surface: #ffffff;
    --surface-soft: rgba(255, 255, 255, 0.74);
    --surface-line: #e2e8f0;
    --line-soft: #eef1f6;
    --text: #0f172a;
    --text-soft: #475569;
    --text-dim: #94a3b8;
    --paper: #ffffff;
    --accent: #2563eb;
    --accent-soft: rgba(37, 99, 235, 0.1);
    --accent-strong: #1d4ed8;
    --cool: #0ea5e9;
    --ok: #16a34a;
    --warn: #f59e0b;
    --danger: #dc2626;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 18px 44px rgba(15, 23, 42, 0.08);
    --radius-xl: 22px;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --container: min(1400px, calc(100vw - 32px));
    --sidebar-w: 268px;
    --rightrail-w: 220px;
    --header-h: 60px;
    --font-display:
        "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
    --font-body:
        "Be Vietnam Pro", "Inter", "Avenir Next", "Segoe UI", system-ui,
        sans-serif;
    --font-mono:
        "JetBrains Mono", "IBM Plex Mono", "SFMono-Regular", "Cascadia Code",
        Menlo, monospace;
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-h) + 24px);
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-body);
    color: var(--text);
    line-height: 1.65;
    font-size: 15.5px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: var(--bg);
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 120ms;
}
a:hover {
    color: var(--accent-strong);
}

button,
input,
textarea,
select {
    font: inherit;
    color: inherit;
}

::selection {
    background: var(--accent-soft);
    color: var(--accent-strong);
}

code {
    font-family: var(--font-mono);
    font-size: 0.88em;
    padding: 1px 6px;
    border-radius: 5px;
    background: rgba(15, 23, 42, 0.06);
    color: #1e3a8a;
    border: 1px solid rgba(15, 23, 42, 0.04);
}

pre {
    margin: 18px 0;
    padding: 16px 18px;
    background: #0f172a;
    color: #e2e8f0;
    border-radius: var(--radius-md);
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 13.5px;
    line-height: 1.55;
    box-shadow: var(--shadow-md);
}
pre code {
    background: none;
    border: none;
    color: inherit;
    padding: 0;
    font-size: inherit;
}

kbd {
    display: inline-block;
    padding: 1px 6px;
    font-family: var(--font-mono);
    font-size: 12px;
    background: var(--surface);
    border: 1px solid var(--surface-line);
    border-bottom-width: 2px;
    border-radius: 5px;
    color: var(--text-soft);
}

.skip-link {
    position: absolute;
    top: -40px;
    left: 12px;
    padding: 8px 12px;
    background: var(--accent);
    color: #fff;
    border-radius: 8px;
    z-index: 100;
}
.skip-link:focus {
    top: 12px;
}

/* ── Header ─────────────────────────────────────────────── */

.docs-header {
    position: sticky;
    top: 0;
    z-index: 30;
    height: var(--header-h);
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 0 24px;
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: saturate(160%) blur(14px);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    border-bottom: 1px solid var(--surface-line);
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    flex-shrink: 0;
    color: var(--text);
}
.brand:hover {
    color: var(--text);
}
.brand-mark {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: linear-gradient(135deg, #60a5fa 0%, #1e40af 80%);
    display: grid;
    place-items: center;
    box-shadow: 0 4px 14px rgba(30, 64, 175, 0.28);
}
.brand-mark__dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #fff;
}
.brand-logo {
    width: 32px;
    height: 32px;
    display: block;
    object-fit: contain;
    flex-shrink: 0;
}
.brand-copy {
    line-height: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.brand-copy strong {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.01em;
}
.brand-copy small {
    font-size: 11px;
    color: var(--text-dim);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-weight: 500;
}

.header-search {
    position: relative;
    flex: 1;
    max-width: 460px;
}
.header-search__input {
    width: 100%;
    height: 38px;
    padding: 0 38px 0 38px;
    border: 1px solid var(--surface-line);
    border-radius: 10px;
    background: var(--surface);
    transition: border-color 120ms, box-shadow 120ms;
}
.header-search__input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.header-search__icon {
    position: absolute;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    color: var(--text-dim);
    pointer-events: none;
}
.header-search__hint {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
}

.header-search__results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 360px;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--surface-line);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    display: none;
}
.header-search__results[data-open="true"] {
    display: block;
}
.search-result {
    display: block;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--text);
}
.search-result:hover,
.search-result.is-focused {
    background: var(--accent-soft);
    color: var(--accent-strong);
}
.search-result__title {
    font-weight: 500;
    font-size: 14px;
    margin: 0 0 2px;
}
.search-result__path {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-dim);
}
.search-result__desc {
    font-size: 12.5px;
    color: var(--text-soft);
    margin: 2px 0 0;
}
.search-empty {
    padding: 16px;
    text-align: center;
    color: var(--text-dim);
    font-size: 13.5px;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-left: auto;
}
.header-nav__link {
    font-size: 14px;
    color: var(--text-soft);
}
.header-nav__link:hover {
    color: var(--text);
}

.button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    border-radius: 9px;
    font-weight: 500;
    font-size: 14px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 120ms, box-shadow 120ms, background 120ms,
        border-color 120ms, color 120ms;
}
.button--primary {
    background: var(--accent);
    color: #fff;
}
.button--primary:hover {
    background: var(--accent-strong);
    color: #fff;
    box-shadow: 0 8px 22px rgba(37, 99, 235, 0.3);
}
.button--ghost {
    border-color: var(--surface-line);
    background: var(--surface);
    color: var(--text-soft);
}
.button--ghost:hover {
    border-color: var(--accent);
    color: var(--accent-strong);
}

.menu-toggle {
    display: none;
    width: 38px;
    height: 38px;
    border: 1px solid var(--surface-line);
    border-radius: 9px;
    background: var(--surface);
    cursor: pointer;
    padding: 10px;
    flex-direction: column;
    justify-content: space-between;
}
.menu-toggle span {
    display: block;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
}

/* ── Layout ─────────────────────────────────────────────── */

.docs-shell {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--rightrail-w);
    gap: 40px;
    width: var(--container);
    margin-inline: auto;
    padding: 24px 0 80px;
    align-items: start;
}

/* ── Sidebar ────────────────────────────────────────────── */

.sidebar {
    position: sticky;
    top: calc(var(--header-h) + 16px);
    max-height: calc(100vh - var(--header-h) - 32px);
    overflow-y: auto;
    padding: 4px 8px 24px 0;
}
.sidebar__cat {
    margin-bottom: 14px;
}
.sidebar__cat-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 4px 12px 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dim);
}
.sidebar__cat-icon {
    font-size: 12px;
    line-height: 1;
}
.sidebar__list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.sidebar__link {
    display: block;
    padding: 6px 12px;
    border-radius: 7px;
    font-size: 14px;
    color: var(--text-soft);
    border-left: 2px solid transparent;
    margin-left: -2px;
    transition: background 120ms, color 120ms, border-color 120ms;
}
.sidebar__link:hover {
    background: var(--bg-deep);
    color: var(--text);
}
.sidebar__link.is-active {
    background: var(--accent-soft);
    color: var(--accent-strong);
    border-left-color: var(--accent);
    font-weight: 500;
}

/* ── Main article ───────────────────────────────────────── */

.docs-article {
    min-width: 0;
    max-width: 760px;
    padding-top: 4px;
}

.breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin: 0 0 12px;
    font-size: 13px;
    color: var(--text-dim);
}
.breadcrumbs a {
    color: var(--text-dim);
}
.breadcrumbs a:hover {
    color: var(--accent);
}
.breadcrumbs__sep {
    color: var(--text-dim);
}
.breadcrumbs__current {
    color: var(--text-soft);
}

.page-header {
    margin: 0 0 28px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--line-soft);
}
.page-header h1 {
    font-family: var(--font-display);
    font-size: clamp(30px, 3.4vw, 40px);
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin: 6px 0 14px;
    color: var(--text);
}
.page-lead {
    font-size: 17px;
    color: var(--text-soft);
    margin: 0;
    line-height: 1.6;
    max-width: 64ch;
}

.docs-article h2 {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text);
    margin: 38px 0 12px;
    scroll-margin-top: calc(var(--header-h) + 16px);
}
.docs-article h3 {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
    margin: 24px 0 8px;
    color: var(--text);
    scroll-margin-top: calc(var(--header-h) + 16px);
}
.docs-article p {
    margin: 0 0 14px;
    color: var(--text-soft);
}
.docs-article p strong,
.docs-article li strong {
    color: var(--text);
    font-weight: 600;
}
.docs-article ul,
.docs-article ol {
    margin: 0 0 16px;
    padding-left: 22px;
    color: var(--text-soft);
}
.docs-article li {
    margin-bottom: 6px;
}
.docs-article li::marker {
    color: var(--accent);
}

.docs-article hr {
    border: 0;
    height: 1px;
    background: var(--line-soft);
    margin: 32px 0;
}

/* ── Cards & grids ──────────────────────────────────────── */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin: 16px 0;
}
.card {
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--surface-line);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: border-color 120ms, box-shadow 120ms, transform 120ms;
}
.card h3 {
    margin: 0 0 6px;
    font-size: 15.5px;
    font-family: var(--font-body);
}
.card p {
    margin: 0;
    font-size: 13.5px;
}
a.card {
    display: block;
    color: inherit;
}
a.card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
    color: inherit;
}
a.card:hover h3 {
    color: var(--accent-strong);
}

.card__icon {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-size: 14px;
    margin-bottom: 10px;
    font-weight: 600;
}

/* ── Steps ──────────────────────────────────────────────── */

.steps {
    counter-reset: step;
    list-style: none;
    padding: 0;
    margin: 14px 0;
    display: grid;
    gap: 10px;
}
.steps li {
    counter-increment: step;
    position: relative;
    padding: 12px 16px 12px 50px;
    background: var(--surface);
    border: 1px solid var(--surface-line);
    border-radius: var(--radius-sm);
    color: var(--text-soft);
    box-shadow: var(--shadow-sm);
}
.steps li::before {
    content: counter(step);
    position: absolute;
    left: 12px;
    top: 12px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 12.5px;
    font-weight: 600;
    display: grid;
    place-items: center;
}

/* ── Callouts ───────────────────────────────────────────── */

.callout {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid;
    margin: 14px 0;
    font-size: 14.5px;
    background: var(--surface);
}
.callout__icon {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    margin-top: 2px;
}
.callout__body {
    flex: 1;
}
.callout__body p:last-child {
    margin: 0;
}
.callout--info {
    background: rgba(37, 99, 235, 0.04);
    border-color: rgba(37, 99, 235, 0.2);
    color: #1e3a8a;
}
.callout--info .callout__icon {
    background: var(--accent);
}
.callout--ok {
    background: rgba(22, 163, 74, 0.05);
    border-color: rgba(22, 163, 74, 0.22);
    color: #14532d;
}
.callout--ok .callout__icon {
    background: var(--ok);
}
.callout--warn {
    background: rgba(245, 158, 11, 0.05);
    border-color: rgba(245, 158, 11, 0.26);
    color: #78350f;
}
.callout--warn .callout__icon {
    background: var(--warn);
}
.callout--danger {
    background: rgba(220, 38, 38, 0.04);
    border-color: rgba(220, 38, 38, 0.22);
    color: #7f1d1d;
}
.callout--danger .callout__icon {
    background: var(--danger);
}

/* ── Tables ─────────────────────────────────────────────── */

.docs-article table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 14px;
    background: var(--surface);
    border: 1px solid var(--surface-line);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.docs-article th,
.docs-article td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--line-soft);
    color: var(--text-soft);
    vertical-align: top;
}
.docs-article th {
    background: var(--bg-deep);
    color: var(--text);
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.02em;
}
.docs-article tr:last-child td {
    border-bottom: 0;
}

/* ── Tags & badges ──────────────────────────────────────── */

.tag {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.02em;
    background: var(--accent-soft);
    color: var(--accent-strong);
}
.tag--ok {
    background: rgba(22, 163, 74, 0.12);
    color: #15803d;
}
.tag--warn {
    background: rgba(245, 158, 11, 0.16);
    color: #b45309;
}

/* ── Definition list ────────────────────────────────────── */

.docs-article dl {
    margin: 14px 0;
    display: grid;
    grid-template-columns: max-content 1fr;
    column-gap: 18px;
    row-gap: 8px;
    align-items: baseline;
}
.docs-article dt {
    font-weight: 600;
    color: var(--text);
}
.docs-article dd {
    margin: 0;
    color: var(--text-soft);
}

/* ── FAQ ────────────────────────────────────────────────── */

details.faq {
    background: var(--surface);
    border: 1px solid var(--surface-line);
    border-radius: var(--radius-sm);
    margin: 8px 0;
    padding: 0 16px;
    box-shadow: var(--shadow-sm);
}
.faq summary {
    list-style: none;
    cursor: pointer;
    padding: 13px 0;
    font-weight: 500;
    color: var(--text);
    display: flex;
    justify-content: space-between;
    gap: 12px;
}
.faq summary::-webkit-details-marker {
    display: none;
}
.faq summary::after {
    content: "+";
    font-size: 20px;
    color: var(--text-dim);
    transition: transform 200ms;
    font-weight: 400;
}
.faq[open] summary::after {
    transform: rotate(45deg);
}
.faq p {
    padding: 0 0 14px;
    color: var(--text-soft);
}

/* ── Right rail (On this page) ──────────────────────────── */

.right-rail {
    position: sticky;
    top: calc(var(--header-h) + 16px);
    max-height: calc(100vh - var(--header-h) - 32px);
    overflow-y: auto;
    padding: 8px 0 24px;
    font-size: 13px;
}
.right-rail__title {
    margin: 0 0 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dim);
}
.right-rail__list {
    list-style: none;
    margin: 0;
    padding: 0;
    border-left: 1px solid var(--line-soft);
}
.right-rail__link {
    display: block;
    padding: 5px 12px;
    color: var(--text-soft);
    border-left: 2px solid transparent;
    margin-left: -1px;
    transition: color 120ms, border-color 120ms;
    line-height: 1.45;
}
.right-rail__link--h3 {
    padding-left: 22px;
    font-size: 12.5px;
}
.right-rail__link:hover {
    color: var(--text);
}
.right-rail__link.is-active {
    color: var(--accent-strong);
    border-left-color: var(--accent);
    font-weight: 500;
}

/* ── Prev / next ────────────────────────────────────────── */

.prev-next {
    margin: 48px 0 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.prev-next__link {
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--surface-line);
    border-radius: var(--radius-md);
    color: var(--text);
    transition: border-color 120ms, transform 120ms, box-shadow 120ms;
    box-shadow: var(--shadow-sm);
}
.prev-next__link:hover {
    border-color: var(--accent);
    color: var(--text);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}
.prev-next__link--next {
    text-align: right;
}
.prev-next__label {
    display: block;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-dim);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 4px;
}
.prev-next__title {
    display: block;
    font-size: 14.5px;
    font-weight: 500;
    color: var(--text);
}
.prev-next__link:hover .prev-next__title {
    color: var(--accent-strong);
}

/* ── Footer ─────────────────────────────────────────────── */

.docs-footer {
    width: var(--container);
    margin: 0 auto;
    padding: 32px 0 28px;
    border-top: 1px solid var(--surface-line);
    color: var(--text-dim);
    font-size: 13px;
    display: flex;
    flex-wrap: wrap;
    gap: 14px 24px;
    justify-content: space-between;
}
.docs-footer a {
    color: var(--text-soft);
}
.docs-footer a:hover {
    color: var(--accent);
}
.docs-footer__links {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
}

/* ── Hero (overview page only) ──────────────────────────── */

.docs-hero {
    margin: 6px 0 28px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--line-soft);
}
.docs-hero__eyebrow {
    margin: 0 0 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-strong);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.docs-hero h1 {
    font-family: var(--font-display);
    font-size: clamp(34px, 4.2vw, 50px);
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin: 0 0 14px;
    color: var(--text);
}
.docs-hero__accent {
    background: linear-gradient(135deg, #2563eb 0%, #0ea5e9 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.docs-hero__lead {
    font-size: 18px;
    color: var(--text-soft);
    margin: 0 0 22px;
    max-width: 64ch;
    line-height: 1.55;
}
.docs-hero__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--surface-line);
    border-radius: 999px;
    background: var(--surface);
    font-size: 13px;
    color: var(--text-soft);
    transition: border-color 120ms, color 120ms, transform 120ms;
}
.chip:hover {
    border-color: var(--accent);
    color: var(--accent-strong);
    transform: translateY(-1px);
}

/* ── 404 ────────────────────────────────────────────────── */

.docs-404 {
    width: var(--container);
    margin: 0 auto;
    padding: 80px 0;
    text-align: center;
}
.docs-404 h1 {
    font-family: var(--font-display);
    font-size: 56px;
    margin: 0 0 8px;
    color: var(--accent-strong);
}
.docs-404 p {
    color: var(--text-soft);
    font-size: 17px;
    margin: 0 0 22px;
}

/* ── Responsive ─────────────────────────────────────────── */

@media (max-width: 1100px) {
    .docs-shell {
        grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
        gap: 36px;
    }
    .right-rail {
        display: none;
    }
}

@media (max-width: 820px) {
    :root {
        --container: calc(100vw - 24px);
    }
    .docs-shell {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .sidebar {
        position: fixed;
        inset: var(--header-h) 0 0 0;
        max-height: none;
        height: calc(100vh - var(--header-h));
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(18px);
        padding: 20px 24px;
        z-index: 22;
        transform: translateX(-100%);
        transition: transform 220ms ease;
    }
    .sidebar[data-open="true"] {
        transform: translateX(0);
    }
    .menu-toggle {
        display: flex;
    }
    .header-nav {
        display: none;
    }
    .header-search {
        max-width: none;
    }
    .header-search__hint {
        display: none;
    }
    .prev-next {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 540px) {
    .docs-header {
        gap: 10px;
        padding-inline: 14px;
    }
    .brand-copy small {
        display: none;
    }
}
