/* /docs and its sub-routes — the design's docs section, style attributes
   converted to classes. Values are the design's, unchanged. */

.docs-layout {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 40px var(--page-gutter);
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}

/* ── Sidebar ────────────────────────────────────────────────────────────── */

.docs-nav {
  position: sticky;
  /* Clears the sticky header (its own height plus the accent rule). */
  top: 80px;
  display: grid;
  gap: 2px;
}

.docs-nav-heading {
  font: 500 11px/1.4 var(--mono);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text3);
  padding: 0 10px 8px;
}

.docs-nav-link {
  font: 400 13.5px/1 var(--sans);
  padding: 9px 10px;
  border-radius: 6px;
  color: var(--text2);
}
.docs-nav-link:hover {
  background: var(--surface2);
  color: var(--text2);
  text-decoration: none;
}

/* The current section. The design had no routes to be current in, so this is
   new; it matches the header nav's convention — weight and colour, no fill
   that would read as a hover state. */
.docs-nav-link.on {
  color: var(--text);
  font-weight: 500;
  background: var(--surface2);
}

.docs-nav-foot {
  margin-top: 12px;
  padding: 12px 10px 0;
  border-top: 1px solid var(--border);
  font: 400 12.5px/1.55 var(--sans);
  color: var(--text3);
}

.docs-nav-version { font: 400 12px/1.5 var(--mono); }

/* ── Body ───────────────────────────────────────────────────────────────── */

.docs-h1 {
  font: 600 32px/1.15 var(--sans);
  letter-spacing: -1.1px;
  margin: 0 0 12px;
}

.docs-lede {
  font: 400 15px/1.65 var(--sans);
  color: var(--text2);
  margin: 0 0 28px;
  max-width: 68ch;
  text-wrap: pretty;
}

.docs-h2 {
  font: 600 20px/1.3 var(--sans);
  letter-spacing: -0.4px;
  margin: 0 0 10px;
}

.docs-p {
  font: 400 14px/1.6 var(--sans);
  color: var(--text2);
  margin: 0 0 12px;
  max-width: 68ch;
}
.docs-p-last { margin-bottom: 0; }

.docs-code { font: 400 12.5px/1.5 var(--mono); }
.docs-code-lg { font: 400 13px/1.5 var(--mono); }

.code {
  margin: 0 0 24px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font: 400 12.5px/1.75 var(--mono);
  overflow-x: auto;
}

.docs-warn {
  border: 1px solid var(--warn-b);
  background: var(--warn-bg);
  color: var(--warn-fg);
  border-radius: 8px;
  padding: 14px 16px;
  font: 400 13.5px/1.6 var(--sans);
}

/* ── API reference ──────────────────────────────────────────────────────── */

.api-table {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
  margin-bottom: 28px;
}

.api-row {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 20px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--hairline);
}
/* The design's last row keeps its rule; removing it is the tidier reading of
   the same drawing and costs nothing. */
.api-row:last-child { border-bottom: 0; }

.api-sig {
  font: 400 12.5px/1.6 var(--mono);
  color: var(--text);
  overflow-wrap: anywhere;
}

.api-desc {
  font: 400 13.5px/1.6 var(--sans);
  color: var(--text2);
}

.consent-wrap {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
}

.consent {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.consent thead th {
  font: 500 11px/1.4 var(--mono);
  letter-spacing: 0.4px;
  color: var(--text3);
  text-align: left;
  padding: 10px 16px;
  border-bottom: 1px solid var(--hairline);
}

.consent tbody th {
  font: 400 13px/1.5 var(--sans);
  color: var(--text2);
  font-weight: 400;
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--hairline);
  overflow-wrap: anywhere;
}

.consent tbody td {
  font: 400 13px/1.5 var(--sans);
  color: var(--text2);
  padding: 12px 16px;
  border-bottom: 1px solid var(--hairline);
}

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

/* The design's first column is wider than the other three. */
.consent thead th:first-child,
.consent tbody th { width: 30%; }

/* ── Wire schema ────────────────────────────────────────────────────────── */

.note-grid {
  display: grid;
  gap: 12px;
}

.note-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px 16px;
}

.note-title {
  font: 600 13.5px/1.5 var(--sans);
  margin-bottom: 4px;
}

.note-body {
  font: 400 13px/1.6 var(--sans);
  color: var(--text2);
}

/* ── Troubleshooting ────────────────────────────────────────────────────── */

.trouble-grid {
  display: grid;
  gap: 14px;
  max-width: 72ch;
}

.trouble-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 16px;
}

.trouble-title {
  font: 600 14px/1.5 var(--sans);
  margin-bottom: 5px;
}

.trouble-body {
  font: 400 13.5px/1.6 var(--sans);
  color: var(--text2);
}

/* ── Narrow ─────────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .docs-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }
  /* A sidebar that sticks above the content it indexes is just a lid. */
  .docs-nav {
    position: static;
    grid-auto-flow: row;
  }
  .docs-h1 { font-size: 27px; letter-spacing: -0.8px; }
  .api-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
}
