/* ==========================================================================
   Help The Poor Initiative — FAQ
   Page-specific only. The accordion itself (markup, styling AND behaviour) is
   shared: styles in style.css, behaviour in main.js. This file adds the
   search, the category nav and the empty state.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Search
   -------------------------------------------------------------------------- */
.ask { padding: 44px 0 0; }

.ask-inner { max-width: 640px; margin: 0 auto; text-align: center; }

.ask-lede {
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 2vw, 1.28rem);
  font-weight: 600;
  line-height: 1.55;
  color: var(--ink);
  margin-bottom: 22px;
}

.search {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 18px;
  color: var(--muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 16px 52px 16px 50px;
  font-size: 1rem;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  transition: border-color var(--speed) var(--ease), box-shadow var(--speed) var(--ease);
}

.search-input::placeholder { color: #9AA39C; }

/* type="search" is right for semantics and for the mobile keyboard, but Chrome
   and Safari draw their own cancel cross, which would sit beside ours. */
.search-input::-webkit-search-cancel-button,
.search-input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }

.search-input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(30, 92, 38, .13);
}

.search-clear {
  position: absolute;
  right: 12px;
  display: none;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--muted);
  transition: background-color var(--speed) var(--ease), color var(--speed) var(--ease);
}

.search-clear.is-shown { display: grid; }
.search-clear:hover { background: var(--surface-alt); color: var(--ink); }

.search-count {
  min-height: 22px;
  margin-top: 14px;
  font-size: .875rem;
  color: var(--muted);
}

.search-count strong { color: var(--ink); font-weight: 700; }

/* --------------------------------------------------------------------------
   2. Category nav
   -------------------------------------------------------------------------- */
.cats { padding: 30px 0 0; }

.cat-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 9px;
}

.cat-list a {
  padding: 9px 17px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  font-family: var(--font-display);
  font-size: .8125rem;
  font-weight: 700;
  color: var(--muted);
  transition: all var(--speed) var(--ease);
}

.cat-list a:hover {
  border-color: color-mix(in srgb, var(--accent, var(--green)) 45%, var(--line));
  color: var(--accent, var(--green));
}

.cat-list a.is-current {
  background: var(--accent, var(--green));
  border-color: var(--accent, var(--green));
  color: #fff;
}

/* Hidden while a search is running — jumping to a category makes no sense
   when the list is already filtered. */
.cats.is-muted { opacity: .35; pointer-events: none; }

/* --------------------------------------------------------------------------
   3. Question groups
   -------------------------------------------------------------------------- */
.qa { padding: 46px 0 84px; }

.qa-wrap { max-width: 820px; margin-inline: auto; }

.qa-group {
  margin-bottom: 44px;
  scroll-margin-top: calc(var(--header-h) + 24px);
}

.qa-group:last-child { margin-bottom: 0; }

.qa-group[hidden] { display: none; }

.qa-group-head {
  display: flex;
  align-items: center;
  gap: 13px;
  padding-bottom: 14px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.qa-mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: color-mix(in srgb, var(--accent, var(--green)) 12%, #fff);
  color: var(--accent, var(--green));
}

.qa-group-head h2 {
  font-size: 1.125rem;
  font-weight: 800;
  letter-spacing: .01em;
  color: var(--ink);
}

/* Class, not `.qa-group-head span` — that would also select the icon span,
   whose SVG the search would then overwrite with the count text. */
.qa-count {
  margin-left: auto;
  font-size: .8125rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* The accordion item itself comes from style.css; only the hidden state and
   the search highlight are page-specific. */
.accordion-item[hidden] { display: none; }

.accordion-item mark {
  padding: 0 2px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--orange) 28%, #fff);
  color: inherit;
}

/* --------------------------------------------------------------------------
   4. Empty state
   -------------------------------------------------------------------------- */
.no-match {
  display: none;
  padding: 54px 24px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-alt);
}

.no-match.is-shown { display: block; }

.no-match h3 {
  font-size: 1.125rem;
  font-weight: 800;
  color: var(--ink);
}

.no-match p {
  max-width: 46ch;
  margin: 8px auto 20px;
  line-height: 1.7;
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   5. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .ask { padding-top: 34px; }
  .qa { padding: 34px 0 62px; }
  .qa-group { margin-bottom: 34px; }
  .cat-list a { padding: 8px 13px; font-size: .75rem; }
  .search-input { padding: 14px 46px 14px 44px; font-size: .9375rem; }
}
