/* ==========================================================================
   BLOG-B/C/D — фільтр за категоріями, сітка карток статей, порожній стан
   (WPBakery-елемент nd_posts + шаблон архіву category.php)
   Палітра узгоджена з рештою сайту (#c57858 / #8e5740 / #faf4e8 / #F2EADC).
   ========================================================================== */

.nd-posts {
  --nd-posts-cols: 3;
  --nd-posts-card: #faf4e8;
  --nd-posts-terra: #c57858;
  --nd-posts-terra-d: #8e5740;
  --nd-posts-ink: #2E2520;
  --nd-posts-muted: #7C6F62;
  --nd-posts-line: rgba(46, 37, 32, 0.12);

  color: var(--nd-posts-ink);
  -webkit-font-smoothing: antialiased;
}

.nd-posts *,
.nd-posts *::before,
.nd-posts *::after { box-sizing: border-box; }

.nd-posts__wrap {
  max-width: 1140px;
  margin: 0 auto;
}

/* --------------------------------------------------------------------------
   Заголовок секції
   -------------------------------------------------------------------------- */
.nd-posts__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--nd-posts-terra);
}
.nd-posts__eyebrow::before {
  content: "";
  width: 28px;
  height: 1px;
  background: currentColor;
  opacity: 0.6;
}

.nd-posts__title-main {
  margin: 0 0 26px;
  font-size: clamp(26px, 3.6vw, 40px);
  line-height: 1.2;
  font-weight: 700;
}
.nd-posts__title-main em {
  font-style: italic;
  color: var(--nd-posts-terra);
}

/* --------------------------------------------------------------------------
   BLOG-B. Таби
   -------------------------------------------------------------------------- */
.nd-posts__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 30px;
  padding: 0;
  list-style: none;
}

.nd-posts__tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 18px;
  border: 1px solid var(--nd-posts-line);
  border-radius: 999px;
  background: transparent;
  color: var(--nd-posts-ink);
  font-size: 15px;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.nd-posts__tab:hover,
.nd-posts__tab:focus-visible {
  border-color: var(--nd-posts-terra);
  color: var(--nd-posts-terra-d);
}
.nd-posts__tab.is-active {
  background: var(--nd-posts-terra);
  border-color: var(--nd-posts-terra);
  color: #ffffff;
}

.nd-posts__tab-count {
  font-size: 12px;
  font-weight: 600;
  opacity: 0.7;
}

/* --------------------------------------------------------------------------
   BLOG-C. Сітка карток
   -------------------------------------------------------------------------- */
.nd-posts__grid {
  display: grid;
  grid-template-columns: repeat(var(--nd-posts-cols), minmax(0, 1fr));
  gap: 28px;
  align-items: start;
}
.nd-posts__grid[hidden] { display: none; }

.nd-posts__card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: var(--nd-posts-card);
  border: 1px solid var(--nd-posts-line);
  border-radius: 18px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.nd-posts__card[hidden] { display: none; }
.nd-posts__card:hover,
.nd-posts__card:focus-within {
  transform: translateY(-3px);
  border-color: var(--nd-posts-terra);
  box-shadow: 0 14px 30px rgba(46, 37, 32, 0.10);
}

/* Обкладинка 16:9 */
.nd-posts__media {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #efe2cd;
}
.nd-posts__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}
.nd-posts__card:hover .nd-posts__img { transform: scale(1.04); }

.nd-posts__img-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--nd-posts-terra);
  opacity: 0.5;
}
.nd-posts__img-placeholder svg { width: 42px; height: 42px; }

.nd-posts__body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px 22px 24px;
  flex: 1 1 auto;
}

/* Категорія · дата · час читання */
.nd-posts__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  font-size: 13px;
  color: var(--nd-posts-muted);
}
.nd-posts__cat {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(197, 120, 88, 0.14);
  color: var(--nd-posts-terra-d);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.nd-posts__read { position: relative; }
.nd-posts__read::before {
  content: "·";
  margin-right: 10px;
  opacity: 0.6;
}

.nd-posts__title {
  margin: 0;
  font-size: 20px;
  line-height: 1.3;
  font-weight: 700;
}
.nd-posts__title a {
  color: inherit;
  text-decoration: none;
}
/* Клікабельна вся картка: посилання заголовка накриває її цілком. */
.nd-posts__title a::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}
.nd-posts__card:hover .nd-posts__title a,
.nd-posts__title a:focus-visible { color: var(--nd-posts-terra-d); }

.nd-posts__lead {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--nd-posts-muted);
}

.nd-posts__more-link {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--nd-posts-terra-d);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
}
.nd-posts__card:hover .nd-posts__more-link { gap: 11px; }
.nd-posts__more-link span { transition: transform 0.2s ease; }

/* --------------------------------------------------------------------------
   «Показати ще» і пагінація
   -------------------------------------------------------------------------- */
.nd-posts__more {
  margin-top: 34px;
  text-align: center;
}
.nd-posts__more[hidden] { display: none; }

.nd-posts__more-btn {
  padding: 14px 34px;
  border: 1px solid var(--nd-posts-terra);
  border-radius: 999px;
  background: transparent;
  color: var(--nd-posts-terra-d);
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.nd-posts__more-btn:hover,
.nd-posts__more-btn:focus-visible {
  background: var(--nd-posts-terra);
  color: #ffffff;
}

.nd-posts__pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 34px;
}
.nd-posts__pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--nd-posts-line);
  border-radius: 999px;
  color: var(--nd-posts-ink);
  font-size: 15px;
  text-decoration: none;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.nd-posts__pagination a.page-numbers:hover {
  border-color: var(--nd-posts-terra);
  color: var(--nd-posts-terra-d);
}
.nd-posts__pagination .page-numbers.current {
  background: var(--nd-posts-terra);
  border-color: var(--nd-posts-terra);
  color: #ffffff;
}
.nd-posts__pagination .page-numbers.dots {
  border-color: transparent;
  min-width: 24px;
}

/* --------------------------------------------------------------------------
   BLOG-D. Порожня категорія
   -------------------------------------------------------------------------- */
.nd-posts__empty-wrap[hidden] { display: none; }

.nd-posts__empty {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 30px 28px;
  background: var(--nd-posts-card);
  border: 1px dashed var(--nd-posts-line);
  border-radius: 18px;
}

.nd-posts__empty-icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(197, 120, 88, 0.12);
  color: var(--nd-posts-terra-d);
}
.nd-posts__empty-icon svg { width: 24px; height: 24px; }

.nd-posts__empty-text {
  margin: 0;
  font-size: 16px;
  line-height: 1.6;
  color: var(--nd-posts-muted);
}
.nd-posts__empty-text a {
  color: var(--nd-posts-terra-d);
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Адаптив
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .nd-posts__grid { gap: 22px; }
}

@media (max-width: 767px) {
  .nd-posts__grid { gap: 18px; }
  .nd-posts__body { padding: 18px 18px 20px; }
  .nd-posts__title { font-size: 18px; }
  .nd-posts__empty { padding: 24px 20px; }
  .nd-posts__more-btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .nd-posts__card,
  .nd-posts__img,
  .nd-posts__tab,
  .nd-posts__more-btn,
  .nd-posts__more-link span { transition: none; }
  .nd-posts__card:hover { transform: none; }
  .nd-posts__card:hover .nd-posts__img { transform: none; }
}
