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

:root {
  --bg: #0d1117;
  --bg-secondary: #161b22;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #58a6ff;
  --accent-hover: #79b8ff;
  --border: #30363d;
  --code-bg: #1c2128;
  --font-mono: 'SF Mono', 'Fira Code', 'Fira Mono', Menlo, Consolas, monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --max-width: 720px;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* === Layout === */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

main.container {
  flex: 1;
  padding-top: 2rem;
  padding-bottom: 4rem;
}

/* === Header === */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

.site-title:hover {
  color: var(--accent);
}

.site-nav {
  display: flex;
  gap: 1.5rem;
}

.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.site-nav a:hover,
.site-nav a.active {
  color: var(--accent);
}

/* === Landing Page === */
.landing .intro {
  padding: 4rem 0 3rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 3rem;
}

.landing .intro h1 {
  font-size: 2.2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.landing .tagline {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
}

.landing .bio {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.social-links a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
}

.social-links a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.disclaimer {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-style: italic;
  margin-top: 1.25rem;
}

/* === Recent Posts / Sections on Landing === */
.recent-posts {
  margin-bottom: 3rem;
}

.recent-posts h2 {
  font-size: 1.3rem;
  margin-bottom: 1.25rem;
  color: var(--text);
}

/* === Post Summary (list items) === */
.post-summary {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.post-summary:last-child {
  border-bottom: none;
}

.post-summary h2,
.post-summary h3 {
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
}

.post-summary h2 a,
.post-summary h3 a {
  color: var(--text);
  text-decoration: none;
}

.post-summary h2 a:hover,
.post-summary h3 a:hover {
  color: var(--accent);
}

.post-summary p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

.post-summary time {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* === List Page === */
.list-page h1 {
  font-size: 1.8rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

/* === Single Post === */
.post-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.post-header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.5rem;
}

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

/* === Post Content === */
.post-content h2 {
  font-size: 1.4rem;
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
}

.post-content h3 {
  font-size: 1.15rem;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

.post-content p {
  margin-bottom: 1.25rem;
}

.post-content a {
  color: var(--accent);
  text-decoration: none;
}

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

.post-content ul,
.post-content ol {
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
}

.post-content li {
  margin-bottom: 0.35rem;
}

.post-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
  margin: 1.5rem 0;
  color: var(--text-muted);
  font-style: italic;
}

.post-content code {
  font-family: var(--font-mono);
  background: var(--code-bg);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.88em;
}

.post-content pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin-bottom: 1.5rem;
}

.post-content pre code {
  background: none;
  padding: 0;
  font-size: 0.85rem;
  line-height: 1.6;
}

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 1.5rem 0;
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
}

.post-content th,
.post-content td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  text-align: left;
}

.post-content th {
  background: var(--bg-secondary);
  font-weight: 600;
}

/* === Topics Grid === */
.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.topic-card {
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-secondary);
  text-decoration: none;
  transition: border-color 0.2s;
}

.topic-card:hover {
  border-color: var(--accent);
}

.topic-name {
  color: var(--text);
  font-weight: 600;
  font-size: 1.05rem;
  margin-bottom: 0.25rem;
}

.topic-count {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* === Topic Tags (on articles) === */
.post-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.topic-tag {
  display: inline-block;
  padding: 0.2em 0.6em;
  font-size: 0.78rem;
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 4px;
  text-decoration: none;
  transition: border-color 0.2s, background 0.2s;
}

.topic-tag:hover {
  border-color: var(--accent);
  background: var(--bg-secondary);
}

/* === Footer === */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  text-align: center;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 0.75rem;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
}

.footer-links a:hover {
  color: var(--accent);
}

.site-footer p {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* === Responsive === */
@media (max-width: 600px) {
  .site-header .container {
    flex-direction: column;
    gap: 0.75rem;
  }

  .site-nav {
    gap: 1rem;
  }

  .landing .intro {
    padding: 2.5rem 0 2rem;
  }

  .landing .intro h1 {
    font-size: 1.8rem;
  }

  .post-header h1 {
    font-size: 1.5rem;
  }
}
