/*
 * The document template (plan 2026-11-19-1304 KTD5, lib/site/templates/document.ts): /docs/mcp now, the legal and
 * template pages next. The letterhead and the reading column are about.css's; the chapters are how.css's. This sheet
 * adds only what a long document owns: the chapters held to the reading measure, the chapter index, numbered steps,
 * code blocks that wrap on a phone, and plain reference tables. Tokens from site.css; no new colors or faces.
 */
.doc-head .doc-line, .doc-pointer .doc-line { font-family: var(--ui); font-size: .95rem; line-height: 1.5; color: var(--muted); margin: 10px 0 0; overflow-wrap: anywhere; }
.doc-head .doc-line code { font-size: .92em; }
/* a pointer line between the letterhead and the chapters (the template's `before` bands): no band of its own to the eye */
.doc-pointer { padding-block: 0; }
.doc-pointer__col { max-width: 66ch; margin: 0 auto; }
.doc-pointer .doc-line { margin: 0; }
/* the pointer reads as the letterhead's last line: the letterhead gives up most of its bottom space to it */
.doc-head:has(+ .doc-pointer) { padding-bottom: clamp(14px, 2vw, 22px); }

/* the chapters in the reading column */
/* one left edge down the page: the body, and the bands after it, sit in the letterhead's column (about.css .about-col) */
.doc-body .wrap > *, .doc-body ~ .band .wrap > * { max-width: 66ch; margin-inline: auto; }
/* how.css lays the chapters out as a grid; a wide table or code block must not widen its column past the wrap */
.doc-body .chapters { grid-template-columns: minmax(0, 1fr); }
.doc-body .chapter p, .doc-body .chapter li { font-size: 1.06rem; line-height: 1.65; }
.doc-body .chapter h3 { font-size: 1.15rem; margin: 26px 0 8px; }
.doc-body .chapter ul { padding-left: 1.2em; }
.doc-body .chapter li + li { margin-top: 6px; }
.doc-body code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; overflow-wrap: anywhere; }

/* the chapter index (the research documents' rule, research-doc.css) */
.doc-body .rd-index { margin: 0 auto clamp(22px, 3vw, 34px); padding-bottom: 14px; border-bottom: 1px solid var(--rule); }
.doc-body .rd-index ul { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 0; padding: 0; list-style: none; font-size: .9rem; line-height: 1.4; }
.doc-body .rd-index a { color: var(--muted); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.doc-body .rd-index a:hover { color: var(--fg); text-decoration-thickness: 2px; }

/* numbered steps */
.doc-steps { counter-reset: doc-step; list-style: none; margin: 18px 0 0; padding: 0; }
.doc-step { counter-increment: doc-step; position: relative; padding: 0 0 0 44px; }
.doc-step + .doc-step { margin-top: 28px; }
.doc-step::before { content: counter(doc-step); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%; background: var(--card); color: var(--fg); font-family: var(--ui); font-weight: 600; font-size: .9rem; line-height: 28px; text-align: center; }
.doc-step > h3 { margin: 0 0 8px; font-size: 1.15rem; line-height: 28px; }

/* code: wraps at phone width, never scrolls the page */
.doc-code { display: block; white-space: pre-wrap; word-break: break-word; overflow-x: auto; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; line-height: 1.6; background: var(--card); border-radius: 12px; padding: 14px 16px; margin: 10px 0 14px; }
.doc-code code { font-size: inherit; }

/* reference tables: two columns, the first holds a name or code */
.doc-table { overflow-x: auto; margin: 14px 0 18px; }
.doc-table table { width: 100%; border-collapse: collapse; font-size: .98rem; line-height: 1.5; }
.doc-table th, .doc-table td { text-align: left; vertical-align: top; padding: 10px 12px 10px 0; border-top: 1px solid var(--rule); }
.doc-table th { font-family: var(--ui); font-size: .85rem; color: var(--muted); font-weight: 600; border-top: 0; }
.doc-table td:first-child { white-space: nowrap; padding-right: 18px; }
@media (max-width: 640px) {
  /* on a phone each row stacks: the name on its own line, what it means under it (a narrow first column broke names letter by letter) */
  .doc-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .doc-table tr { display: block; padding: 12px 0; border-top: 1px solid var(--rule); }
  .doc-table td { display: block; padding: 0; border-top: 0; }
  .doc-table td:first-child { white-space: normal; padding: 0 0 4px; font-weight: 600; }
  .doc-step { padding-left: 38px; }
}
