/* Text pages: legal, privacy, terms, support, 404. Tokens come from site.css.
   Markup, in this order inside <main class="wrap text-page">:
     <header class="page-head"> h1 + <p class="updated">
     <nav class="toc" aria-label="On this page"> (optional; add .has-toc to <main> when present)
     <article class="prose">
   Below 1000px the three stack in source order; above it the nav becomes a sticky right rail, so the
   text column starts on the same line on every text page, with or without a nav. */

/* .wrap resets vertical padding, so the space above the footer is set here, not on main. */
.text-page { display: grid; grid-template-columns: minmax(0, 1fr); padding-top: clamp(40px, 7vw, 88px); padding-bottom: var(--section); }
.page-head, .prose { max-width: var(--w-text); min-width: 0; }
@media (min-width: 1000px) {
  .text-page.has-toc { grid-template-columns: minmax(0, var(--w-text)) 200px; justify-content: space-between; column-gap: 72px; }
  .text-page.has-toc .page-head, .text-page.has-toc .prose { grid-column: 1; }
  .text-page.has-toc .toc { grid-column: 2; grid-row: 2; position: sticky; top: 24px; align-self: start; margin: 0; }
}

/* The gap under the head belongs to the head, so it is the same with and without .updated. */
.page-head { margin-bottom: 2rem; }
.page-head h1 { font-size: clamp(2.2rem, 1.6rem + 3vw, 3.4rem); font-weight: 800; letter-spacing: -0.035em; margin-bottom: 0; }
.page-head .updated { color: var(--muted); font-size: var(--t-s); margin: 0.7rem 0 0; }

.prose > :first-child { margin-top: 0; }
.prose h2 { font-size: var(--t-xl); margin: 2.6rem 0 0.7rem; scroll-margin-top: 24px; }
.prose h3 { font-size: var(--t-l); margin: 1.8rem 0 0.5rem; }
.prose strong { font-weight: 650; }
.prose ul, .prose ol { margin: 0 0 1rem; padding-left: 1.3rem; }
.prose li { margin-bottom: 0.35rem; text-wrap: pretty; }
.prose li::marker { color: var(--muted); }

/* Table of contents: a plain list; the rail position comes from .has-toc above. */
.toc { font-size: var(--t-s); margin-bottom: 2rem; max-width: var(--w-text); }
.toc ol { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.toc li { border-bottom: 1px solid var(--line); }
.toc a { display: flex; align-items: center; min-height: 44px; color: var(--ink); text-decoration: none; }
.toc a:hover { text-decoration: underline; }

/* Tables. Wrap a wide one in <div class="table-wrap" role="region" aria-label="…" tabindex="0">. */
.table-wrap { overflow-x: auto; margin: 0 0 1.4rem; }
.prose table { width: 100%; border-collapse: collapse; font-size: var(--t-s); line-height: 1.45; }
.prose th, .prose td { text-align: left; vertical-align: top; padding: 11px 20px 11px 0; border-bottom: 1px solid var(--line); }
.prose th:last-child, .prose td:last-child { padding-right: 0; }
.prose thead th { color: var(--muted); font-weight: 600; border-bottom-color: var(--line-strong); white-space: nowrap; }
.prose tbody th { font-weight: 600; width: 34%; min-width: 8em; }

/* Draft notes for the owner: <p class="draft todo"><strong>TODO:</strong> …</p>, same with .decision.
   They must not survive into a published page; a check script can grep for class="draft. */
.draft { padding: 12px 16px; border-radius: var(--r-s); border: 1px dashed var(--line-strong); margin: 0 0 1rem; }
.prose .draft strong { font: 700 0.86em/1 var(--mono); letter-spacing: 0.02em; margin-right: 0.35em; }
.draft.todo { background: var(--todo-soft); border-color: var(--todo-ink); }
.prose .draft.todo strong { color: var(--todo-ink); }
.draft.decision { background: var(--decision-soft); border-color: var(--decision-ink); }
.prose .draft.decision strong { color: var(--decision-ink); }
