/* API documentation page: builds on the legal layout in pages.css. */

/* No hero: the content starts right below the fixed navigation. */
.docs-body {
  padding-top: calc(var(--header-h) + clamp(2.5rem, 5vw, 4rem));
}

.docs-document {
  /* A grid item: without this, long code lines widen the column past small screens. */
  min-width: 0;
  max-width: 50rem;
}

.docs-document h3 {
  margin: 2.25rem 0 0.85rem;
  color: var(--fg);
  font-family: 'Geist', var(--font);
  font-size: 1.0625rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.docs-document ol {
  margin: 1.25rem 0;
  padding-left: 1.25rem;
}

.docs-document ol li + li {
  margin-top: 0.65rem;
}

.docs-document strong {
  color: var(--fg);
  font-weight: 500;
}

.docs-document :not(pre) > code {
  padding: 0.1em 0.35em;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 0.8125rem;
  overflow-wrap: anywhere;
}

/* tables */
.doc-table {
  margin: 1.25rem 0 1.5rem;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.doc-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  line-height: 1.55;
}

.doc-table th,
.doc-table td {
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.doc-table th {
  color: var(--fg);
  font-weight: 500;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.03);
}

.doc-table td {
  color: var(--muted);
}

.doc-table tr:last-child td {
  border-bottom: 0;
}

.doc-table td:first-child {
  color: var(--fg);
  white-space: nowrap;
}

/* code samples: tab and copy behaviour comes from js/ui.js ([data-tabs]) */
.doc-code {
  margin: 1.25rem 0 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
}

.doc-code .code-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.doc-code .code-tabs {
  display: flex;
  gap: 2px;
  padding: 0.4rem;
}

.doc-code .code-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
}

.doc-code .code-tab[aria-selected='true'] {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.doc-code .copy-code {
  border: 0;
  background: none;
  padding: 0.7rem;
  color: var(--muted);
  font-size: 0.75rem;
  cursor: pointer;
  white-space: nowrap;
}

.doc-code .copy-code:hover {
  color: var(--fg);
}

.doc-code pre {
  margin: 0;
  padding: 1.1rem 1.25rem;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: #2a3c45 transparent;
  color: rgba(250, 250, 250, 0.9);
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.65;
}

/* model cards: one per model series, at the end of the text, image and video sections */
.docs-toc {
  max-height: calc(100vh - 9rem);
  overflow-y: auto;
  scrollbar-width: thin;
}

.docs-toc ol ol {
  margin: 0.5rem 0 0.25rem;
  padding-left: 0.75rem;
}

.docs-toc ol ol li + li {
  margin-top: 0.35rem;
}

.docs-toc ol ol a {
  font-size: 0.78rem;
}

.model-doc {
  scroll-margin-top: 7rem;
  margin-top: 3rem;
  padding-top: 3rem;
  border-top: 1px dashed var(--line);
}

.model-doc h3 {
  margin-top: 0;
  font-size: 1.25rem;
}

.docs-document h4 {
  margin: 1.75rem 0 0;
  color: var(--fg);
  font-size: 0.875rem;
  font-weight: 500;
}

.model-doc__endpoint {
  margin-bottom: 0;
}

.model-doc tr {
  scroll-margin-top: 7rem;
}

/* Keep the description column readable next to long parameter names. */
.doc-table--fields th:nth-child(1) {
  width: 27%;
}

.doc-table--fields th:nth-child(2) {
  width: 13%;
}

.doc-table--fields th:nth-child(3) {
  width: 19%;
}

/* Several parameter names can share a row: wrap between names, never inside one. */
.model-doc .doc-table td:first-child {
  white-space: normal;
}

.doc-table--fields td:not(:last-child) code,
.model-doc .doc-table td:first-child code {
  white-space: nowrap;
  overflow-wrap: normal;
}

.model-doc tr:target td {
  background: rgba(94, 234, 212, 0.08);
}

@media (max-width: 760px) {
  .doc-table td:first-child {
    white-space: normal;
  }

  .docs-toc {
    max-height: none;
  }

  /* On phones the contents list stays short: kinds only. */
  .docs-toc ol ol {
    display: none;
  }
}
