:root {
  color-scheme: light dark;
  --bg: #fffff8;
  --fg: #111;
  --fg-dim: #555;
  --accent: #a00;
  --border: #ddd;
  --code-bg: #f5f5f0;
  --max-w: 660px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --fg: #c9d1d9;
    --fg-dim: #8b949e;
    --accent: #58a6ff;
    --border: #21262d;
    --code-bg: #161b22;
  }
}

html.dark {
  --bg: #0d1117;
  --fg: #c9d1d9;
  --fg-dim: #8b949e;
  --accent: #58a6ff;
  --border: #21262d;
  --code-bg: #161b22;
}

html.light {
  --bg: #fffff8;
  --fg: #111;
  --fg-dim: #555;
  --accent: #a00;
  --border: #ddd;
  --code-bg: #f5f5f0;
}

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

html {
  font-size: 16px;
  min-height: 100%;
}

body {
  font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', 'Menlo', monospace;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.7;
  padding: 2.5rem 1.5rem;
  max-width: var(--max-w);
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.site-header {
  margin-bottom: 3rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-title {
  font-size: 1.1rem;
  color: var(--fg);
  font-weight: bold;
  text-decoration: none;
}

.site-title:hover {
  color: var(--accent);
  text-decoration: none;
}

.site-nav {
  margin-left: auto;
  margin-right: 1rem;
}

.site-nav a {
  color: var(--fg);
  text-decoration: none;
  font-size: 0.9rem;
  margin-left: 0.8rem;
}

.site-nav a:hover {
  color: var(--accent);
}

h1 {
  font-size: 1.4rem;
  margin-bottom: 0.4rem;
  font-weight: 600;
  line-height: 1.3;
}

h2 {
  font-size: 1.1rem;
  margin-top: 2.2rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--fg-dim);
}

h3 {
  font-size: 1rem;
  margin-top: 1.5rem;
  margin-bottom: 0.4rem;
}

.post-item {
  margin-bottom: 0.4rem;
}

.post-item time {
  color: var(--fg-dim);
  font-size: 0.85rem;
  margin-right: 1rem;
}

.post header time {
  color: var(--fg-dim);
  font-size: 0.85rem;
  display: block;
  margin-bottom: 2rem;
}

.post-content p {
  margin-bottom: 1.2rem;
}

.post-content ul,
.post-content ol {
  margin-bottom: 1.2rem;
  padding-left: 1.5rem;
}

.post-content li {
  margin-bottom: 0.3rem;
}

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 1rem 0;
}

.post-content video {
  max-width: 100%;
  border-radius: 4px;
  margin: 1rem 0;
}

.post-content pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1rem;
  overflow-x: auto;
  margin-bottom: 1.2rem;
  font-size: 0.85rem;
  line-height: 1.5;
}

.post-content code {
  font-family: inherit;
  font-size: 0.85rem;
}

.post-content p code {
  background: var(--code-bg);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  border: 1px solid var(--border);
}

blockquote {
  border-left: 2px solid var(--border);
  padding-left: 1rem;
  color: var(--fg-dim);
  margin-bottom: 1.2rem;
}

.comments {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.comment {
  margin-bottom: 1.5rem;
  padding: 0.8rem;
  background: var(--code-bg);
  border-radius: 4px;
}

.comment strong {
  color: var(--accent);
}

.comment time {
  color: var(--fg-dim);
  font-size: 0.8rem;
  margin-left: 0.5rem;
}

.comment p {
  margin-top: 0.4rem;
}

.no-comments {
  color: var(--fg-dim);
  font-style: italic;
}

.comment-form {
  margin-top: 1.5rem;
}

.comment-form label {
  display: block;
  font-size: 0.85rem;
  color: var(--fg-dim);
  margin-bottom: 0.2rem;
  margin-top: 0.8rem;
}

.comment-form input[type="text"],
.comment-form textarea {
  width: 100%;
  background: var(--code-bg);
  border: 1px solid var(--border);
  color: var(--fg);
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.5rem;
  border-radius: 4px;
}

.comment-form input[type="text"]:focus,
.comment-form textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.comment-form button {
  margin-top: 0.8rem;
  background: none;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-family: inherit;
  font-size: 0.85rem;
  padding: 0.4rem 1.2rem;
  border-radius: 4px;
  cursor: pointer;
}

.comment-form button:hover {
  background: var(--accent);
  color: var(--bg);
}

.site-footer {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--fg-dim);
  text-align: center;
}

.site-footer a {
  color: var(--fg-dim);
}

.site-footer a:hover {
  color: var(--accent);
}

.site-footer .pgp code {
  font-size: 0.75rem;
  color: var(--fg-dim);
}

.pgp-fingerprint {
  font-family: monospace;
  font-size: 0.9rem;
  color: var(--fg-dim);
  letter-spacing: 0.02em;
}

.theme-toggle {
  color: var(--fg-dim);
  text-decoration: none;
  padding: 0.1rem 0.3rem;
  cursor: pointer;
}

.theme-toggle:hover {
  color: var(--accent);
}

@media (max-width: 600px) {
  html {
    font-size: 14px;
  }

  body {
    padding: 1rem 0.8rem;
    line-height: 1.5;
  }

  .site-header {
    margin-bottom: 1.2rem;
    flex-wrap: nowrap;
    gap: 0.4rem;
  }

  .site-title {
    font-size: 1rem;
  }

  .site-nav {
    margin-left: auto;
    margin-right: 0.5rem;
  }

  .site-nav a {
    font-size: 0.85rem;
    margin-left: 0.5rem;
  }

  .theme-toggle {
    padding: 0.2rem;
  }

  .site-footer {
    margin-top: 2rem;
  }

  h1 {
    font-size: 1.1rem;
    margin-bottom: 0.3rem;
  }

  .post-item {
    margin-bottom: 0.3rem;
  }

  .post-item time {
    display: inline;
    margin-right: 0.5rem;
    font-size: 0.8rem;
  }

  .post-item a {
    font-size: 0.9rem;
  }

  .comment-form button {
    padding: 0.5rem 1.2rem;
  }
}
