/* Docs design system: tokens, base, then small reusable components. */

/* ---------- Tokens ---------- */
:root {
    color-scheme: dark;
    --bg: #0d0e10;
    --surface: #15171a;
    --surface-2: #1c1f23;
    --line: #26292e;
    --text: #e8e9ec;
    --muted: #9296a0;
    --accent: #5ec9ea;
    --accent-ink: #04201b;
    --info: #7aa7ff;
    --success: #5ec9ea;
    --warning: #f5c26b;
    --danger: #ff8a80;
    --code-str: #a5e3b5;
    --code-num: #f5c26b;
    --code-key: #9cc2ff;
    --code-lit: #d6a3ff;

    --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
    --radius: 10px;
    --header-h: 3.5rem;
    --sidebar-w: 16rem;
    --side-w: 19rem;
}

:root[data-theme="light"] {
    color-scheme: light;
    --bg: #fbfbfa;
    --surface: #f3f3f1;
    --surface-2: #eaeae7;
    --line: #e2e2de;
    --text: #1a1b1e;
    --muted: #62666f;
    --accent: #125394;
    --accent-ink: #ffffff;
    --info: #279cc7;
    --success: #125394;
    --warning: #9a6200;
    --danger: #c0392b;
    --code-str: #1f7a3d;
    --code-num: #9a6200;
    --code-key: #2757c7;
    --code-lit: #8a3fc2;
}

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

html {
    scroll-padding-top: calc(var(--header-h) + 1rem);
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 400 0.95rem/1.7 var(--font);
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent);
    text-decoration: none;
    text-underline-offset: 3px;
}

a:hover {
    text-decoration: underline;
}

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

h1,
h2,
h3 {
    line-height: 1.25;
    margin: 0;
    letter-spacing: -0.01em;
}

h1 {
    font-size: 1.9rem;
    font-weight: 650;
}

h2 {
    font-size: 1.15rem;
    font-weight: 600;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--line);
}

h3 {
    font-size: 0.95rem;
    font-weight: 600;
}

.stack>*+* {
    margin-top: 0.75rem;
}

p,
ul,
ol {
    margin: 0;
}

ul,
ol {
    padding-left: 1.25rem;
}

li+li {
    margin-top: 0.3rem;
}

hr {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 0;
}

img {
    max-width: 100%;
    height: auto;
}

code,
pre {
    font-family: var(--mono);
    font-size: 0.85em;
}

code {
    background: var(--surface-2);
    padding: 0.1em 0.4em;
    border-radius: 5px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ---------- Layout ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    height: var(--header-h);
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1.25rem;
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}

.topbar__spacer {
    flex: 1;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text);
    font-weight: 600;
}

.brand:hover {
    text-decoration: none;
}

.brand img {
    width: 22px;
    height: 22px;
}

.brand span {
    color: var(--muted);
    font-weight: 400;
}

.shell {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    max-width: 90rem;
    margin: 0 auto;
}

.sidebar {
    position: sticky;
    top: var(--header-h);
    height: calc(100vh - var(--header-h));
    overflow-y: auto;
    padding: 1.5rem 1rem 3rem 1.25rem;
    border-right: 1px solid var(--line);
}

.content {
    min-width: 0;
    padding: 2.5rem clamp(1.25rem, 4vw, 3.5rem) 0;
}

.content>.center {
    padding: 4rem 0;
}

/* Two-column page body: main column plus optional aside. */
.split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--side-w);
    gap: 3rem;
    align-items: start;
}

