:root {
  --text: #1f2328;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #ffffff;
  --code-bg: #f6f8fa;
}

@media (prefers-color-scheme: dark) {
  :root {
    --text: #d7dce3;
    --muted: #8b939e;
    --line: #2d333b;
    --bg: #14181d;
    --code-bg: #1c2128;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
}

main, header, footer {
  max-width: 44rem;
  margin: 0 auto;
  padding: 0 1rem;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-top: 1.75rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.wordmark {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.2rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--text);
}

nav a { margin-left: 1rem; }

footer {
  margin-top: 3rem;
  padding-top: 1rem;
  padding-bottom: 2rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

footer span { margin: 0 0.25rem; }

a { color: var(--text); text-decoration-color: var(--muted); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--text); }

h1 { font-size: 1.6rem; margin: 1.5rem 0 0.5rem; }
h2 { font-size: 1.2rem; margin: 2rem 0 0.5rem; }

.meta, .intro { color: var(--muted); }
.meta { font-size: 0.9rem; margin-top: 0; }

.postlist { list-style: none; padding: 0; }
.postlist li { padding: 0.35rem 0; border-bottom: 1px solid var(--line); }
.postlist time { color: var(--muted); font-size: 0.85rem; margin-left: 0.5rem; }

.toollist { padding-left: 1.2rem; }
.toollist li { padding: 0.25rem 0; }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
  background: var(--code-bg);
  padding: 0.15em 0.35em;
  border-radius: 4px;
}

pre {
  background: var(--code-bg);
  padding: 0.9rem 1rem;
  border-radius: 6px;
  overflow-x: auto;
  line-height: 1.5;
}

pre code { background: none; padding: 0; }

blockquote {
  margin: 1rem 0;
  padding: 0.1rem 1rem;
  border-left: 3px solid var(--line);
  color: var(--muted);
}

table { border-collapse: collapse; width: 100%; margin: 1rem 0; }
th, td { border: 1px solid var(--line); padding: 0.4rem 0.6rem; text-align: left; }
th { background: var(--code-bg); }

/* tool pages */
textarea {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9rem;
  padding: 0.6rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--code-bg);
  color: var(--text);
}

.btnrow { margin: 0.6rem 0; }
button {
  font: inherit;
  padding: 0.35rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}
button:hover { background: var(--code-bg); }

.err { color: #b91c1c; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; }
