/* NUACOM API documentation site. Tokens first, then layout, then components. */

:root {
    color-scheme: light;
    --canvas: #FFFFFF;
    --canvas-soft: #F6F8FB;
    --canvas-code: #F3F5F9;
    --border: #E2E7EE;
    --border-strong: #CBD3DE;
    --text: #1F2633;
    --text-soft: #4A5568;
    --text-muted: #6B7488;
    --brand: #3699FF;
    --brand-strong: #1F7AE0;
    --brand-soft: rgba(54, 153, 255, 0.12);
    --success: #1A9C6B;
    --warning: #D97706;
    --danger: #D83945;
    --info: #2F6FED;
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 8px 24px rgba(16, 24, 40, 0.08);
    --radius: 10px;
    --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    --topbar-height: 56px;
    --sidebar-width: 272px;
    --toc-width: 220px;
    --content-width: 780px;
    --method-get: #1A9C6B;
    --method-post: #2F6FED;
    --method-put: #D97706;
    --method-patch: #7C3AED;
    --method-delete: #D83945;
    --content-flare: radial-gradient(ellipse 80% 50% at 50% -20%, rgba(120, 119, 198, 0.3), transparent);
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --canvas: #0E1218;
    --canvas-soft: #151B24;
    --canvas-code: #161C26;
    --border: #273040;
    --border-strong: #35405280;
    --text: #EEF2F7;
    --text-soft: #C4CCD9;
    --text-muted: #8F9AAE;
    --brand: #5AA9FF;
    --brand-strong: #7CBBFF;
    --brand-soft: rgba(90, 169, 255, 0.16);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.45);
    --content-flare: radial-gradient(ellipse 80% 50% at 50% -20%, rgba(120, 119, 198, 0.3), transparent);
}

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

html {
    scroll-padding-top: calc(var(--topbar-height) + 24px);
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--canvas);
    color: var(--text);
    font: 15px/1.65 var(--font);
    -webkit-font-smoothing: antialiased;
}

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

a:hover {
    text-decoration: underline;
}

code, kbd, pre {
    font-family: var(--font-mono);
}

kbd {
    display: inline-block;
    min-width: 20px;
    padding: 1px 6px;
    border: 1px solid var(--border);
    border-bottom-width: 2px;
    border-radius: 5px;
    background: var(--canvas-soft);
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.5;
    text-align: center;
}

button {
    font: inherit;
    color: inherit;
}

/* Excludes #app: Scalar's own icons there are solid fill="currentColor" glyphs, not this
   site's stroke-style set, and this rule broke them into stray stroked fragments. :where()
   keeps the exclusion at zero specificity so .mermaid-diagram svg can override the icon size. */
svg:not(:where(#app *)) {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.skip-link {
    position: absolute;
    left: -999px;
    top: 8px;
    z-index: 100;
    padding: 8px 12px;
    background: var(--canvas);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.skip-link:focus {
    left: 8px;
}

/* ---------- Top bar ---------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 16px;
    height: var(--topbar-height);
    padding: 0 20px;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--canvas) 86%, transparent);
    backdrop-filter: saturate(180%) blur(12px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-weight: 650;
    letter-spacing: -0.01em;
}

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

.brand img {
    width: auto;
    height: 28px;
    border-radius: 0;
}

.brand em {
    font-style: normal;
    color: var(--brand);
}

.topbar-nav {
    display: flex;
    gap: 2px;
    margin-left: 8px;
}

.topbar-nav a {
    padding: 6px 10px;
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
}

.topbar-nav a:hover {
    color: var(--text);
    background: var(--canvas-soft);
    text-decoration: none;
}

.topbar-nav a.is-active {
    color: var(--text);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
}

.icon-button:hover {
    color: var(--text);
    background: var(--canvas-soft);
}

.nav-toggle {
    display: none;
}

.search-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 220px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--canvas-soft);
    color: var(--text-muted);
    cursor: pointer;
}

.search-button:hover {
    border-color: var(--border-strong);
    color: var(--text);
}

.search-button span {
    flex: 1;
    text-align: left;
    font-size: 14px;
}

.pill-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--canvas);
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.pill-button:hover {
    border-color: var(--border-strong);
    color: var(--text);
}

.pill-button.is-set {
    border-color: color-mix(in srgb, var(--success) 50%, var(--border));
    color: var(--success);
}

.theme-toggle .icon-moon {
    display: none;
}

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

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

/* ---------- Shell ---------- */

.shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr) var(--toc-width);
    gap: 0;
    /* Full-width with the flare spanning content + toc, like the Scalar reference. */
    background: var(--content-flare) var(--sidebar-width) 0 / calc(100% - var(--sidebar-width)) 100vh no-repeat fixed;
}

