/* Open::API::UI - the whole stylesheet. Light and dark via CSS variables
   keyed off prefers-color-scheme; method badge colors follow Swagger UI
   conventions loosely. No external fonts, no images. */

:root {
  --bg: #fafafa;
  --fg: #1a1a1a;
  --muted: #666;
  --border: #d8d8d8;
  --panel: #ffffff;
  --panel-alt: #f2f2f2;
  --code-bg: #f0f0f0;
  --link: #1a6fb5;
  --get: #2f7bb5;
  --post: #3a9b62;
  --put: #c78a2b;
  --patch: #58b5a6;
  --delete: #c0504d;
  --head: #8a5db5;
  --options: #7a7a7a;
  --trace: #7a7a7a;
  --ok: #2f7d4f;
  --err: #b54040;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181c;
    --fg: #e4e4e4;
    --muted: #9a9a9a;
    --border: #34383f;
    --panel: #1e2126;
    --panel-alt: #262a30;
    --code-bg: #2a2e35;
    --link: #6ab0e8;
    --get: #4a9de0;
    --post: #4fbf7f;
    --put: #e0a94f;
    --patch: #6fd0c0;
    --delete: #e06a66;
    --head: #ab7fe0;
    --options: #9a9a9a;
    --trace: #9a9a9a;
    --ok: #4fbf7f;
    --err: #e06a66;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
  max-width: 60rem;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        Helvetica, Arial, sans-serif;
}

code, pre, textarea.oa-body-input, .oa-path {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.875em;
}

h1 { margin: 0 0 0.25rem; font-size: 1.6rem; }
h2 { margin: 2rem 0 0.5rem; font-size: 1.2rem;
     border-bottom: 1px solid var(--border); padding-bottom: 0.25rem; }
h3 { margin: 0.75rem 0 0.25rem; font-size: 1rem; }
h4 { margin: 0.75rem 0 0.25rem; font-size: 0.9rem; color: var(--muted);
     text-transform: uppercase; letter-spacing: 0.04em; }

a { color: var(--link); }

.oa-version {
  font-size: 0.7em;
  vertical-align: middle;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 0.1rem 0.6rem;
  color: var(--muted);
}

.oa-description { color: var(--muted); white-space: pre-line; margin: 0.25rem 0 0.75rem; }

/* server-rendered markdown (Markdown::Simple): real block elements, so no
   pre-line; plain-text descriptions built by app.js keep it */
.oa-md { white-space: normal; }
.oa-md p { margin: 0.25rem 0; }
.oa-md h1, .oa-md h2, .oa-md h3 { border: none; margin: 0.75rem 0 0.25rem; }
.oa-md code {
  background: var(--code-bg);
  padding: 0 0.25rem;
  border-radius: 0.2rem;
}
.oa-md pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  padding: 0.5rem 0.75rem;
  overflow: auto;
}
.oa-md pre code { background: none; padding: 0; }
.oa-md table { border-collapse: collapse; margin: 0.25rem 0; }
.oa-md th, .oa-md td {
  border: 1px solid var(--border);
  padding: 0.2rem 0.5rem;
  font-size: 0.875rem;
}
.oa-md blockquote {
  margin: 0.25rem 0;
  padding-left: 0.75rem;
  border-left: 3px solid var(--border);
}
.oa-op > .oa-description { padding: 0 0.75rem; }

/* ---- header controls ---------------------------------------------------- */

.oa-servers { margin: 0.75rem 0; }
.oa-servers label { margin-right: 0.5rem; color: var(--muted); }

.oa-authorize {
  margin: 0.75rem 0;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  background: var(--panel);
  padding: 0.5rem 0.75rem;
}
.oa-authorize > summary { cursor: pointer; font-weight: 600; }
.oa-scheme { margin: 0.75rem 0; }
.oa-scheme h3 { margin: 0 0 0.25rem; }
.oa-scheme-type { font-weight: 400; color: var(--muted); font-size: 0.85em; }
.oa-remember { display: block; margin-top: 0.5rem; color: var(--muted); font-size: 0.875rem; }
.oa-csrf { margin-top: 0.5rem; }

/* ---- operations --------------------------------------------------------- */

.oa-op {
  margin: 0.5rem 0;
  border: 1px solid var(--border);
  border-left: 4px solid var(--options);
  border-radius: 0.375rem;
  background: var(--panel);
}
.oa-op > summary {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  flex-wrap: wrap;
}
.oa-op > summary::-webkit-details-marker { display: none; }

