/* /platform/api/reference/ (itesthub/templates/core/platform_api_reference.html).
 *
 * Loaded AFTER css/industry/api-page.css and on a page that also carries
 * the `platform-api` body class, so the hero, section rhythm, sub-nav,
 * panels and code panels are literally the ones /platform/api/ uses. This
 * sheet only adds what a reference page needs and that page does not: the
 * endpoint blocks, the method badges, the field tables and the fact lines.
 *
 * Everything is built from the Industry design system's tokens
 * (itesthub/static/css/industry/styles.css). No new palette, no new fonts,
 * no external assets, no JavaScript.
 *
 * Light-only by design, per CLAUDE.md: public marketing pages do not carry
 * a dark-mode media query. The code panels are a deliberate dark surface
 * within a light page, exactly as on /platform/api/.
 *
 * Contrast: the method badges and status chips below are the only new
 * foreground/background pairs. Each is a step-100 ground under step-800
 * text from the same ramp -- the lightest of them (#eef6ff under #2c455d)
 * is 9.4:1, well past the 4.5:1 this page is held to.
 */

/* ── fact lines (version, base URL, spec) ───────────────────────────── */

.api-factline {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 38px;
  margin: 26px 0 0;
}

.api-factline > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.api-factline dt {
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-accent-700);
}

.api-factline dd {
  margin: 0;
  font-size: 15px;
}

.api-scheme .api-factline {
  margin: 14px 0 18px;
}

/* ── prose rendered out of the document's own descriptions ──────────── */

.platform-api .api-prose p {
  margin: 0 0 12px;
  max-width: 74ch;
}

.platform-api .api-prose > :last-child {
  margin-bottom: 0;
}

.api-prose ul {
  margin: 0 0 12px;
  padding-left: 20px;
  font-size: 15px;
  line-height: 1.7;
  max-width: 74ch;
}

.api-prose li + li {
  margin-top: 6px;
}

/* ── the endpoint index ─────────────────────────────────────────────── */

.api-endpoint-index {
  margin: 30px 0 8px;
  border: 1px solid var(--color-divider);
}

.api-endpoint-index ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.api-endpoint-index li + li {
  border-top: 1px solid var(--color-divider);
}

.api-endpoint-index a {
  display: grid;
  grid-template-columns: 74px minmax(0, 20rem) minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding: 12px 18px;
  text-decoration: none;
  color: var(--color-text);
}

.api-endpoint-index a:hover {
  background: var(--color-neutral-100);
}

.api-endpoint-index a:hover .api-endpoint-path {
  text-decoration: underline;
}

.api-endpoint-index-summary {
  font-size: 14px;
  color: color-mix(in srgb, var(--color-text) 78%, transparent);
}

/* ── one endpoint ───────────────────────────────────────────────────── */

.api-endpoint {
  padding: 40px 0 8px;
  border-top: 1px solid var(--color-divider);
  /* Clear of the sticky sub-nav when somebody jumps straight here, by
     keyboard or from the index above. */
  scroll-margin-top: 64px;
}

.platform-api .api-endpoint-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 0 0 8px;
  font-size: 22px;
}

.api-endpoint-path {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86em;
  word-break: break-word;
}

.platform-api .api-endpoint-summary {
  margin: 0;
  font-size: 17px;
  color: color-mix(in srgb, var(--color-text) 80%, transparent);
}

.api-endpoint-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  font-family: var(--font-heading);
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-accent-700);
}

.api-endpoint-body {
  margin-top: 26px;
}

/* The prose and the call sit side by side; everything below them --
   parameters, bodies, responses -- runs the full width of the page,
   because those are field tables and a four-column table squeezed into
   half a page is the whole reason a reference page is hard to read. */
.api-endpoint-lead {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 30rem);
  gap: 40px;
  align-items: start;
}

.api-endpoint-call {
  display: grid;
  gap: 10px;
}

.platform-api .api-endpoint-call .api-fineprint {
  margin: 0;
}

.api-endpoint-main > * + * {
  margin-top: 16px;
}

.platform-api .api-endpoint-main h4 {
  margin: 34px 0 10px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-accent-700);
}

.platform-api .api-response h5 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 8px;
  font-family: var(--font-heading);
  font-size: 16px;
}

.api-response + .api-response {
  margin-top: 26px;
}

/* ── method badges and status chips ─────────────────────────────────── */

.api-method,
.api-status {
  display: inline-block;
  padding: 3px 9px;
  border: 1px solid transparent;
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.25;
  white-space: nowrap;
}

.api-method--get,
.api-status {
  background: var(--color-accent-100);
  border-color: var(--color-accent-300);
  color: var(--color-accent-800);
}

.api-method--post {
  background: var(--color-accent-2-100);
  border-color: var(--color-accent-2-400);
  color: var(--color-accent-2-800);
}

/* Not red: an error RESPONSE is a documented outcome, not a fault, and a
   page of red chips reads as a list of things going wrong. */
.api-status--error {
  background: var(--color-neutral-200);
  border-color: var(--color-neutral-400);
  color: var(--color-neutral-900);
}

/* Stacked rather than side by side: both halves are tables, and half a
   page is not enough width for a table with a prose column in it. */
.api-error-blocks {
  display: grid;
  gap: 40px;
  margin-top: 32px;
}

/* ── field tables ───────────────────────────────────────────────────── */

.api-table-scroll {
  /* A table scrolls INSIDE itself. Wide content must never push the page
     body sideways, and these tables are the widest thing on the page. */
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--color-divider);
}

.api-table-scroll:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: -2px;
}

.api-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.6;
}

.api-table th,
.api-table td {
  padding: 9px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--color-divider);
}

.api-table thead th {
  background: var(--color-neutral-100);
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}

.api-table tbody tr:last-child th,
.api-table tbody tr:last-child td {
  border-bottom: 0;
}

.api-table tbody th {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  font-weight: 400;
  white-space: nowrap;
}

/* Table cells are already small; the inline-code chip inside one would
   otherwise shrink it again and add a second background. */
.platform-api .api-table :not(pre) > code {
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: 1em;
}

.api-cell-type {
  white-space: nowrap;
  color: color-mix(in srgb, var(--color-text) 78%, transparent);
}

.api-cell-required {
  white-space: nowrap;
  font-size: 13px;
}

.api-optional {
  color: color-mix(in srgb, var(--color-text) 72%, transparent);
}

.api-cell-notes {
  min-width: 22rem;
}

.platform-api .api-cell-notes p {
  margin: 0 0 6px;
  font-size: 14px;
  line-height: 1.6;
}

.platform-api .api-cell-notes > :last-child {
  margin-bottom: 0;
}

.platform-api .api-cell-notes ul {
  margin: 0 0 6px;
  padding-left: 18px;
  font-size: 14px;
}

.platform-api .api-enum {
  font-size: 13px;
  color: color-mix(in srgb, var(--color-text) 78%, transparent);
}

/* ── responsive ─────────────────────────────────────────────────────── */

@media (max-width: 1100px) {
  .api-endpoint-lead {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }
}

@media (max-width: 860px) {
  .api-endpoint-index a {
    grid-template-columns: 74px minmax(0, 1fr);
    row-gap: 4px;
  }

  .api-endpoint-index-summary {
    grid-column: 2;
  }
}

@media (max-width: 760px) {
  .api-endpoint {
    padding-top: 30px;
  }

  .api-cell-notes {
    min-width: 17rem;
  }
}
