/* ==========================================================================
   usaindiacfo.com — Insights search (/insights/ and /insights/category/<slug>/)
   The list head (category pills + the search field), the "N results for …"
   line, highlighted matches, and the as-you-type listbox
   (php-assets/insights-search.js). Loaded after blog.css on those pages only.
   Colours: clay.css tokens only (both themes).
   ========================================================================== */

/* ── the list head: pills left, the field right; wraps under on narrow ─── */
.list-head {
  position: relative; z-index: 5;       /* its panel paints over the (transformed) rows below */
  display: flex; align-items: center; justify-content: space-between;
  gap: 18px 20px; flex-wrap: wrap;
  margin-bottom: clamp(28px, 3.5vw, 44px);
}
/* pills take the spare room on a shared row; wrapped onto its own row, the field takes the whole row */
.list-head .cats, .posts-section .list-head .cats--list { margin: 0; flex: 100 1 520px; min-width: 0; }
.list-head--hero { margin: clamp(28px, 3.5vw, 44px) 0 0; }

/* ── the field: a clay inset pill with the icon in it ─────────────────── */
.isearch { position: relative; flex: 1 1 280px; min-width: 220px; }
.isearch__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.isearch__field { position: relative; display: flex; align-items: center; }
.isearch__icon { position: absolute; left: 16px; top: 50%; margin-top: -8px; color: var(--bronze-deep); pointer-events: none; }
.isearch__input {
  width: 100%; height: 44px; padding: 0 48px 0 42px;
  font: 400 14.5px/1.2 Inter, sans-serif; color: var(--ink);
  background: linear-gradient(178deg, var(--sand-917b) 0%, var(--sand-941) 100%);
  border: 0; border-radius: var(--r-pill); box-shadow: var(--clay-in);
  -webkit-appearance: none; appearance: none;
  transition: box-shadow .3s var(--ease);
}
.isearch__input::placeholder { color: var(--ink-faint); opacity: 1; }
.isearch__input::-webkit-search-decoration { -webkit-appearance: none; }
.isearch__input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.isearch__input:focus { outline: none; box-shadow: var(--clay-in), 0 0 0 3px rgba(var(--bronze-bright-rgb), .2); }
.isearch__go {
  position: absolute; right: 5px; top: 5px; width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%; cursor: pointer; color: var(--ink-soft);
  background: linear-gradient(178deg, var(--sand-977) 0%, var(--sand-943) 100%);
  box-shadow: var(--clay-sm);
  transition: color .3s var(--ease), box-shadow .3s var(--ease), transform .3s var(--ease);
}
.isearch__go:hover { color: var(--bronze-deep); box-shadow: var(--clay-md); transform: translate3d(0, -1px, 0); }
.isearch__go:focus-visible { outline: 2px solid var(--bronze-bright); outline-offset: 2px; }

/* ── the as-you-type panel (JS) ───────────────────────────────────────── */
.isearch__pop {
  position: absolute; z-index: 30; right: 0; top: calc(100% + 10px);
  width: max(100%, min(560px, calc(100vw - 2 * var(--gutter))));   /* never narrower than the field */
  max-height: min(70vh, 620px); overflow: auto; overscroll-behavior: contain;
  padding: 8px; border-radius: var(--r);
  background: linear-gradient(178deg, var(--sand-977) 0%, var(--sand-952) 100%);
  box-shadow: var(--clay-md);
}
.isearch__pop[hidden] { display: none; }
.isearch__list { list-style: none; margin: 0; padding: 0; }
.isearch__opt {
  display: block; padding: 13px 14px 14px; border-radius: var(--r-sm); cursor: pointer;
  transition: background-color .2s var(--ease);
}
.isearch__opt + .isearch__opt { margin-top: 2px; }
.isearch__opt[aria-selected="true"], .isearch__opt:hover { background: rgba(var(--bronze-rgb), .1); }
.isearch__opt[aria-selected="true"] { box-shadow: inset 2px 0 0 var(--bronze); }
.isearch__t { display: block; font: 400 17px/1.3 Newsreader, Georgia, serif; color: var(--ink); text-wrap: balance; }
.isearch__m { display: block; margin-top: 6px; font: 500 10.5px/1.5 Inter, sans-serif;
  letter-spacing: .16em; text-transform: uppercase; color: var(--ink-faint); }
