/* AgentGate — API documentation (/docs). Builds on site.css. */

/* ── Page body ─────────────────────────────────────────────────────────────── */

/* The hero leaves room below itself; the document starts right under it. */
.docs-body {
  padding-top: clamp(4px, 1.4vw, 20px);
}

/* ── Contents rail ─────────────────────────────────────────────────────────── */

/* Nineteen entries have to fit a laptop screen without scrolling the rail. */
.docs .doc-toc {
  font-size: 0.8125rem;
}

.docs .doc-toc a {
  padding: 5px 10px;
  line-height: 1.35;
}

.docs .doc-toc .toc-gap {
  margin-top: 10px;
}

/* The same list for small screens, where site.css hides the rail. */
.docs-jump {
  display: none;
}

.docs .prose > .docs-jump + section {
  margin-top: 0;
}

/* ── Article ───────────────────────────────────────────────────────────────── */

/* Code and tables use the whole column; running text keeps a readable measure. */
.docs .prose {
  max-width: none;
  min-width: 0;
}

.docs .prose p,
.docs .prose li,
.docs .prose dd {
  max-width: 74ch;
}

/* Each part of the reference is a <section>, so the flow rules of .prose are
   repeated one level down. */
.docs .prose > section > * + * {
  margin-top: 1.05em;
}

.docs .prose > section + section {
  margin-top: clamp(44px, 6vw, 68px);
  padding-top: clamp(40px, 5vw, 56px);
  border-top: 1px solid var(--line);
}

/* html already offsets anchors by the height of the navigation. */
.docs .prose h2,
.docs .prose h3 {
  scroll-margin-top: 0;
}

.docs .prose h2 {
  margin-top: 0;
}

.docs .prose > section > h3 {
  margin-top: 2.1em;
}

.docs .prose h3 .tag {
  margin-left: 8px;
  vertical-align: 0.2em;
}

/* Quickstart step numbers */
.docs .step-n {
  display: inline-grid;
  place-items: center;
  width: 1.7em;
  height: 1.7em;
  margin-right: 0.45em;
  border: 1px solid var(--line-2);
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 0.72em;
  font-weight: 500;
  color: var(--ink-2);
  vertical-align: 0.12em;
}

/* ── Endpoint line ─────────────────────────────────────────────────────────── */

.docs .prose .endpoint {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  max-width: none;
  padding: 10px 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  background: var(--panel);
  font-family: var(--font-mono);
  font-size: 0.875rem;
}

.docs .endpoint code {
  padding: 0;
  border: 0;
  background: none;
  font-size: 1em;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.docs .endpoint-method {
  font-size: 0.71875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--ink-3);
}

.docs .endpoint-meta {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--ink-3);
}

/* ── Code ──────────────────────────────────────────────────────────────────── */

/* .prose styles a bare <pre> as a box; inside .code the box is already there. */
.docs .prose .code pre {
  padding: 16px 18px;
  border: 0;
  border-radius: 0;
  background: none;
}

/* A request and its response read as one unit. */
.docs .prose > section > .code + .code {
  margin-top: 10px;
}

.docs .code-tabs {
  display: flex;
  gap: 4px;
}

/* The bar is 46px tall and its buttons 31px: give them the whole height to tap. */
.docs .code-tab,
.docs .code-copy {
  position: relative;
}

.docs .code-tab::after,
.docs .code-copy::after {
  content: "";
  position: absolute;
  inset: -6px -2px;
}

/* Without scripts the tabs cannot switch, so show every pane. */
.no-js .docs .code pre[hidden] {
  display: block !important;
  border-top: 1px solid var(--line);
}

.no-js .docs .code-tabs,
.no-js .docs .code-copy {
  display: none;
}

/* ── Tables ────────────────────────────────────────────────────────────────── */

/* .prose turns a table into a scrolling block with boxed cells. Here the
   wrapper scrolls and the table stays a table, with hairlines between rows. */
.docs .prose .table-wrap {
  border-radius: var(--r);
}

