/* =====================================================================
   Posts: the list (posts.html) and single posts (posts/*.html).
   Builds on site.css; only layout here. The class names .item / .date /
   .posttitle / .slides / .blog-date are read by the admin editor, keep them.
   ===================================================================== */

/* ---------- List ---------- */
/* A narrower column centred under the nav, text left-aligned. Each entry is one block, the title in bold over
   the date in small grey; the whole block is the link. Hovered (or focused), it takes the card
   grey from the homepage, with the card corners; the block bleeds its padding past the column so the
   text stays on the column edge. */
.post-list { display: grid; max-width: 480px; margin: calc(var(--sp-page-top) - var(--card-pad)) auto 0; }
.post-list .item { position: relative; margin-inline: calc(-1 * var(--card-pad)); padding: var(--card-pad); border-radius: var(--r-card); transition: background-color var(--dur-fast) ease; }
/* Title on top, date under it (4px, as on the post page). The markup keeps the date first, since the
   admin editor matches entries in that order, so the swap is done here */
.post-list .item { display: flex; flex-direction: column; }
.post-list .date { order: 1; margin-top: 4px; color: var(--muted); font-size: var(--small); line-height: var(--small-lh); letter-spacing: var(--small-ls); }
.post-list .posttitle { font-weight: 600; }
.post-list .posttitle a { color: var(--ink); }
.post-list .posttitle a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.post-list .posttitle a:hover { text-decoration: none; }
.post-list .posttitle a:focus-visible { outline: none; }
@media (hover: hover) { .post-list .item:hover { background: var(--surface); } }
.post-list .item:focus-within { background: var(--surface); }
@media (prefers-reduced-motion: reduce) { .post-list .item { transition: none; } }

/* ---------- Single post ---------- */
/* Two columns, after charlsyang.com/blog: the title and date sit in a narrow column on the left, the text
   runs in its own column on the right, both starting on the same line. The header floats left and every
   block of text keeps a left margin past it, so the text column holds however many paragraphs and
   figures there are (the admin editor writes them straight into the article). The text column starts
   exactly under the left edge of the top nav (the column's centre minus half the nav's width); the title
   column takes the rest of the room on the left, less a 40px gap. On phones they stack: title and date,
   two blank lines, then the text. */
.post { display: flow-root; margin-top: var(--sp-page-top); }
.post-head { float: left; width: calc(50% - var(--nav-width) / 2 - 40px); }
/* The title runs in a narrow column, so its lines are balanced to even lengths */
.post-head h1 { margin-bottom: 0; text-wrap: balance; }
.post .blog-date { margin-top: 4px; color: var(--muted); font-size: var(--small); line-height: var(--small-lh); letter-spacing: var(--small-ls); }
/* 50% of the article's own width, so it holds at any window width, including when the column is narrower than 760px */
.post > :not(.post-head) { margin-left: calc(50% - var(--nav-width) / 2); }
.post > * + * { margin-top: var(--sp-line); }
.post > .post-head + * { margin-top: 0; }
@media (max-width: 640px) {
  .post-head { float: none; width: auto; }
  .post > :not(.post-head) { margin-left: 0; }
  .post > .post-head + * { margin-top: calc(2 * var(--sp-line)); }
}
/* In-text headings: the subhead style */
.post h2, .post h3 { margin-bottom: 0; color: var(--ink); font-size: var(--body); font-weight: 600; line-height: var(--body-lh); letter-spacing: var(--body-ls); }
/* Photos: as wide as the text column, edge to edge with the paragraphs, with the control radius;
   captions start on the same left edge */
.post figure { margin-inline: 0; margin-bottom: 0; }
.post figure img { display: block; width: 100%; height: auto; border-radius: var(--r-control); }
/* Captions: small grey text just under the photo */
.post figcaption { margin-top: var(--tile-pad); color: var(--muted); font-size: var(--small); line-height: var(--small-lh); letter-spacing: var(--small-ls); }

