/* Minimal, semantic, hackable. One file, no build step. */
:root {
  --fg: #14171a;
  --muted: #5b6470;
  --bg: #fbfbfa;
  --accent: #1a73a0;
  --rule: #e3e3e0;
  --code-bg: #f1f0ec;
  --max: 720px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fg: #e8e8e3;
    --muted: #9aa3ab;
    --bg: #0f1115;
    --accent: #6fb8e0;
    --rule: #2a2d33;
    --code-bg: #1a1d22;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: ui-serif, Charter, "Iowan Old Style", "Source Serif Pro", Georgia, serif;
  font-size: 18px;
  line-height: 1.6;
  color: var(--fg);
  background: var(--bg);
}
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 1.25rem; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img, video { max-width: 100%; height: auto; }

.site-header { padding: 2rem 0 0.5rem; border-bottom: 1px solid var(--rule); margin-bottom: 1.5rem; }
.site-title { margin: 0; font-size: 1.4rem; font-weight: 700; }
.site-title a { color: var(--fg); }
.site-tagline { margin: 0.1rem 0 0.8rem; color: var(--muted); font-size: 0.95rem; }
.site-nav { display: flex; flex-wrap: wrap; gap: 0.9rem; font-size: 0.95rem; padding-bottom: 0.6rem; }
.site-nav a { color: var(--muted); }
.site-nav a:hover { color: var(--accent); }

.page-title { margin: 0.5rem 0 1rem; }
.page-title small { color: var(--muted); font-weight: 400; font-size: 0.75em; }

.post { padding: 1.2rem 0; border-bottom: 1px solid var(--rule); }
.post:last-child { border-bottom: none; }
.post-title { margin: 0 0 0.2rem; font-size: 1.5rem; line-height: 1.3; }
.post-title .permalink { color: var(--muted); font-weight: 400; margin-left: 0.3em; }
.post-title .external::after { content: " ↗"; color: var(--muted); font-size: 0.7em; }
.post-meta { margin: 0 0 0.8rem; color: var(--muted); font-size: 0.88rem; }
.post-meta .kind { background: var(--code-bg); padding: 0.05em 0.4em; border-radius: 0.2em; margin-left: 0.4em; font-size: 0.8em; }
.post-meta .tags { margin-left: 0.4em; }
.post-meta .tag { color: var(--muted); }

.post-body p, .post-body ul, .post-body ol, .post-body blockquote { margin: 0 0 1rem; }
.post-body h2, .post-body h3 { margin: 1.8rem 0 0.6rem; line-height: 1.25; }
.post-body code {
  background: var(--code-bg);
  padding: 0.08em 0.35em;
  border-radius: 0.25em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}
.post-body pre {
  background: var(--code-bg);
  padding: 0.85rem 1rem;
  border-radius: 0.4em;
  overflow-x: auto;
  font-size: 0.88em;
  line-height: 1.5;
}
.post-body pre code { background: none; padding: 0; }
.post-body blockquote {
  border-left: 3px solid var(--rule);
  padding: 0.1rem 1rem;
  color: var(--muted);
  margin-left: 0;
}
.post-body table { border-collapse: collapse; }
.post-body th, .post-body td { border: 1px solid var(--rule); padding: 0.3rem 0.6rem; }

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

.tag {
  display: inline-block;
  background: var(--code-bg);
  color: var(--accent);
  padding: 0.1em 0.55em;
  border-radius: 0.25em;
  font-size: 0.85rem;
}
.tag:hover { text-decoration: none; background: var(--rule); }
.tag-cloud { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }

.archive-row h3 { margin: 1.4rem 0 0.4rem; }
.archive-months { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.6rem 1rem; }
.archive-months small { color: var(--muted); }

.search-form { display: flex; gap: 0.5rem; margin: 0.8rem 0 1.4rem; }
.search-form input[type=search] {
  flex: 1;
  font: inherit;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--rule);
  border-radius: 0.3rem;
  background: var(--bg);
  color: var(--fg);
}
.search-form button {
  font: inherit;
  padding: 0.5rem 1rem;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: white;
  border-radius: 0.3rem;
  cursor: pointer;
}
.search-results { list-style: none; padding: 0; }
.search-results li { padding: 0.7rem 0; border-bottom: 1px solid var(--rule); }
.search-results small { color: var(--muted); margin-left: 0.4rem; }
.search-results .snippet { color: var(--muted); margin: 0.2rem 0 0; font-size: 0.95rem; }
.search-results mark { background: #fff3a8; color: inherit; padding: 0 0.1em; }
@media (prefers-color-scheme: dark) { .search-results mark { background: #6b5a00; } }

.site-footer { color: var(--muted); font-size: 0.9rem; padding: 2.5rem 0 2rem; border-top: 1px solid var(--rule); margin-top: 2rem; }

.tool-list { list-style: none; padding: 0; }
.tool-list li { padding: 0.9rem 0; border-bottom: 1px solid var(--rule); }
.tool-list li:last-child { border-bottom: none; }
.tool-title { margin: 0; font-size: 1.2rem; }
.tool-desc { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.95rem; }

.tool-form { margin: 1rem 0 1.5rem; }
.tool-form textarea {
  width: 100%;
  font: 0.95rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  padding: 0.7rem;
  border: 1px solid var(--rule);
  border-radius: 0.3rem;
  background: var(--bg);
  color: var(--fg);
  box-sizing: border-box;
}
.tool-actions { margin-top: 0.6rem; }
.tool-form button {
  font: inherit;
  padding: 0.5rem 1rem;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: white;
  border-radius: 0.3rem;
  cursor: pointer;
}
.tool-output { padding: 0.8rem 1rem; border: 1px solid var(--rule); border-radius: 0.3rem; margin: 0.4rem 0 1.2rem; }
.tool-output-raw { background: var(--code-bg); padding: 0.8rem 1rem; border-radius: 0.4em; overflow-x: auto; font-size: 0.85em; }