.sidebar {
    position: sticky;
    top: var(--topbar-height);
    height: calc(100vh - var(--topbar-height));
    overflow-y: auto;
    padding: 24px 12px 40px 20px;
    border-right: 1px solid var(--border);
    scrollbar-width: thin;
}

.sidebar-backdrop {
    display: none;
}

.nav-section + .nav-section {
    margin-top: 22px;
}

.nav-title {
    margin: 0 0 6px 10px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 650;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.sidebar-nav ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 6px 10px;
    border-radius: 7px;
    color: var(--text-soft);
    font-size: 14px;
}

.sidebar-nav a > span {
    flex: 1;
    min-width: 0;
}

.sidebar-nav a:hover {
    color: var(--text);
    background: var(--canvas-soft);
    text-decoration: none;
}

.sidebar-nav a.is-active {
    color: var(--brand-strong);
    background: var(--brand-soft);
    font-weight: 600;
}

.nav-badge {
    margin-left: auto;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--canvas-soft);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    white-space: nowrap;
}

.content {
    min-width: 0;
    padding: 40px 48px 80px;
}

.doc {
    max-width: var(--content-width);
    margin: 0 auto;
}

.toc {
    position: sticky;
    top: var(--topbar-height);
    height: calc(100vh - var(--topbar-height));
    overflow-y: auto;
    padding: 40px 20px 40px 8px;
    font-size: 13px;
}

.toc[hidden] {
    display: none;
}

.toc-title {
    margin: 0 0 8px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 650;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

#toc-list, #toc-list ol {
    margin: 0;
    padding: 0;
    list-style: none;
}

#toc-list li a {
    display: block;
    padding: 4px 0 4px 12px;
    border-left: 2px solid var(--border);
    color: var(--text-muted);
}

#toc-list li li a {
    padding-left: 24px;
}

#toc-list li a:hover {
    color: var(--text);
    text-decoration: none;
}

#toc-list li a.is-active {
    border-left-color: var(--brand);
    color: var(--brand-strong);
}

/* ---------- Document ---------- */

.doc-kicker {
    margin: 0 0 6px;
    color: var(--brand-strong);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.doc-header h1 {
    margin: 0 0 20px;
    font-size: 36px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.markdown h2 {
    position: relative;
    margin: 44px 0 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    font-size: 24px;
    font-weight: 650;
    letter-spacing: -0.015em;
    line-height: 1.3;
}

.markdown h3 {
    position: relative;
    margin: 30px 0 10px;
    font-size: 18px;
    font-weight: 650;
    line-height: 1.35;
}

.markdown h4 {
    margin: 24px 0 8px;
    font-size: 15px;
    font-weight: 650;
}

.heading-anchor {
    position: absolute;
    left: -1.1em;
    width: 1em;
    color: var(--text-muted);
    opacity: 0;
    text-decoration: none;
}

.markdown h2:hover .heading-anchor, .markdown h3:hover .heading-anchor, .heading-anchor:focus {
    opacity: 1;
}

.markdown p, .markdown ul, .markdown ol {
    margin: 0 0 14px;
}

.markdown li {
    margin: 4px 0;
}

.markdown li > p {
    margin: 0;
}

.markdown ol ol, .markdown ol ul, .markdown ul ul {
    margin: 4px 0 4px 2px;
}

.markdown strong {
    font-weight: 650;
}

.markdown :not(pre) > code {
    padding: 2px 6px;
    border-radius: 5px;
    background: var(--canvas-code);
    border: 1px solid var(--border);
    font-size: 0.875em;
    overflow-wrap: anywhere;
}

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

.mermaid-diagram {
    margin: 20px 0;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--canvas-soft);
    overflow-x: auto;
    text-align: center;
}

/* Undo the 18px icon default for diagrams, on the guides and inside Scalar's viewer. */
.mermaid-diagram svg, .scalar-mermaid-canvas svg {
    width: 100%;
    max-width: 100%;
    height: auto;
    fill: revert;
    stroke: revert;
}

/* Scalar's plugin always draws Mermaid's light palette on a white canvas; in dark mode the canvas
   follows the page and the SVG is inverted, which maps that palette onto dark fills and light text. */
body.is-reference.dark-mode .scalar-mermaid-diagram {
    --scalar-mermaid-canvas-background: var(--canvas-soft);
}

body.is-reference.dark-mode .scalar-mermaid-canvas svg {
    filter: invert(0.88) hue-rotate(180deg);
}

.mermaid-diagram pre {
    margin: 0;
    text-align: left;
}

.markdown img {
    max-width: 100%;
    border-radius: var(--radius);
}

.markdown blockquote {
    margin: 0 0 16px;
    padding: 2px 16px;
    border-left: 3px solid var(--border-strong);
    color: var(--text-soft);
}

/* Tables */

.table-wrap {
    overflow-x: auto;
    margin: 0 0 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.markdown table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.markdown th, .markdown td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.markdown tr:last-child td {
    border-bottom: 0;
}

.markdown th {
    background: var(--canvas-soft);
    color: var(--text-soft);
    font-size: 12.5px;
    font-weight: 650;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    white-space: nowrap;
}

.markdown td code {
    white-space: nowrap;
}

.markdown th code {
    white-space: nowrap;
    overflow-wrap: normal;
}

/* Callouts */

.callout {
    margin: 0 0 18px;
    padding: 14px 16px 4px;
    border: 1px solid var(--callout-border, var(--border));
    border-left: 4px solid var(--callout-accent, var(--info));
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--callout-accent, var(--info)) 6%, var(--canvas));
}

