/*
 * The API documentation (/docs/api/ and /docs/api/reference/), on top of the
 * landing page's stylesheet: the same tokens, header, footer, buttons and code
 * blocks, light and dark as the system is. Its own: the contents sidebar (a
 * menu above the page on narrow screens), the reading column, tables, notes
 * and the reference's method, scope and status badges. (MCP docs) The MCP
 * guide and tool reference use the same, with a few of their own at the end.
 */
:root {
  --docs-toc-w: 260px;
  --docs-text-w: 780px;
  --method-get: #1d4f9e;
  --method-post: #0b5e57;
  --method-put: #7f4c00;
  --method-patch: #5b3cb0;
  --method-delete: #a3243b;
}

@media (prefers-color-scheme: dark) {
  :root {
    --method-get: #9cc0ff;
    --method-post: #5eead4;
    --method-put: #f5c26b;
    --method-patch: #c9b5ff;
    --method-delete: #ff9fae;
  }
}

.docs .site-nav a[aria-current="page"] {
  color: var(--fg);
  background: var(--bg-hover);
}

.docs-layout {
  display: grid;
  grid-template-columns: var(--docs-toc-w) minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}

/* The contents: a sidebar that stays in view on wide screens. */

.docs-toc {
  position: sticky;
  top: 65px;
  max-height: calc(100vh - 65px);
  overflow-y: auto;
  padding: 28px 0 32px;
  font-size: var(--text-md);
}

.docs-toc summary {
  display: none;
}

.docs-toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.docs-toc ul ul {
  margin: 2px 0 8px 12px;
  padding-left: 10px;
  border-left: 1px solid var(--line);
}

.docs-toc a {
  display: block;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  color: var(--fg-muted);
  text-decoration: none;
  line-height: 1.4;
}

.docs-toc a:hover {
  color: var(--fg);
  background: var(--bg-hover);
}

.docs-toc a[aria-current="true"] {
  color: var(--accent-text);
  background: var(--accent-soft);
  font-weight: 600;
}

.docs-toc .method {
  min-width: 46px;
  margin-right: 4px;
}

/* The reading column */

.docs-main {
  min-width: 0;
  max-width: var(--docs-text-w);
  padding: 32px 0 72px;
}

.reference .docs-main {
  max-width: 980px;
}

.docs-main h1 {
  font-size: clamp(30px, 4vw, 40px);
  margin-bottom: 12px;
}

.docs-main h2 {
  font-size: clamp(24px, 3vw, 28px);
  margin: 56px 0 16px;
  padding-top: 8px;
}

.docs-main h3 {
  margin: 36px 0 12px;
}

.docs-main h4 {
  margin: 24px 0 8px;
  font-size: var(--text-lg);
}

.docs-main p,
.docs-main ul,
.docs-main ol,
.docs-main dl,
.docs-main .code,
.docs-main .table-scroll {
  margin: 0 0 16px;
}

.docs-main ul,
.docs-main ol {
  padding-left: 22px;
}

.docs-main li + li {
  margin-top: 6px;
}

.docs-main .lead {
  color: var(--fg-muted);
  font-size: var(--lead);
  margin-bottom: 8px;
}

.docs-main .steps li + li {
  margin-top: 10px;
}

.docs-main .code {
  position: relative;
}

.docs-main .code pre {
  white-space: pre;
}

.docs-main .code figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 40px;
  padding: 6px 8px 6px 16px;
}

.copy-button {
  flex: none;
  min-height: 28px;
  padding: 2px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  color: var(--fg);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.copy-button:hover {
  background: var(--bg-hover);
}

.copy-button:focus-visible,
.docs-toc summary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.note {
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  background: var(--bg-app);
}

.note-owner {
  border-left-color: var(--warning-fg);
  background: var(--warning-bg);
  color: var(--warning-fg);
}

.note-owner code {
  background: transparent;
  border: 1px solid currentColor;
}

.facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px 20px;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.facts dt {
  font-weight: 700;
}

.facts dd {
  margin: 0;
}

/* Tables scroll inside themselves; the page never scrolls sideways. */

.table-scroll {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.docs-main table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-md);
  line-height: 1.5;
}

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

.docs-main thead th {
  background: var(--bg-app);
  color: var(--fg);
  font-weight: 700;
  white-space: nowrap;
}

.docs-main tbody tr:last-child > * {
  border-bottom: 0;
}

.docs-main tbody th {
  font-weight: 600;
  white-space: nowrap;
}

.docs-main td code {
  white-space: nowrap;
}

.docs-main td p,
.docs-main td ul,
.docs-main td ol {
  margin: 0 0 6px;
}

.docs-main td > :last-child {
  margin-bottom: 0;
}

