/* CSS Reset */
html, body, div, span, h1, h2, h3, h4, p, a, em, img, ol, ul, li {
  border: 0;
  font-weight: inherit;
  font-style: inherit;
  font-size: 100%;
  font-family: inherit;
  vertical-align: baseline;
  margin: 0;
  padding: 0;
}

*, *:before, *:after {
  box-sizing: inherit;
}

/* Self-hosted fonts (SIL OFL; licenses in /fonts). Filenames carry a content
   hash, so they can be cached forever. unicode-range means a subset is only
   downloaded when the page uses it. */
@font-face {
  font-family: "DM Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/dm-mono-normal-latin-fd7521f3.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "DM Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/dm-mono-normal-latin-ext-7f8712cb.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Source Serif 4";
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/source-serif-4-italic-latin-4dbf6638.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Source Serif 4";
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/source-serif-4-italic-latin-ext-fa851a31.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Source Serif 4";
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/source-serif-4-italic-greek-5e867ceb.woff2") format("woff2");
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}

@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/source-serif-4-normal-latin-8e38e3fb.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/source-serif-4-normal-latin-ext-231f594a.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/source-serif-4-normal-greek-303d6086.woff2") format("woff2");
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}

/* Warm paper palette. Every color below comes from these tokens so dark
   mode only swaps values. */
:root {
  color-scheme: light dark;
  --bg: #fbfaf7;
  --fg: #1a1a1a;
  --ink: #333;
  --muted: #6b6a64;
  --faint: #8f8d85;
  --rule: #d4d3cb;
  --rule-strong: #c0bdad;
  --surface: #f2f0ea;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161513;
    --fg: #e6e3dc;
    --ink: #cfccc4;
    --muted: #a5a299;
    --faint: #7d7a72;
    --rule: #3a3833;
    --rule-strong: #5c5950;
    --surface: #211f1c;
  }
}

html {
  box-sizing: border-box;
  text-align: justify;
  font-family: "Source Serif 4", georgia, serif;
  color: var(--fg);
  background: var(--bg);
  height: 100%;
  width: 100%;
}

body {
  display: flex;
  flex-flow: column nowrap;
  justify-content: center;
}

h2 {
  font-size: 1.7em;
  font-variant: small-caps;
  text-align: center;
  width: 80%;
  margin: 1em auto 0;
  border-top: 1px solid var(--muted);
  padding: 0.8em 0 1em 0;
}

h3 {
  font-size: 1.3em;
  margin: 0.5em 0;
  padding: 0.5em 0 1em 0;
  text-align: center;
}

h4 {
  font-size: 1.1em;
  margin: 0.1em 0;
  padding: 0.2em 0;
  font-weight: bold;
}

blockquote {
  width: 100%;
  margin: 0.6em auto;
  padding-left: 0.2em;
  font-size: 1.1em;
  font-style: italic;
  display: flex;
  flex-flow: row nowrap;
}

blockquote > p {
  padding-left: 0.8em;
  border-left: 3px solid var(--rule);
  margin: auto;
}

ul, ol {
  list-style-position: inside;
  margin: 1em 0 1em 2em;
  text-align: left;
}

li {
  margin-bottom: 0.7em;
}

em {
  font-style: italic;
}

img {
  margin: auto;
}

/* Monochrome links: text color with a light gray underline that darkens
   on hover. */
a, a:visited {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--rule-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: text-decoration-color 0.15s;
}

a:hover {
  text-decoration-color: currentColor;
}

/* Source icons after links to common sites, gwern-style. Inline-block keeps
   the link underline off the icon; text-indent is reset because list items
   and indented paragraphs would otherwise shift it. */
.post a[href*="wikipedia.org"]::after,
.post a[href*="github.com"]::after,
.post a[href*="youtube.com"]::after,
.post a[href*="youtu.be"]::after,
.post a[href$=".pdf"]::after {
  display: inline-block;
  margin-left: 0.15em;
  text-indent: 0;
  color: var(--muted);
}

.post a[href*="wikipedia.org"]::after {
  content: "W";
  font-size: 0.75em;
}

.post a[href$=".pdf"]::after {
  content: "PDF";
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 0.55em;
  vertical-align: 0.3em;
}

/* SVG marks are masks so they take the theme's muted color. */
.post a[href*="github.com"]::after,
.post a[href*="youtube.com"]::after,
.post a[href*="youtu.be"]::after {
  content: "";
  width: 0.75em;
  height: 0.75em;
  vertical-align: -0.05em;
  background-color: var(--muted);
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}

.post a[href*="github.com"] {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8z'/%3E%3C/svg%3E");
}

.post a[href*="youtube.com"],
.post a[href*="youtu.be"] {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M23.5 6.2a3 3 0 0 0-2.1-2.1C19.5 3.6 12 3.6 12 3.6s-7.5 0-9.4.5A3 3 0 0 0 .5 6.2 31 31 0 0 0 0 12a31 31 0 0 0 .5 5.8 3 3 0 0 0 2.1 2.1c1.9.5 9.4.5 9.4.5s7.5 0 9.4-.5a3 3 0 0 0 2.1-2.1A31 31 0 0 0 24 12a31 31 0 0 0-.5-5.8zM9.6 15.6V8.4l6.2 3.6z'/%3E%3C/svg%3E");
}

/* Header and footer bars share the article column: .post is 40em at 1.2em,
   so 48rem keeps their edges aligned with the text. */
.site-header, .site-footer {
  display: flex;
  flex-flow: row wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem 1.5rem;
  width: 100%;
  max-width: 48rem;
  margin: 0 auto;
  padding: 1.5rem 20px;
}

