@font-face {
  font-family: "EB Garamond";
  src: url("fonts/eb-garamond-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "EB Garamond";
  src: url("fonts/eb-garamond-latin-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "EB Garamond";
  src: url("fonts/eb-garamond-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "EB Garamond";
  src: url("fonts/eb-garamond-latin-700-italic.woff2") format("woff2");
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Open Sans";
  src: url("fonts/open-sans-latin-300-normal.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/jetbrains-mono-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
/* Metric-adjusted local fallback, so text does not jump while the webfont loads. */
@font-face {
  font-family: "Garamond Fallback";
  src: local("Georgia"), local("Times New Roman");
  size-adjust: 90%;
  ascent-override: 95%;
  descent-override: 25%;
}

:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --fg: #1a1a1a;
  --muted: #6b6b6b;
  --rule: #e6e6e6;
  --code-bg: #f5f5f5;
  --link: #1f4d8f;
  --code-string: #7a5c2e;
  --code-keyword: #5e4390;
  --serif: "EB Garamond", "Garamond Fallback", Georgia, "Times New Roman", serif;
  --sans: "Open Sans", system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --line: 1.6;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131311;
    --fg: #e6e4dd;
    --muted: #9a988f;
    --rule: #2b2a26;
    --code-bg: #1c1c19;
    --link: #9bbcec;
    --code-string: #c2a374;
    --code-keyword: #b8a7dc;
  }
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--serif);
  font-size: 20px;
  line-height: var(--line);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
  color: var(--fg);
}

body {
  max-width: 72ch;
  margin: 0 auto;
  padding: 3rem 1.25rem 4rem;
}

@media (max-width: 40rem) {
  html { font-size: 18px; }
  body { padding-top: 2rem; }
}

/* Skip link: hidden until focused. */
.skip {
  position: absolute;
  left: -100vw;
  top: 0.5rem;
  padding: 0.25rem 0.5rem;
  background: var(--bg);
  color: var(--fg);
}
.skip:focus {
  left: 0.5rem;
}

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
  text-decoration-color: color-mix(in srgb, var(--link) 45%, transparent);
}
a:hover {
  text-decoration-color: currentColor;
}
a:focus-visible,
pre:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
  border-radius: 2px;
}

h1, h2, h3 {
  font-family: var(--sans);
  font-weight: 300;
  line-height: 1.2;
  text-wrap: balance;
  letter-spacing: -0.005em;
}
h1 { font-size: 1.8rem; }
h2 { font-size: 1.3rem; margin-top: 2.25rem; margin-bottom: 0.5rem; }
h3 { font-size: 1.1rem; margin-top: 1.5rem; margin-bottom: 0.4rem; }

p, ul, ol, dl, pre, table, blockquote {
  margin-bottom: 1rem;
}

ul, ol {
  padding-left: 1.5rem;
}
li + li {
  margin-top: 0.25rem;
}

strong { font-weight: 700; }
em { font-style: italic; }

/* Site header on inner pages */
.site {
  margin-bottom: 2.5rem;
}
.site a {
  color: var(--fg);
  text-decoration: none;
  font-family: var(--sans);
  font-weight: 300;
  font-size: 0.95rem;
}
.site a:hover {
  text-decoration: underline;
}

/* Home */
.intro h1 {
  margin-bottom: 0.5rem;
}
.intro + section {
  margin-top: 2.5rem;
}

/* Plain lists: projects, writings, links */
.plain {
  list-style: none;
  padding: 0;
}
.plain li {
  margin-top: 0.35rem;
}
.plain .desc {
  color: var(--muted);
}
.plain time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-right: 0.75ch;
}

/* Article */
article header {
  margin-bottom: 2rem;
}
article header time {
  display: block;
  margin-top: 0.5rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

code, pre {
  font-family: var(--mono);
  font-variant-ligatures: none;
}
code {
  font-size: 0.78em;
}
pre {
  font-size: 0.72rem;
  line-height: 1.5;
  padding: 0.85rem 1rem;
  background: var(--code-bg);
  border-radius: 4px;
  overflow-x: auto;
  tab-size: 4;
}
pre code {
  font-size: inherit;
}

pre .k { color: var(--code-keyword); }
pre .t { color: var(--link); }
pre .s { color: var(--code-string); }
pre .c { color: var(--muted); }

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9rem;
  line-height: 1.4;
}
th, td {
  text-align: left;
  vertical-align: top;
  padding: 0.5rem 0.75rem 0.5rem 0;
  border-bottom: 1px solid var(--rule);
}
th {
  font-weight: 700;
}
thead th {
  color: var(--muted);
  font-weight: 400;
}

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

footer {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.9rem;
}
footer ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 1.5ch;
}
footer li,
footer li + li {
  margin: 0;
}
footer a {
  color: inherit;
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}

@media print {
  html { font-size: 12pt; background: #fff; color: #000; }
  a { color: #000; }
  footer, .site, .skip { display: none; }
}
