/* API reference page. Builds on the tokens and shell in styles.css. */
.docs .topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--color-surface);
}
.docs-shell {
  align-items: start;
}
.docs-sidebar {
  position: sticky;
  top: 88px;
  max-height: calc(100vh - 88px);
  overflow-y: auto;
  gap: 0;
}
.operation,
.tag-block {
  scroll-margin-top: 104px;
}
.op-head .status-pill {
  text-transform: none;
}
.docs-filter {
  margin: 0 0 12px;
  min-height: 36px !important;
  padding: 0 10px !important;
  font-size: var(--text-13) !important;
}
.toc-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 16px;
}
.toc-label {
  padding: 8px 10px;
}
.toc-item {
  padding: 6px 10px;
  font-size: var(--text-13);
}
.toc-item .method {
  width: 44px;
  text-align: left;
}
.docs-content {
  max-width: 880px;
}
.docs-intro {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--color-border);
}
.docs-intro .lede {
  max-width: 640px;
}

/* Prose from markdown in the spec */
.prose {
  display: flex;
  flex-direction: column;
  gap: 12px;
  color: var(--color-muted);
  font-size: var(--text-14);
  line-height: var(--leading-22);
  max-width: 680px;
}
.prose h3 {
  margin-top: 12px;
  color: var(--color-ink);
}
.prose h4 {
  margin: 8px 0 0;
  font-size: var(--text-14);
  font-weight: 500;
  color: var(--color-ink);
}
.prose ul {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.prose a {
  color: var(--color-ink);
  text-decoration: underline;
  text-decoration-color: var(--color-border);
  text-underline-offset: 4px;
}
.prose a:hover {
  text-decoration-color: var(--color-ink);
}
.prose code,
.props code,
.route,
.example code {
  font-family: var(--font-mono);
  font-size: var(--text-13);
}
.prose code {
  padding: 1px 5px;
  border-radius: var(--radius-4);
  background: var(--color-subtle);
  color: var(--color-ink);
}

/* Tag sections and operations */
.tag-block {
  padding-top: 48px;
}
.tag-block > .label {
  margin-bottom: 8px;
}
.tag-block > h2 {
  font-size: var(--text-28);
  line-height: var(--leading-32);
  margin-bottom: 12px;
}
.operation {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 32px 0;
  border-top: 1px solid var(--color-border);
}
.tag-block .operation:first-of-type {
  margin-top: 24px;
}
.op-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.endpoint {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.route {
  padding: 8px 12px;
  border-radius: var(--radius-8);
  background: var(--color-subtle);
  color: var(--color-ink);
  overflow-wrap: anywhere;
}
.route em {
  font-style: normal;
  color: var(--color-accent-text);
}
.method {
  display: inline-block;
  min-width: 40px;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: var(--leading-16);
  letter-spacing: 0.04em;
  font-weight: 500;
}
.method-get { color: var(--color-success); }
.method-post { color: var(--color-accent-text); }
.method-put { color: #7c5cbf; }
.method-delete { color: var(--color-error); }
.op-title {
  font-size: var(--text-20);
  line-height: var(--leading-28);
  letter-spacing: var(--tracking-title);
}
.op-section {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: var(--text-12);
  line-height: var(--leading-16);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  font-weight: 400;
  color: var(--color-muted);
}
.content-type {
  font-family: var(--font-mono);
  font-size: var(--text-12);
  letter-spacing: 0;
  text-transform: none;
  padding: 2px 6px;
  border-radius: var(--radius-4);
  background: var(--color-subtle);
  color: var(--color-muted);
}
.prop-required,
.prop-in {
  margin-left: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.prop-required { color: var(--color-accent-text); }
.prop-in { color: var(--color-muted); }

/* Property tables */
.props {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-13);
  line-height: var(--leading-20);
}
.props td {
  padding: 10px 12px 10px 0;
  border-top: 1px solid var(--color-border);
  vertical-align: top;
}
.props tr:first-child td {
  border-top: 0;
}
.prop-name {
  width: 200px;
  white-space: nowrap;
}
.prop-type {
  width: 180px;
  color: var(--color-muted);
  font-family: var(--font-mono);
  font-size: var(--text-12);
}
.prop-limits {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--color-muted);
  opacity: 0.8;
  overflow-wrap: anywhere;
}
.prop-desc {
  color: var(--color-muted);
}
.prop-desc .schema {
  margin-top: 8px;
  padding-left: 12px;
  border-left: 2px solid var(--color-border);
}
.schema {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.schema-ref {
  align-self: flex-start;
  font-family: var(--font-mono);
  font-size: var(--text-12);
  color: var(--color-accent-text);
  text-decoration: underline;
  text-decoration-color: var(--color-border);
  text-underline-offset: 4px;
}
.schema-note,
.schema-scalar {
  font-size: var(--text-13);
  line-height: var(--leading-20);
  color: var(--color-muted);
}
.schema-scalar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
}
.schema-variants {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.schema-variant {
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-8);
}
.example {
  margin: 0;
  padding: 14px 16px;
  border-radius: var(--radius-8);
  background: var(--color-ink);
  color: #f4f3f2;
  overflow-x: auto;
  font-size: var(--text-12);
  line-height: var(--leading-18);
}
.example code {
  font-size: var(--text-12);
  color: inherit;
}

/* Responses */
.response {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid var(--color-border);
  font-size: var(--text-13);
  color: var(--color-muted);
}
.response-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  line-height: var(--leading-20);
}
.status-code {
  font-family: var(--font-mono);
  font-size: var(--text-12);
  padding: 2px 8px;
  border-radius: var(--radius-999);
  background: var(--color-subtle);
  color: var(--color-ink);
}
.status-2xx { background: var(--color-success-soft); color: var(--color-success); }
.status-4xx { background: var(--color-accent-soft); color: var(--color-accent-text); }
.status-5xx { background: var(--color-error-soft); color: var(--color-error); }

@media (max-width: 1024px) {
  .docs-sidebar {
    position: static;
    max-height: none;
  }
  .docs-sidebar .side-list {
    flex-direction: column;
  }
  .toc-group {
    flex-direction: column;
  }
  .side-list .toc-item {
    border: 0;
    border-radius: var(--radius-6);
  }
}
@media (max-width: 640px) {
  .prop-name,
  .prop-type {
    width: auto;
  }
  .props,
  .props tbody,
  .props tr,
  .props td {
    display: block;
    padding: 4px 0;
  }
  .props tr {
    padding: 10px 0;
    border-top: 1px solid var(--color-border);
  }
  .props td {
    border: 0;
  }
}
@media (max-width: 640px) {
  .docs .topbar {
    position: static;
  }
  .docs-sidebar {
    position: static;
    max-height: none;
  }
}
.docs-content {
  min-width: 0;
}
@media (max-width: 1024px) {
  .docs-shell {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 640px) {
  .prop-name {
    white-space: normal;
  }
  .endpoint {
    flex-wrap: wrap;
  }
}
/* Flex children default to min-width auto, which lets a wide example push the page out. */
.operation > *,
.response > *,
.schema > * {
  min-width: 0;
  max-width: 100%;
}
.response-text {
  min-width: 0;
}
.status-code {
  flex-shrink: 0;
}
