@font-face {
  font-family: "Source Serif 4";
  src: url("/fonts/source-serif-4-normal.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("/fonts/source-serif-4-italic.woff2") format("woff2");
  font-weight: 200 900;
  font-style: italic;
  font-display: swap;
}

:root {
  --paper: #fbf7ef;
  --ink: #2b241c;
  --muted: #6b5f52;
  --rule: #e6ddcf;
  --accent: #a3401a;
  --accent-hover: #7f2f10;
  --code-bg: #f3ecdf;
  --serif: "Source Serif 4", Georgia, serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Code", Menlo, Consolas, monospace;
  --measure: 40rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1c1915;
    --ink: #ece4d6;
    --muted: #a99c8b;
    --rule: #3a342c;
    --accent: #f0915f;
    --accent-hover: #ffb48c;
    --code-bg: #26221c;
    color-scheme: dark;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.1875rem);
  line-height: 1.65;
  font-optical-sizing: auto;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
  max-width: var(--measure);
  margin-inline: auto;
  padding: clamp(1.5rem, 5vw, 3.5rem) 1.25rem 3rem;
}

::selection { background: var(--accent); color: var(--paper); }

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color 120ms ease-out, text-decoration-thickness 120ms ease-out;
}
a:hover { color: var(--accent-hover); text-decoration-thickness: 2px; }
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -3rem;
  background: var(--ink);
  color: var(--paper);
  padding: 0.4rem 0.8rem;
}
.skip:focus { top: 1rem; }
.skip:hover { color: var(--paper); }

/* Header */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  margin-bottom: clamp(2.5rem, 7vw, 4.5rem);
}
.site-name {
  color: var(--ink);
  font-weight: 650;
  font-size: 1.15em;
  text-decoration: none;
  letter-spacing: -0.01em;
}
.site-name:hover { color: var(--accent); }
.site-header ul {
  display: flex;
  gap: 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-header nav a { text-decoration: none; }
.site-header nav a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent); }

/* Typography */
h1, h2, h3 {
  line-height: 1.2;
  letter-spacing: -0.015em;
  text-wrap: balance;
  font-weight: 650;
}
h1 { font-size: clamp(2rem, 1.6rem + 1.8vw, 2.6rem); margin: 0 0 1rem; }
h2 { font-size: 1.4em; margin: 2.5em 0 0.6em; }
h3 { font-size: 1.15em; margin: 2em 0 0.5em; }
p, ul, ol, blockquote, pre { margin: 0 0 1.15em; }
.prose > :first-child { margin-top: 0; }
.intro p:first-of-type { font-size: 1.12em; }

blockquote {
  margin-inline: 0;
  padding-left: 1.1rem;
  border-left: 1px solid var(--accent);
  color: var(--muted);
  font-style: italic;
}

hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5rem 0; }

img { max-width: 100%; height: auto; }

/* Code */
code, pre { font-family: var(--mono); font-size: 0.85em; }
:not(pre) > code {
  background: var(--code-bg);
  padding: 0.1em 0.3em;
  border-radius: 3px;
}
pre {
  background: var(--code-bg);
  padding: 1rem 1.15rem;
  border-radius: 6px;
  overflow-x: auto;
  line-height: 1.55;
}
pre code { font-size: 1em; }
.token.comment, .token.prolog { color: var(--muted); font-style: italic; }
.token.keyword, .token.boolean, .token.important { color: var(--accent); }
.token.string, .token.template-string { color: #4f6b2e; }
.token.function, .token.class-name { color: #3d5a80; }
.token.number { color: #8a4f7d; }
@media (prefers-color-scheme: dark) {
  .token.string, .token.template-string { color: #a9c47f; }
  .token.function, .token.class-name { color: #93b4dc; }
  .token.number { color: #d39ac6; }
}

/* Post lists */
.recent { margin-top: 3.5rem; }
.recent h2 { margin-top: 0; font-size: 1.1em; color: var(--muted); font-weight: 600; }
.page-title { margin-bottom: 2rem; }
.post-list { list-style: none; margin: 0; padding: 0; }
.post-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.15rem 1rem;
  padding: 0.7rem 0;
  border-top: 1px solid var(--rule);
}
.post-list li:last-child { border-bottom: 1px solid var(--rule); }
.post-list a { font-weight: 550; text-decoration: none; }
.post-list a:hover { text-decoration: underline; }
.post-list time {
  color: var(--muted);
  font-size: 0.88em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Post */
.post header { margin-bottom: 2rem; }
.post h1 { margin-bottom: 0.4rem; }
.meta { color: var(--muted); font-size: 0.92em; margin: 0; }
.back { margin-top: 3rem; }

/* Footer */
.site-footer {
  margin-top: 4.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.85em;
}
.site-footer p { margin: 0 0 0.3rem; }
