:root {
  --text: #1b1f24;
  --muted: #5b6470;
  --bg: #ffffff;
  --surface: #f4f6f8;
  --border: #d9dee4;
  --link: #0b5cad;
  --link-visited: #6a3fa0;
  --code-bg: #f4f6f8;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --text: #e3e7ec;
    --muted: #9aa4b0;
    --bg: #14171b;
    --surface: #1d2126;
    --border: #2f353d;
    --link: #79b8ff;
    --link-visited: #c4a3f0;
    --code-bg: #0d1117;
  }
}

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

body {
  margin: 0 auto;
  max-width: 44rem;
  padding: 0 1rem 2rem;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.65;
}

a {
  color: var(--link);
  text-underline-offset: 0.15em;
}

a:visited {
  color: var(--link-visited);
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding: 1.5rem 0 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}

.site-title {
  color: var(--text);
  font-size: 1.35rem;
  font-weight: 700;
  text-decoration: none;
}

.site-title:visited {
  color: var(--text);
}

.site-header nav {
  display: flex;
  gap: 1.25rem;
}

.site-header nav a,
.site-header nav a:visited {
  color: var(--muted);
  text-decoration: none;
}

.site-header nav a:hover {
  color: var(--link);
  text-decoration: underline;
}

h1 {
  font-size: 1.9rem;
  line-height: 1.25;
  margin: 0.25rem 0 1rem;
}

h2 {
  font-size: 1.35rem;
  line-height: 1.3;
  margin: 2rem 0 0.75rem;
}

h3 {
  font-size: 1.15rem;
  margin: 1.5rem 0 0.5rem;
}

.meta,
.intro,
.note,
.comment-meta,
.count {
  color: var(--muted);
}

.meta {
  font-size: 0.9rem;
  margin: 0;
}

.meta a,
.meta a:visited {
  color: var(--muted);
}

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

.post-list li {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}

.post-list .meta {
  display: block;
  font-size: 0.85rem;
}

.post-link {
  font-weight: 600;
}

.year-index a,
.archive-years a {
  margin-right: 0.35rem;
}

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

.content blockquote {
  min-width: 0;
  overflow-x: auto;
  margin: 1rem 0;
  padding: 0.25rem 1rem;
  border-left: 4px solid var(--border);
  color: var(--muted);
}

pre {
  max-width: 100%;
  overflow-x: auto;
  padding: 0.9rem 1rem;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.875rem;
  line-height: 1.5;
}

main {
  min-width: 0;
}

main pre code.hljs {
  padding: 0;
  background: transparent;
}

code,
kbd,
tt {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
}

:not(pre) > code {
  padding: 0.1em 0.35em;
  background: var(--surface);
  border-radius: 4px;
}

.tags {
  font-size: 0.9rem;
  color: var(--muted);
}

.tags a {
  margin-right: 0.4rem;
}

.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin: 2.5rem 0 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.95rem;
}

.pager .next {
  margin-left: auto;
  text-align: right;
}

.comments ol {
  list-style: none;
  padding: 0;
}

.comment {
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  background: var(--surface);
  border-radius: 6px;
}

.comment-meta {
  margin: 0 0 0.25rem;
  font-size: 0.875rem;
}

.comment-body p {
  margin: 0.4rem 0;
}

.site-footer {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.875rem;
}

@media (max-width: 480px) {
  h1 {
    font-size: 1.55rem;
  }

  .pager {
    flex-direction: column;
  }

  .pager .next {
    margin-left: 0;
    text-align: left;
  }
}

#search {
  --pagefind-ui-primary: var(--link);
  --pagefind-ui-text: var(--text);
  --pagefind-ui-background: var(--bg);
  --pagefind-ui-border: var(--border);
  --pagefind-ui-tag: var(--surface);
  --pagefind-ui-font: inherit;
}
