/* ==========================================================================
   pyapple-mcp — API reference
   --------------------------------------------------------------------------
   Layered on styles.css, which owns the tokens. Nothing here redefines a
   colour: the route hues keep meaning exactly what they mean on the landing
   page, so the sidebar's grouping is the same grouping as the ledger's.
   ========================================================================== */

.api-intro { padding-block: clamp(2.5rem, 6vw, 4rem) 0; }

.api-intro h1 {
  font-family: var(--mono);
  font-size: clamp(1.75rem, 1.1rem + 2.4vw, 2.6rem);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 1rem;
}

.api-intro .lede {
  color: var(--ink-dim);
  max-width: 64ch;
  font-size: 1.0625rem;
}

/* --- two-column shell --------------------------------------------------- */

.api-shell {
  display: grid;
  grid-template-columns: 14.5rem minmax(0, 1fr);
  gap: clamp(2rem, 4vw, 3.5rem);
  align-items: start;
  padding-block: clamp(2rem, 5vw, 3.5rem) clamp(3rem, 7vw, 5rem);
}

.api-side {
  position: sticky;
  top: 4.75rem;
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 0.5rem;
}

.api-side h2 {
  font: 500 0.6875rem/1 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 1rem;
}

.side-group { margin-bottom: 1.35rem; }
.side-group > p {
  margin: 0 0 0.45rem;
  font: 500 0.6875rem/1.4 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--route);
}

.side-group ul {
  list-style: none;
  margin: 0;
  padding: 0 0 0 0.75rem;
  border-left: 2px solid var(--route-bg);
  /* The flat tint was almost invisible on light paper; this keeps the spine
     legible in both themes without competing with the link text. */
  border-left-color: color-mix(in srgb, var(--route) 38%, transparent);
}
.side-group li { margin: 0; }
.side-group a {
  display: block;
  padding: 0.22rem 0;
  font: 500 0.8438rem/1.5 var(--mono);
  letter-spacing: -0.01em;
  color: var(--ink-dim);
  text-decoration: none;
}
.side-group a:hover { color: var(--route); }
.side-group a[aria-current="true"] { color: var(--route); font-weight: 600; }

.side-foot {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule-soft);
  font-size: 0.8125rem;
  color: var(--ink-faint);
}
.side-foot a { color: var(--ink-dim); }

/* --- tool entries ------------------------------------------------------- */

.tool {
  border-top: 1px solid var(--rule);
  padding-top: 2rem;
  margin-top: 2.75rem;
  scroll-margin-top: 5rem;
}
.tool:first-child { border-top: 0; padding-top: 0; margin-top: 0; }

.tool-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.tool-head h2 {
  font-family: var(--mono);
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.035em;
  color: var(--route);
  margin: 0;
}

.tool-summary {
  color: var(--ink-body);
  max-width: 66ch;
  margin-bottom: 0.6rem;
}

.tool-cost {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--ink-dim);
  max-width: 66ch;
  margin-bottom: 1.5rem;
}

.sub {
  font: 500 0.6875rem/1 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 1.75rem 0 0.7rem;
}

/* Operation vocabulary — the argument that decides what the call does, grouped
   by the class a policy grants. The grouping replaced a flat row in 1.4: the
   class is now the thing a reader has to act on, and a flat row could only say
   "writes / does not write", which is the distinction the policy explicitly
   refuses to be built on. */
.opset { margin: 0; padding: 0; }
.opset > div {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr);
  gap: 0.4rem 0.9rem;
  align-items: baseline;
  padding: 0.4rem 0;
  border-top: 1px solid var(--rule-soft);
}
.opset > div:first-child { border-top: 0; padding-top: 0; }
.opset dt {
  font: 500 0.6875rem/1.9 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.opset dd {
  margin: 0;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.op {
  font: 500 0.8125rem/1.5 var(--mono);
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--card);
  color: var(--ink);
}
.op.is-default {
  border-color: var(--route);
  color: var(--route);
}
/* Operations `*=read` removes from the enum — every class but the first.
   Marked with a dashed edge rather than a colour: on this site colour means
   permission cost and nothing else, so a fourth hue here would be a lie about
   the palette. */
.opset > div:not([data-class="read"]) .op { border-style: dashed; }
.ops-note {
  margin: 0.8rem 0 0;
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--ink-faint);
  max-width: 74ch;
}

/* A summary paragraph that follows its own .sub heading rather than opening a
   tool, so it does not need the gap that separates one tool from the next. */
.tool-summary--tight { margin-bottom: 0; font-size: 0.9375rem; color: var(--ink-dim); }
/* The zero margin above is so the last one sits flush against the end of the
   tool. Two of them in a row is a shell section making a second point, and
   without this they run together into one block of text. */
.tool-summary--tight + .tool-summary--tight { margin-top: 0.7rem; }

/* --- signature + tables ------------------------------------------------- */

.sig {
  background: var(--card);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--route);
  border-radius: 10px;
  padding: 0.9rem 1.1rem;
}
/* Signatures wrap rather than scroll. The long ones (calendar, mail) were
   being cut off mid-argument inside a scroller nobody would think to drag,
   which hides the very thing this page exists to show. The hanging indent
   keeps continuation lines visibly subordinate to the function name. */
.sig code {
  font-size: 0.8438rem;
  line-height: 1.7;
  white-space: pre-wrap;
  color: var(--ink-body);
  display: block;
  padding-left: 2ch;
  text-indent: -2ch;
}
.sig .fn { color: var(--route); font-weight: 600; }
.sig .arg { color: var(--ink); }
.sig .typ { color: var(--ink-faint); }

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--card);
}

table.params {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  min-width: 34rem;
}
table.params th {
  text-align: left;
  font: 500 0.6875rem/1.4 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--rule);
  background: var(--card-sunk);
  white-space: nowrap;
}
table.params td {
  padding: 0.7rem 0.9rem;
  border-top: 1px solid var(--rule-soft);
  vertical-align: top;
  color: var(--ink-dim);
  line-height: 1.55;
}
table.params tr:first-child td { border-top: 0; }
table.params td:nth-child(1) {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}
table.params td:nth-child(2),
table.params td:nth-child(3) {
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--ink-faint);
  white-space: nowrap;
}
table.params td:nth-child(4) { min-width: 16rem; }
/* Specificity, not preference: `table.params td:nth-child(3)` above outranks a
   bare `.req`, so the required marker was silently rendering in the muted
   default-column grey instead of the route colour. */
table.params td:nth-child(3).req { color: var(--route); font-weight: 600; }

.examples {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.6rem;
}
.examples li {
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--route);
  border-radius: 8px;
  padding: 0.75rem 1rem;
}

/* --- responsive --------------------------------------------------------- */

@media (max-width: 900px) {
  .api-shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 2rem;
  }
  .api-side {
    position: static;
    max-height: none;
    overflow: visible;
    padding-right: 0;
    border: 1px solid var(--rule);
    border-radius: 12px;
    background: var(--card);
    padding: 1.25rem;
  }
  .side-group { margin-bottom: 1.1rem; }
  .side-group:last-of-type { margin-bottom: 0; }
  .side-group ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.15rem 1rem;
  }
  .side-foot { margin-top: 1.25rem; }
}
