:root {
  /* The one red: the dino's red in the "Open" poster the logo comes from.
     Tags, highlighted links, inline code, header/footer lines. 5.1:1 on --page. */
  --red: #c53930;
  --lightgray: #e0e0e0;
  --palegray: #f0f0f0;
  --darkgray: #333;
  --blue: #082840;
  /* Links inside article and page content: a plain, classic blue (6.9:1 on --page).
     Visited links look the same as unvisited ones, everywhere. */
  --link: #0f52ba;
  --white: #fff;
  --page: #fffaf5;
  --content-width: 75rem;

  /* Spacing, in three units, each where it fits.

     rem: layout. Page padding, cards, gaps between blocks. The same size
     wherever it is used, and it follows the reader's browser font size. */
  --space-s: 0.5rem;
  --space-m: 1rem;

  /* em: inside a component. Padding of tags, badges, code and buttons, gaps
     in running text. It follows the font size of the element itself, so a
     small tag gets small padding. */
  --space-em-2xs: 0.125em;
  --space-em-xs: 0.25em;
  --space-em-s: 0.5em;
  --space-em-m: 1em;
  --space-em-l: 2em;

  /* px: hairlines. Borders and outlines stay one device-independent pixel,
     whatever the font size or zoom setting. */
  --hairline: 1px;
}

* {
  box-sizing: border-box;
}

@font-face {
  font-family: "Fira Sans";
  src: url("/assets/fonts/firasans-regular.724fc5672267.woff2");
  font-weight: 400;
  font-style: normal;
  font-display: fallback;
}

@font-face {
  font-family: "Fira Sans";
  src: url("/assets/fonts/firasans-semibold.198bf7935a0c.woff2");
  font-weight: 700;
  font-style: normal;
  font-display: fallback;
}

html,
body {
  padding: 0;
  margin: 0;
  font-family: "Fira Sans", system-ui, sans-serif;
  font-size: 100%;
  background-color: var(--page);
  color: var(--darkgray);
}

/* Short pages: main takes the spare height, so the footer sits at the bottom
   of the window instead of mid-page. */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

body > main {
  flex: 1 0 auto;
}

hr {
  margin: var(--space-m) 0;
  border: var(--hairline) dashed var(--lightgray);
}

ul,
ol {
  padding-left: var(--space-em-l);
}

p:last-child {
  margin-bottom: 0;
}

.home-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.home-heading h2 {
  margin: 0 var(--space-em-s) 0 0;
}

/* The rule for white: what sits on white is dated and, once published, about
   immutable (a full article, or an article summary in a list). What sits on
   the cream page updates over time: the home intro, pages such as About,
   headings, tags, header and footer.

   Article (title, date, tags and body): the same quiet white card as the
   items of the articles list. Pages share the text rules below, not the card. */
.tmpl-post article {
  padding: var(--space-m);
  margin-bottom: var(--space-m);
  background-color: var(--white);
  border-radius: 0.5em;
}

.tmpl-post article > :first-child {
  margin-top: 0;
}

.tmpl-post article > :last-child {
  margin-bottom: 0;
}

.tmpl-post p,
.tmpl-post ul {
  max-width: 37.5em; /* 600px /16 */
}
/* height: auto keeps the ratio when a wide image is scaled down; the width
   and height attributes still reserve its place before it loads. */
.tmpl-post img {
  max-width: 100%;
  height: auto;
}

.tmpl-post img.framed {
  border: var(--hairline) solid #282c34;
}

/* 1. prism's CSS only handles pre[class*="language-"] overflow */
.tmpl-post pre {
  /* 1. */
  overflow: auto;
}

/* 2. prism's CSS only sets vertical padding for pre[class*="language-"] */
.tmpl-post pre[class*="language-"] {
  /* 2. */
  padding-left: var(--space-em-m);
  padding-right: var(--space-em-m);
}

p,
main > article li,
.more li {
  line-height: 1.45;
}

/* Air between bullets, so underlined links on consecutive items stay apart. */
main > article li + li,
.more li + li {
  margin-top: var(--space-em-s);
}

a[href] {
  text-underline-offset: 0.25em;
  color: var(--blue);
}


/* Content links (articles, About): blue, so they read as links at a glance.
   Navigation, titles and tags keep their own colours. */
main > article a[href]:not(.direct-link):not(.post-tag),
.intro a[href],
.footer-links a[href] {
  color: var(--link);
}


header,
main {
  padding: var(--space-m);
}

/* Only the first element of the page: no gap under the header line.
   Direct child only, so it does not reach first elements deeper in the page. */
main > :first-child {
  margin-top: 0;
}

body > header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  border-bottom: var(--hairline) dashed var(--red);
}

body > footer {
  padding: var(--space-m);
  border-top: var(--hairline) dashed var(--red);
}

/* On the children, so the footer padding stays aligned with header and main. */
body > footer > * {
  font-size: 0.875em;
}

/* Between the two lines of small footer text, so it follows that text (em),
   unlike the page-level separators (rem). */
