/*
 * NSIN skin for Swagger UI.
 *
 * Swagger UI ships a fixed light theme: white panels, pastel method colours, a
 * bright "Servers" strip. Dropped onto the nsin docs site — near-black, cyan —
 * it reads as a broken page rather than a page in a different style, which is
 * exactly what it looked like before this file existed.
 *
 * Everything is expressed through the same tokens as the rest of the site
 * (src/styles/theme.css), so the two stay in step. Dark is the default because
 * the site is dark; the light block below is a real design, not an inversion.
 *
 * Loaded AFTER swagger-ui.css. Selectors are scoped under .swagger-ui and lean
 * on that specificity rather than !important wherever the cascade allows.
 */

:root {
  --nsw-bg: #0a0a0a;
  --nsw-surface: #0f151b;
  --nsw-raised: #161f28;
  --nsw-line: #232d38;
  --nsw-line-soft: #1a232c;
  --nsw-text: #e6edf3;
  --nsw-muted: #8b97a3;
  --nsw-accent: #22d3ee;
  --nsw-accent-dim: #0aa5c4;
  --nsw-accent-ink: #04252d;
  --nsw-code-bg: #131b23;

  /* HTTP methods. Saturation pulled down so five of them can sit on one
     page without the page becoming a paint chart. */
  --nsw-get: #2f9e6d;
  --nsw-post: #3b82f6;
  --nsw-put: #c08a2e;
  --nsw-patch: #9a6ee0;
  --nsw-delete: #d9534f;
}

:root[data-theme='light'] {
  --nsw-bg: #ffffff;
  --nsw-surface: #f7f9fb;
  --nsw-raised: #ffffff;
  --nsw-line: #dfe5ec;
  --nsw-line-soft: #eaeff4;
  --nsw-text: #1c252e;
  --nsw-muted: #637381;
  --nsw-accent: #0891b2;
  --nsw-accent-dim: #06748f;
  --nsw-accent-ink: #ffffff;
  --nsw-code-bg: #eef2f6;

  --nsw-get: #1f7a52;
  --nsw-post: #2563eb;
  --nsw-put: #9a6a15;
  --nsw-patch: #7c4dd0;
  --nsw-delete: #c0392b;
}

body { background: var(--nsw-bg); color: var(--nsw-text); }

.swagger-ui,
.swagger-ui .info .title,
.swagger-ui .opblock-tag,
.swagger-ui label,
.swagger-ui .tab li,
.swagger-ui .parameter__name,
.swagger-ui .parameter__type,
.swagger-ui table thead tr th,
.swagger-ui table thead tr td,
.swagger-ui .response-col_status,
.swagger-ui .response-col_links,
.swagger-ui .opblock .opblock-section-header h4,
.swagger-ui .opblock .opblock-section-header label,
.swagger-ui .opblock-description-wrapper p,
.swagger-ui .opblock-external-docs-wrapper p,
.swagger-ui .opblock-title_normal p,
.swagger-ui .model-title,
.swagger-ui .model {
  color: var(--nsw-text);
}

.swagger-ui .info li,
.swagger-ui .info p,
.swagger-ui .info table,
.swagger-ui .markdown p,
.swagger-ui .renderedMarkdown p,
.swagger-ui .opblock-tag small,
.swagger-ui .parameter__extension,
.swagger-ui .parameter__in,
.swagger-ui .response-col_description {
  color: var(--nsw-muted);
}

/* ---- links ---- */
.swagger-ui a,
.swagger-ui .info a,
.swagger-ui .info a:hover { color: var(--nsw-accent); }

/* ---- the introduction block ---- */
/* `.wrapper` is a class ON this element, not a child of it, and it is what
   supplies the horizontal padding. Setting `padding: 20px 0` here therefore
   does not just add vertical space, it REMOVES the indent — which left the
   title and the spec link flush against the window edge while every row below
   them stayed indented. Always restate the horizontal value. */
.swagger-ui .information-container {
  background: var(--nsw-surface);
  border-bottom: 1px solid var(--nsw-line);
  padding: 20px 20px 8px;
  max-width: none;
}
.swagger-ui .info { margin: 0; }
/* The page header already names the API. Keep the version and OAS badges,
   which it does not, but stop shouting. */
.swagger-ui .info .title { font-size: 22px; font-weight: 650; margin: 0 0 4px; }
.swagger-ui .info hgroup.main a { font-size: 12.5px; }
.swagger-ui .info .title small.version-stamp { background: var(--nsw-accent-dim); }
.swagger-ui .info .title small {
  background: var(--nsw-raised);
  border: 1px solid var(--nsw-line);
}
.swagger-ui .info .title small pre { color: var(--nsw-text); }

/* The full introduction is long. It is collapsed into a <details> by the page
   script; this styles the toggle so it reads as a control, not a stray line. */
