/* =====================================================================
   The Collectorium — Search (v3)
   ---------------------------------------------------------------------
   The search hero (templates/search/_searchHero.html.twig) and its live-search
   dropdown, plus the results page (templates/search/search.html.twig).

   The hero is on two screens, because the Discover screen is one:
   Discover (/discover) is the hero over the catalogue, /search?q= is the same
   hero over the matches. The shell has no search field of its own, so this is
   the entire search surface.

   From the design project's web/web-search.css: the hero + recent chips, the
   dropdown rows (there, a ⌘K palette; here, anchored under the hero field) and
   the results grid. Cards, tiles, segments and the empty state are shared
   components and stay in components.css.
   ===================================================================== */

/* ---------------------------------------------------------------------
   Hero — the field, centered, above whatever the screen is showing
   --------------------------------------------------------------------- */
.v3-search-hero {
  max-width: 720px;
  margin: 0 auto 34px;
  text-align: center;
}

/* The field is the dropdown's positioning context. */
.v3-livesearch {
  position: relative;
}

.v3-livesearch .v3-input-wrap {
  text-align: left;
}

/* The design's 56px field: taller than the stock .v3-input, filled rather than
   outlined, and with the leading icon inside it. */
.v3-search-hero .v3-input {
  height: 56px;
  border: none;
  border-radius: var(--radius-xl);
  background: var(--circle-chrome);
  font-size: 16px;
}

.v3-search-hero .v3-input:focus {
  background: var(--bg-elevated);
}

/* Chrome and Safari draw their own clear affordance on type=search, which
   would sit alongside the one the markup provides. */
.v3-search-input::-webkit-search-decoration,
.v3-search-input::-webkit-search-cancel-button {
  appearance: none;
}

/* ---------------------------------------------------------------------
   Recent searches — client-side chips (public/js/v3/search.js)
   --------------------------------------------------------------------- */
.v3-recent {
  margin-top: 20px;
}

.v3-recent .lbl {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--fg-tertiary);
  margin-bottom: 9px;
}

.v3-recent .chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.v3-recent .v3-chip {
  gap: 6px;
}

/* ---------------------------------------------------------------------
   Results
   --------------------------------------------------------------------- */
.v3-search-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}

.v3-search-count {
  margin-left: auto;
  font-size: 13px;
  font-weight: var(--weight-semibold);
  color: var(--fg-tertiary);
}

/* The count rides inside the segment button, dimmed — a tab with no results
   still reads as a tab, just an empty one. */
.v3-segment [data-tab] .ct {
  margin-left: 5px;
  opacity: 0.55;
}

/* ---------------------------------------------------------------------
   Users tab — the one result type with no component of its own
   --------------------------------------------------------------------- */
.v3-people {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.v3-person {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px 16px;
  border-radius: var(--radius-xl);
  background: var(--circle-chrome);
  transition: background var(--duration-1);
}

.v3-person:hover {
  background: var(--border);
}

.v3-person .ava {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
}

.v3-person .ava img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.v3-person .nm {
  min-width: 0;
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  font-size: 15px;
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.v3-person .view {
  margin-left: auto;
  flex-shrink: 0;
  padding: 6px 13px;
  border-radius: var(--radius-pill);
  background: var(--accent-blue-soft);
  color: var(--accent-blue);
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  font-size: 12.5px;
}

/* ---------------------------------------------------------------------
   Live-search dropdown — anchored under the hero field, its full width
   --------------------------------------------------------------------- */
.v3-search-drop {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 60;
  max-height: 420px;
  overflow-y: auto;
  padding: 6px;
  border-radius: var(--radius-xl);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-overlay);
  text-align: left;
}

.v3-search-drop .gh {
  padding: 10px 10px 6px;
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--fg-tertiary);
}

/* Hairline between rows, but not under the last one before a group heading —
   the heading is its own separation. */
.v3-search-drop .row + .row {
  border-top: 1px solid var(--divider);
}

.v3-search-drop .row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  border-radius: var(--radius-lg);
  transition: background var(--duration-1);
}

.v3-search-drop .row:hover,
.v3-search-drop .row.sel {
  background: var(--circle-chrome);
  border-top-color: transparent;
}

.v3-search-drop .thumb {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 8px;
  background: var(--circle-chrome);
  color: var(--fg-tertiary);
}

.v3-search-drop .row:hover .thumb,
.v3-search-drop .row.sel .thumb {
  background: var(--border);
}

.v3-search-drop .thumb.user {
  border-radius: 50%;
}

.v3-search-drop .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.v3-search-drop .txt {
  min-width: 0;
}

.v3-search-drop .nm {
  display: block;
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  font-size: 14px;
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.v3-search-drop .meta {
  display: block;
  margin-top: 1px;
  font-size: 12px;
  font-weight: var(--weight-semibold);
  color: var(--fg-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.v3-search-drop-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 26px 14px;
  font-size: 13px;
  font-weight: var(--weight-semibold);
  color: var(--fg-tertiary);
}

/* ---------------------------------------------------------------------
   Narrow viewports
   --------------------------------------------------------------------- */
@media (max-width: 1080px) {
  .v3-people {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 720px) {
  .v3-search-hero h1 {
    font-size: 26px;
  }

  .v3-search-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  /* Ordered after the segment so the caption reads as a footnote to it. */
  .v3-search-count {
    margin-left: 0;
    text-align: center;
  }

  .v3-people {
    grid-template-columns: 1fr;
  }
}