.callout-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 6px;
    color: var(--callout-accent, var(--info));
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.callout-title::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.callout p:last-child {
    margin-bottom: 10px;
}

.callout-note {
    --callout-accent: var(--info);
}

.callout-tip {
    --callout-accent: var(--success);
}

.callout-important {
    --callout-accent: #7C3AED;
}

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

.callout-caution {
    --callout-accent: var(--danger);
}

/* Code blocks */

.code-block {
    position: relative;
    margin: 0 0 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--canvas-code);
    overflow: hidden;
}

.code-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px 6px 14px;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--canvas-soft) 70%, var(--canvas-code));
    font-size: 12px;
}

.code-lang {
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.code-tab {
    padding: 4px 10px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: none;
    color: var(--text-muted);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
}

.code-tab:hover {
    color: var(--text);
}

.code-tab[aria-selected="true"] {
    border-color: var(--border);
    background: var(--canvas);
    color: var(--text);
}

.code-copy {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    padding: 4px 8px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: none;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
}

.code-copy:hover {
    border-color: var(--border);
    color: var(--text);
}

.code-copy.is-done {
    color: var(--success);
}

.code-block pre {
    margin: 0;
    padding: 14px 16px;
    overflow-x: auto;
    font-size: 13.5px;
    line-height: 1.6;
    background: transparent !important;
}

.code-block pre code {
    display: block;
    padding: 0;
    background: transparent !important;
    font-size: inherit;
}

.code-block .code-panel[hidden] {
    display: none;
}

/* Endpoint links */

.endpoint {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    vertical-align: baseline;
    white-space: nowrap;
}

.endpoint-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 8px 2px 4px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--canvas-soft);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 0.86em;
}

/* The frame is the link itself: no underline on the verb or the route, hovered or not, and no
   inline-code box inside it — the generic `.markdown code` rule and Scalar's Markdown styles
   (the same links appear in tag descriptions of the reference) would draw both. */
.endpoint-link, .endpoint-link:hover, .endpoint-link .method, .endpoint-link code {
    text-decoration: none !important;
}

.endpoint-link:hover {
    border-color: var(--brand);
}

.endpoint-link code {
    padding: 0 !important;
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
    background: none !important;
    font-size: inherit !important;
}

.method {
    display: inline-block;
    padding: 1px 6px 0px;
    border-radius: 4px;
    color: #fff;
    font-family: var(--font-mono);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1.6;
    text-align: center;
    text-transform: uppercase;
}

.method-get { color: var(--method-post); }
.method-post { color: var(--method-get); }
.method-put { color: var(--method-put); }
.method-patch { color: var(--method-patch); }
.method-delete { color: var(--method-delete); }