body > footer hr {
  margin: var(--space-em-m) 0;
}

body > footer p {
  margin: 0;
}

ul.footer-links,
ul.footer-links li {
  display: inline;
  margin: 0;
  padding: 0;
}

ul.footer-links li {
  padding: var(--space-em-2xs);
}

body > header,
body > main,
body > footer {
  max-width: var(--content-width);
  width: 100%;
  margin: 0 auto;
}


main header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-s);
  margin-bottom: var(--space-m);
  padding: 0;
}

main footer {
  margin-top: var(--space-m);
}

pre,
code {
  font-family: Consolas, Menlo, Monaco, "Andale Mono WT", "Andale Mono",
    "Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono",
    "Bitstream Vera Sans Mono", "Liberation Mono", "Nimbus Mono L",
    "Courier New", Courier, monospace;
  line-height: 1.5;
}

pre {
  font-size: 0.875em;
  line-height: 1.375;
  direction: ltr;
  text-align: left;
  white-space: pre;
  word-spacing: normal;
  word-break: normal;
  tab-size: 2;
  -webkit-hyphens: none;
  hyphens: none;
  padding: var(--space-em-m);
  margin: var(--space-em-s) 0;
  background-color: #f6f6f6;
}

code:not(pre > code) {
  padding: 0 var(--space-em-xs);
  color: var(--red);
  background-color: var(--palegray); /* keeps the red above 4.5:1 */
  border-radius: 0.25em;
}

.highlight-line {
  display: block;
  padding: var(--space-em-2xs) var(--space-em-m);
  text-decoration: none; /* override del, ins, mark defaults */
  color: inherit; /* override del, ins, mark defaults */
}

/* allow highlighting empty lines */
.highlight-line:empty:before {
  content: " ";
}

/* avoid double line breaks when using display: block; */
.highlight-line + br {
  display: none;
}

.highlight-line-active {
  background-color: hsla(0, 0%, 27%, 0.8);
}

.highlight-line-add {
  background-color: #45844b;
}

.highlight-line-remove {
  background-color: #902f2f;
}

/* A link in the accent colour, for the few that should stand out. */
a[href].accent-link {
  color: var(--red);
}

a[href].accent-link:hover,
a[href].accent-link:focus-visible {
  color: var(--blue);
}

/* Hidden on screen, still read by screen readers and kept in the heading outline. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Home greeting: a notch under the site title, which stays the biggest.
   A paragraph, not a heading: the h1 of the home page is the site title. */
.greeting {
  margin: 0 0 0.67em;
  font-size: 1.125em; /* 18px /16 */
  font-weight: 700;
  line-height: 1.4;
}

/* Header */
/* The site title is the h1 on the home page only; on the other pages it is a
   plain element and the page title is the h1. Same look either way. */
.site-title {
  margin: 0;
  font-size: 1.5em; /* 24px /16 */
  font-weight: 700;
  line-height: 1.4;
}

.site-title a {
  display: inline-flex;
  align-items: center;
}

/* The logo is a greyscale image. On hover or keyboard focus it turns red with
   CSS only: the frame behind it takes the site red and the image is multiplied
   onto it, so white areas become red and black stays black. No second image. */
.site-logo-frame {
  display: inline-flex;
  margin-right: var(--space-em-s);
  border-radius: 0.375em;
  overflow: hidden;
  isolation: isolate;
  transition: background-color 0.2s ease-out;
}

.site-logo {
  display: block;
  width: 2em; /* 48px /24 */
  height: 2em;
  mix-blend-mode: multiply;
  transition: filter 0.2s ease-out;
}

.site-title a:hover .site-logo-frame,
.site-title a:focus-visible .site-logo-frame,
.site-title a:active .site-logo-frame {
  background-color: var(--red);
}

/* Keyboard focus on the logo link: a black ring around the logo itself,
   in place of the browser ring around the whole link. */
.site-title a:focus-visible {
  outline: none;
}

.site-title a:focus-visible .site-logo-frame {
  outline: var(--hairline) solid #000;
  outline-offset: 0;
}

/* Lifts the mid-greys so the red stays bright instead of muddy. */
.site-title a:hover .site-logo,
.site-title a:focus-visible .site-logo,
.site-title a:active .site-logo {
  filter: brightness(1.35) contrast(1.1);
}

@media (prefers-reduced-motion: reduce) {
  .site-logo-frame,
  .site-logo {
    transition: none;
  }
}

.site-title a:not(:hover) {
  text-decoration: none;
}

/* Nav */
body > header nav {
  margin-left: auto;
}

.nav-item:last-child {
  margin-right: 0;
}

.nav {
  padding: 0;
  list-style: none;
  margin: 0;
}

.nav-item {
  display: inline-block;
  margin-right: var(--space-m);
}

.nav-item a[href]:not(:hover) {
  text-decoration: none;
}

/* The one link that stands out: same outline as the tags. */
.nav-item-highlight a[href] {
  display: inline-block;
  padding: var(--space-em-xs) var(--space-em-s);
  border: var(--hairline) solid var(--red);
  border-radius: 0.25em;
  color: var(--red);
}

