:root {
  --text-0: rgba(255, 255, 255, 0.87);
  --text-1: rgba(255, 255, 255, 0.60);
  --bg-0: #121212;
  --bg-1: rgba(255, 255, 255, 0.05);
  --bg-2: rgba(255, 255, 255, 0.12);
  --accent: #672f4d;
  --keyword: #b794f6;
  --string: #89a2f6;
  --literal: #f88478;
  --type: #f8819c;
}

* { margin: 0; padding: 0; box-sizing: border-box; color: inherit; text-decoration: inherit; }

html {
  background: var(--bg-0);
  color: var(--text-0);
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
}

body {
  max-width: 944px;
  margin: 0 auto;
  padding: 0 24px;
  font-family: "Charter", "Bitstream Charter", Georgia, serif;
  background-image: radial-gradient(circle at center, var(--bg-1) 25%, transparent 25%);
  background-size: 10px 10px;
}

@media all and (min-width: 640px) { html { font-size: 16.5px; } }
@media all and (min-width: 720px) { html { font-size: 17px; } }
@media all and (min-width: 960px) { html { font-size: 18px; } }

header, h1, h2, h3 { font-family: "Space Grotesk", Helvetica, sans-serif; }

code { font-family: "Source Code Pro", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-weight: 600; }

body > header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 2em 0;
}
.brand { font-family: "Space Grotesk", Helvetica, sans-serif; font-weight: 700; font-size: 1.5rem; }

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

p, ul, ol { line-height: 1.5; margin-bottom: 1rem; }

h1, h2, h3 { position: relative; margin: 1.2rem 0 0.2rem 0; }
h1 { font-size: 1.3em; }
h2 { font-size: 1.2em; }
h3 { font-size: 1.1em; }

p a { text-decoration: underline; }

body > article { max-width: 40rem; margin-inline: auto; }

.post-title { font-size: 2rem; margin-bottom: 12px; }

.author-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0 12px;
  color: var(--text-1);
}
.author { display: inline-flex; align-items: center; gap: 8px; color: var(--text-0); }
.avatar { width: 48px; height: 48px; border-radius: 50%; background: var(--bg-1); display: block; }
.post-date { font-size: 0.9rem; }

.post-rule { width: 128px; border: 2.5px solid var(--accent); margin-top: 12px; }

.entry { margin-bottom: 2rem; }
.entry-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.entry-title { font-size: 1.2em; }
.brand:hover, .author:hover .handle, .entry-title a:hover, .post-body a:hover, .back a:hover {
  text-decoration: underline 2px var(--accent);
  text-underline-offset: 0.2em;
}
.entry-date { font-size: 0.85rem; color: var(--text-1); font-variant-numeric: tabular-nums; }
.entry-excerpt { color: var(--text-1); margin-top: 0.25rem; }

.post-body h2 { padding-left: 1.15rem; }
.post-body h2::before {
  content: "#";
  color: var(--accent);
  position: absolute;
  left: 0;
}

pre {
  border: 1px solid var(--bg-2);
  border-left: 2px solid var(--accent);
  background: #161619;
  margin: 1.25rem 0 1.5rem;
  padding: 18px 22px;
  overflow-x: auto;
  scrollbar-color: var(--accent) transparent;
  scrollbar-width: thin;
}
pre::-webkit-scrollbar { height: 6px; }
pre::-webkit-scrollbar-thumb { background: var(--accent); }
pre code { font-size: 14.5px; line-height: 1.7; font-weight: 650; tab-size: 2; }
@media screen and (min-width: 640px) { code { font-size: 15px; } }

:not(pre) > code { background: var(--bg-1); padding: 2px 4px; }

.tok-kw { color: var(--keyword); font-weight: bold; }
.tok-ty { color: var(--type); }
.tok-num { color: var(--literal); }
.tok-str { color: var(--string); }
.tok-com { color: var(--text-1); }
.tok-op { color: var(--keyword); }

table.nums {
  border-collapse: collapse;
  margin-bottom: 1rem;
  font-family: "Source Code Pro", ui-monospace, monospace;
  font-weight: 600;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

svg.fig { display: block; margin: 1rem auto; }
svg.fig text { font-family: "Latin Modern Roman", Georgia, serif; fill: currentColor; }
img.fig { display: block; margin: 0 auto; max-width: 100%; height: auto; }
.diagram { margin: 1.7rem 0; }
.diagram img { width: 100%; background: transparent; filter: invert(1); }
.diagram figcaption { margin-top: 0.6rem; font-size: 0.85rem; font-style: italic; line-height: 1.45; color: var(--text-1); }
table.nums th, table.nums td { padding: 0.15rem 1.2rem 0.15rem 0; text-align: right; color: var(--text-1); }
table.nums th { font-weight: 600; border-bottom: 1px solid var(--bg-2); }

.katex { color: inherit; font-size: 1.06em; }
.katex-display { margin: 0.4rem 0 1rem; overflow-x: auto; overflow-y: hidden; }

.back { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--accent); }

@media screen and (max-width: 640px) {
  pre { margin-left: 0; }
}
