/*
 * jazco.dev. Poole's palette and type (by @mdo, MIT,
 * https://github.com/poole/poole) on a wider layout with a contents rail.
 * Colors are custom properties; dark mode only swaps them, by the OS unless `data-theme` says otherwise.
 */

:root {
  color-scheme: light dark;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: Menlo, Monaco, Consolas, monospace;

  --bg: #fff;
  --text: #515151;
  --heading: #313131;
  --soft: #717171;
  --muted: #9a9a9a;
  --link: #268bd2;
  --link-hover: #1a6fa8;
  --rule: #eee;
  --rule-soft: #f3f3f3;
  --badge: #6a6a6a;
  --badge-rule: #e3e3e3;
  --anchor: #c4c4c4;
  --code: #bf616a;
  --code-bg: #f9f9f9;
  --code-rule: #ececec;
  --code-label: #8a8a8a;
  --quote: #7a7a7a;
  --figure-bg: #fff;

  --tk-comment: #9a9a9a;
  --tk-keyword: #7a3e9d;
  --tk-name: #1a6fa8;
  --tk-string: #2a7d4f;
  --tk-number: #a3550f;
  --tk-error: #c0392b;

  --gutter: 24px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #17191c;
    --text: #c3c6cb;
    --heading: #e9ebee;
    --soft: #a4a9b0;
    --muted: #868c94;
    --link: #5eaae4;
    --link-hover: #8cc3ee;
    --rule: #2a2e33;
    --rule-soft: #23262a;
    --badge: #a4a9b0;
    --badge-rule: #363a40;
    --anchor: #4b5057;
    --code: #e0939a;
    --code-bg: #1e2125;
    --code-rule: #2c3035;
    --code-label: #868c94;
    --quote: #9aa0a7;
    /* Charts and screenshots were made on white; dimmed a little to sit in the dark page. */
    --figure-bg: #fff;
    --figure-dim: brightness(0.9);

    --tk-comment: #7b828a;
    --tk-keyword: #c5a3e0;
    --tk-name: #82b8e6;
    --tk-string: #8fc9a1;
    --tk-number: #e2a874;
    --tk-error: #ef8a80;
  }
}

:root[data-theme="light"] { color-scheme: light; }

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #17191c;
  --text: #c3c6cb;
  --heading: #e9ebee;
  --soft: #a4a9b0;
  --muted: #868c94;
  --link: #5eaae4;
  --link-hover: #8cc3ee;
  --rule: #2a2e33;
  --rule-soft: #23262a;
  --badge: #a4a9b0;
  --badge-rule: #363a40;
  --anchor: #4b5057;
  --code: #e0939a;
  --code-bg: #1e2125;
  --code-rule: #2c3035;
  --code-label: #868c94;
  --quote: #9aa0a7;
  /* Charts and screenshots were made on white; dimmed a little to sit in the dark page. */
  --figure-bg: #fff;
  --figure-dim: brightness(0.9);

  --tk-comment: #7b828a;
  --tk-keyword: #c5a3e0;
  --tk-name: #82b8e6;
  --tk-string: #8fc9a1;
  --tk-number: #e2a874;
  --tk-error: #ef8a80;
}

/* Base */

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

html {
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body { color: var(--text); background: var(--bg); }

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; border-radius: 3px; }

h1, h2, h3, h4, h5, h6 { color: var(--heading); font-weight: 600; text-rendering: optimizeLegibility; }

strong { color: var(--heading); }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 var(--gutter); }
.wrap.wide { max-width: 1120px; }

/* Header and footer */

.site-header { border-bottom: 1px solid var(--rule); }
.site-header .wrap {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: 12px 32px; padding-top: 28px; padding-bottom: 22px;
}
.brand { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.site-title { font-size: 26px; font-weight: 700; color: var(--heading); letter-spacing: -0.01em; }
.site-title:hover { color: var(--heading); text-decoration: none; }
.tagline { font-size: 17px; color: var(--muted); }
.site-nav { display: flex; gap: 22px; font-size: 16px; }
.site-nav a { color: var(--soft); }
.site-nav a[aria-current] { color: var(--heading); font-weight: 600; }
.site-nav { align-items: center; }
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; margin: -10px -12px -10px -6px; padding: 0;
  border: 0; background: none; color: var(--soft); cursor: pointer; border-radius: 6px;
}
.theme-toggle[hidden] { display: none; }
.theme-toggle:hover { color: var(--heading); }
.theme-toggle:focus-visible { outline: 2px solid var(--link); outline-offset: -4px; }
.theme-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle[data-to="dark"] .sun, .theme-toggle[data-to="light"] .moon { display: none; }

