/* Docs page for the Distribewt MCP server, served at distribewt.com/mcp/. It loads after
   ../styles.css and reuses that file's tokens, type scale, .bar nav, .button, .link and
   .foot; what is added here is reading furniture only: the two-column docs grid, the sticky
   contents, code blocks with their copy button, the tool table and the client tabs.
   Documentation is scanned and copied, so: light, no gradients, no shadows, generous space. */

:root {
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --hair: 1px solid var(--surface);
  --docs-gutter: clamp(16px, 4vw, 64px);
  --docs-measure: 66ch;
}

/* ---------- shell ---------- */
.docs-head { padding: 20px var(--docs-gutter); }
.docs-head .bar { max-width: 1120px; margin: 0 auto; }

.docs-intro { max-width: 1120px; margin: 0 auto; padding: 32px var(--docs-gutter) 0; }
.docs-intro h1 { max-width: 20ch; font-size: clamp(2rem, 1.2rem + 3vw, 3.25rem); line-height: 0.98; letter-spacing: -0.03em; }
.docs-sub { margin-top: 1rem; max-width: 56ch; font-size: var(--step-lead); line-height: 1.3; }

.docs-wrap {
  display: grid;
  grid-template-columns: minmax(0, 200px) minmax(0, 1fr);
  gap: clamp(32px, 5vw, 80px);
  align-items: start;
  max-width: 1120px;
  margin: 0 auto;
  padding: 56px var(--docs-gutter) 120px;
}

/* ---------- contents ---------- */
.docs-toc { position: sticky; top: 32px; font-size: var(--step-small); }
.docs-toc ul { display: grid; gap: 10px; }
.docs-toc a { color: var(--muted); text-decoration: none; }
.docs-toc a[aria-current] { color: var(--ink); }
@media (hover: hover) and (pointer: fine) { .docs-toc a:hover { color: var(--ink); } }

/* ---------- body ---------- */
.docs-body { min-width: 0; font-size: clamp(1.0625rem, 1rem + 0.15vw, 1.125rem); }
.docs-body p, .docs-body ul, .docs-body ol { max-width: var(--docs-measure); }
.docs-body section { scroll-margin-top: 24px; }
.docs-body section + section { margin-top: 80px; }
.docs-body h2 { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.125rem); line-height: 1.05; letter-spacing: -0.025em; }
.docs-body h3 { margin-top: 40px; font-size: var(--step-lead); line-height: 1.2; letter-spacing: -0.01em; }
.docs-body h2 + p, .docs-body h2 + ol, .docs-body h2 + ul { margin-top: 1rem; }
.docs-body h3 + p { margin-top: 0.4rem; }
.docs-body p + p { margin-top: 0.9rem; }
.docs-body p + ul, .docs-body p + ol, .docs-body ol + p, .docs-body ul + p { margin-top: 1rem; }

.docs-body ul { list-style: disc; padding-left: 1.15em; }
.docs-body ol { list-style: decimal; padding-left: 1.5em; }
.docs-body li + li { margin-top: 0.5rem; }
.docs-body li::marker { color: var(--muted); }

.docs-label { margin-top: 1.5rem; color: var(--muted); font-size: var(--step-small); }

/* ---------- code ---------- */
code { font-family: var(--font-mono); font-size: 0.9em; }
.docs-body p code, .docs-body li code, .docs-table code { padding: 0.1em 0.35em; background: var(--surface); }

.code { display: grid; justify-items: end; gap: 6px; margin: 20px 0; }
.code pre {
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 18px;
  overflow-x: auto;
  background: var(--surface);
  color: var(--ink);
}
.code pre code { display: block; font-size: 14px; line-height: 1.65; white-space: pre; }

.copy {
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  transition: color var(--t-hover) ease, background-color var(--t-hover) ease;
}
.copy.is-copied { color: #1f8a4c; }
@media (hover: hover) and (pointer: fine) { .copy:hover { color: var(--ink); background: var(--surface); } }

/* ---------- client tabs ---------- */
.tablist { display: flex; flex-wrap: wrap; gap: 6px; margin: 28px 0 24px; }
.tab {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  color: var(--muted);
  font-size: var(--step-small);
  font-weight: 500;
  transition: background-color var(--t-hover) ease, color var(--t-hover) ease;
}
.tab[aria-selected="true"] { background: var(--ink); color: #fff; }
@media (hover: hover) and (pointer: fine) { .tab:not([aria-selected="true"]):hover { color: var(--ink); background: var(--surface); } }

/* Without script the tab strip is noise, so it goes away and every client section below
   stays on the page as a plain stacked section with its own heading. */
html:not(.js) .tablist { display: none; }
.tabpanel h3 { margin-top: 0; }
.tabpanel + .tabpanel { margin-top: 48px; }

/* ---------- tool table ---------- */
.table-wrap { margin: 24px 0; overflow-x: auto; }
.docs-table { width: 100%; border-collapse: collapse; font-size: 15px; text-align: left; }
.docs-table caption { margin-bottom: 14px; color: var(--muted); font-size: var(--step-small); text-align: left; }
.docs-table th { padding: 0 16px 10px 0; border-bottom: var(--hair); color: var(--muted); font-weight: 500; }
.docs-table td { padding: 12px 16px 12px 0; border-bottom: var(--hair); vertical-align: top; }
.docs-table th:last-child, .docs-table td:last-child { width: 1%; padding-right: 0; white-space: nowrap; }
.docs-table td code { white-space: nowrap; }

/* ---------- examples ---------- */
.docs-body .examples { margin: 24px 0 0; list-style: none; padding-left: 0; }
.docs-body .examples li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
}
.docs-body .examples li + li { margin-top: 4px; }
.examples p { font-weight: 500; }

/* ---------- tablet and phone: one column, contents as a short list ---------- */
@media (max-width: 900px) {
  .docs-wrap { grid-template-columns: minmax(0, 1fr); gap: 40px; padding-top: 32px; }
  .docs-toc { position: static; }
  .docs-toc ul { grid-template-columns: 1fr 1fr; gap: 8px 20px; }
  .docs-body section + section { margin-top: 64px; }
}

@media (max-width: 640px) {
  .docs-body { font-size: 17px; }
  .docs-intro { padding-top: 24px; }
  .docs-intro h1 { font-size: 2rem; }
  .docs-sub { font-size: 18px; }
  .code pre { padding: 14px 16px; }
  .code pre code { font-size: 13px; }

  /* The table becomes a stack of rows: at 360px three columns cannot be read, and the
     page itself must never scroll sideways. */
  .docs-table thead { display: none; }
  .docs-table, .docs-table caption, .docs-table tbody, .docs-table tr, .docs-table td { display: block; width: auto; }
  .docs-table caption { margin-bottom: 8px; }
  .docs-table tr { padding: 14px 0; border-bottom: var(--hair); }
  .docs-table td, .docs-table td:last-child { width: auto; padding: 0; border: 0; white-space: normal; }
  .docs-table td + td { margin-top: 6px; }
  .docs-table td code { font-size: 15px; }
  .docs-table td[data-label]::before { content: attr(data-label) " "; color: var(--muted); }
}

@media (prefers-reduced-motion: reduce) {
  .copy, .tab, .docs-toc a { transition: none; }
}
