/* API reference page only (site/pages/api-reference.html), task M-API. Linked after site.css and pages.css; it is not part of
   the generator's precache. Transcribed from the ApiReference boards value for value; tokens only, no colour is invented.
   Board names: ink --color-text, muted --color-text-muted, surface --color-surface, line --color-line, bg --color-bg.
   The board's container queries on the page wrapper are viewport media queries here (the wrapper is the full page width):
   1024px sticky contents, 721 to 1023 tablet, 720 and below phone (D32, D33, A14). */

/* — the page: the head is a chip and the h1, then the mono line and the lede (the section), then the layout — */
.page--api-reference { gap: 0; padding-block: clamp(48px, 7vw, 96px) clamp(64px, 8vw, 112px); }
.page--api-reference .page-head { max-width: 760px; gap: 16px; padding-top: 0; margin-block-end: 16px; align-items: stretch; }
.page--api-reference .page-head .eyebrow {
  align-self: flex-start; padding: 8px 14px; border-radius: var(--radius-pill); background: var(--color-text); color: var(--color-bg);
  font-family: var(--font-body); font-size: 13px; font-weight: var(--weight-semibold); line-height: normal; letter-spacing: normal; text-transform: none;
}
.page--api-reference .page-head h1 { margin-block-start: 8px; }

.api-intro { display: flex; flex-direction: column; gap: 16px; max-width: 760px; margin-block-end: 40px; }
.api-meta { margin: 0; font-family: var(--font-mono); font-size: 12.5px; line-height: normal; color: var(--color-text-muted); }
.api-lede { margin: 0; font-size: 17px; line-height: 1.55; color: var(--color-text-muted); }

/* — layout: contents beside the text; the text spans two of the auto-fit columns — */
.api-layout { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 48px; align-items: start; }
.api-main { grid-column: span 2; max-width: 760px; display: flex; flex-direction: column; gap: 44px; }

/* — On this page: a card (tablet and up), a disclosure on a phone — */
.api-toc {
  display: flex; flex-direction: column; gap: 2px; padding: 18px 20px; border-radius: 18px;
  background: var(--color-surface); border: 1px solid var(--color-line);
}
.api-toc__title { margin-bottom: 6px; font-size: 12px; line-height: normal; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-text-muted); }
.api-toc a { display: flex; align-items: center; min-height: 36px; font-size: 14.5px; line-height: normal; color: var(--color-text-muted); text-decoration: none; }
.api-toc a:hover, .api-toc a[aria-current="true"] { color: var(--color-text); text-decoration: none; }
.api-toc a[aria-current="true"] { font-weight: var(--weight-semibold); box-shadow: inset 2px 0 0 var(--color-text); padding-left: 10px; margin-left: -10px; }

.api-toc-d { display: none; border: 1px solid var(--color-line); border-radius: var(--radius-well); background: var(--color-surface); }
.api-toc-d summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 0 16px;
  font-size: 14.5px; font-weight: var(--weight-semibold); line-height: normal; cursor: pointer; list-style: none;
}
.api-toc-d summary::-webkit-details-marker { display: none; }
.api-toc-d summary .icon { flex: none; width: 18px; height: 18px; }
.api-toc-d[open] summary .icon { transform: rotate(180deg); }
.api-toc-d nav { display: flex; flex-direction: column; padding: 0 16px 10px; }
.api-toc-d nav a {
  display: flex; align-items: center; box-sizing: content-box; min-height: 44px; font-size: 14.5px; line-height: normal; text-decoration: none;
  color: var(--color-text-muted); border-top: 1px solid var(--color-line);
}
.api-toc-d nav a:hover { color: var(--color-text); text-decoration: none; }
.api-toc-d nav a[aria-current="true"] { color: var(--color-text); font-weight: var(--weight-semibold); }

/* — an endpoint's article — */
/* The board's anchors land 92px from the top, under the sticky header. The page already scrolls with `scroll-padding` for the
   header (site-header.css), and the two add up, so this is the rest of the 92px. */
