/* ============================================================
   dmcn.dev — prose typography for rendered markdown
   Everything under .prose is goldmark output (SPEC.md and the
   pages under site/content), so it is styled by element rather
   than by the inline-style-on-tokens approach the marketing
   design system uses for bespoke layouts.
   ============================================================ */

.prose {
  color: var(--text-body);
  font-size: 15.5px;
  line-height: var(--leading-relaxed);
  max-width: 74ch;
}

/* ---- Headings ----
   scroll-margin-top keeps an anchored heading clear of the sticky
   header when you follow a #deep-link from the TOC. */
.prose h1, .prose h2, .prose h3, .prose h4 {
  color: var(--text-strong);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
  scroll-margin-top: 90px;
}
.prose h1 { font-size: clamp(28px, 4vw, 38px); margin: 0 0 18px; letter-spacing: -1px; }
.prose h2 {
  font-size: 21px; margin: 44px 0 14px;
  padding-top: 26px; border-top: 1px solid var(--border-subtle);
}
.prose h1 + h2 { border-top: none; padding-top: 0; margin-top: 28px; }
.prose h3 { font-size: 16.5px; margin: 30px 0 10px; }
.prose h4 { font-size: 15px; margin: 24px 0 8px; color: var(--text-body); }

/* Heading anchor: a quiet # that appears on hover, so every section
   of the spec is citable by URL. Injected by the renderer. */
.prose .hash {
  margin-left: 8px; color: var(--border-strong); font-weight: 400;
  text-decoration: none; opacity: 0; transition: opacity var(--dur-fast) var(--ease-standard);
}
.prose h2:hover .hash, .prose h3:hover .hash,
.prose .hash:focus { opacity: 1; }
.prose .hash:hover { color: var(--brand); }

/* ---- Body copy ---- */
.prose p { margin: 0 0 16px; }
.prose strong { color: var(--text-strong); font-weight: var(--weight-semibold); }
.prose em { font-style: italic; }
.prose hr { border: none; border-top: 1px solid var(--border-subtle); margin: 36px 0; }

.prose ul, .prose ol { margin: 0 0 16px; padding-left: 22px; }
.prose li { margin: 0 0 8px; }
.prose li > ul, .prose li > ol { margin: 8px 0 0; }
.prose li::marker { color: var(--text-subtle); }

.prose blockquote {
  margin: 0 0 16px; padding: 2px 0 2px 16px;
  border-left: 2px solid var(--brand); color: var(--text-muted);
}

/* ---- Code ----
   Inline code stays inline-sized; fenced blocks scroll horizontally
   rather than wrapping, because the spec's ASCII stack diagram and
   the wire-format snippets are column-aligned. */
.prose code {
  font-family: var(--font-mono); font-size: 0.875em;
  background: var(--surface-inset); color: var(--text-strong);
  padding: 1.5px 5px; border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
}
.prose pre {
  margin: 0 0 18px; padding: 16px 18px;
  background: var(--surface-sunken); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow-x: auto; line-height: 1.55;
}
.prose pre code {
  background: none; border: none; padding: 0;
  font-size: 13px; color: var(--text-body); white-space: pre;
}

/* ---- Tables ----
   Wrapped in a scroll container by the renderer so a wide table
   scrolls itself instead of the page. */
.prose .table-wrap { overflow-x: auto; margin: 0 0 18px; }
.prose table { border-collapse: collapse; width: 100%; font-size: 14px; }
.prose th, .prose td {
  text-align: left; vertical-align: top;
  padding: 9px 14px; border-bottom: 1px solid var(--border-subtle);
}
.prose th {
  color: var(--text-strong); font-weight: var(--weight-semibold);
  white-space: nowrap; border-bottom-color: var(--border-default);
}
.prose td code { white-space: nowrap; }

.prose a { color: var(--text-link); text-decoration: underline; text-underline-offset: 2px; text-decoration-color: var(--border-strong); }
.prose a:hover { color: var(--brand); text-decoration-color: var(--brand); }

/* ---- Table of contents ---- */
.toc-list { display: flex; flex-direction: column; gap: 2px; }
.toc-list a {
  display: block; padding: 5px 10px; border-radius: var(--radius-xs);
  font-size: 13px; line-height: 1.4; color: var(--text-muted); text-decoration: none;
}
.toc-list a:hover { background: var(--surface-hover); color: var(--text-strong); }
.toc-label {
  font-size: 11px; letter-spacing: var(--tracking-caps); text-transform: uppercase;
  color: var(--text-subtle); font-weight: var(--weight-semibold);
  padding: 0 10px; margin-bottom: 10px;
}

/* ---- Callout: the note strip used on the spec + module pages ---- */
.note {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px; margin: 0 0 24px;
  background: var(--brand-subtle); border: 1px solid var(--border-subtle);
  border-left: 2px solid var(--brand); border-radius: var(--radius-sm);
  font-size: 14px; line-height: var(--leading-normal); color: var(--text-body);
}
.note p:last-child { margin-bottom: 0; }
