/* cnm-news block — ADDITIVE layer on top of assets/css/news.css.
   Only styles the new search/sort affordances and the paginate_links()
   output. Original .news-toolbar / .news-tabs / .news-sort visuals come
   straight from news.css and are not touched here. */

/* ── Anchor tabs inherit the original button visuals ─────────────────── */
.news-tabs a {
  appearance: none;
  background: rgba(var(--green-rgb), 0.09);
  border: 0;
  color: var(--ink);
  font-family: var(--sans);
  font-size: clamp(14px, 2.2vw, 24px);
  font-weight: 400;
  letter-spacing: 0.02em;
  padding: 10px 18px;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  line-height: normal;
  transition: background 0.2s, color 0.2s;
}
.news-tabs a:hover     { background: rgba(var(--brand-rgb), 0.1); }
.news-tabs a.is-active { background: var(--green); color: var(--bg); }

/* ── Sort cluster: position-relative so popover/menu can anchor to it ── */
.news-sort {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

/* Visible "currently searching for X ✕" chip when a search is active */
.news-sort__clear {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  font-family: var(--sans);
  font-size: clamp(13px, 1.3vw, 15px);
  color: var(--brand);
}
.news-sort__search-tag {
  background: rgba(var(--brand-rgb), 0.08);
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.news-sort__clear:hover .news-sort__search-tag { background: rgba(var(--brand-rgb), 0.16); }

/* Search-toggle: subtle icon-only button so the original toolbar layout stays intact */
.news-sort__search-toggle {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 6px;
  cursor: pointer;
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}
.news-sort__search-toggle:hover { background: rgba(var(--brand-rgb), 0.08); }
.news-sort__search-toggle .cnm-icon { width: 18px; height: 18px; }

/* Search form popover — collapsed by default ([hidden] is honored), reveals
   when JS removes the [hidden] attribute on toggle. */
.news-sort__search-form {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 10;
  background: var(--white);
  padding: 8px 12px;
  border: 1px solid rgba(var(--green-rgb), 0.18);
  border-radius: 999px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
}
.news-sort__search-form input[type="search"] {
  appearance: none;
  border: 0;
  outline: 0;
  background: transparent;
  font-family: var(--sans);
  font-size: clamp(14px, 1.5vw, 16px);
  font-weight: 300;
  color: var(--ink);
  width: clamp(180px, 22vw, 280px);
  padding: 4px 6px;
}
.news-sort__search-form input[type="search"]::placeholder { color: rgba(var(--green-rgb), 0.5); }

/* Sort menu — collapsed by default ([hidden] is honored), JS reveals on toggle */
.news-sort__menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 10;
  margin: 0;
  padding: 8px 0;
  list-style: none;
  background: var(--white);
  border: 1px solid rgba(var(--green-rgb), 0.18);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  min-width: 180px;
}
.news-sort__menu li { margin: 0; }
.news-sort__menu a {
  display: block;
  padding: 8px 18px;
  text-decoration: none;
  color: var(--ink);
  font-family: var(--sans);
  font-size: clamp(14px, 1.4vw, 16px);
  font-weight: 300;
  transition: background 0.15s, color 0.15s;
}
.news-sort__menu a:hover     { background: rgba(var(--brand-rgb), 0.06); color: var(--brand); }
.news-sort__menu a.is-active { color: var(--brand); font-weight: 500; }

/* ── Empty / no-results state ──────────────────────────────────────── */
.news-listing__empty {
  padding: 60px 0 90px;
  font-family: var(--sans);
  font-size: clamp(15px, 1.4vw, 18px);
  color: var(--green);
  text-align: center;
}
.news-listing__empty a {
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ── paginate_links() output ───────────────────────────────────────────
   paginate_links emits .page-numbers anchors plus a .current span. The
   shared .listing-pagination styles already cover anchor children; we add
   matching span.current rules and dots handling. */
.listing-pagination .pages span.page-numbers {
  width: 69px;
  height: 69px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--sans);
  font-size: 1.125rem;
  font-weight: 300;
  text-transform: uppercase;
  border: 1px solid rgba(61, 50, 32, 0.7);
  color: var(--brand);
}
.listing-pagination .pages span.page-numbers.current {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--white);
}
.listing-pagination .pages span.page-numbers.dots { border: 0; }

@media (max-width: 575px) {
  .news-sort { gap: 8px; }
  .news-sort__search-form {
    right: auto;
    left: 0;
  }
  .news-sort__search-form input[type="search"] { width: 60vw; }
  .listing-pagination .pages span.page-numbers { width: 46px; height: 46px; font-size: 1rem; }
}
