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

/* ── Theme variables ── */
:root {
  --bg: #fafafa;
  --bg-code: #f0f0f0;
  --text: #1a1a2e;
  --text-muted: #5a5a7a;
  --accent: #e41867;
  --border: #d0d0d0;
  --link-hover-bg: #e41867;
  --link-hover-text: #fff;
  --tag-bg: #e8e8ee;
  --tag-text: #3a3a5a;
}

[data-theme="dark"] {
  --bg: #0d1117;
  --bg-code: #161b22;
  --text: #c9d1d9;
  --text-muted: #8b949e;
  --accent: #f778a2;
  --border: #30363d;
  --link-hover-bg: #f778a2;
  --link-hover-text: #0d1117;
  --tag-bg: #1c2333;
  --tag-text: #8b949e;
}

/* ── Base ── */
html {
  font-family: 'JetBrains Mono', monospace;
  font-size: 15px;
  line-height: 1.7;
  background: var(--bg);
  color: var(--text);
  transition: background 0.2s, color 0.2s;
}

body { min-height: 100vh; display: flex; flex-direction: column; }

.container {
  max-width: 48rem;
  margin: 0 auto;
  padding: 0 1.5rem;
  width: 100%;
}

/* ── Links ── */
a {
  color: var(--accent);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  padding: 0 2px;
}
a:hover {
  background: var(--link-hover-bg);
  color: var(--link-hover-text);
}

/* ── Header ── */
header {
  border-bottom: 1px solid var(--border);
  padding: 1.2rem 0;
}
header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  padding: 0;
}
.logo:hover { background: none; color: var(--accent); }
.logo .cursor { animation: blink 1s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }

nav { display: flex; align-items: center; gap: 1.5rem; }
nav a {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  text-transform: lowercase;
}
nav a:hover { color: var(--link-hover-text); }
nav a.active { color: var(--accent); }

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8rem;
  padding: 4px 8px;
  border-radius: 3px;
  transition: border-color 0.2s, color 0.2s;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* ── Headings with markdown markers ── */
h1::before { content: '# '; color: var(--accent); }
h2::before { content: '## '; color: var(--accent); }
h3::before { content: '### '; color: var(--accent); }

h1 { font-size: 1.8rem; font-weight: 700; margin-bottom: 1rem; line-height: 1.3; }
h2 { font-size: 1.3rem; font-weight: 600; margin: 2rem 0 0.8rem; }
h3 { font-size: 1.1rem; font-weight: 600; margin: 1.5rem 0 0.6rem; }

/* ── Content ── */
main { flex: 1; }

.page-header {
  padding: 3rem 0 2rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}
.page-header p {
  color: var(--text-muted);
  margin-top: 0.5rem;
  font-size: 0.9rem;
}

p { margin-bottom: 1rem; }

/* ── Post list ── */
.post-list { list-style: none; }
.post-item {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
}
.post-item:last-child { border-bottom: none; }
.post-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: 0.3rem;
}
.post-title {
  font-size: 1.1rem;
  font-weight: 600;
}
.post-title a { color: var(--text); }
.post-title a:hover { color: var(--link-hover-text); }
.post-snippet {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0.4rem;
  line-height: 1.5;
}
.post-tags { margin-top: 0.5rem; display: flex; gap: 0.4rem; flex-wrap: wrap; }
.tag {
  font-size: 0.7rem;
  background: var(--tag-bg);
  color: var(--tag-text);
  padding: 2px 8px;
  border-radius: 3px;
}

/* ── Blog post (single) ── */
.post-content {
  padding: 2rem 0 3rem;
}
.post-content p,
.post-content li {
  color: var(--text);
  font-size: 0.95rem;
}
.post-content ul, .post-content ol {
  margin: 0.8rem 0 1rem 1.5rem;
}
.post-content li { margin-bottom: 0.3rem; }
.post-content code {
  background: var(--bg-code);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.85em;
}
.post-content pre {
  background: var(--bg-code);
  padding: 1rem;
  border-radius: 4px;
  overflow-x: auto;
  margin: 1rem 0;
  border: 1px solid var(--border);
}
.post-content pre code { background: none; padding: 0; }
.post-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
  color: var(--text-muted);
  margin: 1rem 0;
  font-style: italic;
}
.post-content strong { color: var(--text); font-weight: 600; }
.post-content em { font-style: italic; }
.post-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* ── About page ── */
.about-section { margin-bottom: 2.5rem; }
.about-section p { color: var(--text-muted); font-size: 0.9rem; }

.skills-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}
.skill {
  font-size: 0.75rem;
  background: var(--tag-bg);
  color: var(--tag-text);
  padding: 3px 10px;
  border-radius: 3px;
  border: 1px solid var(--border);
}

.timeline-item {
  padding-left: 1.2rem;
  border-left: 2px solid var(--border);
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
}
.timeline-item:last-child { margin-bottom: 0; }
.timeline-role { font-weight: 600; font-size: 0.95rem; }
.timeline-meta { color: var(--text-muted); font-size: 0.8rem; margin: 0.2rem 0 0.4rem; }
.timeline-desc { color: var(--text-muted); font-size: 0.85rem; }

/* ── Footer ── */
footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  margin-top: 3rem;
}
footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.footer-links { display: flex; gap: 1rem; }
.footer-links a { color: var(--text-muted); font-size: 0.8rem; }

/* ── Responsive ── */
@media (max-width: 640px) {
  html { font-size: 14px; }
  h1 { font-size: 1.5rem; }
  .page-header { padding: 2rem 0 1.5rem; }
  nav { gap: 1rem; }
  nav a { font-size: 0.8rem; }
  footer .container { flex-direction: column; gap: 0.5rem; text-align: center; }
}
