/* apidocs.css — /api, the developer landing page.

   Everything here is namespaced `.api-*`, `.copybtn` or `.tok-*` so it cannot
   collide with any other stylesheet. It layers over theme.css: the hero is
   theme.css's `.vhero`, the code cards are its `.termcard`, the section shells
   are `.band`. No token defined in theme.css is redefined here — the only
   custom properties declared below are the `--tok-*` syntax-highlight palette,
   which theme.css does not own.

   Colour rule: surfaces and text come from `--t-*`; literal light-on-dark
   values appear only inside `.api-vhero`, `.api-cta` and the hero's terminal
   card, all of which are dark in both themes by construction. */

/* ------------------------------------------------------- Syntax palette */

/* The highlighter emits .tok-c/s/k/p/n/v/f. Each one reads a variable so the
   same markup can sit on a light page surface, on a dark page surface, and on
   the permanently dark hero card — three different backgrounds, one set of
   class names. Light values are picked against --surface-tint (#fafafa),
   dark values against #1c1c1c. */
:root {
    --tok-com: #6b7280;
    --tok-str: #0a7048;
    --tok-key: #a3401d;
    --tok-prop: #1d4ed8;
    --tok-num: #6d28d9;
    --tok-var: #0e6d80;
    --tok-flag: #92610a;
    --tok-text: var(--t-default);
}

:root[data-theme="dark"] {
    --tok-com: #9a9a9a;
    --tok-str: #8ddba4;
    --tok-key: #f6a58c;
    --tok-prop: #8ecdf5;
    --tok-num: #cbb0f5;
    --tok-var: #6fd7cb;
    --tok-flag: #f0c674;
    --tok-text: #dcdcdc;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --tok-com: #9a9a9a;
        --tok-str: #8ddba4;
        --tok-key: #f6a58c;
        --tok-prop: #8ecdf5;
        --tok-num: #cbb0f5;
        --tok-var: #6fd7cb;
        --tok-flag: #f0c674;
        --tok-text: #dcdcdc;
    }
}

.tok-c { color: var(--tok-com); font-style: italic; }
.tok-s { color: var(--tok-str); }
.tok-k { color: var(--tok-key); }
.tok-p { color: var(--tok-prop); }
.tok-n { color: var(--tok-num); }
.tok-v { color: var(--tok-var); }
.tok-f { color: var(--tok-flag); }

/* Method badges and the copy-confirmation flash need a light and a dark value
   each; both are declared here rather than inlined at the use site. */
:root {
    --api-get-fg: #0b5f80;
    --api-get-bg: rgba(14, 165, 233, 0.13);
    --api-post-fg: #1a6b3d;
    --api-post-bg: rgba(16, 185, 129, 0.15);
    --api-del-fg: var(--primary-700);
    --api-ok-fg: #12603c;
    --api-ok-bg: #d8f2e3;
    --api-bad-fg: var(--primary-700);
    --api-bad-bg: var(--primary-100);
}

:root[data-theme="dark"] {
    --api-get-fg: #7dd3fc;
    --api-get-bg: rgba(14, 165, 233, 0.18);
    --api-post-fg: #7ee0aa;
    --api-post-bg: rgba(16, 185, 129, 0.16);
    --api-del-fg: var(--primary-300);
    --api-ok-fg: #8fe3b3;
    --api-ok-bg: rgba(16, 185, 129, 0.20);
    --api-bad-fg: var(--primary-300);
    --api-bad-bg: rgba(229, 50, 45, 0.20);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --api-get-fg: #7dd3fc;
        --api-get-bg: rgba(14, 165, 233, 0.18);
        --api-post-fg: #7ee0aa;
        --api-post-bg: rgba(16, 185, 129, 0.16);
        --api-del-fg: var(--primary-300);
        --api-ok-fg: #8fe3b3;
        --api-ok-bg: rgba(16, 185, 129, 0.20);
        --api-bad-fg: var(--primary-300);
        --api-bad-bg: rgba(229, 50, 45, 0.20);
    }
}

/* ------------------------------------------------------------- Structure */

.api-section {
    scroll-margin-top: calc(var(--header-h) + 16px);
}

.api-section .band__title {
    margin: 0;
}

.api-section h3.band__title {
    font-size: 1.0625rem;
}

.api-section .band__col {
    min-width: 0;
}

/* The theme's banlist puts <strong> inline; on this page the strong is a
   heading for the sentence that follows it, so it gets its own line. */
