/*
 * The blog's layout ("answer first"): the page frame, the header and footer,
 * the question band with its answer box, the contents list, the prose, the
 * next post and the list of further posts.
 *
 * Reads only the semantic custom properties of `theme.css` (grounds, text,
 * muted text, rules, links, accent, fonts, corner cut, sizes): no colour,
 * font name or token name appears here, so a theme change never edits this
 * file. Text on the band uses the text colour, never the link colour: a link
 * colour is only guaranteed on the page ground and on the raised surface.
 *
 * The fonts are declared in `theme.css` (self-hosted, same origin).
 */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-text);
  font-weight: var(--w-text);
  font-size: 1rem;
  line-height: 1.6;
  overflow-wrap: break-word;
}
main { flex: 1 0 auto; }
img, svg { display: block; max-width: 100%; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible, summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
strong { font-weight: var(--w-strong); }
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: var(--w-display);
  hyphens: manual;
  overflow-wrap: break-word;
  text-wrap: balance;
  margin: 0;
}
.wrap {
  width: 100%;
  max-width: calc(var(--container) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.skip {
  position: absolute;
  left: var(--gutter);
  top: 0.5rem;
  z-index: 10;
  padding: 0.5rem 1rem;
  background: var(--surface);
  color: var(--fg);
  transform: translateY(-250%);
}
.skip:focus-visible { transform: none; }
.mono { font-family: var(--font-mono); font-size: var(--small); letter-spacing: 0; }

/* Header: brand and "Blog" left; main-site link and language right. Both fit
   on one row at 360 px. */
.site-head { border-bottom: 1px solid var(--rule); }
.site-head .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 4rem;
}
.brand { display: flex; align-items: center; gap: 0.625rem; color: var(--fg); text-decoration: none; min-height: 3rem; }
.brand .name {
  white-space: nowrap;
  font-family: var(--font-display);
  font-weight: var(--w-display);
  font-size: 1.4375rem;
  letter-spacing: -0.01em;
  line-height: 1;
}
.brand .tag {
  font-family: var(--font-mono);
  font-size: var(--small);
  color: var(--muted);
  padding-left: 0.625rem;
  border-left: 1px solid var(--rule);
  line-height: 1.4;
}
.head-nav { display: flex; align-items: center; gap: 0.25rem; }
.head-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 3rem;
  padding-inline: 0.5rem;
  font-size: var(--small);
  color: var(--fg);
}
.head-nav .site-link { text-decoration: none; }
.head-nav .site-link:hover { text-decoration: underline; }
@media (max-width: 30rem) {
  .head-nav .host {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .site-head .wrap { gap: 0.25rem; }
  .brand { gap: 0.5rem; }
  .brand .name { font-size: 1.25rem; }
  .brand .tag { padding-left: 0.5rem; }
  .head-nav { gap: 0; }
  .head-nav a { padding-inline: 0.375rem; min-width: 3rem; justify-content: center; }
  .head-nav a:last-child { padding-right: 0; }
}
@media (min-width: 30.01rem) { .head-nav .short { display: none; } }

/* Prose: the post column. */
.prose { font-size: var(--prose-size); line-height: var(--prose-lh); hyphens: auto; }
.prose p, .prose ul { margin: 0 0 1.1em; }
.prose ul { padding-left: 1.25em; }
.prose li { margin-bottom: 0.5em; }
.prose li::marker { color: var(--muted); }
.prose h2 { font-size: var(--h2-size); line-height: var(--h2-lh); letter-spacing: var(--display-tracking); margin: 2.2em 0 0.6em; }
.prose code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: var(--surface);
  border: 1px solid var(--rule);
  padding: 0.05em 0.3em;
  border-radius: var(--radius);
  overflow-wrap: anywhere;
  hyphens: none;
}
.prose pre {
  font-family: var(--font-mono);
  font-size: var(--code-size);
  line-height: 1.6;
  background: var(--surface);
  color: var(--fg);
  margin: 0 0 1.4em;
  hyphens: none;
  tab-size: 4;
}
.prose pre code { background: none; border: 0; padding: 0; font-size: inherit; overflow-wrap: normal; }
.prose a { overflow-wrap: anywhere; }

/* The question band and the answer box that overlaps its lower edge. */
.qband { background: var(--band); padding-block: 2.5rem 2.25rem; }
.qband .meta { margin: 0 0 1rem; color: var(--muted); }
.qband .meta a { color: var(--fg); }
.qband h1 {
  font-size: var(--display-size);
  line-height: 1.05;
  letter-spacing: var(--display-tracking);
  max-width: 22ch;
}