.api-block { display: flex; flex-direction: column; gap: 14px; scroll-margin-top: calc(92px - var(--site-header-h) - var(--space-4)); }
/* Beats pages.css's `.page h2:not(.eyebrow):not(.section-title)`. */
.page.page--api-reference .api-block h2:not(.eyebrow):not(.section-title) {
  margin: 0; font-family: var(--font-heading); font-weight: var(--weight-bold); font-size: 28px; letter-spacing: -0.02em; line-height: 1.1;
}
.api-block p { margin: 0 0 14px; line-height: 1.65; font-size: 16.5px; color: var(--color-text-muted); }
.api-block p:last-child { margin: 0; }
.api-block code { font-family: var(--font-mono); font-size: 0.92em; }
.api-sub { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }

.api-ep { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.api-method {
  display: inline-flex; align-items: center; min-height: 26px; padding: 0 10px; border-radius: var(--radius-pill);
  background: var(--color-text); color: var(--color-bg); font-family: var(--font-mono); font-size: 12.5px; font-weight: var(--weight-medium); letter-spacing: 0.04em; line-height: normal;
}
.api-path { font-family: var(--font-mono); font-size: 16px; line-height: normal; color: var(--color-text); overflow-wrap: anywhere; min-width: 0; }

/* — a note: the status in mono, then the words — */
.api-note {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius-box);
  background: var(--color-surface); border: 1px solid var(--color-line); font-size: 15px; line-height: 1.55; color: var(--color-text-muted);
}
.api-note__status { flex: none; padding-top: 2px; font-family: var(--font-mono); font-size: 12.5px; font-weight: var(--weight-medium); color: var(--color-text); }

/* — tables: fields (Name, Type, Notes), status (Status, Meaning), errors (Status, Code, Meaning) — */
.api-table { overflow-x: auto; border: 1px solid var(--color-line); border-radius: var(--radius-well); background: var(--color-surface); }
.api-table table { border-collapse: collapse; width: 100%; }
.api-table th, .api-table td {
  text-align: left; vertical-align: top; padding: 14px 16px; border-bottom: 1px solid var(--color-line);
  font-size: 14.5px; line-height: 1.45; overflow-wrap: break-word;
}
.api-table th { font-weight: var(--weight-semibold); }
.api-table tbody tr:last-child th, .api-table tbody tr:last-child td { border-bottom: 0; }
.api-table .api-table__key, .api-table .api-table__mono { font-family: var(--font-mono); font-size: 13px; }
.api-table .api-table__key { white-space: nowrap; }
.api-table .api-table__note { color: var(--color-text-muted); }
.api-table .api-table__note:empty { display: none; }
.api-table:focus-visible, .api-code__pre:focus-visible { outline-offset: -2px; }

@media (min-width: 721px) {
  .api-table thead th:first-child { width: 26%; }
  .api-table[data-kind="fields"] thead th:nth-child(2) { width: 22%; }
  .api-table[data-kind="errors"] thead th:nth-child(2) { width: 30%; }
}

/* — a code block: mono, bordered, scrolls sideways inside itself with a fade at the scrolling edge; no line numbers, no syntax colours — */
.api-code { margin: 0; border: 1px solid var(--color-line); border-radius: var(--radius-box); background: var(--color-surface); overflow: hidden; min-width: 0; }
.api-code__bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 8px 6px 14px; border-bottom: 1px solid var(--color-line); }
.api-code__title { margin-right: auto; font-size: 12px; line-height: normal; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-text-muted); }
.api-code__tabs { display: flex; gap: 2px; }
.api-code__tabs[hidden], .api-copy[hidden], .api-code__note[hidden] { display: none; }
.api-code__tab {
  min-height: 36px; padding: 0 10px; border: 0; background: transparent; color: var(--color-text-muted);
  font-family: var(--font-mono); font-size: 13px; font-weight: var(--weight-medium); cursor: pointer;
}
.api-code__tab[aria-selected="true"] { color: var(--color-text); box-shadow: inset 0 -2px 0 var(--color-text); }
.api-copy {
  display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 12px; border-radius: var(--radius-pill);
  border: 1px solid var(--color-line); background: var(--color-bg); color: var(--color-text);
  font-family: var(--font-body); font-size: 13px; font-weight: var(--weight-semibold); cursor: pointer;
}
.api-copy:hover { border-color: var(--color-text); }
.api-copy .icon { flex: none; width: 15px; height: 15px; }
/* The copy icon shows until the copy worked (it stays on "Copy failed"); the check shows only then. */
.api-code:not([data-state="copied"]) .api-copy__done,
.api-code[data-state="copied"] .api-copy__idle { display: none; }
.api-code__pre {
  margin: 0; padding: 16px; overflow-x: auto; font-family: var(--font-mono); font-size: 13px; line-height: 1.6;
  color: var(--color-text); tab-size: 2; white-space: pre;
  background:
    linear-gradient(to right, var(--color-surface) 30%, transparent) left center / 28px 100% no-repeat local,
    linear-gradient(to left, var(--color-surface) 30%, transparent) right center / 28px 100% no-repeat local,
    linear-gradient(to right, color-mix(in oklab, var(--color-text) 16%, transparent), transparent) left center / 12px 100% no-repeat scroll,
    linear-gradient(to left, color-mix(in oklab, var(--color-text) 16%, transparent), transparent) right center / 12px 100% no-repeat scroll;
}
.api-code[data-state="denied"] .api-code__pre { background: color-mix(in oklab, var(--color-text) 12%, var(--color-surface)); }
.api-code__note { margin: 0; padding: 10px 14px; border-top: 1px solid var(--color-line); font-size: 13.5px; line-height: 1.45; color: var(--color-text-muted); }

