:root {
  --green: #2d5016;
  --green-dark: #1e3a0e;
  --light: #4a7c2c;
  --accent: #6b9e3f;
  --bg: #f5f3e8;
  --card: #ffffff;
  --text: #2d2d2d;
  --muted: #6b6b6b;
  --radius: 14px;
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
  --shadow-hover: 0 8px 24px rgba(0,0,0,0.12);
}

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

body {
  font-family: Georgia, 'Segoe UI', serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
}

/* Шапка */
.site-header {
  background: linear-gradient(135deg, var(--green-dark) 0%, var(--green) 50%, var(--light) 100%);
  color: #fff;
  padding: 50px 20px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.site-header::after {
  content: '';
  position: absolute;
  bottom: -40px;
  left: 0;
  right: 0;
  height: 80px;
  background: var(--bg);
  border-radius: 50% 50% 0 0;
}
.header-inner { position: relative; z-index: 1; }
.site-header h1 { font-size: 2.6em; margin-bottom: 10px; font-weight: normal; letter-spacing: 1px; }
.site-header h1 a { color: #fff; text-decoration: none; }
.site-header p { font-size: 1.1em; opacity: 0.92; font-style: italic; }

main { max-width: 1000px; margin: 0 auto; padding: 40px 20px; }

.section-title {
  color: var(--green);
  font-size: 1.9em;
  margin-bottom: 25px;
  padding-bottom: 12px;
  border-bottom: 3px solid var(--light);
  position: relative;
}
.section-title::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 0;
  width: 80px;
  height: 3px;
  background: var(--accent);
}

/* Сетка статей */
.articles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 28px;
}

.article-link { text-decoration: none; color: inherit; display: block; }

