/* /api: Swagger UI (static/vendor/swagger-ui) in the site's shell, on the site's fonts and
   tokens. Swagger UI's own dark styles hang off html.dark-mode, which js/api-docs.js keeps
   in step with the site's data-theme; the rules here put both themes on the site's
   surfaces, borders, text and link colours. */

/* Swagger UI names generic font families on many selectors; :is(*, .x.x.x) lifts these
   two rules over all of them without !important. */
.api-ref .swagger-ui :is(*, .x.x.x) { font-family: var(--font); }
.api-ref .swagger-ui :is(code, code *, pre, pre *, kbd, samp, textarea, .model, .model *, .parameter__type,
  .parameter__in, .opblock-summary-path, .opblock-summary-path *, .opblock-summary-operation-id, .base-url,
  .prop-format, .json-schema-2020-12__attribute, .json-schema-2020-12__constraint, table.headers td,
  .response-col_status):is(*, .x.x.x.x) { font-family: var(--mono); }

.api-ref { min-width: 0; }
.api-ref-noscript { padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
html.dark-mode { background: var(--bg); }
.api-ref .swagger-ui,
html.dark-mode .api-ref .swagger-ui { background: transparent; color: var(--text); }
.api-ref .swagger-ui .wrapper { max-width: none; padding: 0; }
.api-ref .swagger-ui a,
.api-ref .swagger-ui .info a,
html.dark-mode .api-ref .swagger-ui .info a,
html.dark-mode .api-ref .swagger-ui .opblock-tag a.link { color: var(--link); }

/* The document's description: one panel, like the site's other panels. */
.api-ref .swagger-ui .information-container { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 4px 16px 8px; margin: 0 0 16px; }
.api-ref .swagger-ui .info { margin: 12px 0; }
.api-ref .swagger-ui .info hgroup.main { margin: 0 0 8px; }
.api-ref .swagger-ui .info .title,
html.dark-mode .api-ref .swagger-ui .info .title { color: var(--text); font-size: 1.2rem; font-weight: 600; }
.api-ref .swagger-ui .info .title small { top: -4px; }
.api-ref .swagger-ui .info .title small pre { font-size: .72rem; }
.api-ref .swagger-ui .info :is(p, li, table),
html.dark-mode .api-ref .swagger-ui .info :is(p, li, table),
.api-ref .swagger-ui :is(.markdown, .renderedMarkdown) :is(p, li),
html.dark-mode .api-ref .swagger-ui :is(.markdown, .renderedMarkdown) :is(p, li, pre) { color: var(--text); font-size: .92rem; line-height: 1.55; }
.api-ref .swagger-ui .info :is(h1, h2, h3, h4),
html.dark-mode .api-ref .swagger-ui .info :is(h1, h2, h3, h4) { color: var(--text); }
.api-ref .swagger-ui .info .description ul,
.api-ref .swagger-ui .info .description ol { padding-left: 1.3rem; }
.api-ref .swagger-ui .info .description li { margin: 4px 0; }
.api-ref .swagger-ui :is(.markdown, .renderedMarkdown) code,
html.dark-mode .api-ref .swagger-ui :is(.markdown, .renderedMarkdown) code { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; font-size: .84em; }
/* Code blocks and tables scroll inside themselves, never the page. */
.api-ref .swagger-ui :is(.markdown, .renderedMarkdown) pre,
html.dark-mode .api-ref .swagger-ui :is(.markdown, .renderedMarkdown) pre { max-width: 100%; overflow-x: auto; margin: 8px 0 12px; padding: 10px 12px; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 6px; font-size: .8rem; line-height: 1.5; white-space: pre; }
.api-ref .swagger-ui :is(.markdown, .renderedMarkdown) pre code { border: 0; padding: 0; background: none; font-size: inherit; }
.api-ref .swagger-ui :is(.markdown, .renderedMarkdown) table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; margin: 8px 0 12px; }
.api-ref .swagger-ui :is(.markdown, .renderedMarkdown) :is(th, td) { padding: 6px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; font-size: .86rem; color: var(--text); }
.api-ref .swagger-ui :is(.markdown, .renderedMarkdown) th { color: var(--muted); font-weight: 600; }

/* Servers and Authorize. */
.api-ref .swagger-ui .scheme-container,
html.dark-mode .api-ref .swagger-ui .scheme-container { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin: 0 0 16px; padding: 12px 16px; }
.api-ref .swagger-ui .scheme-container .schemes { flex-wrap: wrap; gap: 10px; }
.api-ref .swagger-ui .scheme-container .schemes > .schemes-server-container > label,
html.dark-mode .api-ref .swagger-ui .scheme-container .schemes > .schemes-server-container > label { color: var(--muted); }
.api-ref .swagger-ui .servers > label { margin: 0; }
.api-ref .swagger-ui .servers > label select { max-width: 100%; }

