@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&display=swap');

:root {
  /* Light Mode Variables */
  --bg-color: #f8fafc;
  --text-color: #0f172a;
  --text-muted: #475569;
  --primary-color: #3b82f6;
  --primary-hover: #2563eb;
  --card-bg: rgba(255, 255, 255, 0.8);
  --card-border: rgba(255, 255, 255, 0.3);
  --header-bg: rgba(255, 255, 255, 0.7);
  --code-bg: #e2e8f0;
  --border-color: #cbd5e1;
}

[data-theme="dark"] {
  /* Dark Mode Variables */
  --bg-color: #0f172a;
  --text-color: #f8fafc;
  --text-muted: #cbd5e1;
  --primary-color: #60a5fa;
  --primary-hover: #3b82f6;
  --card-bg: rgba(30, 41, 59, 0.8);
  --card-border: rgba(255, 255, 255, 0.1);
  --header-bg: rgba(15, 23, 42, 0.7);
  --code-bg: #1e293b;
  --border-color: #334155;
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

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

/* Header & Glassmorphism */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--card-border);
  transition: background 0.3s ease;
}

.nav-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav-links a {
  color: var(--text-color);
  font-weight: 600;
}

.nav-links a:hover {
  color: var(--primary-color);
}

/* Theme Toggle Button */
#theme-toggle {
  background: none;
  border: none;
  color: var(--text-color);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0.5rem;
  border-radius: 50%;
  transition: background 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

#theme-toggle:hover {
  background: var(--card-bg);
}

/* Main Content */
main {
  flex: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 3rem 2rem;
  width: 100%;
}

.hero {
  text-align: center;
  margin-bottom: 4rem;
  animation: fadeIn 0.8s ease-out;
}

.hero h1 {
  font-size: 3rem;
  margin-bottom: 1rem;
  line-height: 1.2;
}

.hero p {
  font-size: 1.2rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto;
}

/* Grid Layout for Articles */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
}

.article-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 1.5rem;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
}

.article-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
  border-color: var(--primary-color);
}

.article-card h2 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.article-card p {
  color: var(--text-muted);
  flex: 1;
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.read-more {
  display: inline-block;
  font-weight: 600;
  font-size: 0.9rem;
}

/* Single Article View */
.article-content {
  max-width: 800px;
  margin: 0 auto;
  animation: fadeIn 0.5s ease-out;
}

.article-content h1 {
  font-size: 2.5rem;
  margin-bottom: 1.5rem;
  line-height: 1.2;
}

.article-content h2 {
  font-size: 1.8rem;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.article-content h3 {
  font-size: 1.4rem;
  margin-top: 1.5rem;
  margin-bottom: 0.8rem;
}

.article-content p {
  margin-bottom: 1.2rem;
  font-size: 1.1rem;
}

.article-content ul, .article-content ol {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
  font-size: 1.1rem;
}

.article-content li {
  margin-bottom: 0.5rem;
}

/* Code Blocks */
pre {
  background-color: var(--code-bg);
  padding: 1rem;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-color);
}

code {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.95rem;
  color: var(--text-color);
}

p code, li code {
  background-color: var(--code-bg);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-size: 0.9em;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
}

th, td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

th {
  background-color: var(--code-bg);
  font-weight: 600;
}

/* Footer */
footer {
  text-align: center;
  padding: 2rem;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.9rem;
}

footer a {
  color: var(--text-muted);
}

footer a:hover {
  color: var(--primary-color);
}

.footer-links {
  margin-top: 0.5rem;
  display: flex;
  justify-content: center;
  gap: 1rem;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 768px) {
  .nav-container {
    flex-direction: column;
    gap: 1rem;
  }
  
  .hero h1 {
    font-size: 2.2rem;
  }
  
  .article-content h1 {
    font-size: 2rem;
  }
}
