/* ==========================================================================
   Search: header suggestions dropdown and the /search/ results page.
   Uses only the design tokens from site.css.
   ========================================================================== */

/* ---------- Header suggestions (combobox listbox) ---------- */
/* Wrapper added by search.js around the header form: mobile = first item of the menu, in flow. */
.search-wrap { position: relative; order: -1; }
.search-suggest {
  list-style: none; margin: 6px 0 0; padding: 6px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  max-height: min(60vh, 480px); overflow-y: auto; overscroll-behavior: contain;
}
.search-suggest[hidden] { display: none; }
@media (min-width: 960px) {
  .search-wrap { order: 0; margin-left: auto; width: 280px; }
  .search-wrap .search-form { width: 100%; margin-left: 0; }
  .search-suggest {
    position: absolute; top: calc(100% + 6px); right: 0; z-index: 70; margin: 0;
    width: min(420px, calc(100vw - 2 * var(--gutter)));
    box-shadow: var(--shadow-lg);
  }
}

.suggest-option {
  display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 6px 10px;
  border-radius: 8px; cursor: pointer; color: var(--text);
}
.suggest-option[aria-selected="true"] { background: var(--brand-blue-tint); box-shadow: inset 3px 0 0 var(--brand-blue); }
.suggest-thumb {
  flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 42px; padding: 3px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
}
.suggest-thumb img { width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; }
.search-noimg { stroke: var(--muted); stroke-width: 1.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.suggest-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.suggest-name {
  font-weight: 500; color: var(--navy); font-size: .9375rem;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
}
.suggest-cat { font-size: .8125rem; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggest-none { padding: 12px 10px; color: var(--muted); font-size: .9375rem; }
.suggest-all {
  min-height: var(--tap); margin-top: 4px; justify-content: space-between;
  color: var(--brand-blue); font-weight: 500; font-size: .9375rem;
  border-top: 1px solid var(--border); border-radius: 0 0 8px 8px;
}
.suggest-all span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.suggest-arrow { stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- /search/ page ---------- */
.search-page-form { display: flex; gap: 8px; max-width: 640px; margin-top: 16px; }
.search-page-input { flex: 1; min-width: 0; padding-right: 14px; background: var(--bg); }
.search-page-submit { flex-shrink: 0; }

.search-correction { margin: 0 0 8px; color: var(--text); }
.search-correction strong { font-weight: 600; }
.search-literal { display: inline-flex; align-items: center; min-height: var(--tap); font-weight: 500; }
.search-count { margin: 0 0 24px; color: var(--muted); font-weight: 500; }
.search-count:empty { display: none; }
.search-grid { justify-content: flex-start; }

.card-category {
  display: block; margin-bottom: 4px;
  font-size: .75rem; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--brand-blue);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.search-empty { padding: 8px 0 8px; }
.search-empty-title { font-size: 1.375rem; margin-bottom: 6px; }
.search-empty-tip { color: var(--muted); margin: 0; }
.search-noscript { color: var(--muted); margin: 0 0 8px; }

.search-browse { margin-top: 32px; }
.search-results .search-empty:not([hidden]) + noscript + .search-browse,
.search-results .search-empty:not([hidden]) ~ .search-browse { margin-top: 32px; }
.search-browse-title { font-size: 1.25rem; margin-bottom: 16px; }
.search-browse-list {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px;
}
.search-browse-list a {
  display: flex; align-items: center; min-height: 56px; height: 100%; padding: 12px 16px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg);
  font-weight: 500; text-decoration: none; color: var(--navy);
  transition: border-color var(--ease), box-shadow var(--ease), color var(--ease);
}
.search-browse-list a:hover { border-color: var(--brand-blue); color: var(--brand-blue); box-shadow: var(--shadow-sm); }
.search-browse-list a:focus-visible { outline: none; border-color: var(--brand-blue); box-shadow: var(--focus-ring); }
.search-browse[hidden] { display: none; }
.search-results .search-browse:first-child { margin-top: 0; }