/* Tags and operations. */
.api-ref .swagger-ui .opblock-tag,
html.dark-mode .api-ref .swagger-ui .opblock-tag { color: var(--text); border-bottom-color: var(--border); font-size: 1.1rem; font-weight: 600; }
.api-ref .swagger-ui .opblock-tag small,
html.dark-mode .api-ref .swagger-ui .opblock-tag small { color: var(--muted); font-size: .86rem; font-weight: 400; }
.api-ref .swagger-ui .opblock-tag:hover { background: var(--row-hover); }
.api-ref .swagger-ui .opblock { border-radius: 6px; box-shadow: none; }
.api-ref .swagger-ui .opblock .opblock-summary-path,
.api-ref .swagger-ui .opblock .opblock-summary-description,
html.dark-mode .api-ref .swagger-ui .opblock .opblock-summary-description,
html.dark-mode .api-ref .swagger-ui .opblock .opblock-summary-path { color: var(--text); }
.api-ref .swagger-ui .opblock .opblock-summary-path { font-size: .9rem; overflow-wrap: anywhere; word-break: break-word; }
.api-ref .swagger-ui .opblock .opblock-summary-method { font-family: var(--mono); border-radius: 4px; }
.api-ref .swagger-ui .opblock-description-wrapper,
.api-ref .swagger-ui .opblock-description-wrapper p,
.api-ref .swagger-ui .opblock-section-header h4,
html.dark-mode .api-ref .swagger-ui .opblock-description-wrapper p,
html.dark-mode .api-ref .swagger-ui .opblock-section-header h4 { color: var(--text); }
.api-ref .swagger-ui .opblock .opblock-section-header { box-shadow: none; }
.api-ref .swagger-ui .opblock.opblock-get .opblock-section-header { background: var(--surface-2); }
/* Try it out's curl line, request URL and response body keep their exact characters
   (Swagger UI wraps them anywhere and hyphenates JSON keys) and scroll inside themselves. */
.api-ref .swagger-ui .opblock-body pre.microlight,
html.dark-mode .api-ref .swagger-ui .opblock-body pre.microlight { max-width: 100%; overflow-x: auto; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 6px; font-size: .8rem; white-space: pre; word-break: normal; overflow-wrap: normal; hyphens: manual; }
.api-ref .swagger-ui .opblock-body pre.microlight code,
.api-ref .swagger-ui .highlight-code > .microlight code { white-space: pre !important; word-break: normal; overflow-wrap: normal; hyphens: manual; }
.api-ref .swagger-ui .highlight-code { max-width: 100%; }
/* A response's description column (examples, Try it out's body) takes the width that is
   left and never grows to its content, so a wide block scrolls in itself (Swagger UI does
   the same for model boxes). */
.api-ref .swagger-ui .responses-table td.response-col_description { max-width: 1px; }
.api-ref .swagger-ui .highlight-code > .microlight { max-height: 480px; }

/* Parameters, responses and models. */
.api-ref .swagger-ui table thead tr :is(td, th),
html.dark-mode .api-ref .swagger-ui table thead tr :is(td, th) { color: var(--muted); border-bottom-color: var(--border); }
.api-ref .swagger-ui :is(.parameter__name, .parameter__type, .response-col_status, .response-col_links, .col_header, .tab li, .model-title, .model, .prop-type, .prop-format),
html.dark-mode .api-ref .swagger-ui :is(.parameter__name, .parameter__type, .response-col_status, .response-col_links, .col_header, .tab li, .model-title, .model) { color: var(--text); }
.api-ref .swagger-ui .parameter__in,
html.dark-mode .api-ref .swagger-ui .parameter__in { color: var(--muted); }
/* A response's Headers table (RateLimit-*, Retry-After): Swagger UI colours its cells for
   light only. */
