/* Reset and Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Light Mode (Default) - Baby Blue Theme */
:root {
  --bg-primary: #e6f2ff;
  --bg-secondary: #f0f8ff;
  --bg-card: #ffffff;
  --text-primary: #1a365d;
  --text-secondary: #2c5282;
  --accent: #3182ce;
  --accent-hover: #2b6cb0;
  --border: #bee3f8;
  --shadow: rgba(49, 130, 206, 0.15);
}

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

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

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

/* Dark Mode - Automatic */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-card: #21262d;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --accent: #58a6ff;
    --accent-hover: #79c0ff;
    --border: #30363d;
    --shadow: rgba(0, 0, 0, 0.3);
  }

  body {
    background: var(--bg-primary);
    color: var(--text-primary);
  }
}

/* Header/Nav */
header {
  background: var(--bg-secondary);
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
}

.logo {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--accent);
  max-height: 40px;
}

nav ul {
  list-style: none;
  display: flex;
  gap: 1rem;
}

nav li a {
  padding: 0.5rem 1rem;
  color: var(--text-primary);
}

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

/* Main Sections */
main {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.hero {
  text-align: center;
  margin-bottom: 2rem;
  padding: 2rem;
  background: var(--bg-card);
  border-radius: 12px;
  box-shadow: 0 2px 8px var(--shadow);
}

.hero h1 {
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.hero p {
  color: var(--text-secondary);
}

.featured h2,
.recent h2 {
  margin-bottom: 1rem;
  color: var(--text-primary);
}

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

article {
  background: var(--bg-card);
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 2px 8px var(--shadow);
  border: 1px solid var(--border);
  transition: transform 0.2s, box-shadow 0.2s;
}

article:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 16px var(--shadow);
}

article h3 {
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

article p {
  color: var(--text-secondary);
}

.read-more {
  display: inline-block;
  margin-top: 0.75rem;
  font-weight: bold;
  color: var(--accent);
}

.read-more:hover {
  color: var(--accent-hover);
}

.recent {
  margin-top: 3rem;
  padding: 1.5rem;
  background: var(--bg-card);
  border-radius: 12px;
  box-shadow: 0 2px 8px var(--shadow);
  border: 1px solid var(--border);
}

.recent ul {
  list-style: none;
}

.recent li {
  margin-bottom: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

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

.recent li a {
  color: var(--text-primary);
}

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

/* Article Page Styles */
article[style*="max-width"] {
  max-width: 800px;
  margin: 2rem auto;
  padding: 2rem;
  background: var(--bg-card);
  border-radius: 12px;
  box-shadow: 0 2px 8px var(--shadow);
  border: 1px solid var(--border);
}

article h1 {
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

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

article ul {
  margin: 1rem 0 1rem 1.5rem;
  color: var(--text-secondary);
}

article li {
  margin-bottom: 0.5rem;
}

article strong {
  color: var(--text-primary);
}

article hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

article em a {
  color: var(--accent);
}

/* Footer */
footer {
  text-align: center;
  padding: 1.5rem;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
  margin-top: 2rem;
}

/* Archive Page */
.archive-list {
  list-style: none;
}

.archive-list li {
  margin-bottom: 1rem;
  padding: 1rem;
  background: var(--bg-card);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.archive-list li a {
  color: var(--text-primary);
  font-weight: bold;
}

.archive-list li a:hover {
  color: var(--accent);
}

.archive-list li p {
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* Responsive */
@media (max-width: 768px) {
  nav {
    flex-direction: column;
    gap: 1rem;
  }

  nav ul {
    margin-top: 0.5rem;
  }

  .post-grid {
    grid-template-columns: 1fr;
  }

  article[style*="max-width"] {
    margin: 1rem;
    padding: 1.5rem;
  }
}

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

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

article th {
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-weight: bold;
}

article td {
  color: var(--text-secondary);
}

/* Blockquotes */
article blockquote {
  border-left: 4px solid var(--accent);
  padding: 1rem;
  margin: 1rem 0;
  background: var(--bg-secondary);
  border-radius: 0 8px 8px 0;
}

article blockquote p {
  margin-bottom: 0.5rem;
  font-style: italic;
}

article blockquote cite {
  color: var(--text-secondary);
  font-size: 0.9rem;
}