/* Search / results page (DESIGN_V2 section 4 "Search"). Page-scoped classes only (.srch-*): kit classes are never redefined here.
   Mobile first. Colours only from tokens. Breakpoint 900 = split view. */
.srch {
  --srch-hdr: var(--pt-header-h);              /* set by JS to the real header height */
  --srch-bar-h: 56px;                          /* set by JS to the real filter-bar height */
  --srch-bottom: calc(var(--pt-consent-h, 0px) + var(--pt-tabbar-h, 0px));
  background: var(--pt-surface);
}

/* ---------- sticky filter bar ---------- */
.srch-bar { position: sticky; top: var(--srch-hdr); z-index: 30; background: var(--pt-surface); border-bottom: 1px solid var(--pt-border); }
.srch-bar__in { display: flex; align-items: center; gap: var(--pt-s3); padding-block: 10px; }
.srch-chips { display: flex; gap: var(--pt-s2); align-items: center; min-width: 0; flex: 1; overflow-x: auto; scrollbar-width: none; margin-inline: calc(var(--pt-s2) * -1); padding: 2px var(--pt-s2); }
.srch-chips::-webkit-scrollbar { display: none; }
.srch-chip { display: inline-flex; align-items: center; gap: 6px; flex: none; min-height: var(--pt-tap); padding: 0 16px; border: 1.5px solid var(--pt-border-strong); border-radius: var(--pt-r-pill);
  background: var(--pt-surface); color: var(--pt-text); font: 600 .9375rem/1 var(--pt-font); cursor: pointer; white-space: nowrap; transition: border-color .16s var(--pt-ease), background .16s var(--pt-ease); }
.srch-chip .pt-icon { width: 16px; height: 16px; flex: none; }
.srch-chip:hover { border-color: var(--pt-text); }
.srch-chip:focus-visible { outline: 3px solid var(--pt-ring); outline-offset: 2px; }
.srch-chip.is-on { border-color: var(--pt-text); background: var(--pt-surface-2); box-shadow: inset 0 0 0 1px var(--pt-text); }
.srch-chip[aria-expanded="true"] { border-color: var(--pt-text); box-shadow: inset 0 0 0 1px var(--pt-text); }
.srch-chip--more { margin-inline-start: 2px; }
.srch-chip__n { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--pt-primary); color: #fff; font-size: .75rem; }
.srch-bar__right { display: none; align-items: center; gap: var(--pt-s3); flex: none; }
.srch-count { margin: 0; font-size: .9375rem; color: var(--pt-text-2); white-space: nowrap; }
.srch-count strong { color: var(--pt-text); font-variant-numeric: tabular-nums; }
.srch-sort select { min-height: 44px; min-width: 190px; border-radius: var(--pt-r-pill); padding-inline-start: 16px; }

/* popovers (desktop): the same inputs as the sheet, moved here by JS on wide screens */
.srch-pop { position: relative; flex: none; }
.srch-pop__panel { position: absolute; z-index: 40; top: calc(100% + 8px); left: 0; width: 340px; max-width: calc(100vw - 32px); padding: var(--pt-s4); background: var(--pt-surface);
  border: 1px solid var(--pt-border); border-radius: var(--pt-r-lg); box-shadow: var(--pt-shadow-3); animation: srch-pop .16s var(--pt-ease); }
.srch-pop__panel[hidden] { display: none; }
.srch-pop__foot { display: flex; justify-content: space-between; gap: var(--pt-s2); margin-top: var(--pt-s4); padding-top: var(--pt-s3); border-top: 1px solid var(--pt-border); }
@keyframes srch-pop { from { opacity: 0; transform: translateY(-4px); } }

/* ---------- body: list + map ---------- */
.srch-body { max-width: none; padding-inline: 0; }
.srch-list { min-width: 0; padding: var(--pt-s3) var(--pt-s4) var(--pt-s7); }
.srch-crumbs { margin-bottom: 0; }
.srch-crumbs ol { font-size: .8125rem; }
.srch-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--pt-s3); flex-wrap: wrap; margin: var(--pt-s1) 0 var(--pt-s3); }
.srch-title { margin: 0; font-size: 1.875rem; line-height: 1.15; letter-spacing: -.02em; font-weight: 800; min-width: 0; flex: 1 1 260px; }
.srch-save .by-save-search { min-height: 44px; border-radius: var(--pt-r-pill); }
.srch .by-ai-summary { position: relative; margin-bottom: var(--pt-s3); padding-inline-end: 52px; border-radius: var(--pt-r); }
.srch .by-ai-summary .srch-x { position: absolute; right: 2px; top: 2px; }
.srch-meta { display: flex; align-items: center; justify-content: space-between; gap: var(--pt-s3); margin-bottom: var(--pt-s3); }
.srch-meta .srch-count { font-size: .875rem; }
.srch-meta .srch-sort select { min-width: 0; }