.answer-row { display: grid; gap: 1.5rem; margin-top: -1.25rem; margin-bottom: 2.5rem; }
@media (min-width: 60rem) { .answer-row { max-width: 52rem; } }
.answer {
  background: var(--surface);
  border-top: 4px solid var(--accent-fill);
  padding: 1.25rem 1.5rem 1.5rem;
  clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut)));
}
.answer .k { margin: 0 0 0.5rem; font-family: var(--font-mono); font-size: var(--small); color: var(--muted); }
.answer .a { margin: 0; font-size: var(--lede-size); line-height: var(--lede-lh); hyphens: auto; }
.answer .facts { margin: 1rem 0 0; color: var(--muted); }

/* Contents: two columns on a wide screen, a closed <details> on a phone. */
.toc-wide { display: none; }
@media (min-width: 60rem) {
  .toc-wide { display: block; }
  .toc-wide ol { display: grid; grid-template-columns: 1fr 1fr; column-gap: 2rem; }
  .toc-small { display: none; }
}
.toc-wide .k { margin: 0 0 0.5rem; font-family: var(--font-mono); font-size: var(--small); color: var(--muted); }
.toc ol { margin: 0; padding: 0; list-style: none; }
.toc li { border-top: 1px solid var(--rule); }
.toc li a { display: block; padding: 0.55rem 0; color: var(--fg); text-decoration: none; font-size: 0.9375rem; line-height: 1.35; hyphens: auto; }
.toc li a:hover { text-decoration: underline; }
.toc-small { border-block: 1px solid var(--rule); }
.toc-small summary {
  min-height: 3rem;
  display: flex;
  align-items: center;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: var(--small);
  color: var(--fg);
}
.toc-small ol { padding-bottom: 0.75rem; }

/* The text: 66 characters per line; code wraps with a hanging indent, so no
   page scrolls sideways. */
.prose.answer-body { max-width: var(--measure); }
.answer-body h2 { border-top: 1px solid var(--rule); padding-top: 0.8em; }
.answer-body pre { padding: 1rem 1.25rem; white-space: pre-wrap; border-left: 3px solid var(--rule); }
.answer-body pre .ln { display: block; padding-left: 2ch; text-indent: -2ch; overflow-wrap: anywhere; }
.answer-body pre .ln:empty::before { content: "\200b"; }
.answer-body .next {
  background: var(--surface);
  border-top: 4px solid var(--accent-fill);
  padding: 0.25rem 1.5rem 1rem;
  margin: 2.5rem 0;
  clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut)));
}
.answer-body .next h2 { border-top: 0; margin-top: 1rem; }
.answer-body .next p { margin-bottom: 0.5rem; }
.answer-body .next .go { font-weight: var(--w-strong); }

/* Further posts, and the home page's list. */
.more { border-top: 1px solid var(--rule-strong); margin-top: 3rem; padding-top: 1.5rem; }
.more > h2 { font-size: var(--h2-size); line-height: var(--h2-lh); margin-bottom: 1rem; }
.qlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 0 3rem; }
@media (min-width: 48rem) { .qlist { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.qlist li { border-top: 1px solid var(--rule); padding: 1.25rem 0 1.5rem; }
.qlist h3, .qlist h2 { font-size: 1.25rem; line-height: 1.3; margin: 0 0 0.5rem; letter-spacing: var(--display-tracking); }
.qlist h3 a, .qlist h2 a { color: var(--fg); }
.qlist .a { margin: 0 0 0.5rem; hyphens: auto; }
.qlist .meta { margin: 0; color: var(--muted); }

/* Home. */
.home-band { background: var(--band); padding-block: 2.5rem 3rem; }
.home-band h1 { font-size: 1rem; font-family: var(--font-mono); font-weight: 400; color: var(--muted); margin-bottom: 1.25rem; }
.lead-q {
  font-family: var(--font-display);
  font-weight: var(--w-display);
  font-size: var(--display-size);
  line-height: 1.05;
  letter-spacing: var(--display-tracking);
  margin: 0 0 1.25rem;
  max-width: 22ch;
  hyphens: manual;
  text-wrap: balance;
}
.lead-q a { color: var(--fg); }
.home-band .answer { max-width: 44rem; }
.home-list { padding-top: 1rem; }

/* Footer: one structure; each slot is optional. */
.site-foot { border-top: 1px solid var(--rule); margin-top: 4rem; padding-block: 2.5rem 3rem; font-size: var(--small); color: var(--muted); }
.site-foot .wrap { display: grid; gap: 1rem; }
.foot-statement {
  margin: 0;
  color: var(--fg);
  font-family: var(--font-display);
  font-weight: var(--w-display);
  font-size: 1.125rem;
  border-block: 1px solid var(--rule-strong);
  padding-block: 0.75rem;
}
.foot-descriptor { margin: 0; color: var(--fg); font-size: 1rem; }
.foot-notes { display: grid; gap: 0.5rem; max-width: 68ch; }
.foot-notes p { margin: 0; }
.foot-links { display: flex; flex-wrap: wrap; gap: 0 1.25rem; }
.foot-links a { display: inline-flex; align-items: center; min-height: 3rem; color: var(--fg); }
.foot-bottom { margin: 0; }