.site-header .wrap.wide { padding-top: 22px; padding-bottom: 18px; }
.site-header .wide .site-title { font-size: 22px; letter-spacing: 0; }
.site-header .wide .tagline { font-size: 16px; }

.site-footer { border-top: 1px solid var(--rule); margin-top: 24px; }
.site-footer .wrap {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px;
  padding-top: 22px; padding-bottom: 40px; font-size: 15px; color: var(--muted);
}
.footer-links { display: flex; gap: 20px; }

/* Home */

.featured { padding: 48px 0 44px; border-bottom: 1px solid var(--rule); }
.kicker { font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 10px; }
.featured h1 { margin: 0 0 14px; font-size: 40px; line-height: 1.2; font-weight: 700; letter-spacing: -0.015em; max-width: 860px; }
.featured h1 a { color: var(--heading); }
.lede { margin: 0 0 18px; font-size: 20px; max-width: 760px; }
.read { font-size: 17px; font-weight: 600; }

.year { padding-top: 36px; }
.year h2 { margin: 0 0 8px; font-size: 15px; color: var(--muted); letter-spacing: 0.06em; }
.post-list { list-style: none; margin: 0; padding: 0; }
.post-list li {
  display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 4px 20px;
  padding: 14px 0; border-bottom: 1px solid var(--rule-soft);
}
.post-list time { color: var(--muted); font-size: 15px; padding-top: 3px; }
.post-link { font-size: 20px; font-weight: 600; line-height: 1.4; color: var(--heading); }
.post-list p {
  margin: 4px 0 0; font-size: 16px; color: var(--soft);
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
}

.series {
  display: inline-block; vertical-align: 0.2em; margin-left: 6px; padding: 1px 7px;
  font-size: 13px; font-weight: 400; line-height: 1.5; letter-spacing: 0; text-transform: none;
  color: var(--badge); border: 1px solid var(--badge-rule); border-radius: 4px; white-space: nowrap;
}
.featured h1 .series { vertical-align: 0.6em; }

/* Article */

.article-layout { display: flex; gap: 56px; align-items: flex-start; padding: 56px 0 40px; }
.article-layout > .post { flex: 1 1 auto; min-width: 0; max-width: 760px; }

.post-title { margin: 0 0 14px; font-size: 42px; line-height: 1.18; font-weight: 700; letter-spacing: -0.015em; }
.post-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 18px; font-size: 15px; color: var(--muted); margin-bottom: 36px; }
.post-meta a { color: var(--soft); }
.post-meta .series { margin-left: 0; vertical-align: baseline; }

.post-body { font-size: 19px; line-height: 1.7; overflow-wrap: break-word; }
.post-body p, .post-body ul, .post-body ol, .post-body dl, .post-body table { margin: 0 0 22px; }
.post-body li + li { margin-top: 4px; }
.post-body h1, .post-body h2, .post-body h3, .post-body h4, .post-body h5, .post-body h6 { line-height: 1.3; scroll-margin-top: 24px; }
.post-body h1 { margin: 48px 0 14px; font-size: 32px; }
.post-body h2 { margin: 48px 0 14px; font-size: 28px; }
.post-body h3 { margin: 40px 0 12px; font-size: 22px; }
.post-body h4, .post-body h5, .post-body h6 { margin: 32px 0 10px; font-size: 19px; }

/* The # is drawn here so the heading's text is only its words. */
.anchor { margin-left: 10px; font-size: 0.72em; font-weight: 400; color: var(--anchor); opacity: 0; }
.anchor::before { content: "#"; }
.anchor:hover { color: var(--link); text-decoration: none; }
:is(h1, h2, h3, h4, h5, h6):hover > .anchor, .anchor:focus-visible { opacity: 1; }
@media (hover: none) { .anchor { display: none; } }

.post-body code { font-family: var(--mono); font-size: 0.85em; color: var(--code); background: var(--code-bg); padding: 2px 5px; border-radius: 3px; }
.post-body :is(h1, h2, h3, h4, h5, h6) code { background: none; padding: 0; }

.post-body blockquote { margin: 0 0 22px; padding: 4px 0 4px 20px; color: var(--quote); border-left: 3px solid var(--rule); }
.post-body blockquote > :last-child { margin-bottom: 0; }