/* Hover, keyboard focus, pressed, and current page: the colours swap (white on red, 5.25:1),
   with no underline. */
.nav-item-highlight a[href]:hover,
.nav-item-highlight a[href]:focus-visible,
.nav-item-highlight a[href]:active,
.nav-item-highlight a[href][aria-current="page"] {
  color: var(--white);
  background-color: var(--red);
  text-decoration: none;
}

/* Posts list */
.postlist {
  list-style: none;
  padding: 0;
  margin-bottom: 0;
}

/* Each article is a quiet card: white on the warm page, slightly rounded. */
.postlist-item {
  padding: var(--space-m);
  margin-bottom: var(--space-m);
  background-color: var(--white);
  border-radius: 0.5em;
}

.postlist-item .postlist-date {
  margin-right: 0;
  margin-bottom: var(--space-em-s);
}

/* Same size whatever the heading level (h3 on the home page, h2 on lists):
   22px, one step under the section headings (24px). The link inherits it. */
.postlist-title {
  margin: 0 0 var(--space-em-s);
  font-size: 1.375em; /* 22px /16 */
}

.postlist-item-metadata {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-s);
}

/* The date is a small grey badge. */
.postlist-date {
  display: inline-block;
  font-size: 0.8125em; /* 13px /16 */
  padding: var(--space-em-xs) var(--space-em-s);
  margin-right: var(--space-em-s);
  background-color: var(--lightgray);
  border-radius: 0.25em;
  font-weight: 700;
  word-spacing: -0.04em;
}

/* Label of the next/previous block under an article. Not a heading, so it
   stays out of the article outline; it names the <nav> via aria-labelledby. */
.more-title {
  margin: var(--space-m) 0 var(--space-s);
  font-weight: 700;
}

.more {
  margin-top: 0;
  margin-bottom: 0;
}

/* Tags: quiet pills, slightly rounded. About 27px tall at the default font size. */
.post-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-s);
  list-style-type: none;
  padding: 0;
  margin: 0;
}

.post-tag {
  display: inline-block;
  font-family: system-ui, sans-serif;
  font-size: 0.625em; /* 10px /16 */
  font-weight: bold;
  line-height: 1.5;
  text-transform: uppercase;
  white-space: nowrap;
  padding: var(--space-em-s) var(--space-em-m);
  border: var(--hairline) solid var(--red);
  border-radius: 0.5em;
  /* Slightly skeuomorphic button: lit from above, with a solid edge and a
     soft shadow below. It sinks on hover and is pressed flat when active. */
  background-image: linear-gradient(var(--white), #fdeee4);
  box-shadow: inset 0 var(--hairline) 0 var(--white), 0 0.2em 0 currentColor,
    0 0.3em 0.3em rgba(0, 0, 0, 0.15);
}

a[href].post-tag {
  color: var(--red);
  text-decoration: none;
}

a[href].post-tag:hover,
a[href].post-tag:focus-visible {
  color: var(--blue);
  border-color: currentColor;
  box-shadow: inset 0 var(--hairline) 0 var(--white), 0 0.1em 0 currentColor,
    0 0.15em 0.15em rgba(0, 0, 0, 0.15);
  transform: translateY(0.1em);
}

a[href].post-tag:active {
  background-image: linear-gradient(#fdeee4, var(--white));
  box-shadow: inset 0 0.1em 0.2em rgba(0, 0, 0, 0.2);
  transform: translateY(0.2em);
}

/* Direct Links / Markdown Headers */
/* Zero width, so the "#" never wraps onto a line of its own (which added an
   empty line under headings that fill the row). It overflows into the page
   padding when shown. */
.direct-link {
  display: inline-block;
  width: 0;
  white-space: nowrap;
  font-family: sans-serif;
  text-decoration: none;
  font-style: normal;
}

a[href].direct-link {
  color: transparent;
}

a[href].direct-link:focus,
:hover > a[href].direct-link {
  color: #6e6e6e; /* 4.92:1 on --page */
}

/* Room for the link underline when a heading wraps onto several lines. */
h1,
h2,
h3,
h4,
h5,
h6 {
  line-height: 1.4;
}

h1 {
  font-size: 1.875em;
}

h2 {
  font-size: 1.5em;
}

h3 {
  font-size: 1.375em;
}

h4 {
  font-size: 1.25em;
}

h5,
h6 {
  font-size: 1.1875em;
}

/* Phones (under 480px at the default font size): in an article header, the
   tags go on their own line under the date. */
@media (max-width: 30em) {
  main header {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Very small phones (under 344px): the header title steps down a size, and
   the logo with it, so the row keeps some air. */
@media (max-width: 21.5em) {
  .site-title {
    font-size: 1.25em;
  }
}

/* Print: browsers drop backgrounds, which would leave light code text on white
   paper, and cut long lines. Keep the dark block and wrap. */
@media print {
  pre {
    white-space: pre-wrap;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
