/* That's Isomorphic - generated by src/blog/gen. No JS. Always light. */

/* ---------- fonts (SIL OFL, see fonts/README.md) ---------- */

@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;
}

/* ---------- tokens ---------- */

:root {
  color-scheme: light;

  --sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, "JetBrains Mono",
          Consolas, "Liberation Mono", monospace;
  --serif: "Source Serif 4", Charter, "Iowan Old Style", Georgia, serif;

  --base: 1.1875rem;             /* body text size */
  --measure: 34;                 /* line length, in units of --base */

  --bg: #faf8f4;
  --fg: #2b2622;
  --muted: #71675e;
  --faint: #9b9188;
  --rule: #e7e1d7;
  --code-bg: #f2eee6;
  --figure-bg: #ffffff;

  --accent: #b4532a;             /* terracotta */

  --syn-kw: #8a3f8a;
  --syn-str: #4f7a28;
  --syn-com: #948a80;
  --syn-fn: #2a5f9e;
  --syn-num: #b4532a;
}

/* ---------- base ---------- */

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

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

body {
  margin: 0;
  padding: 0 1.25rem;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

main { display: block; }

.site-header,
.site-footer,
main {
  max-width: calc(var(--base) * var(--measure));
  margin-inline: auto;
}

a {
  color: var(--accent);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  transition: text-decoration-color 0.15s, color 0.15s;
}
a:hover {
  text-decoration-color: currentColor;
}

::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }

/* ---------- chrome ---------- */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding: 2.25rem 0 0;
}

.site-title {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 600;
  font-style: italic;
  letter-spacing: -0.01em;
  color: var(--fg);
  text-decoration: none;
}
.site-title:hover { color: var(--accent); }

.site-nav { display: flex; gap: 1.25rem; }
.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.875rem;
  letter-spacing: 0.02em;
}
.site-nav a:hover { color: var(--accent); }

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-top: 5rem;
  padding: 1.5rem 0 3rem;
  border-top: 1px solid var(--rule);
  color: var(--faint);
  font-size: 0.8125rem;
}
.site-footer p { margin: 0; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }

.meta {
  font-family: var(--sans);
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.avatar {
  border-radius: 50%;
  flex: none;
  filter: grayscale(0.15);
}

/* ---------- index ---------- */

.intro {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin: 3.5rem 0 3rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--rule);
}
.intro p {
  margin: 0;
  font-family: var(--serif);
  font-size: calc(var(--base) * 1.1);
  line-height: 1.45;
  color: var(--muted);
  text-wrap: pretty;
}

.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.post-list-item {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 0 1.5rem;
  margin-bottom: 2.75rem;
}

.post-list-item time {
  padding-top: 0.45rem;
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.post-list-item h2 {
  margin: 0 0 0.4rem;
  font-family: var(--serif);
  font-size: calc(var(--base) * 1.3);
  font-weight: 600;
  line-height: 1.22;
  letter-spacing: -0.012em;
  text-wrap: balance;
}
.post-list-item h2 a { color: var(--fg); text-decoration: none; }
.post-list-item h2 a:hover { color: var(--accent); }

.summary {
  margin: 0 0 0.5rem;
  font-family: var(--serif);
  font-size: calc(var(--base) * 0.92);
  line-height: 1.55;
  color: var(--muted);
  text-wrap: pretty;
}
.post-list-item .meta { margin: 0; color: var(--faint); }

@media (max-width: 40rem) {
  .post-list-item { display: block; }
  .post-list-item time { display: block; padding: 0 0 0.35rem; }
}

/* ---------- post ---------- */

.post-header {
  margin: 4rem 0 3rem;
}
.post-header .meta { margin: 0 0 0.9rem; }
.post-header .tags { margin: 1.25rem 0 0; color: var(--faint); }

.post-header h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2rem, 1.3rem + 2.8vw, 2.875rem);
  font-weight: 650;
  line-height: 1.1;
  letter-spacing: -0.022em;
  text-wrap: balance;
}

.dek {
  margin: 1rem 0 0;
  font-family: var(--serif);
  font-size: calc(var(--base) * 1.12);
  font-style: italic;
  line-height: 1.45;
  color: var(--muted);
  text-wrap: pretty;
}

.post-body {
  font-family: var(--serif);
  font-size: calc(var(--base));
  line-height: 1.68;
  font-variant-numeric: oldstyle-nums proportional-nums;
  hanging-punctuation: first;
}

.post-body p,
.post-body li { text-wrap: pretty; }

.post-body p { margin: 0 0 1.2em; }

.post-body h2,
.post-body h3 {
  position: relative;
  font-family: var(--serif);
  font-weight: 650;
  letter-spacing: -0.012em;
  text-wrap: balance;
  font-variant-numeric: lining-nums;
}
.post-body h2 {
  font-size: 1.45em;
  line-height: 1.22;
  margin: 2.4em 0 0.7em;
}
.post-body h3 {
  font-size: 1.15em;
  line-height: 1.3;
  margin: 2em 0 0.5em;
}

