/* mossmoth · blog, pencil style: on top of pencil.css. The line splits what a thing is from the thing:
   on the list, a post's date left of the line and its title right; in a post, the date beside the dek, each section's
   heading beside its first paragraph, a table's row names beside their values, and Sources beside its notes. */
ol, blockquote, pre, table, hr { margin: 0; }
.blog .title { max-width: 11em; text-wrap: balance; }
.blog .post-title { font-size: clamp(2rem, 1.4rem + 2.2vw, 3.1rem); line-height: 1.04; }

/* the list: date | [title], with one line about it under the title */
.posts { list-style: none; display: grid; row-gap: calc(var(--u) * 1.2); padding: 0 var(--right) calc(var(--u) * 2) var(--left); }
.posts li { display: grid; grid-template-columns: 1fr 1fr; column-gap: calc(2 * var(--gap)); align-items: baseline; }
.posts time { justify-self: end; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.posts li > div { width: min(100%, 26em); }
.posts .t { display: block; width: fit-content; font-size: 1.45em; line-height: 1.2; color: var(--muted); transition: transform .26s cubic-bezier(.22, 1, .36, 1); text-wrap: balance; }
.posts .t:has(a:is(:hover, :focus-visible)) { transform: translateX(.16em); }
.posts .t a:focus-visible { outline: none; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .3em; }
.posts .d { margin-top: .35em; color: var(--muted); text-wrap: pretty; }

/* a post: the date and length left of the line, the dek right of it */
.byline { display: grid; grid-template-columns: 1fr 1fr; column-gap: calc(2 * var(--gap)); align-items: baseline;
  padding: 0 var(--right) calc(var(--u) * 1.6) var(--left); }
.byline .meta { justify-self: end; text-align: right; color: var(--muted); font-size: .9em; font-variant-numeric: tabular-nums; }
.byline .dek { width: min(100%, 30em); font-size: 1.18em; line-height: 1.45; text-wrap: pretty; }

.post { display: grid; grid-template-columns: 1fr 1fr; column-gap: calc(2 * var(--gap)); row-gap: calc(var(--u) * .75); align-items: baseline;
  padding: 0 var(--right) calc(var(--u) * 1.5) var(--left); }
.post > * { grid-column: 2; width: min(100%, 31em); min-width: 0; }
.post p { text-wrap: pretty; }
/* a heading stands left of the line, level with the first line of what it heads */
.post h2, .post h3, .post h4 { grid-column: 1; justify-self: end; text-align: right; width: auto; max-width: 14em; margin-top: calc(var(--u) * 1.4);
  font: 400 1.5em/1.2 var(--display); text-wrap: balance; }
.post h3 { font-size: 1.2em; }
.post h4 { font: 400 1em/1.4 var(--body); color: var(--muted); }
.post :is(h2, h3, h4) + * { margin-top: calc(var(--u) * 1.4); }
.post ul, .post ol { padding-left: 1.3em; }
.post ul { list-style: none; }
.post ul > li { position: relative; }
.post ul > li::before { content: "–"; position: absolute; left: -1.3em; color: var(--muted); }
.post ol > li::marker { color: var(--muted); }
.post li + li { margin-top: calc(var(--u) * .25); }
.post blockquote { margin-block: calc(var(--u) * .6); font: 400 1.32em/1.38 var(--display); }
.post blockquote > * + * { margin-top: calc(var(--u) * .5); }
.post hr { border: 0; height: calc(var(--u) * .75); }        /* a pause; the page already has its one line */
.post code { font: .86em/1 ui-monospace, "SF Mono", Menlo, monospace; padding: .12em .32em; background: color-mix(in srgb, var(--muted) 11%, transparent); }
.post pre { overflow-x: auto; padding: .8em 1em; background: color-mix(in srgb, var(--muted) 8%, transparent); }
.post pre code { padding: 0; background: none; font-size: .82em; line-height: 1.5; }
.again { margin-top: calc(var(--u) * 1.5); color: var(--muted); }

/* a table crosses the line: each row's name left of it, its values right of it, no rules between rows */
.post .wide { grid-column: 1 / -1; width: auto; margin-block: calc(var(--u) * .6); overflow-x: auto; scrollbar-width: none; }
/* no hanging brackets in a table (Safari): the scroll box clips them and, on phones, the pinned column's white covers them */
.post .wide { hanging-punctuation: none; }
.post .wide::-webkit-scrollbar { display: none; }
.post table { width: 100%; border-collapse: collapse; font-size: .86em; line-height: 1.4; font-variant-numeric: tabular-nums; }
.post th, .post td { padding: .45em .9em .45em 0; text-align: left; vertical-align: baseline; }
.post th { font-weight: 400; color: var(--muted); vertical-align: bottom; }
.post th:last-child, .post td:last-child { padding-right: 0; }
/* the names' column ends a gap before the line and the values start a gap after it, where the text column does
   (a plain 50%: Chrome treats a calc() mixing % and lengths on a table column as auto) */
.post th:first-child, .post td:first-child { width: 50%; padding-right: var(--gap); text-align: right; }
.post :is(th, td):nth-child(2) { padding-left: var(--gap); }
.post td:first-child, .post tbody th { font: 400 1.12em/1.3 var(--display); color: var(--ink); vertical-align: baseline; }

/* source marks: a small raised number; the notes themselves sit beside "Sources" at the very end */
.ref { font-size: .68em; line-height: 0; vertical-align: .55em; padding-left: .06em; text-decoration: none; }
.post .sources { display: contents; }
.post .sources ol { padding-left: 1.4em; font-size: .86em; line-height: 1.5; color: var(--muted); }
.post .sources li + li { margin-top: .5em; }
.post .sources li::marker { color: var(--link); }
.post .sources li:target { color: var(--ink); }
.post .sources .back { text-decoration: none; }

/* phones, the thread (pencil.css): dates and section names are tied onto the line, the posts and the text hang right of
   it; a table scrolls sideways under the right edge with its names pinned on the line, and a short fade after them */
@media (max-width: 47.99em) {
  .posts, .byline, .post { padding-left: var(--hang); }
  .posts li, .byline, .post { grid-template-columns: 1fr; }
  .posts time, .byline .meta, .post :is(h2, h3, h4) {
    position: relative; z-index: 1; justify-self: start; text-align: left; width: fit-content; max-width: none; margin-left: var(--tie);
    padding-right: .2em; background: var(--white); box-shadow: var(--halo); }
  .posts time, .byline .meta, .post h4 { font: 400 .8rem/1.3 var(--body); color: var(--muted); letter-spacing: .02em; }
  .post h2 { font-size: 1.4rem; }
  .post h3 { font-size: 1.15rem; }
  .posts { row-gap: calc(var(--u) * 1.5); }
  .posts li, .byline { row-gap: .3em; }
  .byline .meta br { display: none; }
  .byline .meta time::after { content: " · "; }
  .post > *, .post :is(h2, h3, h4) { grid-column: 1; }
  .post :is(h2, h3, h4) { margin-top: calc(var(--u) * 1.6); }
  .post :is(h2, h3, h4) + * { margin-top: .35em; }
  .post .wide { margin-right: calc(-1 * var(--right)); padding-right: var(--right);
    background:
      linear-gradient(to left, var(--white) 55%, transparent) right center / 2.4em 100% no-repeat local,
      linear-gradient(to left, color-mix(in srgb, var(--ink) 16%, transparent), transparent) right center / 1em 100% no-repeat scroll; }
  .post .wide table { width: max-content; table-layout: auto; }
  .post .wide th, .post .wide td { max-width: 9.5em; padding: .45em 0 .45em .85em; }
  .post .wide :is(th, td):nth-child(2) { padding-left: .85em; }
  .post .wide th:first-child, .post .wide td:first-child { position: sticky; left: 0; z-index: 1; width: auto; max-width: 7.2em; padding-left: 0; padding-right: .5em;
    text-align: left; background: var(--white); }
  .post .wide th:first-child::after, .post .wide td:first-child::after { content: ""; position: absolute; top: 0; bottom: 0; left: 100%;
    width: .85em; background: linear-gradient(to right, var(--white), transparent); pointer-events: none; }
}
