:root {
  --brand-green: #2d6a4f;
  --brand-green-dark: #1f4d38;
  --bg: #f7f7f2;
  --bg-card: #ffffff;
  --text: #1f2a1f;
  --text-muted: #5c6b5c;
  --border: #e0e3da;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--brand-green); text-decoration: none; }
a:hover { text-decoration: underline; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Header */
.site-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 18px 24px;
}
.site-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.site-logo { display: inline-flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 700; color: var(--brand-green); }
.site-logo:hover { text-decoration: none; }
.site-logo-image { display: block; width: 40px; height: 40px; object-fit: contain; flex-shrink: 0; }
.site-logo-text { line-height: 1.2; }
.site-tagline { margin: 6px 0 0; font-size: 14px; color: var(--text-muted); }

.site-header-actions { display: flex; align-items: center; gap: 14px; }

.theme-toggle-group {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.theme-toggle-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  cursor: pointer;
}
.theme-toggle-btn:hover { color: var(--text); }
.theme-toggle-btn.active { background: var(--brand-green); color: #fff; }

.btn-subscribe {
  display: inline-block;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  background: var(--brand-green);
  color: #fff;
  border-radius: 999px;
  white-space: nowrap;
}
.btn-subscribe:hover { background: var(--brand-green-dark); color: #fff; text-decoration: none; }

.btn-support {
  display: inline-block;
  padding: 8.5px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--brand-green);
  background: transparent;
  border: 1.5px solid var(--brand-green);
  border-radius: 999px;
  white-space: nowrap;
}
.btn-support:hover { background: var(--brand-green); color: #fff; text-decoration: none; }

/* Search */
.search-section { padding: 48px 24px 32px; }
.search-form {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  gap: 8px;
}
.search-form input[type="search"] {
  flex: 1;
  padding: 16px 20px;
  font-size: 17px;
  border: 2px solid var(--border);
  border-radius: 999px;
  outline: none;
  background: var(--bg-card);
  color: var(--text);
}
.search-form input[type="search"]:focus { border-color: var(--brand-green); }
.search-form button {
  padding: 16px 28px;
  font-size: 16px;
  font-weight: 600;
  background: var(--brand-green);
  color: #fff;
  border: none;
  border-radius: 999px;
  cursor: pointer;
}
.search-form button:hover { background: var(--brand-green-dark); }

/* Category grid */
.category-grid-section { max-width: 1100px; margin: 0 auto; padding: 24px 24px 64px; }
.category-grid-section h1 { font-size: 24px; text-align: center; margin-bottom: 32px; }
.category-grid-section h2 { font-size: 24px; text-align: center; margin: 8px 0 32px; }
.category-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.category-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 24px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-align: center;
  color: var(--text);
}
.category-tile:hover {
  border-color: var(--brand-green);
  box-shadow: 0 4px 14px rgba(45, 106, 79, 0.12);
  text-decoration: none;
}
.category-tile img { width: 64px; height: 64px; object-fit: contain; }
.category-tile span { font-size: 14px; font-weight: 600; }

@media (max-width: 720px) {
  .category-grid { grid-template-columns: repeat(2, 1fr); }
  .search-form { flex-direction: column; }
}
@media (min-width: 721px) and (max-width: 900px) {
  .category-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Category & search pages */
.page-content { max-width: 900px; margin: 0 auto; padding: 32px 24px 64px; }
.page-content h1 { font-size: 28px; margin: 0 0 12px; }
.page-content h2 { font-size: 18px; margin: 32px 0 14px; }
.breadcrumb { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--brand-green); }
.category-description { color: var(--text-muted); font-size: 15px; margin: 0; }

.rss-subscribe-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  margin: 16px 0 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 20px;
  font-weight: 600;
  color: var(--brand-green);
}
.rss-subscribe-link:hover { border-color: var(--brand-green); text-decoration: none; }
.rss-subscribe-link svg { display: block; width: 1em; height: 1em; flex-shrink: 0; fill: currentColor; }

/* Article page */
.article-meta-line { color: var(--text-muted); font-size: 14px; margin: 0 0 24px; }
.article-featured-image { width: 100%; max-height: 420px; object-fit: cover; border-radius: 10px; margin-bottom: 28px; }
.article-body { font-size: 17px; line-height: 1.7; }
.article-body p { margin: 0 0 18px; }
.article-body h2 { font-size: 22px; margin: 32px 0 14px; }
.article-body h3 { font-size: 19px; margin: 26px 0 12px; }
.article-body img { max-width: 100%; height: auto; border-radius: 8px; margin: 16px 0; }
.video-embed { position: relative; width: 100%; height: 0; padding-bottom: 56.25%; margin: 20px 0; }
.video-embed iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0; border-radius: 8px; }
.article-body blockquote {
  margin: 20px 0;
  padding: 12px 20px;
  border-left: 3px solid var(--brand-green);
  background: var(--bg-card);
  color: var(--text-muted);
}
.article-body ul, .article-body ol { margin: 0 0 18px; padding-left: 24px; }
.article-body a { text-decoration: underline; }
.author-box {
  margin-top: 40px;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.author-box h2 { margin: 0 0 8px; font-size: 16px; }
.author-box p { margin: 0; color: var(--text-muted); font-size: 14px; }
.subcategory-list { display: flex; flex-wrap: wrap; gap: 10px; }
.subcategory-link {
  display: inline-block;
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 14px;
  color: var(--text);
}
.subcategory-link:hover { border-color: var(--brand-green); text-decoration: none; }
.article-list-public { display: flex; flex-direction: column; gap: 16px; }
.article-card {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
}
.article-card:hover { border-color: var(--brand-green); text-decoration: none; }
.article-card-image { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; flex-shrink: 0; background: var(--bg); }
.article-card-body { flex: 1; min-width: 0; }
.article-card-body h3 { margin: 0 0 6px; font-size: 17px; }
.article-card-body p { margin: 0; color: var(--text-muted); font-size: 14px; }
.hint-public { color: var(--text-muted); font-size: 14px; }

.pagination-public {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 24px;
  font-size: 14px;
  color: var(--text-muted);
}

@media (max-width: 480px) {
  .article-card { flex-direction: column; }
  .article-card-image { width: 100%; height: 160px; }
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px;
  margin-top: 40px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}
.site-footer p { margin: 0 0 8px; }
.site-footer-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.footer-links { display: flex; justify-content: center; gap: 16px; }
.footer-links a { color: var(--text-muted); }
.footer-links a:hover { color: var(--brand-green); }

/* Email signup page */
.subscribe-intro { color: var(--text-muted); margin: 0 0 24px; }
.subscribe-form .field-row { margin-bottom: 20px; }
.subscribe-form label.field-label { display: block; font-weight: 600; margin-bottom: 8px; }
.subscribe-form input[type="email"] {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text);
}
.subscribe-form input[type="email"]:focus { outline: none; border-color: var(--brand-green); }
.all-categories-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  margin-bottom: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-weight: 600;
}
.category-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.category-checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}
.category-checkbox-item input:disabled { opacity: 0.5; }
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.subscribe-form .form-actions { margin-top: 24px; }
.subscribe-form button[type="submit"] {
  padding: 14px 32px;
  font-size: 16px;
  font-weight: 600;
  background: var(--brand-green);
  color: #fff;
  border: none;
  border-radius: 999px;
  cursor: pointer;
}
.subscribe-form button[type="submit"]:hover { background: var(--brand-green-dark); }
.flash-public {
  padding: 14px 18px;
  border-radius: 8px;
  margin-bottom: 24px;
  font-size: 15px;
}
.flash-public.flash-success { background: rgba(45, 106, 79, 0.12); color: var(--brand-green); }
.flash-public.flash-error { background: rgba(180, 60, 60, 0.12); color: #b43c3c; }

@media (max-width: 480px) {
  .category-checkbox-grid { grid-template-columns: 1fr; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12181f;
    --bg-card: #1b232d;
    --text: #e6e9ef;
    --text-muted: #a9b4c2;
    --border: #2a3542;
    --brand-green: #4fae82;
    --brand-green-dark: #3f9169;
  }
}
:root[data-theme="dark"] {
  --bg: #12181f;
  --bg-card: #1b232d;
  --text: #e6e9ef;
  --text-muted: #a9b4c2;
  --border: #2a3542;
  --brand-green: #4fae82;
  --brand-green-dark: #3f9169;
}
:root[data-theme="light"] {
  --bg: #f7f7f2;
  --bg-card: #ffffff;
  --text: #1f2a1f;
  --text-muted: #5c6b5c;
  --border: #e0e3da;
  --brand-green: #2d6a4f;
  --brand-green-dark: #1f4d38;
}