/* — a response sample behind "Show response" (A10) — */
.api-resp { min-width: 0; }
.api-resp summary {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 10px; box-sizing: content-box; min-height: 44px; padding: 0 18px; line-height: normal;
  border-radius: var(--radius-pill); border: 1px solid var(--color-line); background: var(--color-surface); color: var(--color-text);
  font-family: var(--font-body); font-size: 14px; font-weight: var(--weight-semibold); cursor: pointer; list-style: none;
}
.api-resp summary::-webkit-details-marker { display: none; }
.api-resp summary:hover { border-color: var(--color-text); }
.api-resp summary .icon { flex: none; width: 16px; height: 16px; }
.api-resp[open] summary .icon { transform: rotate(180deg); }
.api-resp .api-resp__hide, .api-resp[open] .api-resp__show { display: none; }
.api-resp[open] .api-resp__hide { display: inline; }
.api-resp[open] summary { margin-bottom: 12px; }

@media (prefers-reduced-motion: no-preference) {
  .api-toc-d summary .icon, .api-resp summary .icon { transition: transform var(--dur-hover); }
}

/* — 1024px and up: the contents card stays in view — */
@media (min-width: 1024px) {
  .api-toc { position: sticky; top: 92px; max-height: calc(100vh - 120px); overflow: auto; box-sizing: border-box; }
}
@media (max-width: 1023px) {
  .api-main { grid-column: 1 / -1; }
}

/* — tablet, 721 to 1023: the contents card sits above the text with its links in two columns — */
@media (min-width: 721px) and (max-width: 1023px) {
  .api-toc { display: grid; grid-template-columns: 1fr 1fr; }
  .api-toc__title { grid-column: 1 / -1; }
  .api-table th, .api-table td { padding: 12px; font-size: 14px; }
}

/* — phone, 720 and below: the contents are a disclosure; each table row is a card whose first column is the title and
     whose other columns are one "Label: value" line (A14) — */
@media (max-width: 720px) {
  .api-toc { display: none; }
  .api-toc-d { display: block; }
  .api-main { gap: 32px; }
  .api-table { border: 0; background: transparent; overflow: visible; }
  .api-table table { display: block; }
  .api-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .api-table tbody { display: flex; flex-direction: column; gap: 0; border: 1px solid var(--color-line); border-radius: var(--radius-box); background: var(--color-surface); overflow: hidden; }
  .api-table tr { display: flex; flex-direction: column; gap: 1px; padding: 10px 16px; border: 0; border-bottom: 1px solid var(--color-line); }
  .api-table tr:last-child { border-bottom: 0; }
  .api-table th, .api-table td { display: block; padding: 0; border: 0; font-size: 14px; line-height: 1.4; }
  .api-table th[scope="row"] { font-size: 15px; white-space: normal; }
  .api-table td[data-label] { font-size: 14px; line-height: 1.4; }
  .api-table td[data-label]::before {
    content: attr(data-label) ":"; margin-right: 6px; font-weight: var(--weight-semibold); color: var(--color-text-muted);
    font-family: var(--font-body); font-size: 14px;
  }
  .api-table .api-table__note { color: var(--color-text); }
  .api-code__pre { font-size: 12.5px; padding: 14px; }
  .api-note { flex-direction: column; gap: 4px; }
}