.post-body hr { margin: 40px 0; border: 0; border-top: 1px solid var(--rule); }

.post-body table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; font-size: 16px; }
.post-body td, .post-body th { padding: 6px 12px; border: 1px solid var(--rule); }
.post-body th { text-align: left; color: var(--heading); }
.post-body tbody tr:nth-child(odd) td { background: var(--code-bg); }

.post-body img { max-width: 100%; height: auto; }
.post-body picture { display: contents; }

.post-body figure { margin: 32px 0 34px; }
.zoom { display: block; overflow: hidden; border: 1px solid var(--rule); border-radius: 6px; background: var(--figure-bg); }
.zoom img { display: block; margin: 0 auto; filter: var(--figure-dim, none); }
.post-body figcaption { margin-top: 10px; font-size: 15px; line-height: 1.5; color: var(--muted); text-align: center; }

.footnotes { margin-top: 48px; font-size: 16px; color: var(--soft); }
.footnotes hr { margin: 0 0 20px; }
a.footnote-ref, a.footnote-backref { font-weight: 600; }

/* Code blocks. A wide one scrolls inside its box; it never wraps or widens the page. */

.highlight { margin: 0 0 26px; border: 1px solid var(--code-rule); border-radius: 6px; background: var(--code-bg); overflow: hidden; }
.code-bar {
  display: flex; align-items: center; min-height: 43px; padding: 6px 8px 6px 14px;
  border-bottom: 1px solid var(--code-rule); font-size: 13px; color: var(--code-label);
}
.code-bar::before { content: attr(data-lang); font-family: var(--mono); }
.copy {
  margin-left: auto; min-height: 30px; padding: 4px 10px; cursor: pointer;
  font: inherit; font-size: 13px; color: var(--soft); background: transparent;
  border: 1px solid transparent; border-radius: 4px;
}
.copy:hover { border-color: var(--code-rule); background: var(--bg); }
.highlight pre {
  margin: 0; padding: 14px 16px; overflow-x: auto; white-space: pre;
  font-family: var(--mono); font-size: 14.5px; line-height: 1.6; color: var(--heading);
  scrollbar-width: thin; scrollbar-color: var(--code-rule) transparent;
}
.highlight pre code { padding: 0; font-size: inherit; color: inherit; background: none; }

/* Token colors by Pygments class name, which chroma uses. */
.highlight :is(.c, .ch, .cm, .c1, .cs, .cp, .cpf) { color: var(--tk-comment); font-style: italic; }
.highlight :is(.k, .kc, .kd, .kn, .kp, .kr, .kt, .ow) { color: var(--tk-keyword); }
.highlight :is(.nf, .fm, .nc, .nn, .na, .nt, .nb, .bp, .nd) { color: var(--tk-name); }
.highlight :is(.s, .sa, .sb, .sc, .dl, .sd, .s2, .se, .sh, .si, .sx, .sr, .s1, .ss) { color: var(--tk-string); }
.highlight :is(.m, .mb, .mf, .mh, .mi, .il, .mo) { color: var(--tk-number); }
.highlight :is(.gp, .go) { color: var(--tk-comment); }
.highlight .gd { color: var(--tk-error); }
.highlight .gi { color: var(--tk-string); }
.highlight .ge { font-style: italic; }
.highlight .gs { font-weight: 600; }
.highlight .err { color: var(--tk-error); }

/* On this page */

.toc-rail {
  flex: 0 0 240px; position: sticky; top: 32px; max-height: calc(100vh - 64px); overflow-y: auto;
  padding-top: 8px; font-size: 15px; line-height: 1.5;
}
.toc-label { margin-bottom: 12px; font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }
.toc-rail ol {
  list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--rule);
  display: flex; flex-direction: column; gap: 9px;
}
.toc-rail li { position: relative; }
.toc-rail a { color: var(--soft); }
.toc-rail a[aria-current] { color: var(--link); font-weight: 600; }
.toc-rail a[aria-current]::before { content: ""; position: absolute; left: -16px; top: 0; bottom: 0; border-left: 2px solid var(--link); }
.toc-rail .toc-h3 { padding-left: 14px; }
.back-top { display: inline-block; margin-top: 20px; font-size: 14px; color: var(--muted); }