.try-button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--canvas);
    color: var(--brand-strong);
    font-size: 11.5px;
    font-weight: 650;
    cursor: pointer;
}

.try-button:hover {
    border-color: var(--brand);
    background: var(--brand-soft);
}

/* A solid play glyph in the button's own colour: the site icon rule would stroke it, and
   inside the reference (#app, where that rule does not reach) SVG would fill it black. */
.try-button svg {
    width: 12px;
    height: 12px;
    fill: currentColor;
    stroke: none;
}

/* Footer */

.doc-footer {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 56px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.doc-neighbour {
    display: flex;
    flex-direction: column;
    max-width: 48%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
}

.doc-neighbour:hover {
    border-color: var(--brand);
    text-decoration: none;
}

.doc-neighbour small {
    color: var(--text-muted);
    font-size: 12px;
}

.doc-neighbour span {
    font-weight: 600;
}

.doc-neighbour.is-next {
    margin-left: auto;
    text-align: right;
}

/* ---------- Welcome page ---------- */

.doc-welcome {
    max-width: 880px;
}

.hero {
    padding: 8px 0 24px;
}

.hero h1 {
    margin: 0 0 14px;
    font-size: 44px;
    font-weight: 750;
    letter-spacing: -0.03em;
    line-height: 1.08;
}

.hero-lead {
    max-width: 640px;
    margin: 0 0 22px;
    color: var(--text-soft);
    font-size: 18px;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 24px;
}

.hero-snippet {
    margin: 0;
    padding: 14px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--canvas-code);
    font-size: 13.5px;
    overflow-x: auto;
}

.button-primary, .button-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 16px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.button-primary {
    background: var(--brand-strong);
    color: #fff;
}

.button-primary:hover {
    background: var(--brand);
    text-decoration: none;
}

.button-secondary {
    border-color: var(--border);
    background: var(--canvas);
    color: var(--text);
}

.button-secondary:hover {
    border-color: var(--border-strong);
    background: var(--canvas-soft);
    text-decoration: none;
}

.cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin: 28px 0;
}

.card {
    display: block;
    padding: 18px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--canvas);
    color: var(--text);
    transition: border-color 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}

.card:hover {
    border-color: var(--brand);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
    text-decoration: none;
}

.card h3 {
    margin: 0 0 6px;
    font-size: 16px;
}

.card p {
    margin: 0;
    color: var(--text-soft);
    font-size: 14px;
}

.versions {
    margin: 32px 0;
}

.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border);
}

.tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    margin-bottom: -1px;
    border: 1px solid transparent;
    border-radius: 8px 8px 0 0;
    background: none;
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
}

.tab[aria-selected="true"] {
    border-color: var(--border) var(--border) var(--canvas);
    background: var(--canvas);
    color: var(--text);
}

.tab-panel {
    padding: 16px 0 8px;
}

.tab-panel h2 {
    margin-top: 8px;
}

.badge {
    padding: 2px 8px;
    border-radius: 999px;
    color: #fff;
    font-size: 11px;
    font-weight: 650;
}

.badge-v1 {
    background: var(--danger);
}

.badge-v2 {
    background: var(--success);
}

.guide-index {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px 32px;
    margin-top: 40px;
    padding-top: 28px;
    border-top: 1px solid var(--border);
}

.guide-index h2 {
    margin: 0 0 8px;
    font-size: 14px;
    font-weight: 650;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.guide-index ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.guide-index li {
    padding: 3px 0;
}

/* ---------- Modals ---------- */

.modal[hidden] {
    display: none;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 10vh 16px;
}

.modal-backdrop, .playground-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 14, 20, 0.45);
    backdrop-filter: blur(2px);
}

.modal-panel {
    position: relative;
    width: 100%;
    max-width: 640px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--canvas);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.search-panel {
    position: relative;
}

.search-field {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 52px 14px 18px;
    color: var(--text-muted);
}

.search-field svg, .search-close svg, .search-result-icon {
    width: 18px;
    height: 18px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.search-field input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 17px;
}

.search-field input::-webkit-search-cancel-button {
    display: none;
}

.search-close {
    position: absolute;
    top: 12px;
    right: 12px;
    display: inline-flex;
    padding: 6px;
    border: 0;
    border-radius: 6px;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
}