.site-header {
  border-bottom: 1px solid var(--rule);
  margin-bottom: 1.5rem;
}

.site-header nav {
  display: flex;
  gap: 1.25rem;
}

.site-header nav a {
  text-underline-offset: 0.5em;
}

/* Language switch sits apart from the section links, after a thin rule. */
.site-header nav .lang-switch {
  padding-left: 1.25rem;
  border-left: 1px solid var(--rule);
  color: var(--muted);
}

.site-id {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

/* Same contact line as the footer bar, set small under the wordmark. */
.site-header .socials {
  font-size: 0.8rem;
  color: var(--faint);
}

.site-footer {
  border-top: 1px solid var(--rule);
  margin-top: 2rem;
  text-align: left;
}

.wordmark, .wordmark:visited {
  font-family: "Source Serif 4", georgia, serif;
  font-size: 1.8rem;
  text-decoration: none;
}

.site-footer .wordmark {
  font-size: 1.2rem;
}

footer {
  font-size: 0.8em;
  min-height: 200px;
  padding: 1em;
  color: var(--faint);
  text-align: center;
}

table {
  border-collapse: collapse;
}

td, th {
  border: 1px solid var(--rule);
  padding: 0.5rem;
  text-align: center;
}

tbody tr:nth-child(odd) {
  background: var(--surface);
}

/* openring.html is generated with hard-coded colors in an inline <style>
   that loads after this file; the footer prefix outranks it. */
footer .webring .article {
  background: var(--surface);
}

footer .webring .attribution {
  color: var(--muted);
}

/* Monospace for site chrome (header, metadata, footer); serif is for prose
   and titles. */
.site-header nav, .socials, .post-meta, .date, .site-footer {
  font-family: "DM Mono", ui-monospace, monospace;
}

.title {
  font-family: inherit;
  font-weight: 400;
  font-size: 3em;
  text-transform: capitalize;
}

.title a {
  text-decoration: none;
}

.title a:hover {
  text-decoration: underline;
  text-decoration-color: var(--rule-strong);
}

/* Horizontal rules with a centered ornament on the line. */
hr.section-ender, hr.eot {
  overflow: visible;
  padding: 0;
  border: none;
  color: var(--ink);
  text-align: center;
}

hr.section-ender {
  border-top: thick double var(--ink);
  margin-top: 0.9em;
}

hr.eot {
  border-top: medium double var(--ink);
  margin-top: 1.9em;
}

hr.section-ender:after, hr.eot:after {
  display: inline-block;
  position: relative;
  top: -0.7em;
  font-size: 1.6em;
  padding: 0 0.32em;
  background: var(--bg);
}

hr.section-ender:after {
  content: "§";
}

hr.eot:after {
  content: "␄";
  font-size: 2.6em;
}

/* Date and topics under a post title. */
.post-meta {
  font-size: 0.75em;
  color: var(--muted);
  text-align: center;
  margin: 0.2em 0 1.5em;
}

.masthead {
  display: flex;
  flex-flow: column nowrap;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-height: 64px;
  text-align: center;
  margin: auto;
}

.date {
  color: var(--faint);
  font-size: 0.9em;
  line-height: 2em;
}

.post {
  display: flex;
  flex-flow: column nowrap;
  min-width: 100px;
  /* About 70 characters per line, a comfortable reading measure. */
  max-width: 40em;
  padding: 0 20px;
  margin: 1em auto 4em;
  font-size: 1.2em;
}

.post p {
  line-height: 1.6em;
  letter-spacing: 0.02em;
  margin: 0.5em 0 0 0;
  -webkit-hyphens: auto;
  hyphens: auto;
  word-break: break-word;
}

.post p + p {
  margin-top: 1em;
}

/* Book-style body text: consecutive paragraphs are set off by a first-line
   indent, not a gap. Paragraphs inside quotes and lists keep the gap above. */
.post > p + p {
  margin-top: 0;
  text-indent: 1.5em;
}

/* A lead-in paragraph stands apart: the text after it gets a gap, not an
   indent. */
.post > p.lede + p {
  margin-top: 1em;
  text-indent: 0;
}

.post ul {
  list-style-type: disc;
  text-indent: -1em;
}

.post ul li {
  line-height: 1.3em;
  letter-spacing: 0.05em;
  margin: 0.5em 0 0 0;
  -webkit-hyphens: auto;
  hyphens: auto;
  word-break: break-word;
}

.post img {
  max-width: 100%;
  margin: auto;
  display: block;
}

ul.toc {
  text-align: center;
}

.toc li {
  display: inline-block;
}

.toc li:not(:last-child):after {
  content: " ⁂ ";
  padding-right: 1em;
}

.post pre {
  overflow-x: auto;
}

/* Fake shell session on the 404 page. */
.post pre.terminal {
  margin: 1em 0;
  padding: 1em;
  font-size: 0.85em;
  text-align: left;
  border: 1px solid var(--rule);
}

/* Spotify embed (flow-playlist). */
.responsive-iframe {
  width: 100%;
  height: 352px;
  border: 0;
}

/* Phones and narrow windows: wide tables scroll instead of widening the
   page. */
@media only screen and (max-width: 750px) {
  /* A flex item won't shrink below its widest child (tables, code) without
     an explicit cap. */
  .post {
    max-width: 100%;
  }

  .title {
    font-size: 2em;
  }

  .post table {
    display: block;
    overflow-x: auto;
  }
}

@media only screen and (min-device-width: 320px) and (max-device-width: 480px) {
  h2 {
    border-top: 3px solid var(--muted);
  }
}
