:root {
  --bg: #fafafa;
  --bg-secondary: #ffffff;
  --text: #1a1a1a;
  --text-secondary: #6b6b6b;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.1);
  --border: #e5e5e5;
  --code-bg: #f0f0f0;
  --shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.03);
}

[data-theme="dark"] {
  --bg: #0a0a0a;
  --bg-secondary: #141414;
  --text: #e5e5e5;
  --text-secondary: #888888;
  --accent: #60a5fa;
  --accent-soft: rgba(96, 165, 250, 0.1);
  --border: #262626;
  --code-bg: #1a1a1a;
  --shadow: 0 1px 3px rgba(0,0,0,0.2), 0 4px 12px rgba(0,0,0,0.15);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  transition: background 0.4s ease, color 0.3s ease;
}

.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 5rem 1.5rem;
}

/* Header */
header {
  margin-bottom: 4rem;
}

h1 {
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--text) 0%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
}

/* Section headers */
h2 {
  font-size: 0.75rem;
  font-weight: 500;
  margin-bottom: 1rem;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
}

/* Links */
a {
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

/* Navigation */
nav {
  margin-bottom: 4rem;
}

.nav-section {
  margin-bottom: 2.5rem;
  padding: 1.5rem;
  background: var(--bg-secondary);
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.nav-section:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

[data-theme="dark"] .nav-section:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.nav-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.nav-list li a {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.85rem;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  display: inline-block;
  transition: all 0.2s ease;
}

.nav-list li a:hover {
  background: var(--accent);
  color: var(--bg);
}

/* Post list */
.post-list {
  list-style: none;
}

.post-list li {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  gap: 1rem;
  transition: padding-left 0.2s ease;
}

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

.post-list li:hover {
  padding-left: 0.5rem;
}

.post-date {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.8rem;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.post-list a {
  font-weight: 500;
}

/* Post page */
.post-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.post-header h1 {
  margin-bottom: 0.75rem;
}

.post-meta {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: inline-block;
  padding: 0.25rem 0.6rem;
  background: var(--accent-soft);
  border-radius: 4px;
}

.post-content {
  margin-bottom: 3rem;
}

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

.post-content a {
  color: var(--accent);
  border-bottom: 1px solid var(--accent-soft);
  transition: border-color 0.2s ease;
}

.post-content a:hover {
  border-color: var(--accent);
}

/* Back link */
.back-link {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.9rem;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 2.5rem;
  padding: 0.5rem 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: all 0.2s ease;
}

.back-link:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateX(-4px);
}

/* Code */
code {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.9em;
  background: var(--code-bg);
  padding: 0.2em 0.5em;
  border-radius: 4px;
}

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

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

/* Theme toggle */
.theme-toggle {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  color: var(--text-secondary);
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.8rem;
  transition: all 0.2s ease;
  box-shadow: var(--shadow);
}

.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: scale(1.05);
}

/* Iframe / embeds */
iframe {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 1rem 0;
  box-shadow: var(--shadow);
}

.play-toggle {
  cursor: pointer;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 6px;
  display: inline-block;
  transition: all 0.2s ease;
}

.play-toggle:hover {
  background: var(--accent);
  color: var(--bg);
}

/* 404 page */
.container h1:only-of-type {
  font-size: 4rem;
  margin-bottom: 0.5rem;
}

/* Responsive */
@media (max-width: 480px) {
  html {
    font-size: 16px;
  }

  .container {
    padding: 3rem 1.25rem;
  }

  .nav-section {
    padding: 1.25rem;
  }

  .post-list li {
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
  }

  .theme-toggle {
    top: 1rem;
    right: 1rem;
  }
}

/* Subtle animation on page load */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

header, .nav-section, article {
  animation: fadeIn 0.5s ease forwards;
}

.nav-section:nth-child(1) { animation-delay: 0.1s; }
.nav-section:nth-child(2) { animation-delay: 0.2s; }
.nav-section:nth-child(3) { animation-delay: 0.3s; }