.swagger-ui .nsin-intro > summary {
  cursor: pointer;
  color: var(--nsw-accent);
  font-size: 14px;
  padding: 8px 0;
  list-style: none;
}
.swagger-ui .nsin-intro > summary::-webkit-details-marker { display: none; }
.swagger-ui .nsin-intro > summary::before { content: '▸ '; }
.swagger-ui .nsin-intro[open] > summary::before { content: '▾ '; }
.swagger-ui .nsin-intro > summary:hover { color: var(--nsw-text); }

/* ---- the Servers strip (the white band that stood out most) ---- */
.swagger-ui .scheme-container {
  background: var(--nsw-surface);
  box-shadow: none;
  border-top: 1px solid var(--nsw-line);
  border-bottom: 1px solid var(--nsw-line);
  padding: 16px 0;
}
.swagger-ui .scheme-container .schemes-title { color: var(--nsw-muted); }

/* ---- form controls ---- */
.swagger-ui select,
.swagger-ui input[type='text'],
.swagger-ui input[type='password'],
.swagger-ui input[type='email'],
.swagger-ui input[type='search'],
.swagger-ui input[type='file'],
.swagger-ui textarea {
  background: var(--nsw-raised);
  color: var(--nsw-text);
  border: 1px solid var(--nsw-line);
  border-radius: 6px;
  box-shadow: none;
  outline-offset: 2px;
}
.swagger-ui select { background-image: none; }
.swagger-ui textarea { background: var(--nsw-code-bg); }
.swagger-ui input:focus-visible,
.swagger-ui select:focus-visible,
.swagger-ui textarea:focus-visible { outline: 2px solid var(--nsw-accent); }
.swagger-ui .filter .operation-filter-input {
  border: 1px solid var(--nsw-line);
  background: var(--nsw-raised);
}

/* ---- buttons ---- */
.swagger-ui .btn {
  color: var(--nsw-text);
  background: var(--nsw-raised);
  border-color: var(--nsw-line);
  border-radius: 6px;
  box-shadow: none;
}
.swagger-ui .btn:hover { border-color: var(--nsw-accent); }
.swagger-ui .btn.authorize,
.swagger-ui .btn.execute {
  background: var(--nsw-accent);
  color: var(--nsw-accent-ink);
  border-color: var(--nsw-accent);
  font-weight: 650;
}
.swagger-ui .btn.authorize svg,
.swagger-ui .btn.execute svg { fill: var(--nsw-accent-ink); }
.swagger-ui .btn.authorize:hover,
.swagger-ui .btn.execute:hover { background: var(--nsw-accent-dim); border-color: var(--nsw-accent-dim); }
.swagger-ui .btn.cancel { background: transparent; color: var(--nsw-delete); border-color: var(--nsw-delete); }

/* ---- tag sections ---- */
.swagger-ui .opblock-tag {
  border-bottom: 1px solid var(--nsw-line);
  color: var(--nsw-text);
  padding: 14px 20px;
}
.swagger-ui .opblock-tag:hover { background: var(--nsw-surface); }
.swagger-ui .opblock-tag small { color: var(--nsw-muted); font-weight: 400; }
.swagger-ui section.models { border-color: var(--nsw-line); background: var(--nsw-surface); }
.swagger-ui section.models .model-container { background: var(--nsw-raised); }
.swagger-ui section.models h4 { color: var(--nsw-text); }

/* ---- operations ---- */
.swagger-ui .opblock {
  background: var(--nsw-surface);
  border: 1px solid var(--nsw-line);
  border-radius: 8px;
  box-shadow: none;
  margin: 0 0 12px;
}
.swagger-ui .opblock .opblock-summary { border-color: var(--nsw-line); }
.swagger-ui .opblock .opblock-summary-description { color: var(--nsw-muted); }
.swagger-ui .opblock .opblock-summary-path,
.swagger-ui .opblock .opblock-summary-path__deprecated,
.swagger-ui .opblock .opblock-summary-operation-id { color: var(--nsw-text); }
.swagger-ui .opblock .opblock-summary-method {
  border-radius: 5px;
  text-shadow: none;
  font-weight: 700;
}