.docs .prose .table {
  display: table;
  width: 100%;
  font-size: 0.875rem;
  overflow: visible;
}

.docs .prose .table th,
.docs .prose .table td {
  padding: 11px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
}

.docs .prose .table tbody tr:last-child td {
  border-bottom: 0;
}

.docs .prose .table th {
  background: color-mix(in srgb, var(--panel-2) 60%, transparent);
  font-weight: 500;
  color: var(--ink-3);
}

/* Field and endpoint names in the first column are never broken mid-word. */
.docs .table td:first-child code {
  white-space: nowrap;
  word-break: normal;
}

/* Tables that need room keep their shape and scroll inside the wrapper. */
.docs .prose .table.t-wide {
  min-width: 40rem;
}

/* a field name in a column heading keeps its own letter case */
.docs .table th code {
  text-transform: none;
  letter-spacing: 0;
}

.docs .verdict-table td:first-child {
  white-space: nowrap;
}

.docs .req {
  display: inline-block;
  margin-left: 8px;
  font-family: var(--font-mono);
  font-size: 0.65625rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ── Notes, term rows, cards ───────────────────────────────────────────────── */

.docs .prose .note {
  max-width: 82ch;
}

.docs .prose .note > * {
  min-width: 0;
  max-width: none;
}

/* Term + explanation rows (how each receipt value is computed). */
.docs .calc {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  border-top: 1px solid var(--line);
}

.docs .calc > div {
  display: grid;
  grid-template-columns: minmax(0, 12.5rem) minmax(0, 1fr);
  gap: 4px 24px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.docs .calc dt {
  color: var(--ink);
}

.docs .calc dd {
  max-width: none;
  font-size: 0.9375rem;
}

.docs .proof .card {
  padding: 18px 20px;
  border-radius: var(--r);
}

.docs .proof .card ul {
  margin-top: 10px;
  padding-left: 1.15em;
  font-size: 0.9375rem;
}

/* ── Small screens ─────────────────────────────────────────────────────────── */

@media (max-width: 1020px) {
  .docs-jump {
    display: block;
    border: 1px solid var(--line-2);
    border-radius: var(--r);
    background: var(--panel);
  }

  .docs .prose > .docs-jump + section {
    margin-top: 32px;
  }

  .docs-jump summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 48px;
    padding: 0 16px;
    cursor: pointer;
    list-style: none;
    font-family: var(--font-mono);
    font-size: 0.71875rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-2);
  }

  .docs-jump summary::-webkit-details-marker {
    display: none;
  }

  .docs-jump summary::after {
    content: "";
    flex: none;
    width: 9px;
    height: 9px;
    border-right: 1.6px solid var(--ink-3);
    border-bottom: 1.6px solid var(--ink-3);
    transform: rotate(45deg) translate(-2px, -2px);
    transition: transform 0.25s var(--ease);
  }

  .docs-jump[open] summary::after {
    transform: rotate(225deg) translate(-2px, -2px);
  }

  .docs-jump nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 20px;
    padding: 2px 16px 10px;
    border-top: 1px solid var(--line);
  }

  .docs .docs-jump a {
    display: flex;
    align-items: center;
    min-height: 44px;
    font-size: 0.9375rem;
    color: var(--ink-2);
    text-decoration: none;
  }

  .docs .docs-jump a:hover {
    color: var(--ink);
  }
}

@media (max-width: 760px) {
  .docs .calc > div {
    grid-template-columns: minmax(0, 1fr);
  }

  .docs .endpoint-meta {
    margin-left: 0;
    flex-basis: 100%;
  }
}

@media (max-width: 340px) {
  .docs-jump nav {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ── Print ─────────────────────────────────────────────────────────────────── */

@media print {
  .docs-jump,
  .code-copy,
  .code-tabs {
    display: none !important;
  }

  .docs .code pre[hidden] {
    display: block !important;
  }

  .docs .code pre {
    white-space: pre-wrap;
    overflow: visible;
  }

  .docs .prose .table.t-wide {
    min-width: 0;
  }
}