.isearch__m b { font-weight: 500; color: var(--bronze-deep); }
.isearch__x { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  margin-top: 6px; font: 400 13px/1.55 Inter, sans-serif; color: var(--ink-soft); }
.isearch__all {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 6px; padding: 13px 14px; border-top: 1px solid var(--line-soft); border-radius: 0 0 var(--r-sm) var(--r-sm);
  font: 500 12.5px/1.3 Inter, sans-serif; letter-spacing: .02em; color: var(--ink);
}
.isearch__all svg { color: var(--bronze-deep); flex: 0 0 auto; }
.isearch__note { padding: 14px; font: 400 13.5px/1.55 Inter, sans-serif; color: var(--ink-soft); }

/* ── matches, the count line, the empty state ─────────────────────────── */
.posts mark, .isearch__pop mark {
  background: rgba(var(--bronze-rgb), .24); color: inherit;
  border-radius: 3px; padding: 0 .08em; box-decoration-break: clone; -webkit-box-decoration-break: clone;
}
.search-rule { align-items: baseline; flex-wrap: wrap; }
.search-count { margin: 0; text-transform: none; letter-spacing: .02em; font-size: 13px; color: var(--ink-soft); }
.search-clear { margin-left: auto; font: 500 11px/1 Inter, sans-serif; letter-spacing: .16em; text-transform: uppercase;
  color: var(--bronze-deep); text-decoration: underline; text-decoration-color: rgba(var(--bronze-deep-rgb), .35);
  text-underline-offset: 4px; }
.search-clear:hover { text-decoration-color: currentColor; }
.search-empty__links { display: flex; flex-wrap: wrap; gap: 10px 26px; margin-top: 12px; }

/* ── recent posts: the "Latest" lead card (page 1 of /insights/) and the "New" badge ──
   New = published within INSIGHTS_NEW_DAYS (includes/insights-search.php); the same rule
   rings the post on the constellation map. */
.tag-new {
  display: inline-block; margin-left: .7em; padding: 5px 9px 4px; border-radius: var(--r-pill);
  font: 600 10px/1 Inter, sans-serif; letter-spacing: .16em; text-transform: uppercase; white-space: nowrap;
  color: var(--bronze-bright); background: linear-gradient(178deg, var(--umber-236) 0%, var(--dark) 100%);
  box-shadow: var(--clay-dark-in); vertical-align: middle; position: relative; top: -.12em;
}
.lead {
  display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); align-items: center;
  gap: clamp(26px, 3.6vw, 56px); padding: clamp(14px, 1.5vw, 20px);
  margin-bottom: clamp(34px, 4vw, 56px); text-decoration: none; color: inherit;
}
.lead--text { grid-template-columns: minmax(0, 1fr); padding: clamp(26px, 3vw, 40px); }
.lead__media { aspect-ratio: 1.9 / 1; border-radius: var(--r); box-shadow: var(--clay-in); }
.lead__copy { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; min-width: 0;
  padding: clamp(4px, 1vw, 14px) clamp(4px, 1.6vw, 26px) clamp(4px, 1vw, 14px) 0; }
.lead--text .lead__copy { padding: 0; }
.lead__kicker { display: flex; align-items: center; gap: 2px; }
.lead__kicker .tag-new { top: 0; }
.lead__title { font: 300 clamp(1.75rem, 3vw, 2.75rem)/1.1 Newsreader, Georgia, serif; letter-spacing: -.018em;
  color: var(--ink); text-wrap: balance; overflow-wrap: break-word; }
.lead__body { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  font: 400 15px/1.7 Inter, sans-serif; color: var(--ink-muted); }
.lead .post-meta { margin-top: 0; }
.lead__more { margin-top: 4px; }
.lead:hover .lead__more svg { transform: translateX(4px); }

@media (max-width: 760px) {
  .lead { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .lead__copy { padding: 0 6px 8px; }
  .isearch { flex: 1 1 100%; min-width: 0; }
  .isearch__pop { left: 0; right: 0; width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .isearch__input, .isearch__go, .isearch__opt { transition: none; }
  .lead, .lead__more svg { transition: none; }
  .lead:hover, .lead:focus-visible { transform: none; }
}
