/* API index pages. Uses only tokens from /styles.css, plus the --ap-ok/--ap-warn
   pair below (ND-13 cost badge): styles.css has no red/green tokens, and these
   are local to this file, with a dark override mirroring styles.css's own
   plain `@media (prefers-color-scheme: dark)` -- no `data-theme` attribute. */
:root {
  --ap-ok: #176B36;
  --ap-ok-wash: rgba(23, 107, 54, 0.09);
  --ap-warn: #A83F2C;
  --ap-warn-wash: rgba(168, 63, 44, 0.08);
}
@media (prefers-color-scheme: dark) {
  :root {
    --ap-ok: #6FCF8E;
    --ap-ok-wash: rgba(111, 207, 142, 0.12);
    --ap-warn: #EE9580;
    --ap-warn-wash: rgba(238, 149, 128, 0.14);
  }
}
.apis-page .site-head { position: relative; background: var(--panel); }
.apis-page .site-head .wrap > div, .apis-page .head-nav { display: flex; }
.head-apis { margin-left: auto; margin-right: var(--s-100); }
.apis-main { padding: var(--s-700) 0 var(--s-900); }
.apis-main section:not(.ap-card) { padding: 0; }
.ap-title { font-family: var(--font-display); font-weight: 400; font-size: var(--f-5); line-height: var(--lh-display); margin: 0 0 var(--s-200); letter-spacing: -0.01em; }
.ap-lede { font-size: var(--f-1); line-height: var(--lh-lede); color: var(--muted); max-width: 44rem; margin: 0 0 var(--s-400); }
.ap-lede a, .ap-card a:not(.btn), .ap-small a { color: var(--accent); }
.ap-crumb { font-size: var(--f--1); color: var(--meta); margin-bottom: var(--s-200); }
.ap-crumb a { color: var(--accent); }
.ap-meta { display: flex; gap: var(--s-200); align-items: center; font-size: var(--f--1); color: var(--meta); margin: 0 0 var(--s-300); }
.ap-badge { display: inline-block; font-size: var(--f--2); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 3px 8px; border-radius: var(--r-sm); border: 1px solid var(--border-strong); color: var(--muted); white-space: nowrap; }
.ap-sales-only { border-color: var(--accent); color: var(--accent); }
.ap-no-public-api { border-style: dashed; }
.ap-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s-300); margin: 0 0 var(--s-300); max-width: 68rem; }
/* readable prose measure for body text inside cards; tables, dl grids, code
   and preview grids are left at full card width. */
.ap-card > p, .ap-card > ul { max-width: 52rem; }
.ap-register, .ap-caution { border-color: var(--accent); }
.ap-register h2, .ap-caution h2 { color: var(--accent); }
.ap-shelved-badge { background: var(--text); border-color: var(--text); color: var(--bg); }
.ap-shelved { background: var(--text); border-color: var(--text); }
.ap-shelved h2, .ap-shelved p, .ap-card.ap-shelved h2, .ap-card.ap-shelved p { color: var(--bg); }
.ap-card h2 { font-family: var(--font-display); font-weight: 400; font-size: var(--f-2); margin: 0 0 var(--s-200); }
.ap-card p { margin: 0 0 var(--s-100); color: var(--muted); line-height: var(--lh-body); }
.ap-dl { display: grid; grid-template-columns: minmax(8rem, 12rem) 1fr; gap: var(--s-75) var(--s-200); margin: 0; }
.ap-dl dt { color: var(--meta); font-size: var(--f--1); }
.ap-dl dd { margin: 0; overflow-wrap: anywhere; }
.ap-card code { font-family: var(--font-mono); font-size: .9em; background: var(--accent-wash); padding: 1px 5px; border-radius: var(--r-sm); }
.ap-scroll { overflow-x: auto; margin-top: var(--s-200); }
.ap-table { border-collapse: collapse; width: 100%; font-size: var(--f--1); }
.ap-table th, .ap-table td { text-align: left; padding: var(--s-75) var(--s-100); border-top: 1px solid var(--border); vertical-align: top; }
.ap-table thead th { color: var(--meta); font-weight: 600; border-top: 0; }
.ap-note, .ap-small { font-size: var(--f--1); color: var(--meta); }
.ap-src { margin: 0; padding-left: var(--s-300); font-size: var(--f--1); overflow-wrap: anywhere; }
.ap-filters { display: flex; flex-wrap: wrap; gap: var(--s-200); margin: 0 0 var(--s-200); }
.ap-filters label { display: flex; flex-direction: column; gap: var(--s-50); font-size: var(--f--1); color: var(--meta); }
.ap-filters input, .ap-filters select { font: inherit; font-size: var(--f-0); color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-base); padding: var(--s-75) var(--s-100); min-width: 14rem; }
.ap-filters input:focus-visible, .ap-filters select:focus-visible, .ap-list a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ap-count { font-size: var(--f--1); color: var(--meta); }
.ap-list { list-style: none; padding: 0; margin: 0 0 var(--s-400); display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: var(--s-200); }
.ap-list a { display: grid; grid-template-columns: 1fr auto auto; align-content: start; align-items: start; gap: var(--s-75); height: 100%; padding: var(--s-200); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); color: var(--text); text-decoration: none; transition: border-color var(--dur-fast) var(--ease); }
.ap-list a:hover { border-color: var(--accent); }
.ap-name { font-family: var(--font-display); font-size: var(--f-1); }
.ap-cat { grid-column: 1 / -1; font-size: var(--f--2); text-transform: uppercase; letter-spacing: .06em; color: var(--meta); }
.ap-sum { grid-column: 1 / -1; font-size: var(--f--1); color: var(--muted); line-height: var(--lh-micro); }
/* ---------- routes: direct vs aggregator, side by side ---------- */
.ap-navline { font-size: var(--f--1); color: var(--muted); line-height: var(--lh-body); max-width: 48rem; margin: 0 0 var(--s-300); }
.ap-navline a { color: var(--accent); }
.ap-h2 { font-family: var(--font-display); font-weight: 400; font-size: var(--f-2); margin: var(--s-400) 0 var(--s-100); }
.ap-card h3 { font-family: var(--font-display); font-weight: 400; font-size: var(--f-1); margin: var(--s-300) 0 var(--s-100); }
.ap-routes th[scope="row"] { min-width: 8rem; }
.ap-routes th[scope="row"] a { color: var(--accent); }
.ap-routes .ap-badge { font-size: var(--f--2); }
.ap-routes .ap-unverified { border-style: dashed; }
.ap-ex { display: block; font-size: var(--f--2); color: var(--meta); line-height: var(--lh-micro); font-weight: 400; }
.ap-ex a { color: var(--meta); }
.ap-pick { margin: 0; padding-left: var(--s-300); color: var(--muted); line-height: var(--lh-body); }
.ap-pick li { margin-bottom: var(--s-75); }
.ap-pick li:last-child { margin-bottom: 0; }
.ap-rnotes { font-size: var(--f--1); }
.ap-rnotes dt { color: var(--text); font-weight: 600; font-size: var(--f--1); }
.ap-rnotes dd { color: var(--muted); line-height: var(--lh-micro); }