/* The reference */

.operation,
.schema {
  padding: 24px 0;
  border-top: 1px solid var(--line);
}

.operation h3,
.schema h3 {
  margin-top: 0;
}

.endpoint {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: var(--text-md);
}

.endpoint .path {
  font-size: var(--text-md);
  overflow-wrap: anywhere;
}

.operation-id {
  color: var(--fg-muted);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

.method {
  display: inline-block;
  min-width: 56px;
  padding: 1px 6px;
  border: 1px solid currentColor;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 700;
  text-align: center;
}

.method-get {
  color: var(--method-get);
}

.method-post {
  color: var(--method-post);
}

.method-put {
  color: var(--method-put);
}

.method-patch {
  color: var(--method-patch);
}

.method-delete {
  color: var(--method-delete);
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 2px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--fg-muted);
  font-size: var(--text-sm);
  font-weight: 600;
}

.badge code {
  background: none;
  padding: 0;
}

.badge-scope {
  border-color: var(--accent);
  color: var(--accent-text);
}

.badge-owner {
  border-color: var(--warning-fg);
  background: var(--warning-bg);
  color: var(--warning-fg);
}

.required {
  color: var(--danger);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
}

.content-type {
  color: var(--fg-muted);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 400;
}

.constraints {
  color: var(--fg-muted);
  font-size: var(--text-sm);
}

.responses dt {
  margin-top: 12px;
  font-weight: 600;
}

.responses dd {
  margin: 4px 0 0;
  padding-left: 16px;
  border-left: 2px solid var(--line);
}

.status {
  display: inline-block;
  min-width: 40px;
  font-family: var(--font-mono);
  font-weight: 700;
}

.status-2xx {
  color: var(--accent-text);
}

.status-4xx,
.status-5xx {
  color: var(--danger);
}

.owner-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  list-style: none;
  padding: 0 !important;
}

.owner-list li + li {
  margin-top: 0;
}

/* Narrower screens: the contents become a menu above the page. */

/* (MCP docs) The MCP guide (/docs/mcp/) and tool reference (/docs/mcp/reference/). */
.tool {
  padding: 24px 0;
  border-top: 1px solid var(--line);
}

.tool h3 {
  margin-top: 0;
}

.tool .endpoint .path {
  font-weight: 700;
}

.badge-hint {
  font-weight: 500;
}

.badge-destructive,
.badge-send {
  border-color: var(--warning-fg);
  background: var(--warning-bg);
  color: var(--warning-fg);
}

.form-note {
  color: var(--fg-muted);
  font-size: var(--text-sm);
}

.schema-json,
.result-fields {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.schema-json summary,
.result-fields summary {
  padding: 8px 12px;
  font-weight: 600;
  cursor: pointer;
}

.schema-json summary:focus-visible,
.result-fields summary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.schema-json pre {
  margin: 0;
  padding: 12px;
  overflow-x: auto;
  border-top: 1px solid var(--line);
  font-size: var(--text-sm);
}

.result-fields .table-scroll {
  margin: 0;
  border-top: 1px solid var(--line);
}

.instructions,
.prompt {
  margin: 16px 0;
  padding: 12px 16px;
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  background: var(--bg-app);
}

.prompt p {
  margin: 0;
  font-style: italic;
}

.status-pill {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 10px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: var(--text-sm);
  font-weight: 600;
  vertical-align: middle;
  white-space: nowrap;
}

.status-verified {
  color: var(--accent-text);
}

.status-unverified {
  color: var(--warning-fg);
  background: var(--warning-bg);
}

.note-warn {
  border-left-color: var(--warning-fg);
  background: var(--warning-bg);
  color: var(--warning-fg);
}

.docs-main .shot {
  margin: 24px 0;
}

.docs-main .shot img {
  width: 100%;
  max-width: 560px;
  height: auto;
}

.docs-main .shot-wide img {
  max-width: 100%;
}

.docs-main code.url {
  overflow-wrap: anywhere;
}

@media (max-width: 960px) {
  .docs-layout {
    display: block;
  }

  .docs-toc {
    position: static;
    max-height: none;
    overflow: visible;
    margin: 16px 0 0;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg-raised);
  }

  .docs-toc summary {
    display: block;
    padding: 10px 14px;
    font-weight: 600;
    cursor: pointer;
  }

  .docs-toc nav {
    max-height: 60vh;
    overflow-y: auto;
    padding: 0 8px 10px;
    border-top: 1px solid var(--line);
  }

  .docs-main {
    padding-top: 20px;
  }
}

@media (max-width: 720px) {
  .docs-main h2 {
    margin-top: 44px;
  }

  .facts {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .facts dd {
    margin-bottom: 8px;
  }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
