:root {
  --paper: #F7F3EA;
  --paper2: #F1EBDD;
  --ink: #1F1D1A;
  --ink2: #3A3630;
  --mute: #6B655B;
  --rule: #E2DACB;
  --red: #C8452D;
  --teal: #2F6F6A;
  color-scheme: light;
}

html.night {
  --paper: #1C1A17;
  --paper2: #26231E;
  --ink: #E8DFCC;
  --ink2: #CFC5B0;
  --mute: #9A9080;
  --rule: #3A352D;
  --red: #E07A5F;
  --teal: #7FB5AE;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 19.5px/1.62 Newsreader, Georgia, "Iowan Old Style", serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--teal);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

nav.top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px 18px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 14px;
}

.wordmark {
  font-family: Newsreader, Georgia, serif;
  font-weight: 400;
  font-style: normal;
  font-size: 22px;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}

.wordmark i {
  color: var(--red);
  font-style: italic;
  font-weight: 450;
}

.nav-links {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px 18px;
  justify-content: flex-end;
}

.nav-links a {
  font: 500 12px "IBM Plex Mono", ui-monospace, monospace;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mute);
  text-decoration: none;
}

.nav-links a.on { color: var(--red); }

.mode {
  font: 500 12px "IBM Plex Mono", ui-monospace, monospace;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mute);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 3px 9px;
  cursor: pointer;
}

.mode[aria-pressed="true"] {
  color: var(--red);
  border-color: var(--red);
}

h1 {
  font-weight: 400;
  font-size: 44px;
  line-height: 1.12;
  margin: 56px 0 16px;
  letter-spacing: -0.01em;
}

h1 em { color: var(--red); font-style: italic; }

.post h1 { font-size: 46px; margin-top: 48px; }

h2.k {
  font: 500 12px "IBM Plex Mono", ui-monospace, monospace;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--red);
  margin: 48px 0 6px;
}

.lede,
.home-intro > p:first-child,
.section-intro > p:first-child {
  font-size: 22px;
  line-height: 1.5;
  color: var(--ink2);
  margin: 0 0 0.4em;
}

.sub {
  font-size: 22px;
  font-style: italic;
  color: var(--ink2);
  margin: 0 0 18px;
}

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 16px;
  align-items: start;
  padding: 13px 0;
  border-bottom: 1px solid var(--rule);
}

.row .t {
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
}

.row p {
  margin: 2px 0 0;
  font-size: 17px;
  line-height: 1.45;
  color: var(--mute);
}

.d {
  font: 13px "IBM Plex Mono", ui-monospace, monospace;
  color: var(--mute);
  white-space: nowrap;
}

.more {
  margin: 18px 0 0;
}

.more a,
.link-label {
  font: 500 12px "IBM Plex Mono", ui-monospace, monospace;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mute);
  text-decoration: none;
}

.more a:hover,
.link-label:hover,
.nav-links a:hover,
.row .t:hover { color: var(--red); }

.tag {
  font: 11px "IBM Plex Mono", ui-monospace, monospace;
  color: var(--teal);
  border: 1px solid currentColor;
  border-radius: 2px;
  padding: 1px 6px;
  margin-left: 8px;
  text-decoration: none;
  white-space: nowrap;
  vertical-align: 2px;
}

.filters { margin: 22px 0 8px; }

.filters .tag {
  display: inline-block;
  margin: 0 6px 8px 0;
  font-size: 12px;
  padding: 3px 8px;
}

.tag.on {
  background: var(--teal);
  color: var(--paper);
}

.src {
  font: 12px "IBM Plex Mono", ui-monospace, monospace;
  color: var(--mute);
  margin-left: 8px;
  text-decoration: none;
  white-space: nowrap;
}

.meta {
  font: 12px "IBM Plex Mono", ui-monospace, monospace;
  color: var(--mute);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 10px 0;
  margin-bottom: 28px;
}

.meta a {
  color: var(--teal);
  text-decoration: none;
  letter-spacing: 0.04em;
}

.call {
  margin: 48px 0 0;
  padding: 22px 24px;
  border-left: 3px solid var(--red);
  background: var(--paper2);
  font-size: 18px;
  line-height: 1.5;
}