/* ---------- ND-18: FREE/PAYG/SUBS cost pill, red callout, alternatives ---------- */
.ap-badge.ap-cost-green { background: var(--ap-ok-wash); border-color: var(--ap-ok); color: var(--ap-ok); }
.ap-badge.ap-cost-red { background: var(--ap-warn-wash); border-color: var(--ap-warn); color: var(--ap-warn); }
.ap-cost { margin: 0 0 var(--s-300); }
.ap-cost-note { font-size: var(--f--1); color: var(--meta); }
.apis-main .ap-card.ap-cost-red { border-color: var(--ap-warn); padding: var(--s-300); background: var(--ap-warn-wash); }
.ap-card.ap-cost-red h2 { color: var(--ap-warn); }
.ap-alt { list-style: none; margin: var(--s-200) 0 0; padding: 0; display: grid; gap: var(--s-150); }
.ap-alt li { border-top: 1px solid var(--border); padding-top: var(--s-150); }
.ap-alt-name a { color: var(--accent); font-weight: 600; }
.ap-alt-gate { font-size: var(--f--2); text-transform: uppercase; letter-spacing: .04em; color: var(--meta); margin-left: var(--s-75); }
.ap-alt-why { margin: var(--s-50) 0 0; color: var(--muted); line-height: var(--lh-micro); overflow-wrap: anywhere; }
.ap-alt-why a { color: var(--accent); }
.ap-badges { display: flex; flex-wrap: wrap; gap: var(--s-75); justify-content: flex-end; }

@media (max-width: 600px) { .ap-dl { grid-template-columns: 1fr; } .ap-filters input, .ap-filters select { min-width: 0; width: 100%; } .ap-filters label { flex: 1 1 100%; } }

