:root {
  --fg: #1a1a1a;
  --bg: #ffffff;
  --muted: #6a6a6a;
  --accent: #1a5fb4;
  --border: #e4e4e4;
  --code-bg: #f5f5f5;
  --measure: 42rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fg: #e6e6e6;
    --bg: #16181c;
    --muted: #9aa0a6;
    --accent: #7bb0ff;
    --border: #2c2f36;
    --code-bg: #22262c;
  }
}

* { box-sizing: border-box; }

html { font-size: 18px; }

body {
  margin: 0;
  color: var(--fg);
  background: var(--bg);
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
}

main {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 1.25rem 4rem;
}

/* Header */
.site-header {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 1.75rem 1.25rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  border-bottom: 1px solid var(--border);
}
.site-title {
  font-weight: 700;
  font-size: 1.35rem;
  text-decoration: none;
  color: var(--fg);
}
.site-header nav a {
  color: var(--muted);
  text-decoration: none;
  margin-left: 1rem;
  font-size: 0.95rem;
  font-family: system-ui, sans-serif;
}
.site-header nav a:hover { color: var(--accent); }

/* Links */
a { color: var(--accent); }
a:hover { text-decoration: underline; }

/* Post list */
.post-list { list-style: none; padding: 0; margin: 2rem 0; }
.post-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
}
.post-link { text-decoration: none; font-size: 1.1rem; }
.post-link:hover { text-decoration: underline; }
.post-list time { color: var(--muted); font-size: 0.85rem; font-family: system-ui, sans-serif; white-space: nowrap; }

/* Post */
.post-header { margin: 2.5rem 0 2rem; }
.post-header h1 { font-size: 2rem; line-height: 1.2; margin: 0 0 0.5rem; }
.post-meta { color: var(--muted); font-size: 0.9rem; font-family: system-ui, sans-serif; }
.post-meta .post-tags a { color: var(--muted); text-decoration: none; margin-left: 0.4rem; }
.post-meta .post-tags a:hover { color: var(--accent); }

.post-content { font-size: 1.05rem; }
.post-content h2 { margin-top: 2.25rem; font-size: 1.5rem; }
.post-content h3 { margin-top: 1.75rem; font-size: 1.2rem; }
.post-content img { max-width: 100%; height: auto; display: block; margin: 1.5rem auto; }
.post-content blockquote {
  margin: 1.5rem 0;
  padding-left: 1rem;
  border-left: 3px solid var(--border);
  color: var(--muted);
}

/* Code */
code, pre, kbd {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.9em;
}
:not(pre) > code {
  background: var(--code-bg);
  padding: 0.12em 0.35em;
  border-radius: 4px;
}
pre {
  background: var(--code-bg);
  padding: 1rem;
  border-radius: 6px;
  overflow-x: auto;
  line-height: 1.5;
}
pre code { background: none; padding: 0; }

/* Math: let long display equations scroll rather than overflow the page */
.katex-display { overflow-x: auto; overflow-y: hidden; padding: 0.25rem 0; }

/* Tags */
.tag-list { list-style: none; padding: 0; }
.tag-list li { padding: 0.35rem 0; }
.tag-count { color: var(--muted); font-size: 0.85rem; }
.list-title { margin: 2rem 0 1rem; }

/* Footer */
.site-footer {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 2rem 1.25rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
  font-family: system-ui, sans-serif;
}