.split--even {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.split__main>*+* {
    margin-top: 1rem;
}

.split__main>h2 {
    margin-top: 2.5rem;
}

.split__main>h2+* {
    margin-top: 1.25rem;
}

.split__side {
    position: sticky;
    top: calc(var(--header-h) + 1.5rem);
}

.split__side>*+* {
    margin-top: 1.5rem;
}

.split+.split,
.split+hr+.split {
    margin-top: 3rem;
}

.split+hr {
    margin-top: 3rem;
}

.footer {
    margin-top: 5rem;
    padding: 1.5rem 0 2rem;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.85rem;
}

/* ---------- Components ---------- */

/* Nav: grouped link list used in sidebar and table of contents. */
.nav__group+.nav__group {
    margin-top: 1.5rem;
}

.nav__title {
    margin: 0 0 0.4rem 0.6rem;
    padding: 0;
    border: 0;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.nav__list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav__list li+li {
    margin-top: 1px;
}

.nav__link {
    display: block;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

.nav__link:hover {
    color: var(--text);
    background: var(--surface);
    text-decoration: none;
}

.nav__link[aria-current="page"] {
    color: var(--text);
    background: var(--surface-2);
    font-weight: 500;
}

.nav__list--mono .nav__link {
    font-family: var(--mono);
    font-size: 0.8rem;
}

.toc {
    border-left: 1px solid var(--line);
    padding-left: 0.5rem;
}

.toc .nav__link {
    padding: 0.2rem 0.75rem;
    font-size: 0.85rem;
}

/* Button */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.45rem 0.9rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.4;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.btn:hover {
    background: var(--surface-2);
    text-decoration: none;
}

.btn--primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-ink);
}

.btn--primary:hover {
    background: var(--accent);
    filter: brightness(1.08);
}

.btn--ghost {
    border-color: transparent;
    color: var(--muted);
}

.btn--ghost:hover {
    color: var(--text);
}

.btn--icon {
    padding: 0.45rem;
}

.btn--block {
    display: flex;
    width: 100%;
}

.btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn svg {
    width: 1.1em;
    height: 1.1em;
    flex: none;
}

/* Callout: highlighted note. Variants set the accent colour. */
.callout {
    --tone: var(--info);
    padding: 0.85rem 1rem;
    border-radius: var(--radius);
    border: 1px solid color-mix(in srgb, var(--tone) 35%, transparent);
    background: color-mix(in srgb, var(--tone) 9%, transparent);
}

.callout--success {
    --tone: var(--success);
}

.callout--warning {
    --tone: var(--warning);
}

.callout--danger {
    --tone: var(--danger);
}

.callout__title {
    display: block;
    color: var(--tone);
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.15rem;
}

/* Code block */
.code {
    margin: 0;
    padding: 1rem 1.15rem;
    overflow-x: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    line-height: 1.6;
    tab-size: 4;
    white-space: pre;
}

.code code {
    background: none;
    padding: 0;
    font-size: inherit;
}

.tok-key {
    color: var(--code-key);
}

.tok-str {
    color: var(--code-str);
}

.tok-num {
    color: var(--code-num);
}

.tok-lit {
    color: var(--code-lit);
}

/* Field list: parameter / response field descriptions. */
.fields {
    list-style: none;
    padding: 0;
    margin: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}

.fields>li+li {
    margin-top: 0;
}

.field {
    padding: 0.8rem 1rem;
    background: var(--surface);
}

.field+.field {
    border-top: 1px solid var(--line);
}

.field h3,
.field__name {
    font-family: var(--mono);
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.field>code:first-of-type {
    color: var(--muted);
    background: none;
    padding: 0;
}

.field .callout {
    margin-top: 0.6rem;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 0.05rem 0.5rem;
    border-radius: 999px;
    font-family: var(--font);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    background: color-mix(in srgb, var(--accent) 18%, transparent);
    color: var(--accent);
}

/* Card grid and stat card */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    gap: 0.75rem;
}

.card {
    padding: 1rem 1.15rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.card__label {
    display: block;
    color: var(--muted);
    font-size: 0.8rem;
}

.card__value {
    display: block;
    font-size: 1.25rem;
    font-weight: 600;
}

/* Table */
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table th,
.table td {
    padding: 0.65rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

.table tr:last-child>* {
    border-bottom: 0;
}

.table th {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: var(--surface);
}

/* Pricing page */
.pricing-section>*+* {
    margin-top: 1rem;
}

.pricing-section>h2+* {
    margin-top: 1.25rem;
}

.pricing__table {
    min-width: 42rem;
}

.pricing__table tbody th {
    color: var(--text);
    font-size: inherit;
    font-weight: 500;
    letter-spacing: normal;
    text-transform: none;
}

.pricing__legacy {
    margin-top: 1rem;
}

.pricing__legacy summary {
    color: var(--accent);
    cursor: pointer;
}

.pricing__legacy[open] summary {
    margin-bottom: 1rem;
}

.pricing__legacy h3 {
    margin-bottom: 0.75rem;
}

.pricing-estimator__result {
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--line);
    text-align: center;
}

.pricing-estimator__total {
    display: block;
    margin: 0.5rem 0;
    color: var(--accent);
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 700;
    line-height: 1;
}

.pricing-estimator__plan {
    margin-top: 0.75rem;
}

.pricing-estimator__controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
    gap: 1.25rem;
    margin-top: 1.25rem;
}

.pricing-estimator__label,
.pricing-estimator__scale {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
}

.pricing-estimator__label {
    font-size: 0.9rem;
}

.pricing-estimator__range {
    display: block;
    width: 100%;
    margin: 0.75rem 0 0.25rem;
    accent-color: var(--accent);
}

.pricing-estimator__scale {
    color: var(--muted);
    font-size: 0.8rem;
}

.pricing-estimator__checkbox {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    margin-top: 1.25rem;
}

.pricing-estimator__checkbox input {
    margin-top: 0.4rem;
    accent-color: var(--accent);
}

.pricing-estimator__calculation {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.85rem;
}

/* Status mark for feature matrices */
.mark {
    display: inline-block;
    font-weight: 700;
}

.mark::before {
    content: "\2713";
    color: var(--success);
}

.mark--no::before {
    content: "\2715";
    color: var(--danger);
}

.mark--na::before {
    content: "\2715";
    color: var(--muted);
}

.mark--partial::before {
    content: "\2713";
    color: var(--warning);
}

/* Text helpers */
.lead {
    font-size: 1.1rem;
    color: var(--muted);
}

.muted {
    color: var(--muted);
}

.danger {
    color: var(--danger);
}

.center {
    text-align: center;
}

.display {
    font-size: 5rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.04em;
    color: var(--accent);
}

/* Hero banner image */
.banner {
    height: 9rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface) center / cover no-repeat;
    margin-bottom: 2rem;
}

