/* ============================================================================
   Answers — Topics page
   A browse hub matching the design's "Topics" screen. Shares the app shell
   (phone-width card on desktop, full-screen on mobile) with the chat embed and
   reuses the design tokens. Every card / question deep-links into the chat
   (chat.html?q=<question>), which auto-sends it on connect.
   ========================================================================== */

/* Depends on design-tokens.css and answers-shell.css being <link>ed first (no @import:
   imported URLs can't carry the ?v= cache-busting version the HTML uses). */
/* ---- Top: title + search ------------------------------------------------- */
.topics-top {
  flex-shrink: 0;
  padding: 22px 22px 14px;
  background: var(--ans-surface);
  box-shadow: var(--ans-shadow-header);
  position: relative;
  z-index: 5;
}
.topics-title {
  font-family: var(--ans-font-display);
  font-size: 30px;
  line-height: 1;
  color: var(--ans-navy-900);
  margin: 0 0 14px;
}
.topics-search {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 42px;
  background: #f1f4f8;
  border-radius: var(--ans-r-input);
  padding: 0 14px;
}
.topics-search svg { flex-shrink: 0; }
.topics-search input {
  flex: 1;
  border: 0;
  background: transparent;
  font-family: var(--ans-font-body);
  font-size: 14.5px;
  color: var(--ans-navy-900);
  outline: none;
  min-width: 0;
}
.topics-search input::placeholder { color: #9aa7b8; }

/* ---- Scrollable body ----------------------------------------------------- */
.topics-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 16px 22px;
}

/* Category grid (2-up) */
.topics-cats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
  margin-bottom: 18px;
}
.topic-card {
  display: block;
  text-align: left;
  text-decoration: none;
  background: var(--ans-surface);
  border-radius: 16px;
  padding: 15px;
  box-shadow: 0 1px 2px rgba(7, 30, 60, 0.05), 0 6px 18px rgba(7, 30, 60, 0.04);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.topic-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(7, 30, 60, 0.06), 0 12px 26px rgba(7, 30, 60, 0.09);
}
.topic-card:focus-visible {
  outline: 2px solid var(--ans-blue-500);
  outline-offset: 2px;
}
.topic-card__icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 11px;
}
.topic-card__label {
  font-size: 15px;
  font-weight: 600;
  color: var(--ans-navy-900);
}
.topic-card__count {
  font-size: 12.5px;
  color: #9aa7b8;
  margin-top: 3px;
}

/* Section label */
.topics-section {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--ans-slate-400);
  text-transform: uppercase;
  margin: 4px 4px 12px;
}

/* Popular questions */
.topics-questions {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.topic-q {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  background: var(--ans-surface);
  border-radius: 14px;
  padding: 14px 15px;
  box-shadow: 0 1px 2px rgba(7, 30, 60, 0.04);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.topic-q:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(7, 30, 60, 0.06), 0 8px 18px rgba(7, 30, 60, 0.07);
}
.topic-q:focus-visible {
  outline: 2px solid var(--ans-blue-500);
  outline-offset: 2px;
}
.topic-q__emoji { font-size: 15px; flex-shrink: 0; }
.topic-q__text {
  flex: 1;
  font-size: 14px;
  color: var(--ans-ink);
  line-height: 1.35;
}
.topic-q__chev { flex-shrink: 0; }

/* Empty state for the search filter */
.topics-empty {
  text-align: center;
  color: var(--ans-slate-400);
  font-size: 13.5px;
  padding: 18px 8px;
}
.topics-empty[hidden] { display: none; }

/* Bottom tab bar — shared .answers-nav* classes live in answers-shell.css. */

/* ---- Reduced motion ------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---- JSON-rendered additions (real taxonomy) ------------------------------ */
.topic-card__icon--emoji { font-size: 20px; }
.topic-card--active {
  border-color: var(--ans-blue-500);
  box-shadow: 0 0 0 1px var(--ans-blue-500), var(--ans-shadow-bot);
}
.topics-loading {
  grid-column: 1 / -1;
  font-size: 14px;
  color: var(--ans-slate);
  margin: 4px;
}