.api-section .banlist strong {
    display: block;
    margin-bottom: 2px;
}

.banlist.api-banlist--two {
    gap: 18px;
}

@media (min-width: 720px) {
    .banlist.api-banlist--two {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 18px 32px;
    }
}

.banlist.api-banlist--tight li {
    font-size: 0.8125rem;
}

.minilabel.api-minilabel--spaced {
    margin-top: 28px;
}

/* Inline code in prose. */
.api-section code,
.api-vhero code,
.api-cta code {
    padding: 1px 5px;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 0.875em;
    color: var(--t-highlighted);
    background: var(--t-elevated);
    border: 1px solid var(--t-border);
    border-radius: var(--radius-sm);
    overflow-wrap: anywhere;
}

/* --------------------------------------------------------- Terminal cards */

.api-term {
    min-width: 0;
}

.api-term + .api-term,
.api-term + .api-note {
    margin-top: 14px;
}

.api-term .termcard__bar {
    justify-content: flex-start;
    padding-right: 8px;
}

.api-term .termcard__name {
    /* The labels are already cased the way they should read — file names stay
       lower-case, methods stay upper-case. */
    text-transform: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.api-term .termcard__type {
    display: none;
}

@media (min-width: 560px) {
    .api-term .termcard__type {
        display: inline;
        opacity: 0.75;
    }
}

.api-term .api-term__pre {
    margin: 0;
    padding: 16px 18px;
    overflow-x: auto;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 0.8125rem;
    line-height: 1.65;
    color: var(--tok-text);
    tab-size: 4;
    -webkit-overflow-scrolling: touch;
}

.api-term .api-term__pre:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: -2px;
}

.api-term .api-term__code {
    display: block;
    font: inherit;
    white-space: pre;
}

.copybtn {
    display: inline-flex;
    flex: none;
    gap: 7px;
    align-items: center;
    margin-left: auto;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--t-muted);
    background: var(--t-surface);
    border: 1px solid var(--t-border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.copybtn:hover {
    color: var(--t-highlighted);
    background: var(--t-accented);
    border-color: var(--t-border-strong);
}

.copybtn:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

/* site.js swaps the label and adds one of these after a copy attempt. */
.copybtn.is-copied {
    color: var(--api-ok-fg);
    background: var(--api-ok-bg);
    border-color: var(--api-ok-bg);
}

.copybtn.is-copy-failed {
    color: var(--api-bad-fg);
    background: var(--api-bad-bg);
    border-color: var(--api-bad-bg);
}

/* ------------------------------------------------------------------ Hero */

.vhero.api-vhero {
    padding: 0 0 150px;
}

.vhero__inner.api-vhero__inner {
    padding-top: 44px;
}

/* Breadcrumbs ride inside the dark hero rather than sitting on a white strip
   between the header and the gradient. */
.api-crumbs {
    position: relative;
    background: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.api-crumbs .crumbs__list,
.api-crumbs .crumbs__list a {
    color: var(--n-400);
}

.api-crumbs .crumbs__list li + li::before {
    color: var(--n-600);
}

.api-crumbs .crumbs__list a:hover {
    color: #ffffff;
}

.api-crumbs .crumbs__list [aria-current="page"] {
    color: var(--n-200);
}

.api-eyebrow {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 18px;
    padding: 5px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--primary-300);
    background: rgba(229, 50, 45, 0.16);
    border: 1px solid rgba(229, 50, 45, 0.38);
    border-radius: 999px;
}

.api-vhero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-top: 28px;
}

@media (min-width: 1024px) {
    .api-vhero__actions {
        justify-content: flex-start;
    }
}

/* A ghost button for the dark surfaces, where the default light .btn would
   punch a white hole in the gradient. */
.api-btn-ghost,
.api-btn-ghost:hover {
    color: #ffffff;
}

.api-btn-ghost {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.22);
}

.api-btn-ghost:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.34);
}

.api-vhero code {
    color: var(--n-200);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.16);
}

/* The hero's terminal card is dark in both themes, so it carries the dark
   syntax palette explicitly instead of inheriting the page's. */
.api-vhero__code {
    min-width: 0;
    --tok-com: #9a9a9a;
    --tok-str: #8ddba4;
    --tok-key: #f6a58c;
    --tok-prop: #8ecdf5;
    --tok-num: #cbb0f5;
    --tok-var: #6fd7cb;
    --tok-flag: #f0c674;
    --tok-text: #e0e0e0;
}