/* Drawer: slide-in side panel */
.drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    width: min(26rem, 100vw);
    display: flex;
    flex-direction: column;
    background: var(--bg);
    border-left: 1px solid var(--line);
    box-shadow: -20px 0 50px rgba(0, 0, 0, 0.25);
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 0.2s ease, visibility 0s 0.2s;
}

.drawer[data-open] {
    transform: none;
    visibility: visible;
    transition: transform 0.2s ease;
}

.drawer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--line);
}

.drawer__title {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 1rem;
}

.drawer__body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.drawer__foot {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--line);
}

/* Chat messages */
.msg {
    overflow-wrap: anywhere;
}

.msg> :last-child {
    margin-bottom: 0;
}

.msg>*+* {
    margin-top: 0.75rem;
}

.msg pre {
    overflow-x: auto;
    padding: 0.75rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.msg pre code {
    background: none;
    padding: 0;
}

.msg--user {
    align-self: flex-end;
    max-width: 85%;
    padding: 0.5rem 0.85rem;
    white-space: pre-wrap;
    background: var(--surface-2);
    border-radius: 1rem 1rem 0.25rem 1rem;
}

.msg--error {
    color: var(--danger);
}

/* Form control */
.input {
    flex: 1;
    min-width: 0;
    padding: 0.5rem 0.75rem;
    resize: none;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.input:focus {
    outline: none;
    border-color: var(--accent);
}

.row {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}

/* Theme toggle icon swap */
.theme-toggle .icon-sun {
    display: none;
}

:root[data-theme="light"] .theme-toggle .icon-sun {
    display: block;
}

:root[data-theme="light"] .theme-toggle .icon-moon {
    display: none;
}

.menu-toggle {
    display: none;
}

.scrim {
    display: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {

    .split,
    .split--even {
        grid-template-columns: minmax(0, 1fr);
        gap: 1.5rem;
    }

    .split__side {
        position: static;
    }
}

@media (max-width: 800px) {
    .shell {
        grid-template-columns: minmax(0, 1fr);
    }

    .menu-toggle {
        display: inline-flex;
    }

    .topbar__links {
        display: none;
    }

    .sidebar {
        position: fixed;
        top: var(--header-h);
        left: 0;
        bottom: 0;
        z-index: 30;
        width: min(18rem, 85vw);
        height: auto;
        background: var(--bg);
        transform: translateX(-100%);
        visibility: hidden;
        transition: transform 0.2s ease, visibility 0s 0.2s;
    }

    .sidebar[data-open] {
        transform: none;
        visibility: visible;
        transition: transform 0.2s ease;
    }

    .scrim[data-open] {
        display: block;
        position: fixed;
        inset: var(--header-h) 0 0 0;
        z-index: 25;
        background: rgba(0, 0, 0, 0.5);
    }

    h1 {
        font-size: 1.6rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
    }
}