/* Styles for blog posts (layout: post). Everything is scoped to article.post, so it applies to every post
   and to nothing else on the site. */

/* Posts use the full page width (the site-wide 70% is meant for the home page); the text column is capped below. */
body:has(article.post) { width: auto; font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }

article.post { line-height: 1.5; font-size: 1.05rem; }
article.post h1 { font-size: 1.9rem; line-height: 1.2; margin-bottom: 0.3rem; }
article.post .post-meta { color: #666; margin-top: 0; }
article.post h2 { margin: 1.6rem 0 0.5rem; padding-bottom: 0.2rem; font-size: 1.4rem; line-height: 1.25; border-bottom: 1px solid #ddd; }
article.post h3 { margin: 0.9rem 0 0.2rem; font-size: 1.1rem; line-height: 1.25; }
/* The paragraph's own top margin is what sets the gap under a heading (margins collapse), so shrink it too. */
article.post h4 { margin: 0.8rem 0 0.2rem; font-size: 1rem; line-height: 1.25; }
article.post h2 + p, article.post h3 + p, article.post h4 + p { margin-top: 0.3rem; }
article.post p { margin: 0.7rem 0; }
article.post ul, article.post ol { margin: 0.4rem 0; padding-left: 1.4rem; }
article.post li { margin: 0.05rem 0; line-height: 1.4; }
article.post li > p { margin: 0; }
/* A paragraph that introduces a list sits close to it (margins collapse, so the paragraph's own bottom margin sets the gap). */
article.post p:has(+ ul), article.post p:has(+ ol) { margin-bottom: 0.2rem; }
article.post p + ul, article.post p + ol { margin-top: 0; }
article.post code, article.post pre { font-family: ui-monospace, Menlo, Consolas, "DejaVu Sans Mono", monospace; }
article.post code { background: #f3f3f3; padding: 0.1em 0.35em; border-radius: 3px; font-size: 0.9em; }
article.post pre { background: #f6f6f6; padding: 0.8rem 1rem; border-radius: 4px; overflow-x: auto; }
article.post pre code { background: none; padding: 0; }
/* Footnotes (kramdown puts them in div.footnotes at the end of the post) */
article.post .footnotes { margin-top: 2rem; padding-top: 0.6rem; border-top: 1px solid #ddd; font-size: 0.85em; color: #444; }
article.post .footnotes ol { padding-left: 1.2rem; }

/* Text width: keep lines readable (roughly 65-75 characters). */
article.post > h1,
article.post > h2,
article.post > h3,
article.post > h4,
article.post > p,
article.post > ul,
article.post > ol,
article.post > .footnotes { max-width: 48rem; }

/* With a side figure (class="fig-side", see styles.css) the text column is capped
   and the figure sits to the right of it. */
@media (min-width: 1100px) {
  article.post:has(figure.fig-side) { grid-template-columns: minmax(0, 48rem) 340px; justify-content: start; }
}

/* Narrower screens (phones, small tablets): the figure stays inline in the text, centred and capped in width.
   Tapping it opens the full-size SVG. */
@media (max-width: 1099px) {
  figure.fig-side { max-width: 22rem; }
}