/* [ai] The document reading page (app/lib/docpage.py): TOC rail + chapter measure. Tokens only. */
.wrap { max-width: 1240px; margin: 0 auto; display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 48px; padding: 32px 0 140px; }
nav.toc { position: sticky; top: 76px; align-self: start; max-height: calc(100vh - 96px); overflow: auto; font-size: 13px; line-height: 1.35; border-right: 1px solid var(--ds-line); padding-right: 16px; }
nav.toc a { display: block; color: var(--ds-muted); text-decoration: none; padding: 5px 0 5px 10px; border-left: 2px solid transparent; margin-left: -12px; }
nav.toc a:hover, nav.toc a.on { color: var(--ds-fg); border-left-color: var(--ds-fg); }
main#main { min-width: 0; max-width: var(--ds-measure); font: var(--ds-read); font-optical-sizing: auto; }
main > h1 { font: 600 40px/1.08 var(--ds-font); letter-spacing: -.01em; margin: 8px 0 18px; text-wrap: balance; }
main h2 { font: 600 24px/1.2 var(--ds-font); margin: 64px 0 14px; padding-top: 18px; border-top: 1px solid var(--ds-line); }
main h3 { font-size: 19px; font-weight: 700; margin: 34px 0 8px; } main h4 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--ds-muted); margin: 26px 0 6px; }
main p { margin: 0 0 16px; } main li { margin: 6px 0; } main ul, main ol { padding-left: 26px; } main strong { font-weight: 700; } main em { color: var(--ds-muted); }
main > p:first-of-type em, main > p:nth-of-type(2) em { display: block; font-style: normal; font-size: 14px; color: var(--ds-muted); line-height: 1.5; margin-bottom: 10px; }
main a { color: var(--ds-fg); }
blockquote { margin: 20px 0; padding: 14px 20px; background: var(--ds-quote); border-left: 3px solid var(--ds-accent2); border-radius: 0 10px 10px 0; font-size: 16px; } blockquote p { margin: 0; }
code { font-family: var(--ds-mono); font-size: .85em; background: var(--ds-code); padding: 2px 6px; border-radius: 5px; } pre { background: var(--ds-code); padding: 14px; border-radius: 10px; overflow: auto; font-size: 14px; } pre code { background: none; padding: 0; }
hr { border: 0; border-top: 1px solid var(--ds-line); margin: 40px 0; }
.tbl { overflow-x: auto; margin: 18px 0; border: 1px solid var(--ds-line); border-radius: 12px; background: var(--ds-card); }
table { border-collapse: collapse; width: 100%; font-size: 14px; line-height: 1.45; } th, td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--ds-line); }
th { font-weight: 600; background: var(--ds-quote); position: sticky; top: 0; } tr:last-child td { border-bottom: 0; } td:first-child, th:first-child { padding-left: 16px; }
@media (max-width: 899px) { .wrap { grid-template-columns: 1fr; gap: 0; } main#main { margin: 0 auto; }   /* one column (an iPad upright): the measure sits centred, not left with a gap */ nav.toc { position: static; max-height: none; border-right: 0; border-bottom: 1px solid var(--ds-line); padding: 0 0 16px; margin-bottom: 24px; columns: 2; } main#main { font-size: 17px; } main > h1 { font-size: 36px; } }
@media print { .at-bar, nav.toc { display: none; } .wrap { display: block; padding: 0; } body { font-size: 11pt; } main h2 { page-break-after: avoid; } }
