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

:root {
  --bg: #fff;
  --text: #1a1a1a;
  --muted: #767676;
  --subtle: #444;
  --border: #e5e5e5;
  --code-bg: #f4f4f4;
}

.dark {
  --bg: #1a1a1a;
  --text: #e5e5e5;
  --muted: #999;
  --subtle: #bbb;
  --border: #333;
  --code-bg: #2a2a2a;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  margin: 0;
  padding: 0 1rem;
  transition: background 0.2s ease, color 0.2s ease;
}

header, main, footer {
  max-width: 680px;
  margin: 0 auto;
}

/* Nav */

nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.5rem;
}

.site-title {
  font-weight: 600;
  margin-right: auto;
}

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

nav a:hover {
  text-decoration: underline;
}

#theme-toggle {
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  border: none;
  background: var(--muted);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: background 0.2s ease;
}

.dark #theme-toggle {
  background: var(--subtle);
}

.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg);
  transition: transform 0.2s ease, background 0.2s ease;
}

.dark .toggle-thumb {
  transform: translateX(18px);
}

/* Post list */

.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.post-list li a {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  display: block;
}

.post-list li a:hover {
  text-decoration: underline;
}

.post-list time {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.post-list p {
  margin: 0.4rem 0 0;
  color: var(--subtle);
  font-size: 0.95rem;
}

/* Article / page */

article h1 {
  font-size: 1.6rem;
  margin: 0 0 0.25rem;
  line-height: 1.3;
}

.page-header time {
  font-size: 0.85rem;
  color: var(--muted);
}

.page-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

article h2 { font-size: 1.25rem; }
article h3 { font-size: 1.1rem; }

article a {
  color: var(--text);
}

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

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

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

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

/* Footer */

footer {
  margin-top: 4rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--muted);
}

footer p {
  margin: 0;
}
