:root {
  /* Dark theme (default) */
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --code-bg: #1e293b;
  --border: #334155;
  --code-comment: #64748b;
  --code-string: #fda4af;
  --code-keyword: #93c5fd;
  --code-operator: #e2e8f0;
  --code-number: #86efac;
}

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

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  line-height: 1.6;
}

nav {
  background: var(--bg-secondary);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.logo {
  font-family: 'Fira Code', monospace;
  font-weight: 600;
  color: var(--accent);
  font-size: 1.5rem;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  margin-left: 2rem;
  transition: color 0.3s ease;
}

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

.theme-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.5rem;
  margin-left: 2rem;
  font-size: 1.2rem;
  transition: color 0.3s ease;
}

.theme-toggle:hover {
  color: var(--accent-hover);
}

/* Light theme variables */
[data-theme="light"] {
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --code-bg: #f1f5f9;
  --border: #e2e8f0;
  --code-comment: #94a3b8;
  --code-string: #dc2626;
  --code-keyword: #2563eb;
  --code-operator: #0f172a;
  --code-number: #059669;
}

main {
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.learning-entry {
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 2rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

header {
  margin-bottom: 2rem;
}

h1 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  color: var(--accent);
}

time {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.code-example {
  margin: 2rem 0;
}

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

code {
  font-family: 'Fira Code', monospace;
  font-size: 0.9rem;
  line-height: 1.5;
}

.explanation {
  margin-top: 2rem;
}

h2 {
  color: var(--accent);
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

h3 {
  color: var(--text-primary);
  margin: 1.5rem 0 1rem;
}

p {
  margin-bottom: 1rem;
}

.use-cases ul {
  list-style-position: inside;
  margin-left: 1rem;
}

.use-cases li {
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

/* Syntax highlighting */
.comment { color: var(--code-comment); }
.string { color: var(--code-string); }
.keyword { color: var(--code-keyword); }
.operator { color: var(--code-operator); }
.number { color: var(--code-number); }

/* Archive Page Styles */
.archive-header {
  margin-bottom: 2rem;
}

.archive-filters {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.search-input, .category-filter {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
}

.search-input {
  flex: 1;
  min-width: 200px;
}

.search-input:focus, .category-filter:focus {
  outline: none;
  border-color: var(--accent);
}

.archive-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.archive-card {
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 1.5rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: 1px solid var(--border);
  cursor: pointer;
}

.archive-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-color: var(--accent);
}

.archive-card h2 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--accent);
}

.archive-card time {
  display: block;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.archive-card .category {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: var(--accent);
  color: white;
  border-radius: 4px;
  font-size: 0.75rem;
  margin-bottom: 1rem;
}

.archive-card .excerpt {
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 768px) {
  .archive-filters {
    flex-direction: column;
  }
  
  .archive-grid {
    grid-template-columns: 1fr;
  }
}

/* Home Page Styles */
.home {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.hero {
  text-align: center;
  margin-bottom: 4rem;
  position: relative;
}

.code-animation {
  margin-bottom: 2rem;
  transform: perspective(1000px) rotateX(10deg);
  transition: transform 0.3s ease;
}

.code-animation:hover {
  transform: perspective(1000px) rotateX(0deg);
}

.hero h1 {
  font-size: 3rem;
  margin-bottom: 1rem;
  background: linear-gradient(45deg, var(--accent), var(--accent-hover));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-bottom: 4rem;
}

.feature-card {
  background: var(--bg-secondary);
  padding: 2rem;
  border-radius: 12px;
  text-align: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: 1px solid var(--border);
}

.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  border-color: var(--accent);
}

.feature-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.feature-card h2 {
  margin-bottom: 1rem;
  color: var(--accent);
}

.latest-posts {
  margin-top: 4rem;
}

.latest-posts h2 {
  margin-bottom: 2rem;
  text-align: center;
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

.post-card {
  background: var(--bg-secondary);
  padding: 2rem;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text-primary);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: 1px solid var(--border);
}

.post-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  border-color: var(--accent);
}

.post-card h3 {
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.post-card p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.post-date {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

@media (max-width: 768px) {
  .hero h1 {
    font-size: 2rem;
  }
  
  .features {
    grid-template-columns: 1fr;
  }
  
  .post-grid {
    grid-template-columns: 1fr;
  }
}