.api-vhero__code .termcard {
    margin-top: 0;
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.api-vhero__code .api-term + .api-term {
    margin-top: 14px;
}

.api-vhero__code .termcard__bar {
    background: rgba(255, 255, 255, 0.05);
    border-bottom-color: rgba(255, 255, 255, 0.10);
}

.api-vhero__code .termcard__dots span {
    background: rgba(255, 255, 255, 0.16);
    box-shadow: none;
}

.api-vhero__code .termcard__name,
.api-vhero__code .termcard__type {
    color: rgba(255, 255, 255, 0.58);
}

.api-vhero__code .copybtn {
    color: var(--n-300);
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.16);
}

.api-vhero__code .copybtn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.28);
}

.api-vhero__code .api-term__pre:focus-visible {
    outline-color: var(--primary-300);
}

/* ------------------------------------------------- Lifted language block */

.api-lift-sec {
    position: relative;
    z-index: 10;
}

.liftcard.api-liftcard {
    width: min(100% - 32px, 1000px);
    padding: 28px 20px;
    text-align: left;
}

@media (min-width: 640px) {
    .liftcard.api-liftcard {
        padding: 34px 34px 38px;
    }
}

.liftcard.api-liftcard .band__lede {
    max-width: 62ch;
}

/* ------------------------------------------------------------- Quickstart */

.api-steps {
    display: grid;
    gap: 36px;
    margin-top: 36px;
}

.api-step {
    min-width: 0;
}

.api-step__head {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 4px;
}

.api-step__num {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--primary-100);
    background: var(--primary-600);
    border-radius: 50%;
}

.api-step__title {
    font-size: 1.0625rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--t-highlighted);
}

.api-step__text {
    max-width: 72ch;
    margin-top: 6px;
    font-size: 0.9375rem;
    line-height: 1.65;
    color: var(--t-muted);
}

/* ------------------------------------------------------------------ Tabs */

.api-tabs {
    margin-top: 22px;
}

.api-tabs__list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 5px;
    margin-bottom: 4px;
    background: var(--t-elevated);
    border: 1px solid var(--t-border);
    border-radius: var(--radius-lg);
}

.api-tab {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    padding: 8px 16px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--t-default);
    background: none;
    border: 0;
    border-radius: var(--radius);
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.api-tab:hover {
    color: var(--t-highlighted);
    background: var(--t-accented);
}

.api-tab[aria-selected="true"] {
    color: #ffffff;
    background: var(--primary-500);
}

.api-tab[aria-selected="true"]:hover {
    color: #ffffff;
    background: var(--primary-600);
}

.api-tabs__panels {
    min-width: 0;
}

.api-tabs__panels > [data-tab-panel]:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 4px;
    border-radius: var(--radius-lg);
}

/* ------------------------------------------------------- Notes and tables */

.api-note {
    display: flex;
    gap: 11px;
    align-items: flex-start;
    max-width: 82ch;
    margin-top: 20px;
    padding: 13px 16px;
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--t-default);
    background: var(--t-elevated);
    border: 1px solid var(--t-border);
    border-left: 3px solid var(--primary-500);
    border-radius: var(--radius);
}

.api-note i {
    flex: none;
    margin-top: 3px;
    color: var(--primary-500);
}

.api-tablewrap {
    margin-top: 12px;
    overflow-x: auto;
    background: var(--t-surface);
    border: 1px solid var(--t-border);
    border-radius: var(--radius-xl);
    -webkit-overflow-scrolling: touch;
}

.api-tablewrap:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

.api-table {
    width: 100%;
    min-width: 620px;
    border-collapse: collapse;
    font-size: 0.875rem;
    text-align: left;
}

.api-table--codes {
    min-width: 420px;
}

.api-table th {
    padding: 12px 16px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--t-muted);
    background: var(--t-elevated);
    border-bottom: 1px solid var(--t-border);
    white-space: nowrap;
}

.api-table td {
    padding: 12px 16px;
    color: var(--t-default);
    vertical-align: top;
    border-bottom: 1px solid var(--t-border);
}

.api-table tbody tr:last-child td {
    border-bottom: 0;
}

.api-table tbody tr:hover {
    background: var(--t-elevated);
}

.api-method {
    display: inline-block;
    min-width: 62px;
    padding: 2px 8px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-align: center;
    border-radius: var(--radius-sm);
}

