.api-docs {
  --api-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  padding-top: calc(var(--header-height) + env(safe-area-inset-top));
}

.api-docs .page-back { padding-inline: 12px; }

.api-wrap {
  width: min(920px, 100%);
  margin-inline: auto;
  padding: clamp(28px, 5vw, 56px) clamp(20px, 4vw, 40px) 64px;
}

.api-heading h1 {
  font-size: clamp(26px, 4vw, 42px);
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -.025em;
}

.api-content {
  color: var(--body);
  font-size: 15px;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

.api-links {
  display: flex;
  flex-wrap: wrap;
  column-gap: clamp(16px, 4vw, 32px);
  margin-block: 16px 24px;
  border-block: 1px solid var(--line);
}

.api-links a {
  display: flex;
  align-items: center;
  min-height: 44px;
  color: var(--ice);
  font-size: 14px;
}

.api-links a:hover { text-decoration: underline; text-underline-offset: .25em; }

.api-content section, .api-content h3 { scroll-margin-top: env(safe-area-inset-top); }
.api-content section + section {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.api-content h2, .api-content h3, .api-content h4 {
  color: var(--text);
  font-weight: 500;
  line-height: 1.4;
}

.api-content h2 { margin-bottom: 10px; font-size: clamp(21px, 3vw, 26px); }
.api-content h3 { margin-block: 24px 8px; font-size: clamp(18px, 2.5vw, 20px); }
#endpoints > h3:first-of-type { margin-top: 0; }
.api-content h4 { margin-block: 18px 6px; font-size: 15px; }
.api-content p + p { margin-top: 8px; }
.api-content ol { padding-left: 1.4em; }
.api-content li + li { margin-top: 4px; }

.api-content table {
  width: 100%;
  margin-block: 10px 14px;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.55;
}

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

.api-content th { color: var(--text); background: var(--surface); font-weight: 500; }
.api-content code { color: var(--ice); font-family: var(--api-mono); font-size: .93em; }
.api-content pre {
  margin: 8px 0 14px;
  padding: 12px 14px;
  border-radius: 4px;
  background: var(--surface);
  font: 13px/1.65 var(--api-mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.api-content pre code { font-size: inherit; }

@media (max-width: 480px) {
  .api-wrap > .api-links { justify-content: space-between; column-gap: 4px; }
  .api-links a { font-size: 13px; }
  .api-content table { font-size: 13px; }
  .api-content th, .api-content td { padding-inline: 6px; }
}