.search-close:hover {
    background: var(--canvas-soft);
    color: var(--text);
}

.search-results {
    overflow-y: auto;
    padding: 0 8px 8px;
}

.search-hint, .search-empty {
    margin: 0;
    padding: 20px 12px;
    color: var(--text-muted);
    text-align: center;
}

.search-result {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 8px 10px;
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
}

.search-result:hover, .search-result[aria-selected="true"] {
    background: var(--canvas-soft);
    text-decoration: none;
}

.search-result-icon {
    margin-top: 3px;
    color: var(--text-muted);
    opacity: 0.6;
}

.search-result-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.search-result-title {
    overflow: hidden;
    color: var(--brand);
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-result-snippet {
    overflow: hidden;
    color: var(--text-soft);
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-result-snippet mark {
    background: none;
    color: var(--text);
    font-weight: 650;
}

.search-method { font-weight: 500; }
.method-text-get { color: var(--method-post); }
.method-text-post { color: var(--method-get); }
.method-text-put, .method-text-patch { color: var(--method-put); }
.method-text-delete { color: var(--method-delete); }

.search-footer {
    display: flex;
    gap: 16px;
    align-items: center;
    margin: 0;
    padding: 10px 18px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 13px;
}

.apikey-panel {
    padding: 22px 24px;
    gap: 12px;
}

.apikey-panel h2 {
    margin: 0;
    font-size: 18px;
}

.apikey-panel p {
    margin: 0;
    color: var(--text-soft);
    font-size: 14px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
}

.field > span {
    color: var(--text-soft);
    font-weight: 600;
}

.field > span small {
    color: var(--text-muted);
    font-weight: 500;
}

.field input, .field textarea, .playground textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--canvas);
    color: var(--text);
    font: inherit;
    font-size: 14px;
}

.field input:focus, .playground textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-soft);
}

.field input::placeholder {
    color: var(--text-muted);
}

.checkbox {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    color: var(--text-soft);
    font-size: 13px;
}

.checkbox input {
    margin-top: 3px;
}

.modal-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.modal-actions .spacer {
    flex: 1;
}

/* ---------- Playground ---------- */

.playground[hidden] {
    display: none;
}

.playground {
    position: fixed;
    inset: 0;
    z-index: 55;
}

.playground-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(620px, 100%);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: var(--canvas);
    border-left: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.playground-header {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--canvas);
}

.playground-kicker {
    margin: 0 0 4px;
    color: var(--brand-strong);
    font-size: 12px;
    font-weight: 650;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.playground-header h2 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.playground-header h2 code {
    font-size: 14px;
}

.playground-summary {
    margin: 6px 0 0;
    color: var(--text-muted);
    font-size: 13px;
}

.playground-header-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}

.playground-header-actions .button-secondary {
    height: 32px;
    padding: 0 12px;
    font-size: 13px;
}

.playground-form {
    display: flex;
    flex-direction: column;
}

.playground-section {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.playground-section[hidden] {
    display: none;
}

.playground-section h3 {
    margin: 0 0 10px;
    font-size: 13px;
    font-weight: 650;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.playground-section h3 small {
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
}

.playground-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 12px;
}

.playground-grid .field.is-wide {
    grid-column: 1 / -1;
}

.playground textarea {
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.5;
    resize: vertical;
}

.playground-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
}

.playground-status {
    color: var(--text-muted);
    font-size: 13px;
}

.playground-status.is-error {
    color: var(--danger);
}

.playground-response {
    border-top: 1px solid var(--border);
}

.playground-response pre {
    margin: 0;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--canvas-code);
    font-size: 12.5px;
    line-height: 1.5;
    overflow: auto;
    max-height: 60vh;
}

.status-pill {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--canvas-soft);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 12px;
    font-weight: 650;
    letter-spacing: 0;
    text-transform: none;
}

.status-pill.is-2xx { color: var(--success); border-color: color-mix(in srgb, var(--success) 40%, var(--border)); }
.status-pill.is-4xx { color: var(--warning); border-color: color-mix(in srgb, var(--warning) 40%, var(--border)); }
.status-pill.is-5xx { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }

/* ---------- Reference page (Scalar below the shared top bar) ---------- */