@media (max-width: 639px) {
  .ap-scroll { overflow-x: visible; }
  .ap-table thead { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  .ap-table, .ap-table tbody { display: block; }
  .ap-table tr { display: block; border: 1px solid var(--border); border-radius: var(--r-base); padding: var(--s-100) var(--s-200); margin: 0 0 var(--s-100); }
  .ap-table tr:last-child { margin-bottom: 0; }
  .ap-table th, .ap-table td { border-top: 0; padding: var(--s-50) 0; }
  .ap-table th[scope="row"] { display: block; font-weight: 700; }
  .ap-table td { display: grid; grid-template-columns: minmax(5rem, 7rem) 1fr; gap: var(--s-100); }
  .ap-table td::before { content: attr(data-label); color: var(--meta); }
  .ap-table td:empty { display: none; }
}

@media (max-width: 639px) {
  .ap-routes td { grid-template-columns: minmax(6rem, 8rem) 1fr; }
  .ap-routes th[scope="row"] { min-width: 0; margin-bottom: var(--s-50); }
  /* the sub-label sits under its value, not under the data-label column */
  .ap-routes td .ap-ex { grid-column: 2; }
}

/* ND-18: long endpoint paths must wrap at 375px instead of widening the page. */
.apis-main code, .apis-main .ap-ex, .apis-main td, .apis-main th { overflow-wrap: anywhere; }

/* ---------- ND-20b: TinyFish vendor page + Glasser aggregator page mock.
   New classes only, prefixed ap-nd20b- -- no existing rule above is changed,
   and apis.css?v=3 is not bumped, so this file's content can grow without
   changing the <link> on every other generated page. ---------- */
.ap-nd20b-purpose strong { color: var(--meta); font-weight: 600; margin-right: var(--s-75); text-transform: uppercase; font-size: var(--f--2); letter-spacing: .04em; vertical-align: middle; }
.ap-nd20b-cards { display: grid; gap: var(--s-200); grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); margin-top: var(--s-200); }
.ap-nd20b-product { border: 1px solid var(--border); border-radius: var(--r-base); padding: var(--s-200); background: var(--surface); }
.ap-nd20b-product h3 { font-family: var(--font-display); font-weight: 400; font-size: var(--f-1); margin: 0 0 var(--s-100); }
.ap-nd20b-account { border-style: dashed; }
.ap-nd20b-btnrow { display: flex; flex-wrap: wrap; gap: var(--s-100); margin-top: var(--s-200); }
.ap-nd20b-preview-grid { display: grid; gap: var(--s-200); grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); margin-top: var(--s-200); }
.ap-nd20b-preview-card { border: 1px solid var(--border); border-radius: var(--r-base); padding: var(--s-200); background: var(--surface); }
.ap-nd20b-preview-card h3 { font-family: var(--font-display); font-weight: 400; font-size: var(--f-1); margin: 0 0 var(--s-75); }
.ap-nd20b-preview-card p { margin: 0 0 var(--s-75); }
.ap-nd20b-call { white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--font-mono); font-size: var(--f--2); background: var(--accent-wash); border-radius: var(--r-sm); padding: var(--s-100); margin: 0 0 var(--s-75); }
.ap-nd20b-price { font-weight: 600; }
.ap-nd20b-links { font-size: var(--f--1); }
.ap-nd20b-links a { color: var(--accent); margin-right: var(--s-100); }
.ap-nd20b-fulllist { margin-top: var(--s-300); max-width: 68rem; }

/* ---------- ND-20c: eptable rebalanced from 6 columns to 4 (Capability/Call/
   Price/Docs) -- the section/table containers (.ap-nd20b-calls, .ap-nd20b-account)
   are untouched; only the inner <table> moved from ap-nd20b-eptable to
   ap-nd20c-eptable since every column rule changed shape. Capability and Call
   each carry a second line (Does / Limit) as a block child, so vertical-align:
   top (inherited from .ap-table) keeps every row's first line level. Single
   breakpoint at 768px, matching the spec's desktop/mobile split. */
.ap-nd20c-does { display: block; color: var(--muted); margin-top: var(--s-50); }
.ap-nd20c-limit { display: block; color: var(--meta); font-size: var(--f--2); margin-top: var(--s-50); }
.ap-nd20c-docs {
  display: inline-block;
  padding: var(--s-25) var(--s-75);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  font-size: var(--f--1);
  line-height: var(--lh-micro);
  white-space: nowrap;
  text-decoration: none;
}
.ap-nd20c-docs:hover { border-color: var(--accent); }

@media (min-width: 768px) {
  .ap-nd20c-eptable { width: 100%; table-layout: fixed; }
  .ap-nd20c-eptable col:nth-child(1) { width: 38%; }
  .ap-nd20c-eptable col:nth-child(2) { width: 36%; }
  .ap-nd20c-eptable col:nth-child(3) { width: 16%; }
  .ap-nd20c-eptable col:nth-child(4) { width: 10%; }
  .ap-nd20c-eptable th:nth-child(3), .ap-nd20c-eptable td:nth-child(3) { text-align: right; }
  .ap-nd20c-eptable td:nth-child(3) { font-weight: 600; white-space: nowrap; }
  .ap-nd20c-eptable td:nth-child(4) { white-space: nowrap; }
}

/* <768px: eptable rows become stacked cards (same idea as the global
   @media (max-width: 639px) .ap-table rules above, but eptable-scoped and
   extended through 767px so 640-767 stacks too, instead of falling back to
   the global rules' plain label/value grid): Capability full-width, Call
   full-width, Price+Docs sharing one row. */
@media (max-width: 767px) {
  .ap-nd20c-eptable thead {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    border: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
  }
  .ap-nd20c-eptable, .ap-nd20c-eptable tbody { display: block; }
  .ap-nd20c-eptable tr {
    display: flex; flex-wrap: wrap; column-gap: var(--s-200);
    border: 1px solid var(--border); border-radius: var(--r-base);
    padding: var(--s-100) var(--s-200); margin: 0 0 var(--s-100);
  }
  .ap-nd20c-eptable tr:last-child { margin-bottom: 0; }
  .ap-nd20c-eptable td {
    display: block; flex: 1 1 100%; border-top: 0; padding: var(--s-50) 0;
  }
  .ap-nd20c-eptable td::before { content: none; }
  .ap-nd20c-eptable td:nth-child(3), .ap-nd20c-eptable td:nth-child(4) { flex: 0 1 auto; }
}