.oa-method {
  min-width: 4.5rem;
  text-align: center;
  padding: 0.15rem 0.4rem;
  border-radius: 0.25rem;
  color: #fff;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  background: var(--options);
}
.m-get     { border-left-color: var(--get); }
.m-post    { border-left-color: var(--post); }
.m-put     { border-left-color: var(--put); }
.m-patch   { border-left-color: var(--patch); }
.m-delete  { border-left-color: var(--delete); }
.m-head    { border-left-color: var(--head); }
.m-get     .oa-method { background: var(--get); }
.m-post    .oa-method { background: var(--post); }
.m-put     .oa-method { background: var(--put); }
.m-patch   .oa-method { background: var(--patch); }
.m-delete  .oa-method { background: var(--delete); }
.m-head    .oa-method { background: var(--head); }

.oa-summary { color: var(--muted); flex: 1; }
.oa-deprecated .oa-path, .oa-deprecated .oa-summary { text-decoration: line-through; }
.oa-flag {
  color: var(--err);
  border: 1px solid var(--err);
  border-radius: 0.25rem;
  padding: 0 0.3rem;
  font-size: 0.75rem;
}

.oa-op-body { padding: 0.25rem 0.75rem 0.75rem; border-top: 1px solid var(--border); }

/* ---- tables ------------------------------------------------------------- */

table.oa-params { width: 100%; border-collapse: collapse; margin: 0.25rem 0 0.75rem; }
.oa-params th, .oa-params td {
  text-align: left;
  padding: 0.3rem 0.5rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  font-size: 0.875rem;
}
.oa-params th { color: var(--muted); font-weight: 600; }
.oa-required { color: var(--err); }
.oa-constraints { color: var(--muted); font-size: 0.8rem; }

/* ---- schemas ------------------------------------------------------------ */

.oa-schema { margin: 0.25rem 0 0.75rem; font-size: 0.875rem; }
.oa-schema ul { list-style: none; margin: 0; padding-left: 1.1rem;
                border-left: 1px dotted var(--border); }
.oa-schema > ul { padding-left: 0; border-left: none; }
.oa-schema li { margin: 0.1rem 0; }
.oa-prop-name { font-weight: 600; }
.oa-prop-type { color: var(--link); }
.oa-enum, .oa-fmt { color: var(--muted); }
.oa-ref-toggle {
  background: none; border: none; color: var(--link);
  cursor: pointer; padding: 0; font: inherit; text-decoration: underline;
}
.oa-cycle { color: var(--muted); font-style: italic; }

/* ---- try it out --------------------------------------------------------- */

.oa-try { margin-top: 0.5rem; }
button.oa-btn {
  background: var(--panel-alt);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  padding: 0.3rem 0.9rem;
  cursor: pointer;
  font: inherit;
  font-size: 0.875rem;
}
button.oa-btn:hover { border-color: var(--muted); }
button.oa-btn.oa-exec { background: var(--get); border-color: var(--get); color: #fff; }

.oa-try input[type="text"], .oa-try input[type="password"],
.oa-authorize input[type="text"], .oa-authorize input[type="password"] {
  width: 100%;
  max-width: 28rem;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-size: 0.875rem;
}
.oa-field { margin: 0.35rem 0; }
.oa-field label {
  display: inline-block;
  min-width: 8rem;
  font-size: 0.875rem;
  vertical-align: top;
}
.oa-field input[type="file"] { font-size: 0.875rem; }

textarea.oa-body-input {
  width: 100%;
  min-height: 8rem;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  background: var(--bg);
  color: var(--fg);
}
.oa-ct-select { margin: 0.25rem 0; }

.oa-response { margin-top: 0.75rem; }
.oa-status { font-weight: 700; }
.oa-status.ok { color: var(--ok); }
.oa-status.err { color: var(--err); }
.oa-elapsed { color: var(--muted); font-size: 0.8rem; margin-left: 0.5rem; }
pre.oa-pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  padding: 0.5rem 0.75rem;
  overflow: auto;
  max-height: 24rem;
  margin: 0.25rem 0 0.75rem;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---- misc --------------------------------------------------------------- */

section.oa-tag { margin-bottom: 1rem; }
.oa-note { color: var(--muted); font-size: 0.8rem; }