body.is-reference {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.scalar-reference-intro-server > div {
    background-color: var(--scalar-background-1);
}

/* Scalar's variables resolve to the docs tokens above, so the reference follows <html data-theme>
   together with the guides; body.is-reference outranks Scalar's own .light-mode/.dark-mode rules. */
body.is-reference.light-mode,
body.is-reference.dark-mode {
    --scalar-background-1: var(--canvas);
    --scalar-background-2: var(--canvas-soft);
    --scalar-background-3: var(--canvas-code);
    --scalar-background-accent: var(--brand-soft);
    --scalar-color-1: var(--text);
    --scalar-color-2: var(--text-soft);
    --scalar-color-3: var(--text-muted);
    --scalar-color-accent: var(--brand-strong);
    --scalar-border-color: var(--border);
    --scalar-color-green: var(--method-get);
    --scalar-color-blue: var(--method-post);
    --scalar-color-orange: var(--method-put);
    --scalar-color-purple: var(--method-patch);
    --scalar-color-red: var(--method-delete);
    --scalar-color-yellow: var(--warning);
    --scalar-button-1: var(--brand-strong);
    --scalar-button-1-color: #fff;
    --scalar-button-1-hover: var(--brand);
    --scalar-sidebar-background-1: var(--canvas);
    --scalar-sidebar-color-1: var(--text-soft);
    --scalar-sidebar-color-2: var(--text-muted);
    --scalar-sidebar-color-active: var(--brand-strong);
    --scalar-sidebar-item-hover-background: var(--canvas-soft);
    --scalar-sidebar-item-hover-color: var(--text);
    --scalar-sidebar-item-active-background: var(--brand-soft);
    --scalar-sidebar-border-color: var(--border);
    --scalar-sidebar-search-background: var(--canvas-soft);
    --scalar-sidebar-search-border-color: var(--border);
    --scalar-sidebar-search-color: var(--text-muted);
    --scalar-sidebar-indent-border: var(--border);
    --scalar-sidebar-indent-border-hover: var(--border-strong);
    --scalar-sidebar-indent-border-active: var(--brand);
}

body.is-reference,
body.is-reference .scalar-app,
body.is-reference .scalar-api-reference {
    --scalar-font: var(--font);
    --scalar-font-code: var(--font-mono);
    --scalar-radius: 6px;
    --scalar-radius-lg: 8px;
    --scalar-radius-xl: 10px;
    --scalar-sidebar-width: 272px;
    --scalar-custom-header-height: var(--topbar-height);
}

/* The "Test Request" trigger that opens Scalar's API client is a hardcoded white Scalar
   component, not themed through --scalar-button-1 like the client's own Send button; match it
   by hand so the two don't read as two different products. */
#app .show-api-client-button {
    background: var(--brand-strong);
}

#app .show-api-client-button,
#app .show-api-client-button *,
#app .scalar-app .text-c-btn {
    color: var(--scalar-background-3);
}

#app .show-api-client-button:hover {
    background: var(--brand);
}

.reference-app {
    flex: 1;
    min-height: 0;
}

.nav-toggle[hidden] {
    display: none;
}

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

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

    .toc {
        display: none;
    }
}

@media (max-width: 960px) {
    .shell {
        grid-template-columns: minmax(0, 1fr);
        background-position: 0 0;
        background-size: 100% 100vh;
    }

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

    .topbar-nav {
        display: none;
    }

    .search-button {
        min-width: 0;
    }

    .search-button span, .search-button kbd {
        display: none;
    }

    .sidebar {
        position: fixed;
        top: var(--topbar-height);
        left: 0;
        bottom: 0;
        z-index: 45;
        width: min(320px, 86vw);
        background: var(--canvas);
        transform: translateX(-105%);
        transition: transform 160ms ease;
    }

    body.sidebar-open .sidebar {
        transform: none;
    }

    body.sidebar-open .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: var(--topbar-height) 0 0;
        z-index: 44;
        background: rgba(10, 14, 20, 0.4);
    }

    .content {
        padding: 28px 16px 64px;
    }

    .hero h1 {
        font-size: 32px;
    }

    .doc-header h1 {
        font-size: 28px;
    }

    .cards, .guide-index, .playground-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .pill-button span {
        display: none;
    }
}

@media print {
    .topbar, .sidebar, .toc, .doc-footer, .try-button, .code-copy, .modal, .playground {
        display: none !important;
    }

    .shell {
        display: block;
    }
}
