body { line-height: 1.7; }
/* leave room for wide tables and figures below the shared, narrower header */
.page-layout { display: grid; grid-template-columns: 215px minmax(0, 1fr); gap: 3rem; max-width: 1540px; margin: 0 auto; padding: 2.8rem var(--site-gutter) 4rem; }
.contents { position: sticky; top: 1.5rem; align-self: start; max-height: calc(100vh - 3rem); overflow-y: auto; font-size: .82rem; line-height: 1.5; padding-right: .7rem; }
.contents summary { font-weight: 700; cursor: pointer; padding-bottom: .7rem; }
.contents ul { margin: 0; padding: 0; list-style: none; }
.contents li { padding: .25rem 0; }
.contents .level-h3 { padding-left: .9rem; }
.contents a { color: var(--muted); text-decoration: none; }
.contents a:hover { color: var(--link); text-decoration: underline; }
.source-link { display: inline-block; margin-top: 1.5rem; }
main { min-width: 0; }
article > p, article > ul, article > ol, article > pre { max-width: 78ch; }
article h1 { max-width: 30ch; font-size: clamp(1.8rem, 3.1vw, 2.8rem); line-height: 1.16; letter-spacing: -.025em; margin: 0 0 1.3rem; }
article h2 { margin: 3rem 0 1rem; font-size: 1.55rem; line-height: 1.3; border-top: 1px solid var(--border); padding-top: 1.5rem; }
article h3 { margin: 2rem 0 .6rem; font-size: 1.15rem; line-height: 1.4; }
article h1, article h2, article h3 { scroll-margin-top: 1.5rem; }
article p { margin: .9rem 0 1.2rem; }
article li { margin: .35rem 0; }
article code { font-size: .88em; overflow-wrap: anywhere; background: var(--surface-raised); border-radius: 3px; padding: .12em .25em; }
article pre { overflow-x: auto; padding: 1rem 1.2rem; background: var(--surface-raised); border: 1px solid var(--border); border-radius: 5px; line-height: 1.5; }
article pre code { padding: 0; overflow-wrap: normal; }
article .figure { max-width: none; margin: 1.8rem 0 .7rem; }
.figure-link { display: block; cursor: zoom-in; }
.figure img { display: block; width: 100%; height: auto; }
.figure + p { max-width: 100ch; color: var(--muted); font-size: .9rem; line-height: 1.6; margin-bottom: 2rem; }
.table-scroll { max-width: 100%; overflow-x: auto; margin: 1.5rem 0; }
table { border-collapse: collapse; font-size: .9rem; line-height: 1.5; font-variant-numeric: tabular-nums; }
th, td { text-align: left; vertical-align: top; padding: .7rem .9rem; border-bottom: 1px solid var(--border); }
td[style*="text-align:right"] { white-space: nowrap; }
th { border-top: 2px solid var(--rule); border-bottom: 2px solid var(--rule); background: var(--surface); }
table code { white-space: normal; }
footer { border-top: 1px solid var(--border); margin-top: 3rem; padding-top: 1rem; color: var(--muted); font-size: .85rem; }
@media (max-width: 960px) {
  .page-layout { grid-template-columns: minmax(0, 1fr); gap: 2rem; padding-block: 1.5rem; }
  .contents { position: static; max-height: none; padding: .8rem 1rem; border: 1px solid var(--border); border-radius: 4px; }
  .contents nav { max-height: 16rem; overflow-y: auto; }
  .source-link { margin-top: .6rem; }
}
@media (max-width: 540px) {
  .page-layout { padding-block: 1.2rem; }
  body { font-size: 15px; }
  th, td { padding: .5rem .65rem; }
}