.btn {
  display: inline-block;
  font: 500 13px "IBM Plex Mono", ui-monospace, monospace;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 16px;
  border-radius: 2px;
  text-decoration: none;
  margin: 12px 8px 0 0;
}

.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--ink);
}

.project {
  padding: 28px 0;
  border-bottom: 1px solid var(--rule);
}

.project .row {
  border: 0;
  padding: 0;
}

.project h2 {
  margin: 0;
  font-size: 28px;
  font-weight: 500;
  line-height: 1.2;
}

.project h2 a {
  color: var(--ink);
  text-decoration: none;
}

.project-line {
  font-size: 21px;
  line-height: 1.4;
  margin: 0.35em 0 0;
}

.content p { margin: 0 0 1.1em; }

.content h2 {
  font-weight: 500;
  font-size: 28px;
  line-height: 1.25;
  margin: 44px 0 10px;
}

.content h3 {
  font-weight: 600;
  font-size: 22px;
  line-height: 1.3;
  margin: 36px 0 8px;
}

.content ul,
.content ol { padding-left: 1.25em; }

.content li { margin: 0.35em 0; }

.content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.3em 0;
}

.content blockquote {
  margin: 1.5em 0;
  padding: 0 0 0 22px;
  border-left: 3px solid var(--red);
  font-size: 24px;
  line-height: 1.35;
  font-style: italic;
  color: var(--ink);
}

.content > blockquote:first-child {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 13.5px;
  font-style: normal;
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: 0;
  color: var(--mute);
  border: 1px dashed var(--rule);
  padding: 12px 14px;
  margin: 0 0 28px;
}

.home-intro blockquote {
  margin: 28px 0 0;
  padding: 0 0 0 16px;
  border-left: 2px solid var(--rule);
  font-size: 15.5px;
  font-style: normal;
  line-height: 1.5;
  color: var(--mute);
}

.content pre,
.content code {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}

.content code {
  font-size: 0.84em;
  background: var(--paper2);
  padding: 0.08em 0.32em;
}

.content pre {
  background: var(--paper2);
  border: 1px solid var(--rule);
  padding: 16px 18px;
  overflow: auto;
  font-size: 14px;
  line-height: 1.6;
  border-radius: 2px;
}

.content pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

.content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 17px;
  margin: 1.2em 0;
}

.content th,
.content td {
  border-bottom: 1px solid var(--rule);
  padding: 8px 12px 8px 0;
  text-align: left;
  vertical-align: top;
}

.content hr { border: 0; border-top: 1px solid var(--rule); margin: 2em 0; }

.content embed,
.content iframe,
.content video { max-width: 100%; }

.katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.2em 0;
}

.footnotes {
  font-size: 15.5px;
  color: var(--mute);
  border-top: 1px solid var(--rule);
  margin-top: 40px;
  padding-top: 4px;
}

.footnotes hr { display: none; }

sup,
.footnote-ref {
  color: var(--red);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 11px;
  font-weight: 500;
  text-decoration: none;
}

footer.site {
  margin-top: 64px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
  font: 12px "IBM Plex Mono", ui-monospace, monospace;
  color: var(--mute);
  display: flex;
  justify-content: space-between;
  gap: 12px 18px;
  flex-wrap: wrap;
}

footer.site a {
  color: var(--mute);
  text-decoration: none;
}

footer.site a:hover { color: var(--ink); }

.footer-links a + a::before {
  content: " · ";
  color: var(--mute);
}

html.night .content pre,
html.night .content code {
  background: var(--paper2);
  color: var(--ink);
}

html.night .content pre span {
  color: var(--ink) !important;
  background: transparent !important;
}

@media (max-width: 600px) {
  body { font-size: 18.5px; }
  h1 { font-size: 34px; margin-top: 36px; }
  .post h1 { font-size: 34px; }
  .lede,
  .home-intro > p:first-child,
  .section-intro > p:first-child,
  .sub { font-size: 20px; }
  .nav-links { gap: 8px 12px; }
  .nav-links a { font-size: 11px; }
  .content h2,
  .project h2 { font-size: 24px; }
  .content blockquote { font-size: 21px; }
  .call { padding: 18px 16px; }
  footer.site { flex-direction: column; }
}