.srch-active, .srch-suggest { display: flex; flex-wrap: wrap; gap: var(--pt-s2); list-style: none; margin: 0 0 var(--pt-s4); padding: 0; }
.srch-tag { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 4px 14px; border-radius: var(--pt-r-pill); background: var(--pt-surface-3); color: var(--pt-text); font-size: .875rem; font-weight: 600; text-decoration: none; }
.srch-tag:hover { background: var(--pt-border); }
.srch-tag .pt-icon { width: 14px; height: 14px; }
.srch-tag--clear { background: none; color: var(--pt-primary-500); text-decoration: underline; padding-inline: 6px; }

.srch-grid { display: grid; gap: var(--pt-s5) var(--pt-s4); grid-template-columns: 1fr; }
.srch-grid > [role="listitem"] { min-width: 0; display: flex; }
.srch-grid .pt-lcard { width: 100%; }
@media (min-width: 600px) and (max-width: 899px) { .srch-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.srch-pager { margin-top: var(--pt-s6); text-align: center; }
.srch-pager__info { margin: 0; color: var(--pt-text-2); font-size: .875rem; }

/* empty state */
.srch-empty { display: flex; flex-direction: column; align-items: center; gap: var(--pt-s2); text-align: center; padding: var(--pt-s7) var(--pt-s4); max-width: 520px; margin-inline: auto; }
.srch-empty h2 { margin: var(--pt-s3) 0 0; font-size: 1.375rem; letter-spacing: -.02em; }
.srch-empty p { margin: 0 0 var(--pt-s3); }
.srch-empty__art { width: 220px; max-width: 70%; height: auto; }
.srch-suggest { justify-content: center; margin-bottom: var(--pt-s3); }

/* ---------- map column ---------- */
.srch-mapcol { display: none; }
.srch-mapframe { position: relative; height: 100%; }
.srch .srch-map { position: absolute; inset: 0; background: var(--pt-surface-3); }
.srch-map__off { display: grid; place-items: center; height: 100%; margin: 0; padding: var(--pt-s5); text-align: center; color: var(--pt-text-2); }
.srch-map__note { position: absolute; left: 12px; top: 12px; z-index: 2; display: inline-flex; gap: 6px; align-items: center; max-width: calc(100% - 84px); margin: 0; padding: 6px 12px;
  border-radius: var(--pt-r-pill); background: rgba(255,255,255,.94); color: var(--pt-text-2); font-size: .75rem; box-shadow: var(--pt-shadow-1); pointer-events: none; }
.srch-map__note .pt-icon { width: 14px; height: 14px; flex: none; }
.srch-map .maplibregl-ctrl-group { border-radius: var(--pt-r); box-shadow: var(--pt-shadow-2); overflow: hidden; }
.srch-map .maplibregl-ctrl-group button { width: 44px; height: 44px; }
.srch-map .maplibregl-ctrl-attrib { font-size: .75rem; }
.srch-map .maplibregl-ctrl-attrib.maplibregl-compact { min-height: 44px; }
.srch-map .maplibregl-ctrl-attrib-button { width: 44px; height: 44px; }
.srch-map .maplibregl-ctrl-attrib-inner a { display: inline-block; padding: 12px 4px; }

/* pins: price pills + brand-red clusters (HTML markers) */
.srch-pin { all: unset; box-sizing: border-box; cursor: pointer; }
.srch-pin span { display: block; padding: 6px 11px; border-radius: var(--pt-r-pill); background: var(--pt-surface); color: var(--pt-text); border: 1px solid var(--pt-border-strong);
  font: 700 .8125rem/1.1 var(--pt-font); font-variant-numeric: tabular-nums; white-space: nowrap; box-shadow: var(--pt-shadow-2); transition: transform .16s var(--pt-ease), background .16s, color .16s; }
.srch-pin:hover span, .srch-pin.is-hl span, .srch-pin:focus-visible span { background: var(--pt-text); color: #fff; border-color: var(--pt-text); transform: scale(1.1); }
.srch-pin.is-sel span { background: var(--pt-primary); color: #fff; border-color: var(--pt-primary); transform: scale(1.12); }
.srch-pin:focus-visible span { outline: 3px solid var(--pt-ring); outline-offset: 2px; }
.srch-pin.is-hl, .srch-pin.is-sel { z-index: 3; }
.srch-cluster { all: unset; box-sizing: border-box; display: grid; place-items: center; border-radius: 50%; background: var(--pt-primary); color: #fff; border: 3px solid #fff;
  font: 700 .9375rem/1 var(--pt-font); box-shadow: var(--pt-shadow-2); cursor: pointer; transition: transform .16s var(--pt-ease); }
.srch-cluster:hover { transform: scale(1.08); background: var(--pt-primary-600); }
.srch-cluster:focus-visible { outline: 3px solid var(--pt-ring); outline-offset: 2px; }

/* mini card after a pin click */
.srch-mini { position: absolute; z-index: 5; left: 12px; right: 12px; bottom: 44px; max-width: 420px; margin-inline: auto; background: var(--pt-surface); border-radius: var(--pt-r-lg); box-shadow: var(--pt-shadow-3); }
.srch-mini[hidden] { display: none; }
.srch-mini__link { display: flex; gap: var(--pt-s3); padding: 10px; padding-inline-end: 48px; color: var(--pt-text); text-decoration: none; }
.srch-mini__link img, .srch-mini__noimg { width: 96px; height: 96px; flex: none; object-fit: cover; border-radius: var(--pt-r); background: var(--pt-surface-3); }
.srch-mini__txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; justify-content: center; }
.srch-mini__txt b { font-size: 1.125rem; font-weight: 800; letter-spacing: -.01em; color: var(--pt-primary); }
.srch-mini__title { font-weight: 600; font-size: .9375rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.srch-mini__facts { font-size: .8125rem; color: var(--pt-text-2); }
.srch-mini__close { position: absolute; right: 4px; top: 4px; display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: none; color: var(--pt-text); cursor: pointer; }
.srch-mini__close:hover { background: var(--pt-surface-3); }
.srch-mini__close .pt-icon { width: 18px; height: 18px; }

/* card highlighted from the map */
.srch-card.is-hl { border-color: var(--pt-text); box-shadow: var(--pt-shadow-2); }

/* ---------- phone: Map / List toggle ---------- */
.srch-fab { position: fixed; z-index: 35; left: 50%; transform: translateX(-50%); bottom: calc(var(--srch-bottom) + 16px + env(safe-area-inset-bottom)); display: inline-flex; align-items: center;
  min-height: 48px; padding: 0 22px; border: 0; border-radius: var(--pt-r-pill); background: var(--pt-ink); color: #fff; font: 700 .9375rem/1 var(--pt-font); box-shadow: var(--pt-shadow-3); cursor: pointer; }
.srch-fab span { display: inline-flex; align-items: center; gap: 8px; }
.srch-fab .pt-icon { width: 18px; height: 18px; }
.srch-fab:focus-visible { outline: 3px solid var(--pt-ring); outline-offset: 3px; }
.srch-fab__list { display: none !important; }
/* no results: a map of nothing is useless and the pill covered the empty-state text on phones (qa2-visual) */
.srch:has(.srch-empty) .srch-fab { display: none; }
.srch[data-mode="map"] .srch-fab__list { display: inline-flex !important; }
.srch[data-mode="map"] .srch-fab__map { display: none !important; }
/* public.js adds .is-tucked while the pill would cover the "Ask Amara" card, the pager or the footer */
.srch-fab { transition: opacity .18s var(--pt-ease, ease), transform .18s var(--pt-ease, ease), visibility .18s; }
.srch-fab.is-tucked { opacity: 0; visibility: hidden; pointer-events: none; transform: translate(-50%, 12px); }
@media (prefers-reduced-motion: reduce) { .srch-fab { transition: none; } }
@media (max-width: 899px) {
  .srch[data-mode="map"] .srch-list { display: none; }
  .srch[data-mode="map"] .srch-mapcol { display: block; position: fixed; z-index: 28; left: 0; right: 0; top: calc(var(--srch-hdr) + var(--srch-bar-h)); bottom: var(--srch-bottom); }
  .srch[data-mode="map"] .srch-mini { bottom: 80px; }

  .srch-list { padding-bottom: calc(80px + var(--srch-bottom)); }
}

/* ---------- filter sheet (phones) / modal (desktop) ---------- */
.srch-sheet { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: flex-end; justify-content: center; }
.srch-sheet[hidden] { display: none; }
.srch-sheet__backdrop { position: absolute; inset: 0; background: var(--pt-overlay); animation: srch-fade .2s; }
.srch-sheet__panel { position: relative; display: flex; flex-direction: column; width: 100%; max-height: min(92dvh, calc(100dvh - var(--pt-consent-h, 0px) - 12px)); margin-bottom: var(--pt-consent-h, 0px);
  background: var(--pt-surface); border-radius: var(--pt-r-xl) var(--pt-r-xl) 0 0; box-shadow: var(--pt-shadow-3); animation: srch-up .24s var(--pt-ease); }
.srch-sheet__grab { width: 40px; height: 4px; border-radius: 2px; background: var(--pt-border-strong); margin: 10px auto 0; flex: none; }
.srch-sheet__head { display: flex; align-items: center; justify-content: space-between; padding: 6px var(--pt-s3) 6px var(--pt-s5); border-bottom: 1px solid var(--pt-border); flex: none; }
.srch-sheet__head h2 { margin: 0; font-size: 1.125rem; }
.srch-sheet__body { overflow-y: auto; overscroll-behavior: contain; padding: var(--pt-s4) var(--pt-s5); flex: 1 1 auto; }
.srch-sheet__foot { display: flex; justify-content: space-between; align-items: center; gap: var(--pt-s3); flex: none; padding: var(--pt-s3) var(--pt-s5) calc(var(--pt-s3) + env(safe-area-inset-bottom)); border-top: 1px solid var(--pt-border); background: var(--pt-surface); }
.srch-sheet__foot .pt-btn--primary { flex: 1; max-width: 280px; }
@keyframes srch-up { from { transform: translateY(40px); opacity: 0; } }
@keyframes srch-fade { from { opacity: 0; } }
@media (min-width: 900px) {
  .srch-sheet { align-items: center; }
  .srch-sheet__panel { width: 640px; border-radius: var(--pt-r-xl); max-height: 86dvh; margin-bottom: 0; }
  .srch-sheet__grab { display: none; }
}
body.srch-lock { overflow: hidden; }

/* filter groups (sheet + popovers) */
.srch-group { border: 0; margin: 0 0 var(--pt-s5); padding: 0; min-width: 0; }
.srch-group > legend, .srch-group > .pt-label { display: block; padding: 0; margin-bottom: var(--pt-s2); font-weight: 700; font-size: 1rem; }
.srch-opts { display: flex; flex-wrap: wrap; gap: var(--pt-s2); }
.srch-range { display: flex; align-items: center; gap: var(--pt-s2); }
.srch-range .pt-input { min-width: 0; flex: 1; }
.srch-stack { display: grid; gap: var(--pt-s2); }
.srch-pop__panel .srch-group:last-of-type { margin-bottom: 0; }
.srch-pop__panel .srch-group > legend { font-size: .9375rem; }

/* no-JS: show the filter form inline above the results */
.pt-nojs .srch-sheet { position: static; display: block; }
.pt-nojs .srch-sheet__backdrop, .pt-nojs .srch-fab, .pt-nojs .srch-chip--more { display: none; }
.pt-nojs .srch-sheet__panel { max-height: none; border-radius: 0; box-shadow: none; margin: 0; animation: none; border-top: 1px solid var(--pt-border); }
.pt-nojs .srch-sheet[hidden] { display: block; }

/* ---------- wide: split view ---------- */
@media (min-width: 900px) {
  .srch-chips { overflow: visible; margin: 0; padding: 0; flex-wrap: wrap; }
  .srch-bar__right { display: flex; }
  .srch-meta { display: none; }
  .srch-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 42%); align-items: start; }
  .srch-list { padding: var(--pt-s4) var(--pt-s6) var(--pt-s8); }
  .srch-title { font-size: 2.25rem; }
  .srch-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--pt-s6) var(--pt-s5); }
  .srch-mapcol { display: block; position: sticky; top: calc(var(--srch-hdr) + var(--srch-bar-h)); height: calc(100dvh - var(--srch-hdr) - var(--srch-bar-h)); border-left: 1px solid var(--pt-border); }
  .srch-fab { display: none; }
  .srch-bar__in { padding-inline: var(--pt-s6); max-width: none; }
}
@media (min-width: 900px) and (max-width: 1099px) { .srch-grid { grid-template-columns: 1fr; } .srch-sort select { min-width: 150px; } }
@media (min-width: 1500px) { .srch-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } .srch-body { grid-template-columns: minmax(0, 1fr) 40%; } }
@media (prefers-reduced-motion: reduce) { .srch *, .srch-sheet * { animation: none !important; transition: none !important; } }

/* phones: "More filters" first so it is never scrolled out of view */
@media (max-width: 899px) { .srch-chip--more { order: -1; margin-inline: 0 2px; } }

/* map attribution: 44px button, no repeated icon, links padded to touch size */
.srch-map .maplibregl-ctrl-attrib-button { background-repeat: no-repeat; background-position: center; }
.srch-map .maplibregl-ctrl-attrib.maplibregl-compact { max-width: calc(100% - 24px); }
.srch-map .maplibregl-ctrl-attrib-inner { line-height: 1.2; }
.srch-map .maplibregl-ctrl-attrib-inner a { padding: 14px 4px; }

/* PT filter groups: long PT lists fold away (docs/PT_FORMAT_V2.md) */
.srch-group__t { display: block; margin-bottom: var(--pt-s2); font-weight: 700; font-size: 1rem; }
.srch-det { border-top: 1px solid var(--pt-border, #e5e7eb); padding: var(--pt-s2) 0; }
.srch-det > summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; gap: var(--pt-s2); list-style-position: inside; }
.srch-det[open] > summary { margin-bottom: var(--pt-s2); }
.srch-det .srch-opts { max-height: 40vh; overflow: auto; }
