/* API reference pages: the ::: endpoint / params / responses / request / response blocks
   (src/utils/Markdown.js) and the sidebar's method badges and sections. */
:root {
  --api-get: #15803d;
  --api-post: #2563eb;
  --api-put: #b45309;
  --api-patch: #7c3aed;
  --api-delete: #dc2626;
  --api-other: #555562;
}
:root[data-theme='dark'] {
  --api-get: #4ade80;
  --api-post: #6ea8ff;
  --api-put: #fbbf24;
  --api-patch: #c4a1ff;
  --api-delete: #f87171;
  --api-other: #a4a4b0;
}

/* ---------- Method badges (page and sidebar) ---------- */
.api-method,
.nav-method {
  --m: var(--api-other);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  min-width: 42px;
  height: 20px;
  padding: 0 6px;
  border-radius: 5px;
  background: color-mix(in srgb, var(--m) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--m) 22%, transparent);
  color: var(--m);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
}
.api-method-get { --m: var(--api-get); }
.api-method-post { --m: var(--api-post); }
.api-method-put { --m: var(--api-put); }
.api-method-patch { --m: var(--api-patch); }
.api-method-delete { --m: var(--api-delete); }

/* ---------- Sidebar: endpoint links and sections ---------- */
.nav-link.nav-endpoint {
  display: flex;
  align-items: center;
  gap: 9px;
}
.nav-link-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-endpoint .nav-method {
  min-width: 38px;
  height: 18px;
  font-size: 10px;
}
/* A category of endpoints reads as a section heading: small caps, no icon, children not indented. */
.nav-section {
  margin-top: 10px;
}
.nav-section > .nav-category {
  padding: 8px 8px 6px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.nav-section > .nav-category:hover {
  color: var(--text);
}
.nav-section > .nav-collapse .nav-children {
  margin: 2px 0 6px;
  padding-left: 0;
  border-left: 0;
}
.nav-section .nav-children .nav-link.active {
  box-shadow: none;
}
.nav-section + .nav-section {
  border-top: 1px solid var(--border);
  padding-top: 6px;
}

/* ---------- Page layout ---------- */
.docs-shell.api-page {
  max-width: 1720px;
}
.api-page .content-inner {
  max-width: 1360px;
}
.api-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
}
.api-samples {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}
@media (min-width: 1200px) {
  .api-page .api-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 48px;
    align-items: start;
  }
  .api-page .api-samples {
    position: sticky;
    top: calc(var(--header-h) + 24px);
    max-height: calc(100vh - var(--header-h) - 48px);
    overflow-y: auto;
    scrollbar-width: thin;
  }
}
.api-main > h1:first-child {
  margin-bottom: 10px;
}

/* ---------- Endpoint header ---------- */
.prose .api-endpoint {
  margin: 0 0 22px;
}
.prose .api-since {
  display: inline-flex;
  margin: 0 8px 14px 0;
  padding: 2px 9px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--bg-muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
  color: var(--text);
}
.prose .api-deprecated {
  border-color: color-mix(in srgb, var(--warning) 40%, transparent);
  background: var(--warning-bg);
  color: var(--warning);
}
.api-url {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border: 1px solid var(--code-border);
  border-radius: var(--radius-lg);
  background: var(--code-bg);
}
.api-url .api-method {
  height: 22px;
}
.prose .api-url-text {
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  font-size: 13.5px;
  color: var(--text);
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}
.api-var {
  color: var(--brand-text);
}
.api-url .api-copy {
  flex: none;
}
.prose .api-auth {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 12px 0 0;
  font-size: 13.5px;
  color: var(--text-muted);
}
.prose .api-auth::before {
  content: '';
  width: 13px;
  height: 13px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='11' width='18' height='11' rx='2'/%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='11' width='18' height='11' rx='2'/%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'/%3E%3C/svg%3E") center / contain no-repeat;
}
.prose .api-auth code {
  font-size: 12.5px;
}

/* ---------- Parameter and response sections ---------- */
.prose .api-section {
  margin: 28px 0 0;
}
.prose .api-section-title {
  margin: 0;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0;
}
.prose .api-fields,
.prose .api-statuses {
  margin: 0;
  padding: 0;
  list-style: none;
}
.prose .api-fields > li,
.prose .api-statuses > li {
  margin: 0;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.api-field-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}
.prose .api-field-name {
  padding: 0;
  border: 0;
  background: none;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
}
.api-field-type {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-muted);
}
.api-field-req,
.api-field-opt {
  font-size: 11.5px;
  font-weight: 600;
}
.api-field-req {
  color: var(--warning);
}
.api-field-opt {
  color: var(--text-subtle);
}
.api-field-desc {
  margin-top: 6px;
  font-size: 14.5px;
  color: var(--text);
}
.prose .api-statuses > li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
}
.api-status {
  --s: var(--api-other);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 24px;
  padding: 0 7px;
  border-radius: 5px;
  background: color-mix(in srgb, var(--s) 14%, transparent);
  color: var(--s);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
}
.api-status-2xx { --s: var(--api-get); }
.api-status-3xx { --s: var(--api-post); }
.api-status-4xx { --s: var(--api-put); }
.api-status-5xx { --s: var(--api-delete); }

/* ---------- Request / response panels ---------- */
/* Before the script runs (and in feeds/no-JS), samples show as labelled code blocks. */
.api-sample-label {
  margin: 0 0 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
}
.api-panel {
  border: 1px solid var(--code-border);
  border-radius: var(--radius-lg);
  background: var(--code-bg);
  overflow: hidden;
}
.api-panel-head {
  display: flex;
  align-items: stretch;
  gap: 4px;
  min-height: 42px;
  padding: 0 8px 0 14px;
  border-bottom: 1px solid var(--code-border);
}
.api-panel-title {
  display: flex;
  align-items: center;
  margin-right: 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-subtle);
}
.api-tabs {
  display: flex;
  flex: 1;
  min-width: 0;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}
.api-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 0;
  background: none;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-subtle);
  white-space: nowrap;
  transition: color var(--dur);
}
.api-tab:hover {
  color: var(--text);
}
.api-tab[aria-selected='true'] {
  color: var(--text);
  font-weight: 650;
}
.api-tab[aria-selected='true']::after {
  content: '';
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--brand);
}
.api-tab:focus-visible {
  outline: none;
  box-shadow: inset var(--focus);
  border-radius: var(--radius-sm);
}
.api-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--s, var(--api-other));
}
.api-panel-head .api-copy {
  align-self: center;
  width: 28px;
  padding: 0;
  justify-content: center;
}
.prose .api-panel pre {
  margin: 0;
  border: 0;
  border-radius: 0;
  background: none;
}
.prose .api-panel .api-status-line {
  margin: 0;
  padding: 12px 16px 0;
  font-size: 12.5px;
  color: var(--text-subtle);
}
.api-panel-note {
  padding: 12px 16px 0;
  font-size: 13.5px;
}
.api-panel-note > :last-child {
  margin-bottom: 0;
}