.api-method--get    { color: var(--api-get-fg); background: var(--api-get-bg); }
.api-method--post   { color: var(--api-post-fg); background: var(--api-post-bg); }
.api-method--delete { color: var(--api-del-fg); background: var(--brand-tint); }

.api-path {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--t-highlighted);
    white-space: nowrap;
}

.api-scope {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.75rem;
    color: var(--t-muted);
}

.api-code {
    display: inline-block;
    min-width: 40px;
    padding: 2px 8px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--t-highlighted);
    background: var(--t-elevated);
    border: 1px solid var(--t-border);
    border-radius: var(--radius-sm);
}

/* ------------------------------------------------------------------- FAQ */

.band.api-faq-band {
    width: min(100% - 48px, 860px);
}

.api-faq {
    margin-top: 28px;
    overflow: hidden;
    background: var(--t-surface);
    border: 1px solid var(--t-border);
    border-radius: var(--radius-xl);
}

.api-faq__item + .api-faq__item {
    border-top: 1px solid var(--t-border);
}

.api-faq__heading {
    margin: 0;
    font-size: 1rem;
}

.api-faq__trigger {
    display: flex;
    gap: 18px;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 18px 20px;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.45;
    color: var(--t-highlighted);
    text-align: left;
    background: none;
    border: 0;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.api-faq__trigger:hover {
    color: var(--primary-500);
    background: var(--t-elevated);
}

.api-faq__chevron {
    flex: none;
    font-size: 0.8125rem;
    color: var(--t-dimmed);
    transition: transform 0.18s ease, color 0.15s ease;
}

.api-faq__trigger[aria-expanded="true"] .api-faq__chevron {
    color: var(--primary-500);
    transform: rotate(180deg);
}

.api-faq__panel {
    padding: 0 20px 20px;
    font-size: 0.9375rem;
    line-height: 1.65;
    color: var(--t-muted);
}

.api-faq__panel p {
    max-width: 78ch;
}

/* ------------------------------------------------------------ Closing CTA */

.api-cta {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    padding: 72px 0;
    color: var(--hero-body);
    background: linear-gradient(135deg, var(--hero-from), var(--hero-via) 55%, var(--hero-to));
}

.api-cta::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: radial-gradient(ellipse 60% 60% at 50% 0%, var(--hero-glow), transparent);
}

.api-cta__inner {
    max-width: 720px;
    text-align: center;
}

.api-cta__title {
    font-size: clamp(1.5rem, 3.4vw, 2rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--hero-ink);
}

.api-cta__lede {
    margin-top: 14px;
    font-size: 1rem;
    line-height: 1.7;
    color: var(--hero-body);
}

.api-cta__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-top: 28px;
}

.api-cta code {
    color: var(--n-200);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.16);
}

/* ------------------------------------------------------------ Responsive */

@media (min-width: 901px) {
    .api-steps {
        gap: 46px;
    }
}

@media (max-width: 1023px) {
    .vhero.api-vhero {
        padding-bottom: 130px;
    }
}

@media (max-width: 640px) {
    .vhero__inner.api-vhero__inner {
        padding-top: 32px;
    }

    .vhero.api-vhero {
        padding-bottom: 120px;
    }

    .api-vhero__actions .btn {
        flex: 1 1 100%;
    }

    .api-step__head {
        gap: 12px;
    }

    .api-tabs__list {
        gap: 4px;
        padding: 4px;
    }

    .api-tab {
        flex: 1 1 auto;
        justify-content: center;
        padding: 8px 10px;
        font-size: 0.8125rem;
    }

    .api-term .api-term__pre {
        padding: 14px;
        font-size: 0.75rem;
    }

    .api-faq__trigger {
        gap: 12px;
        padding: 16px;
        font-size: 0.9375rem;
    }

    .api-faq__panel {
        padding: 0 16px 16px;
    }

    .api-cta {
        padding: 56px 0;
    }

    .api-cta__actions .btn {
        flex: 1 1 100%;
    }
}

@media (max-width: 380px) {
    .api-tab span,
    .copybtn span:not(.visually-hidden) {
        display: none;
    }

    .api-tab {
        padding: 8px;
    }

    .liftcard.api-liftcard {
        padding: 22px 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .api-faq__chevron,
    .api-tab,
    .copybtn {
        transition: none;
    }
}
