/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Custom properties ── */
:root,
[data-theme="light"] {
  --bg: #ffffff;
  --bg-secondary: #f5f5f5;
  --text: #1a1a1a;
  --text-muted: #666666;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --border: #e5e5e5;
  --code-bg: #f0f0f0;
}

[data-theme="dark"] {
  --bg: #111111;
  --bg-secondary: #1a1a1a;
  --text: #e5e5e5;
  --text-muted: #999999;
  --accent: #60a5fa;
  --accent-hover: #93bbfd;
  --border: #2a2a2a;
  --code-bg: #1e1e1e;
}

/* ── Base ── */
html { color-scheme: light dark; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

/* ── Nav ── */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}
.nav-logo {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
}
.nav-logo:hover { text-decoration: none; color: var(--accent); }
.nav-links { display: flex; align-items: center; gap: 1.25rem; }
.nav-links a { color: var(--text-muted); font-size: 0.95rem; }
.nav-links a:hover, .nav-links a.active { color: var(--text); text-decoration: none; }

#theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.25rem;
  display: flex;
  align-items: center;
}
#theme-toggle:hover { color: var(--text); }
[data-theme="dark"] .icon-moon,
[data-theme="light"] .icon-sun { display: none; }
[data-theme="dark"] .icon-sun,
[data-theme="light"] .icon-moon { display: block; }
/* Default before JS runs: show moon (assume light) */
.icon-sun { display: none; }
.icon-moon { display: block; }

/* ── Container ── */
.container {
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 0 1rem 2rem;
  flex: 1;
}

/* ── Profile (homepage) ── */
.profile {
  text-align: center;
  padding: 3rem 0 2rem;
}
.profile-avatar {
  border-radius: 50%;
  width: 150px;
  height: 150px;
  object-fit: cover;
  margin-bottom: 1.5rem;
}
.profile h1 { font-size: 1.75rem; margin-bottom: 0.25rem; }
.profile-headline { color: var(--text-muted); font-size: 1.1rem; margin-bottom: 0.75rem; }
.profile-bio { color: var(--text-muted); max-width: 480px; margin: 0 auto 1.5rem; }
.profile-links { display: flex; justify-content: center; gap: 1rem; }
.profile-links a {
  color: var(--text-muted);
  transition: color 0.15s;
}
.profile-links a:hover { color: var(--text); text-decoration: none; }

/* ── Recent articles ── */
.recent { padding: 1rem 0 2rem; }
.recent h2 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.recent-list { list-style: none; }
.recent-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.5rem 0;
  gap: 1rem;
}
.recent-list time {
  color: var(--text-muted);
  font-size: 0.85rem;
  white-space: nowrap;
}
.view-all {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.9rem;
}

/* ── Section header ── */
.section-header { padding: 2rem 0 1.5rem; }
.section-header h1 { font-size: 1.75rem; margin-bottom: 0.25rem; }
.section-header p { color: var(--text-muted); }

/* ── Card grid ── */
.card-grid {
  display: grid;
  gap: 1rem;
}
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
}
.card h2 { font-size: 1.15rem; margin-bottom: 0.35rem; }
.card p { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 0.35rem; }
.card time { color: var(--text-muted); font-size: 0.85rem; }

/* ── Prose (article content) ── */
.prose { padding: 2rem 0; }
.prose header { margin-bottom: 2rem; }
.prose h1 { font-size: 1.75rem; margin-bottom: 0.25rem; }
.article-meta { color: var(--text-muted); font-size: 0.9rem; }
.prose h2 { font-size: 1.4rem; margin: 2rem 0 0.75rem; }
.prose h3 { font-size: 1.2rem; margin: 1.5rem 0 0.5rem; }
.prose p { margin-bottom: 1rem; }
.prose ul, .prose ol { margin: 0 0 1rem 1.5rem; }
.prose li { margin-bottom: 0.25rem; }
.prose blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
  color: var(--text-muted);
  margin: 1rem 0;
}
.prose code {
  background: var(--code-bg);
  padding: 0.15em 0.35em;
  border-radius: 3px;
  font-size: 0.9em;
}
.prose pre {
  background: var(--code-bg);
  padding: 1rem;
  border-radius: 6px;
  overflow-x: auto;
  margin: 1rem 0;
}
.prose pre code { background: none; padding: 0; }
.prose img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 1rem 0;
}
.back-link {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* ── Footer ── */
.footer {
  text-align: center;
  padding: 1.5rem 1rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .recent-list li { flex-direction: column; gap: 0.15rem; }
  .profile-avatar { width: 120px; height: 120px; }
}
