/* === CSS Variables === */
:root {
  --bg: #ffffff;
  --bg-card: #f8f9fa;
  --text: #1a1a2e;
  --text-muted: #6c757d;
  --accent: #2d6a4f;
  --accent-light: #40916c;
  --border: #dee2e6;
  --tag-bg: #e8f5e9;
  --tag-text: #2d6a4f;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --radius: 12px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

[data-theme="dark"] {
  --bg: #0f172a;
  --bg-card: #1e293b;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --accent: #4ade80;
  --accent-light: #22c55e;
  --border: #334155;
  --tag-bg: #1e3a2f;
  --tag-text: #4ade80;
  --shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  transition: background 0.3s, color 0.3s;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-light); }
img { max-width: 100%; }
.container { max-width: 800px; margin: 0 auto; padding: 0 1.25rem; }

/* === Header === */
.site-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  max-width: 900px;
  margin: 0 auto;
}
.site-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}
.site-nav { display: flex; gap: 1rem; align-items: center; }
.site-nav a { color: var(--text-muted); font-size: 0.9rem; }
.site-nav a:hover { color: var(--accent); }
.theme-btn {
  background: none; border: none; cursor: pointer;
  font-size: 1.2rem; padding: 0.25rem;
}
.menu-toggle { display: none; background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text); }

/* === Hero === */
.hero {
  text-align: center;
  padding: 3rem 0 2rem;
}
.hero h1 { font-size: 2rem; margin-bottom: 0.5rem; }
.hero p { color: var(--text-muted); font-size: 1.05rem; }

/* === Post Cards === */
.posts-grid {
  display: grid;
  gap: 0.5rem;
  padding: 1rem 0 2rem;
}
.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 0.5rem;
  transition: transform 0.2s, box-shadow 0.2s;
}
.post-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.post-meta { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.5rem; font-size: 0.85rem; }
.post-date { color: var(--text-muted); }
.post-category {
  background: var(--tag-bg);
  color: var(--tag-text);
  padding: 0.15rem 0.6rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
}
.post-title { font-size: 1.1rem; margin-bottom: 0.3rem; line-height: 1.3; }
.post-title a { color: var(--text); }
.post-title a:hover { color: var(--accent); }
.post-summary { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 0.4rem; line-height: 1.5; }
.post-footer { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.5rem; }
.post-tags { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.tag {
  color: var(--tag-text);
  font-size: 0.8rem;
  font-weight: 500;
}
.tag:hover { text-decoration: underline; }
.post-actions { display: flex; gap: 0.75rem; align-items: center; font-size: 0.85rem; }
.likes { color: var(--text-muted); }
.source-link { color: var(--accent); font-weight: 500; }
.read-more { display: inline-block; font-size: 0.85rem; color: var(--accent); font-weight: 500; margin-top: 0.25rem; }
.read-more:hover { color: var(--accent-light); text-decoration: underline; }
.post-date, .likes, .replies { font-size: 0.8rem; }

/* === Single Post === */
.single-post { padding: 2rem 0 3rem; }
.post-header { margin-bottom: 2rem; }
.post-header h1 { font-size: 2rem; line-height: 1.3; margin: 0.5rem 0; }
.post-content { font-size: 1.05rem; line-height: 1.8; }
.post-content h2 { margin: 2rem 0 0.75rem; font-size: 1.5rem; }
.post-content h3 { margin: 1.5rem 0 0.5rem; }
.post-content ul, .post-content ol { padding-left: 1.5rem; margin: 1rem 0; }
.post-content li { margin-bottom: 0.4rem; }
.post-content p { margin-bottom: 1rem; }
.post-single-footer { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 1rem; }
.source-btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  font-weight: 600;
  text-align: center;
  width: fit-content;
}
.source-btn:hover { background: var(--accent-light); color: #fff; }
.back-link { color: var(--text-muted); }

/* === Search === */
.search-page { padding: 2rem 0; }
.search-page h1 { margin-bottom: 1rem; }
.search-box { margin-bottom: 1rem; }
.search-box input {
  width: 100%;
  padding: 0.85rem 1rem;
  font-size: 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}
.search-box input:focus { border-color: var(--accent); }
.filter-bar { margin-bottom: 1rem; }
.filter-bar select {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.9rem;
}
.search-hint { color: var(--text-muted); text-align: center; padding: 2rem; }

/* === Terms / Taxonomy === */
.terms-page, .taxonomy-page { padding: 2rem 0; }
.terms-page h1, .taxonomy-page h1 { margin-bottom: 1rem; }
.terms-list { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.term-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
}
.term-count { color: var(--text-muted); font-size: 0.85rem; }

/* === Pagination === */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  padding: 2rem 0;
}
.pagination a {
  padding: 0.4rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
}
.pagination a:hover { background: var(--bg-card); }
.page-num { color: var(--text-muted); font-size: 0.9rem; }

/* === Footer === */
.site-footer {
  text-align: center;
  padding: 2rem 0;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 2rem;
}
.footer-note { margin-top: 0.3rem; }

/* === Mobile === */
@media (max-width: 640px) {
  .site-nav { display: none; }
  .menu-toggle { display: block; }
  .site-nav.active {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 1rem;
    gap: 0.75rem;
  }
  .hero h1 { font-size: 1.5rem; }
  .post-header h1 { font-size: 1.5rem; }
}