.anchor {
  margin-left: 0.4em;
  color: var(--faint);
  font-weight: 400;
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.15s;
}
h2:hover .anchor, h3:hover .anchor, .anchor:focus-visible { opacity: 1; }
.anchor:hover { color: var(--accent); }

.post-body strong { font-weight: 650; }

.post-body blockquote {
  margin: 2em 0;
  padding: 0 0 0 1.4em;
  border-left: 2px solid var(--accent);
  font-style: italic;
  color: color-mix(in srgb, var(--fg) 82%, var(--bg));
}
.post-body blockquote p:last-child { margin-bottom: 0; }

.post-body ol,
.post-body ul { padding-left: 1.4em; }
.post-body li { margin-bottom: 0.45em; }
.post-body li::marker { color: var(--faint); }

.post-body hr {
  border: 0;
  margin: 3em auto;
  text-align: center;
  color: var(--faint);
}
.post-body hr::before { content: "\2217\2003\2217\2003\2217"; }

.post-body small {
  font-family: var(--sans);
  font-size: 0.75em;
  color: var(--muted);
}

/* figures */

.post-body figure {
  margin: 2.25em 0;
  text-align: center;
}
.post-body figure img,
.post-body img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border-radius: 4px;
}
/* Diagrams and drawings are mostly white PNGs; sit them on a card so they
   don't float edgeless on the tinted background. */
.post-body figure img[src$=".png"] {
  background: var(--figure-bg);
  box-shadow: 0 0 0 1px var(--rule);
}

.post-body figcaption {
  margin-top: 0.75rem;
  font-family: var(--sans);
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--faint);
  overflow-wrap: anywhere;
}
.post-body figcaption a { color: var(--muted); }

/* ---------- code ---------- */

code, pre { font-family: var(--mono); }

code {
  padding: 0.12em 0.32em;
  border-radius: 3px;
  background: var(--code-bg);
  font-size: 0.84em;
}

pre {
  margin: 1.75em 0;
  padding: 1.1rem 1.25rem;
  border-radius: 6px;
  background: var(--code-bg);
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.6;
  font-variant-numeric: normal;
  tab-size: 2;
}
pre code {
  padding: 0;
  background: none;
  font-size: inherit;
}
pre.chroma { color: var(--fg); }

/* chroma classes */
.chroma .c, .chroma .c1, .chroma .cm, .chroma .cs, .chroma .ch { color: var(--syn-com); font-style: italic; }
.chroma .k, .chroma .kd, .chroma .kn, .chroma .kr, .chroma .kt, .chroma .kc, .chroma .nb { color: var(--syn-kw); }
.chroma .s, .chroma .s1, .chroma .s2, .chroma .sb, .chroma .sr, .chroma .se, .chroma .sa { color: var(--syn-str); }
.chroma .nf, .chroma .fm, .chroma .nc { color: var(--syn-fn); }
.chroma .m, .chroma .mi, .chroma .mf, .chroma .mh { color: var(--syn-num); }
.chroma .o, .chroma .p { color: var(--muted); }

/* ---------- tables ---------- */

.post-body table {
  width: 100%;
  margin: 1.75em 0;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}
.post-body th,
.post-body td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--rule);
  text-align: left;
}
.post-body th { color: var(--muted); font-weight: 600; }

/* ---------- footnotes & references ---------- */

sup { font-size: 0.7em; line-height: 0; }
sup a {
  font-family: var(--sans);
  font-weight: 600;
  text-decoration: none;
  padding: 0 0.1em;
}

.footnotes {
  margin-top: 3.5em;
  padding-top: 1.5em;
  border-top: 1px solid var(--rule);
  font-size: 0.86em;
  line-height: 1.6;
  color: var(--muted);
}
.footnotes hr { display: none; }
.footnote-backref { text-decoration: none; }

/* A "References" section at the end of a post reads like the footnotes. */
.post-body h2#references {
  font-size: 1em;
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-top: 3.5em;
  padding-top: 1.5em;
  border-top: 1px solid var(--rule);
}
.post-body h2#references + ol {
  font-size: 0.86em;
  line-height: 1.6;
  color: var(--muted);
}

/* ---------- post footer ---------- */

.post-footer {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
}

.byline {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.9375rem;
}
.byline p { margin: 0; }

.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 2.5rem;
}
.post-nav a {
  display: block;
  padding: 1rem 1.15rem;
  border: 1px solid var(--rule);
  border-radius: 8px;
  color: var(--fg);
  text-decoration: none;
  font-family: var(--serif);
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.3;
  transition: border-color 0.15s, background-color 0.15s;
}
.post-nav a:hover {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--rule));
  background: color-mix(in srgb, var(--accent) 5%, transparent);
}
.post-nav span {
  display: block;
  margin-bottom: 0.3rem;
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--faint);
}
.post-nav .newer { grid-column: 2; text-align: right; }

@media (max-width: 34rem) {
  .post-nav { grid-template-columns: 1fr; }
  .post-nav .newer { grid-column: auto; }
  .post-header { margin-top: 2.75rem; }
  .intro { gap: 1rem; margin-top: 2.5rem; }
  .intro .avatar { width: 48px; height: 48px; }
  :root { --base: 1.125rem; }
}