.api-ref .swagger-ui table.headers td,
html.dark-mode .api-ref .swagger-ui table.headers td { color: var(--text); }
.api-ref .swagger-ui .parameter__name.required span,
.api-ref .swagger-ui .parameter__name.required::after { color: var(--error); }
.api-ref .swagger-ui section.models,
html.dark-mode .api-ref .swagger-ui section.models { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.api-ref .swagger-ui section.models h4,
html.dark-mode .api-ref .swagger-ui section.models h4 { color: var(--text); }
.api-ref .swagger-ui section.models .model-container,
html.dark-mode .api-ref .swagger-ui section.models .model-container { background: var(--surface-2); }
.api-ref .swagger-ui section.models .model-container:hover { background: var(--row-hover); }
.api-ref .swagger-ui :is(.json-schema-2020-12__title, .json-schema-2020-12-keyword__name, .json-schema-2020-12-keyword__value, .json-schema-2020-12-property .json-schema-2020-12__title),
html.dark-mode .api-ref .swagger-ui :is(.json-schema-2020-12__title, .json-schema-2020-12-keyword__name, .json-schema-2020-12-keyword__value, .json-schema-2020-12-property .json-schema-2020-12__title) { color: var(--text); }
.api-ref .swagger-ui .json-schema-2020-12__constraint { font-size: .72rem; line-height: 1.5; }
.api-ref .swagger-ui .json-schema-2020-12-keyword--description :is(p, li),
html.dark-mode .api-ref .swagger-ui .json-schema-2020-12-keyword--description :is(p, li) { color: var(--muted); }

/* Form controls on the site's surfaces. */
.api-ref .swagger-ui :is(input[type=text], input[type=password], input[type=search], input[type=email], input[type=file], textarea, select),
html.dark-mode .api-ref .swagger-ui :is(input, textarea, select) { background-color: var(--surface); color: var(--text); border-color: var(--border-strong); border-radius: 6px; }
.api-ref .swagger-ui .btn { border-radius: 6px; box-shadow: none; color: var(--text); border-color: var(--border-strong); }
.api-ref .swagger-ui .btn.execute { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--accent-contrast); }
/* Authorize in the site's green: the deeper teal on light surfaces (the light green is
   under 3:1 on white), the light green on dark ones. */
.api-ref .swagger-ui .btn.authorize { color: var(--teal); border-color: var(--teal); background: transparent; }
.api-ref .swagger-ui .btn.authorize svg { fill: var(--teal); color: var(--teal); }
html.dark-mode .api-ref .swagger-ui .scheme-container .btn.authorize { color: var(--success); border-color: var(--success); background: transparent; }
html.dark-mode .api-ref .swagger-ui .scheme-container .btn.authorize svg { fill: var(--success); color: var(--success); }
.api-ref .swagger-ui .dialog-ux .modal-ux,
html.dark-mode .api-ref .swagger-ui .dialog-ux .modal-ux { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.api-ref .swagger-ui .dialog-ux .modal-ux-header h3,
.api-ref .swagger-ui .dialog-ux .modal-ux-content :is(h4, p, label),
html.dark-mode .api-ref .swagger-ui .dialog-ux .modal-ux :is(h2, h3, h4, h5, h6, label, p) { color: var(--text); }
.api-ref .swagger-ui .dialog-ux .modal-ux { width: min(650px, calc(100vw - 32px)); }

/* Phone widths: nothing may push the page sideways. */
@media (max-width: 760px) {
  .api-ref .swagger-ui .information-container { padding: 2px 12px 6px; }
  .api-ref .swagger-ui .opblock .opblock-summary { flex-wrap: wrap; }
  .api-ref .swagger-ui .opblock .opblock-summary-path { flex: 1 1 100%; max-width: 100%; }
  .api-ref .swagger-ui .opblock .opblock-summary-description { flex-basis: 100%; padding: 4px 0 0; }
  .api-ref .swagger-ui .opblock-tag { flex-wrap: wrap; padding: 10px 6px; }
  .api-ref .swagger-ui .opblock-tag small { flex: 1 1 100%; padding: 4px 0 0; }
  .api-ref .swagger-ui .parameters { display: block; max-width: 100%; overflow-x: auto; }
  /* Responses stack: the code, then its description and examples at the full width, then
     its links, so nothing is squeezed into a narrow column. */
  .api-ref .swagger-ui .responses-table,
  .api-ref .swagger-ui .responses-table > tbody,
  .api-ref .swagger-ui .responses-table > tbody > tr,
  .api-ref .swagger-ui .responses-table > tbody > tr > td,
  .api-ref .swagger-ui .responses-table > tbody > tr > td.response-col_description { display: block; width: auto; max-width: 100%; min-width: 0; }
  .api-ref .swagger-ui .responses-table > thead { display: none; }
  .api-ref .swagger-ui .responses-table > tbody > tr > td.response-col_status { padding: 10px 0 0; font-weight: 600; }
  .api-ref .swagger-ui .responses-table > tbody > tr > td.response-col_links { padding: 4px 0 10px; color: var(--muted); }
  .api-ref .swagger-ui .response-col_description table.headers { display: block; max-width: 100%; overflow-x: auto; }
  .api-ref .swagger-ui .parameters-col_description input[type=text] { max-width: 100%; }
  .api-ref .swagger-ui .opblock-section-header { flex-wrap: wrap; gap: 6px; }
  .api-ref .swagger-ui section.models { margin: 16px 0; }
  .api-ref .swagger-ui .model-box { max-width: 100%; overflow-x: auto; }
}
