:root {
  --bg:       #fafafa;
  --text:     #111111;
  --link:     #2563eb;
  --muted:    #64748b;
  --code-bg:  #f4f4f4;
  --border:   #e5e5e5;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 18px;
  line-height: 1.7;
  margin: 0;
  padding: 0;
}

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

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem max(1.25rem, calc((100% - 720px) / 2 + 1.25rem));
  border-bottom: 1px solid var(--border);
}

.logo {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 1rem;
  color: var(--text);
  text-decoration: none;
}

header nav a {
  margin-left: 1.5rem;
  text-decoration: none;
  color: var(--link);
}

footer {
  margin-top: 3rem;
  padding: 1rem max(1.25rem, calc((100% - 720px) / 2 + 1.25rem)) 2rem;
  font-size: 0.875rem;
  display: flex;
  gap: 0.5rem;
  color: var(--muted);
}

footer a {
  color: var(--muted);
}

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

code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.875em;
  background: var(--code-bg);
  padding: 0.15em 0.35em;
  border-radius: 3px;
}

pre code {
  background: none;
  padding: 0;
  font-size: 1em;
}

/* Archive */
.archive-year {
  font-size: 1rem;
  font-weight: 700;
  margin: 2.5rem 0 0;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  letter-spacing: 0.01em;
  line-height: 1.4;
}

.archive-list {
  margin-bottom: 0.25rem;
}

.archive-row {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
}

.archive-row:hover span {
  color: var(--link);
}

.archive-row time {
  flex-shrink: 0;
  font-size: 0.875rem;
  color: var(--muted);
  min-width: 4rem;
  font-variant-numeric: tabular-nums;
}

.archive-row span {
  font-size: 1rem;
}

/* Single post */
.post-meta {
  font-size: 0.875rem;
  color: var(--muted);
  margin: 0.25rem 0 2.5rem;
}

article h1, article h2, article h3 {
  margin-top: 2rem;
}

article p {
  margin: 1.25rem 0;
}

.post-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:       #0d1117;
    --text:     #e6edf3;
    --link:     #58a6ff;
    --muted:    #8b949e;
    --code-bg:  #161b22;
    --border:   #30363d;
  }
}

:root[data-theme="dark"] {
  --bg:       #0d1117;
  --text:     #e6edf3;
  --link:     #58a6ff;
  --muted:    #8b949e;
  --code-bg:  #161b22;
  --border:   #30363d;
}

:root[data-theme="light"] {
  --bg:       #fafafa;
  --text:     #111111;
  --link:     #2563eb;
  --muted:    #64748b;
  --code-bg:  #f4f4f4;
  --border:   #e5e5e5;
}

#theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  margin-left: 1.5rem;
  padding: 0;
  line-height: 1;
  color: var(--muted);
}
