/* Reset and base */
*, *::before, *::after {
  box-sizing: border-box;
}

:root {
  --text: #1a1a1a;
  --text-muted: #666;
  --bg: #fff;
  --link: #1a1a1a;
  --link-hover: #444;
  --border: #e0e0e0;
  --max-width: 42rem;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --text: #e0e0e0;
    --text-muted: #999;
    --bg: #1a1a1a;
    --link: #e0e0e0;
    --link-hover: #fff;
    --border: #333;
  }
}

html {
  font-size: 18px;
  line-height: 1.6;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  color: var(--text);
  background: var(--bg);
  margin: 0;
  padding: 1rem;
}

/* Layout */
header, main, footer {
  max-width: var(--max-width);
  margin: 0 auto;
}

main {
  min-height: calc(100vh - 10rem);
  padding: 2rem 0;
}

/* Navigation */
header nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

header nav ul {
  display: flex;
  gap: 1.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-title {
  font-weight: 600;
  text-decoration: none;
}

.feed-link::before {
  content: "";
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  margin-right: 0.3em;
  vertical-align: -0.05em;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M4 11a9 9 0 0 1 9 9'/%3E%3Cpath d='M4 4a16 16 0 0 1 16 16'/%3E%3Ccircle cx='5' cy='19' r='1'/%3E%3C/svg%3E");
  background-size: contain;
}

@media (prefers-color-scheme: dark) {
  .feed-link::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e0e0e0' stroke-width='2'%3E%3Cpath d='M4 11a9 9 0 0 1 9 9'/%3E%3Cpath d='M4 4a16 16 0 0 1 16 16'/%3E%3Ccircle cx='5' cy='19' r='1'/%3E%3C/svg%3E");
  }
}

/* Links */
a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

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

/* Typography */
h1, h2, h3 {
  line-height: 1.3;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }

p, ul, ol {
  margin: 1rem 0;
}

/* Article */
article header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

article header h1 {
  margin-top: 0;
  margin-bottom: 0.5rem;
}

article header time,
article header .updated {
  color: var(--text-muted);
  font-size: 0.9rem;
}

article .content {
  margin-top: 1.5rem;
}

/* Post lists */
.post-list, .recent-posts ul {
  list-style: none;
  padding: 0;
}

.post-list li, .recent-posts li {
  display: flex;
  gap: 1rem;
  padding: 0.5rem 0;
}

.post-list time, .recent-posts time {
  color: var(--text-muted);
  font-size: 0.9rem;
  flex-shrink: 0;
  width: 6rem;
}

/* Code */
code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--border);
  padding: 0.1em 0.3em;
  border-radius: 3px;
}

pre {
  background: var(--border);
  padding: 1rem;
  overflow-x: auto;
  border-radius: 4px;
}

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

/* Blockquote */
blockquote {
  border-left: 3px solid var(--border);
  margin-left: 0;
  padding-left: 1rem;
  color: var(--text-muted);
}

/* Footer */
footer {
  padding: 2rem 0;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.9rem;
}

footer p {
  margin: 0;
}

/* Responsive */
@media (max-width: 600px) {
  html {
    font-size: 16px;
  }

  .post-list li, .recent-posts li {
    flex-direction: column;
    gap: 0.25rem;
  }

  .post-list time, .recent-posts time {
    width: auto;
  }
}