/* One accent per method, on a quiet tinted ground rather than a solid slab. */
.swagger-ui .opblock.opblock-get    { border-color: color-mix(in srgb, var(--nsw-get) 45%, var(--nsw-line)); }
.swagger-ui .opblock.opblock-post   { border-color: color-mix(in srgb, var(--nsw-post) 45%, var(--nsw-line)); }
.swagger-ui .opblock.opblock-put    { border-color: color-mix(in srgb, var(--nsw-put) 45%, var(--nsw-line)); }
.swagger-ui .opblock.opblock-patch  { border-color: color-mix(in srgb, var(--nsw-patch) 45%, var(--nsw-line)); }
.swagger-ui .opblock.opblock-delete { border-color: color-mix(in srgb, var(--nsw-delete) 45%, var(--nsw-line)); }
.swagger-ui .opblock.opblock-get .opblock-summary-method    { background: var(--nsw-get); }
.swagger-ui .opblock.opblock-post .opblock-summary-method   { background: var(--nsw-post); }
.swagger-ui .opblock.opblock-put .opblock-summary-method    { background: var(--nsw-put); }
.swagger-ui .opblock.opblock-patch .opblock-summary-method  { background: var(--nsw-patch); }
.swagger-ui .opblock.opblock-delete .opblock-summary-method { background: var(--nsw-delete); }
.swagger-ui .opblock.opblock-get .opblock-summary,
.swagger-ui .opblock.opblock-post .opblock-summary,
.swagger-ui .opblock.opblock-put .opblock-summary,
.swagger-ui .opblock.opblock-patch .opblock-summary,
.swagger-ui .opblock.opblock-delete .opblock-summary { border-color: var(--nsw-line); }
.swagger-ui .opblock.opblock-get,
.swagger-ui .opblock.opblock-post,
.swagger-ui .opblock.opblock-put,
.swagger-ui .opblock.opblock-patch,
.swagger-ui .opblock.opblock-delete { background: var(--nsw-surface); }

.swagger-ui .opblock .opblock-section-header {
  background: var(--nsw-raised);
  border-color: var(--nsw-line);
  box-shadow: none;
}

/* ---- tables ---- */
.swagger-ui table thead tr th,
.swagger-ui table thead tr td {
  border-bottom: 1px solid var(--nsw-line);
  color: var(--nsw-muted);
}
.swagger-ui table tbody tr td { border-bottom: 1px solid var(--nsw-line-soft); }
.swagger-ui .responses-inner { background: transparent; }
.swagger-ui .response-col_status { color: var(--nsw-text); }

/* ---- code, models, examples ---- */
.swagger-ui .highlight-code > .microlight,
.swagger-ui .model-example,
.swagger-ui pre,
.swagger-ui .body-param__example {
  background: var(--nsw-code-bg);
  color: var(--nsw-text);
  border-radius: 6px;
}
.swagger-ui .microlight code { color: var(--nsw-text); }
.swagger-ui .markdown code,
.swagger-ui .renderedMarkdown code {
  background: var(--nsw-code-bg);
  color: var(--nsw-accent);
  border-radius: 4px;
  padding: 1px 5px;
}
.swagger-ui .model-toggle:after { filter: invert(1) opacity(.6); }
:root[data-theme='light'] .swagger-ui .model-toggle:after { filter: none; }
.swagger-ui .prop-type { color: var(--nsw-accent); }
.swagger-ui .prop-format { color: var(--nsw-muted); }

/* ---- the Authorize dialog ---- */
.swagger-ui .dialog-ux .modal-ux {
  background: var(--nsw-surface);
  border: 1px solid var(--nsw-line);
  border-radius: 10px;
}
.swagger-ui .dialog-ux .modal-ux-header { border-bottom: 1px solid var(--nsw-line); }
.swagger-ui .dialog-ux .modal-ux-header h3,
.swagger-ui .dialog-ux .modal-ux-content h4,
.swagger-ui .dialog-ux .modal-ux-content p,
.swagger-ui .dialog-ux .modal-ux-content label { color: var(--nsw-text); }
.swagger-ui .dialog-ux .modal-ux-content table td { color: var(--nsw-muted); }
.swagger-ui .auth-container { border-color: var(--nsw-line); }
.swagger-ui .auth-btn-wrapper { justify-content: flex-start; }
.swagger-ui .dialog-ux .backdrop-ux { background: rgba(0, 0, 0, .72); }
.swagger-ui .close-modal svg { fill: var(--nsw-muted); }

/* ---- misc chrome ---- */
.swagger-ui .loading-container .loading:after { color: var(--nsw-muted); }
.swagger-ui .expand-methods svg,
.swagger-ui .expand-operation svg,
.swagger-ui .arrow { fill: var(--nsw-muted); }
.swagger-ui .copy-to-clipboard { background: var(--nsw-raised); border-radius: 5px; }
.swagger-ui .copy-to-clipboard button { background: var(--nsw-muted); }
.swagger-ui .tab li button.tablinks { color: var(--nsw-muted); }
.swagger-ui .tab li.active button.tablinks { color: var(--nsw-text); }
.swagger-ui .parameter__name.required:after { color: var(--nsw-delete); }
.swagger-ui .opblock-deprecated { opacity: .7; }

/* Wide tables and long paths must scroll inside the block, never the page. */
.swagger-ui .opblock-body,
.swagger-ui .responses-wrapper { overflow-x: auto; }
