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

:root {
  --primary-color: #2563eb;
  --text-color: #1f2937;
  --text-secondary: #6b7280;
  --bg-color: #ffffff;
  --bg-secondary: #f9fafb;
  --border-color: #e5e7eb;
  --code-bg: #f3f4f6;
  --max-width: 1200px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--bg-color);
}

/* Header */
header {
  background-color: var(--bg-color);
  border-bottom: 1px solid var(--border-color);
  padding: 1.5rem 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

header .container {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header h1 {
  font-size: 1.5rem;
  font-weight: 700;
}

header h1 a {
  color: var(--text-color);
  text-decoration: none;
}

header nav a {
  color: var(--text-secondary);
  text-decoration: none;
  margin-left: 2rem;
  transition: color 0.2s;
}

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

/* Main Content */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem 2rem;
}

/* Hero Section */
.hero {
  text-align: center;
  padding: 3rem 0 4rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 3rem;
}

.hero h1 {
  font-size: 3rem;
  font-weight: 800;
  margin-bottom: 1rem;
  color: var(--text-color);
}

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

/* Topics Grid */
.topics-grid {
  display: grid;
  gap: 2rem;
}

.topic-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 2rem;
  transition: transform 0.2s, box-shadow 0.2s;
}

.topic-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.topic-card h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.topic-card h2 a {
  color: var(--text-color);
  text-decoration: none;
}

.topic-card h2 a:hover {
  color: var(--primary-color);
}

.topic-description {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  font-size: 1rem;
}

.article-list {
  list-style: none;
  margin-top: 1rem;
}

.article-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-color);
}

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

.article-list a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
}

.article-list a:hover {
  text-decoration: underline;
}

.view-all {
  display: inline-block;
  margin-top: 1rem;
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 600;
}

.view-all:hover {
  text-decoration: underline;
}

/* Article Content */
.article-header {
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
}

.article-header h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 1rem;
  line-height: 1.2;
}

.article-meta {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.article-meta a {
  color: var(--primary-color);
  text-decoration: none;
}

.article-meta a:hover {
  text-decoration: underline;
}

.article-content {
  font-size: 1.125rem;
  line-height: 1.8;
  max-width: 800px;
}

.article-content h2 {
  font-size: 1.875rem;
  font-weight: 700;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
}

.article-content h3 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.article-content p {
  margin-bottom: 1.5rem;
}

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

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

.article-content code {
  background-color: var(--code-bg);
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.9em;
}

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

.article-content pre code {
  background-color: transparent;
  padding: 0;
}

.article-content strong {
  font-weight: 600;
}

/* List Pages */
.page-header {
  margin-bottom: 3rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.page-header h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.page-header p {
  font-size: 1.125rem;
  color: var(--text-secondary);
}

.articles-list {
  display: grid;
  gap: 1.5rem;
}

.article-item {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 1.5rem;
  transition: transform 0.2s, box-shadow 0.2s;
}

.article-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.article-item h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.article-item h2 a {
  color: var(--text-color);
  text-decoration: none;
}

.article-item h2 a:hover {
  color: var(--primary-color);
}

.article-item .summary {
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.6;
}

/* Breadcrumb */
.breadcrumb {
  margin-bottom: 2rem;
  font-size: 0.875rem;
}

.breadcrumb ol {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 0;
  flex-wrap: wrap;
}

.breadcrumb li {
  display: flex;
  align-items: center;
}

.breadcrumb li:not(:last-child)::after {
  content: '›';
  margin: 0 0.5rem;
  color: var(--text-secondary);
}

.breadcrumb a {
  color: var(--primary-color);
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb li[aria-current="page"] {
  color: var(--text-secondary);
}

/* Reading Time */
.reading-time {
  margin-left: 1rem;
  color: var(--text-secondary);
}

.reading-time::before {
  content: '•';
  margin-right: 0.5rem;
}

/* Table of Contents */
.table-of-contents {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.table-of-contents h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.table-of-contents ul {
  list-style: none;
  padding-left: 0;
}

.table-of-contents li {
  margin-bottom: 0.5rem;
}

.table-of-contents a {
  color: var(--primary-color);
  text-decoration: none;
}

.table-of-contents a:hover {
  text-decoration: underline;
}

.table-of-contents ul ul {
  padding-left: 1.5rem;
  margin-top: 0.5rem;
}

/* Related Articles */
.related-articles {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

.related-articles h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.related-articles ul {
  list-style: none;
  padding: 0;
}

.related-articles li {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

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

.related-articles a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 600;
  font-size: 1.125rem;
}

.related-articles a:hover {
  text-decoration: underline;
}

.related-articles p {
  margin-top: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

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

.footer-content {
  max-width: var(--max-width);
  margin: 0 auto 2rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
}

.footer-section h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-color);
}

.footer-section ul {
  list-style: none;
  padding: 0;
}

.footer-section li {
  margin-bottom: 0.5rem;
}

.footer-section a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
}

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

.footer-copyright {
  text-align: center;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

/* Responsive */
@media (max-width: 768px) {
  header {
    padding: 1rem;
  }

  header nav a {
    margin-left: 1rem;
  }

  main {
    padding: 2rem 1rem;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .hero p {
    font-size: 1rem;
  }

  .article-header h1 {
    font-size: 2rem;
  }

  .article-content {
    font-size: 1rem;
  }
}