.toc-inline { display: none; margin: 0 0 24px; border: 1px solid var(--rule); border-radius: 8px; }
.toc-inline summary { padding: 12px 14px; font-size: 15px; font-weight: 600; color: var(--heading); cursor: pointer; }
.toc-inline ol { list-style: none; margin: 0; padding: 0 14px 6px; font-size: 15px; line-height: 1.5; }
.toc-inline a { display: block; padding: 10px 0; }
.toc-inline .toc-h3 { padding-left: 14px; }

@media (max-width: 1023px) {
  .toc-rail { display: none; }
  .toc-inline { display: block; }
}

/* Older and newer */

.post-nav {
  margin-top: 56px; padding-top: 28px; border-top: 1px solid var(--rule);
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px;
}
.post-nav a { display: block; padding: 16px 18px; border: 1px solid var(--rule); border-radius: 8px; color: var(--heading); }
.post-nav a:hover { border-color: var(--link); text-decoration: none; }
.post-nav .older { grid-column: 1; }
.post-nav .newer { grid-column: 2; text-align: right; }
.post-nav .dir { display: block; font-size: 14px; color: var(--muted); }
.post-nav .t { display: block; font-size: 17px; font-weight: 600; line-height: 1.4; }

/* 404 */

.not-found { padding: 72px 0; text-align: center; }
.not-found h1 { margin: 0 0 12px; font-size: 64px; line-height: 1; }

/* Phones */

@media (max-width: 640px) {
  :root { --gutter: 16px; }
  html { font-size: 17px; }

  .site-header .wrap, .site-header .wrap.wide { align-items: center; flex-wrap: nowrap; gap: 12px; padding-top: 4px; padding-bottom: 4px; }
  .site-title, .site-header .wide .site-title { font-size: 18px; }
  .tagline, .nav-bsky { display: none; }
  .site-nav { gap: 4px; font-size: 15px; margin-right: -8px; }
  .site-nav a { padding: 10px 8px; }

  .site-footer .wrap { gap: 10px; padding-top: 8px; padding-bottom: 24px; font-size: 14px; align-items: center; }
  .footer-links { gap: 16px; }
  .footer-links a { padding: 10px 0; }

  .featured { padding: 32px 0; }
  .featured h1 { font-size: 29px; }
  .lede { font-size: 18px; }
  .read { display: inline-block; padding: 10px 0; }
  .year { padding-top: 28px; }
  .post-list li { grid-template-columns: minmax(0, 1fr); gap: 2px; padding: 12px 0; }
  .post-list time { padding-top: 0; font-size: 14px; }
  .post-link { font-size: 18px; }

  .article-layout { padding: 28px 0 24px; }
  .post-title { font-size: 29px; line-height: 1.2; letter-spacing: -0.01em; margin-bottom: 10px; }
  .post-meta { gap: 4px 14px; font-size: 14px; margin-bottom: 20px; }
  .post-meta a { padding: 10px 0; margin: -10px 0; }

  .post-body { font-size: 17px; line-height: 1.65; }
  .post-body p, .post-body ul, .post-body ol, .post-body dl, .post-body table { margin-bottom: 18px; }
  .post-body h2 { margin: 34px 0 10px; font-size: 23px; }
  .post-body h3 { margin: 30px 0 10px; font-size: 20px; }
  .post-body h4, .post-body h5, .post-body h6 { margin: 26px 0 8px; font-size: 17px; }

  .post-body > figure { margin: 22px calc(-1 * var(--gutter)) 24px; }
  .post-body > figure .zoom { border-radius: 0; border-left: 0; border-right: 0; }
  .post-body > figure figcaption { margin: 8px var(--gutter) 0; font-size: 14px; text-align: left; }

  .post-body > .highlight { margin: 0 calc(-1 * var(--gutter)) 22px; border-radius: 0; border-left: 0; border-right: 0; }
  .code-bar { min-height: 45px; padding: 0 6px 0 16px; }
  .copy { min-height: 44px; padding: 0 12px; border: 0; }
  .highlight pre { padding: 12px 16px; font-size: 13.5px; }

  .post-nav { margin-top: 36px; padding-top: 20px; display: flex; flex-direction: column; gap: 10px; }
  .post-nav a { padding: 12px 14px; }
  .post-nav .newer { order: -1; text-align: left; }
  .post-nav .dir { font-size: 13px; }
  .post-nav .t { font-size: 16px; }
}

@media (max-width: 640px) and (hover: none) {
  .post-body > figure figcaption::after { content: " · tap to zoom"; }
}