.article {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.25s, box-shadow 0.25s;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.article-link:hover .article {
  transform: translateY(-6px);
  box-shadow: var(--shadow-hover);
}

.article-img {
  height: 170px;
  background: linear-gradient(135deg, var(--green), var(--light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.4em;
  transition: transform 0.3s;
}
.article-link:hover .article-img { transform: scale(1.05); }

.article-body { padding: 22px; flex: 1; display: flex; flex-direction: column; }
.article-body h3 { color: var(--green); font-size: 1.25em; margin-bottom: 10px; }
.article-body p { color: var(--muted); font-size: 0.95em; margin-bottom: 12px; flex: 1; }
.article-body .meta { font-size: 0.8em; color: #a0a0a0; margin-top: auto; }

/* Пагинация */
.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 40px;
}
.page-btn {
  display: inline-block;
  padding: 10px 16px;
  background: var(--card);
  color: var(--green);
  border-radius: 8px;
  text-decoration: none;
  font-weight: bold;
  box-shadow: var(--shadow);
  transition: background 0.2s, color 0.2s;
}
.page-btn:hover { background: var(--light); color: #fff; }
.page-btn.active { background: var(--green); color: #fff; }

/* Полная статья */
.article-full {
  background: var(--card);
  border-radius: var(--radius);
  padding: 40px;
  box-shadow: var(--shadow);
  max-width: 800px;
  margin: 0 auto;
}
.article-full-img { font-size: 5em; text-align: center; margin-bottom: 20px; }
.article-full h2 { font-size: 2.1em; color: var(--green); margin-bottom: 8px; }
.article-full .meta { color: #a0a0a0; font-size: 0.9em; margin-bottom: 25px; }
.article-content h3 { color: var(--green); margin-top: 28px; margin-bottom: 10px; font-size: 1.3em; }
.article-content p { margin-bottom: 16px; }
.back-link { margin-top: 30px; }

a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Подвал */
.site-footer {
  background: var(--green-dark);
  color: #fff;
  text-align: center;
  padding: 35px 20px;
  margin-top: 50px;
}
.footer-sub { opacity: 0.7; font-size: 0.85em; margin-top: 6px; }

/* Адаптивность */
@media (max-width: 600px) {
  .site-header h1 { font-size: 2em; }
  .article-full { padding: 25px; }
  .articles { grid-template-columns: 1fr; }
}

/* Меню рубрик */
.categories-menu {
  background: #fff;
  border-bottom: 1px solid #e6e6e6;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  position: sticky;
  top: 0;
  z-index: 10;
}
.categories-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.cat-btn {
  display: inline-block;
  padding: 8px 14px;
  background: #f5f3e8;
  color: var(--green);
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.92em;
  font-weight: bold;
  transition: background 0.2s, color 0.2s;
  border: 1px solid transparent;
}
.cat-btn:hover {
  background: var(--light);
  color: #fff;
  text-decoration: none;
}
.cat-btn.active {
  background: var(--green);
  color: #fff;
  border-color: var(--green-dark);
}
.count {
  font-size: 0.7em;
  color: #a0a0a0;
  font-weight: normal;
  margin-left: 6px;
}
.empty {
  text-align: center;
  padding: 40px;
  color: var(--muted);
  font-style: italic;
}

.article-full .meta a {
  color: var(--green);
  font-weight: bold;
}

@media (max-width: 600px) {
  .categories-inner {
    padding: 10px 12px;
    gap: 6px;
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  .cat-btn {
    padding: 7px 11px;
    font-size: 0.85em;
    white-space: nowrap;
    flex-shrink: 0;
  }
}


/* === Меню рубрик — обновлённые стили с jQuery === */
.categories-menu {
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid #e6e6e6;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: box-shadow 0.25s, padding 0.2s;
}
.categories-menu.scrolled {
  box-shadow: 0 4px 16px rgba(45,80,22,0.18);
  padding: 0;
}
.categories-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}
.cat-btn {
  display: inline-block;
  padding: 9px 16px;
  background: #f5f3e8;
  color: var(--green);
  border-radius: 10px;
  text-decoration: none;
  font-size: 0.92em;
  font-weight: bold;
  border: 2px solid transparent;
  transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
  position: relative;
  overflow: hidden;
  cursor: pointer;
}
.cat-btn::before {
  content: ;
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--green), var(--light));
  opacity: 0;
  transition: opacity 0.25s;
  z-index: -1;
}
.cat-btn:hover {
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(45,80,22,0.25);
  text-decoration: none;
}
.cat-btn:hover::before { opacity: 1; }
.cat-btn.active {
  background: linear-gradient(135deg, var(--green-dark) 0%, var(--green) 50%, var(--light) 100%);
  color: #fff;
  border-color: var(--green-dark);
  box-shadow: 0 4px 12px rgba(45,80,22,0.30);
}

/* Кнопка «Наверх» */
.to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--green), var(--light));
  color: #fff;
  border: none;
  font-size: 1.5em;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(45,80,22,0.4);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.3s ease;
  z-index: 99;
}
.to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.to-top:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 6px 22px rgba(45,80,22,0.55);
}

@media (max-width: 600px) {
  .categories-inner {
    padding: 10px 12px;
    gap: 6px;
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  .cat-btn {
    padding: 7px 12px;
    font-size: 0.85em;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .to-top {
    bottom: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    font-size: 1.3em;
  }
}


/* Ripple-эффект при клике на рубрику */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  transform: scale(0);
  animation: ripple-anim 0.6s linear;
  pointer-events: none;
}
@keyframes ripple-anim {
  to { transform: scale(2.5); opacity: 0; }
}

/* Анимация при наведении на карточку статьи */
.article {
  transition: opacity 0.4s ease, margin-top 0.4s ease, transform 0.3s, box-shadow 0.3s;
}
.article:hover { transform: translateY(-3px); }

/* Скрытие меню при загрузке (jQuery fadeIn) */
.categories-menu { animation: menuFadeIn 0.5s ease-out; }
@keyframes menuFadeIn {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Pulse-эффект активной рубрики */
.cat-btn.active { animation: activePulse 3.2s infinite; }
@keyframes activePulse {
  0%, 100% { box-shadow: 0 4px 12px rgba(45,80,22,0.30); }
  50%      { box-shadow: 0 4px 22px rgba(45,80,22,0.55); }
}

/* Плавное появление блока main */
main { animation: mainFade 0.5s ease-out; }
@keyframes mainFade {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Hover-эффект для кнопки "Наверх" */
.to-top:hover {
  animation: topBounce 0.5s ease;
}
@keyframes topBounce {
  0%, 100% { transform: translateY(-3px) scale(1.05); }
  50%      { transform: translateY(-7px) scale(1.1); }
}
