/* ═══════════════════════════════════════════════════════════════
   SEARCH — live quick-search dropdown + /?s= results page
   Prefixes: .vh-qs- (the box, everywhere) · .vh-search- (results page)
   Added 2026-09-01 for audit finding #1 (search was dead site-wide).
   ═══════════════════════════════════════════════════════════════ */

/* ── The box ───────────────────────────────────────────────── */

.vh-qs {
  position: relative;
  width: 100%;
}

.vh-qs__form {
  position: relative;
}

/* Standalone box (shop hub + results page). The header overlay keeps its own
   look from header.css — only the panel below is shared. */
.vh-qs--page {
  max-width: 480px;
  margin: 24px auto 0;
}

.vh-qs--page .vh-qs__form {
  display: block;
  height: auto;
  padding: 0;
  gap: 0;
  background: #fff;
  border: 1px solid #E0DDD6;
  border-radius: 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.vh-qs--page .vh-qs__form:focus-within {
  border-color: #1A1A1A;
  box-shadow: 0 0 0 3px rgba(26, 26, 26, 0.06);
}

.vh-qs--page .vh-qs__form > svg {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  stroke: #9A9A94;
  pointer-events: none;
}

.vh-qs--page .vh-qs__input {
  width: 100%;
  height: 52px;
  padding: 0 16px 0 46px;
  border: 0;
  background: transparent;
  outline: none;
  font-family: 'Onest', system-ui, sans-serif;
  font-size: 15px;
  color: #1A1A1E;
}

.vh-qs--page .vh-qs__input::placeholder {
  color: #B0B0B0;
}

/* The overlay form is clipped (border-radius + overflow:hidden in header.css);
   the panel is a sibling, so it is not — but the wrapper must not clip either. */
.vh-search-overlay .vh-qs {
  overflow: visible;
}

/* The /shop/ hero sets overflow:hidden and cut the dropdown off mid-list (the
   old 3-result box had the same problem). What that clip protected is a
   ::before decoration with inset:0, which cannot overflow in the first place.
   Specificity beats the page's own inline <style>, which loads after this
   file — hence the element selector rather than a bare .sh-header. */
section.sh-header {
  overflow: visible;
}

/* ── The dropdown panel ────────────────────────────────────── */

.vh-qs__panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 60;
  background: #fff;
  border: 1px solid #E7E4DD;
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  text-align: left;
}

.vh-qs__panel[hidden] {
  display: none;
}

.vh-qs__head {
  padding: 12px 16px;
  border-bottom: 1px solid #F0EEE9;
  font-family: 'Onest', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #8A8A84;
}

/* 8 rows at ~65px each = 520px; the cap lets the full set show on a laptop
   and starts scrolling only on genuinely short viewports. */
.vh-qs__results {
  max-height: min(58vh, 540px);
  overflow-y: auto;
}

.vh-qs__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  text-decoration: none;
  border-bottom: 1px solid #F6F4F0;
  transition: background 0.15s;
}

.vh-qs__item:last-child {
  border-bottom: 0;
}

.vh-qs__item:hover,
.vh-qs__item.is-active {
  background: #FAF9F7;
}

.vh-qs__thumb {
  width: 44px;
  height: 44px;
  flex: none;
  object-fit: cover;
  border-radius: 6px;
  background: #F2F0EB;
}

.vh-qs__thumb--empty {
  display: block;
  background: linear-gradient(145deg, #EEEEE8, #D9D4CA);
}

.vh-qs__text {
  flex: 1;
  min-width: 0;
}

.vh-qs__name {
  display: block;
  font-family: 'Geologica', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
  color: #1A1A1E;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vh-qs__meta {
  display: block;
  margin-top: 2px;
  font-family: 'Onest', system-ui, sans-serif;
  font-size: 12px;
  color: #8A8A84;
}

.vh-qs__price {
  flex: none;
  font-family: 'Onest', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #1A1A1E;
  white-space: nowrap;
}

.vh-qs__all {
  display: block;
  padding: 12px 16px;
  border-top: 1px solid #F0EEE9;
  background: #FCFBF9;
  font-family: 'Onest', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #F97316;
  text-decoration: none;
  text-align: center;
}

.vh-qs__all:hover {
  text-decoration: underline;
}

/* ── Results page ──────────────────────────────────────────── */

.vh-search__head {
  padding: 28px 0 8px;
  background: #fff;
}

.vh-search__title {
  font-family: 'Geologica', system-ui, sans-serif;
  font-size: clamp(24px, 3.4vw, 34px);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: #1A1A1E;
  margin: 10px 0 6px;
  overflow-wrap: anywhere;
}

.vh-search__count {
  font-family: 'Onest', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: #6B6860;
  margin: 0;
}

.vh-search .vh-qs--page {
  margin: 20px 0 4px;
}

/* Non-product hits (a blog search) reuse the card shell without an image. */
.vh-search__post .cp-card__info {
  padding: 16px;
}

/* ── Empty state ───────────────────────────────────────────── */

.vh-search__empty {
  padding: 8px 0 32px;
  background: #fff;
}

.vh-search__empty-card {
  padding: 28px 24px;
  border: 1px solid #E7E4DD;
  border-radius: 14px;
  background: #FCFBF9;
  text-align: center;
}

.vh-search__empty-card svg {
  color: #B8B5AE;
  margin-bottom: 8px;
}

.vh-search__empty-card h2 {
  font-family: 'Geologica', system-ui, sans-serif;
  font-size: 20px;
  font-weight: 600;
  color: #1A1A1E;
  margin: 0 0 8px;
}

.vh-search__empty-card p {
  font-family: 'Onest', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  color: #6B6860;
  margin: 0 auto;
  max-width: 56ch;
}

.vh-search__section-title {
  font-family: 'Geologica', system-ui, sans-serif;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #1A1A1E;
  margin: 28px 0 14px;
}

.vh-search__cats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.vh-search__cat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px;
  border: 1px solid #E7E4DD;
  border-radius: 12px;
  background: #FCFBF9;
  text-decoration: none;
  transition: border-color 0.2s, transform 0.2s;
}

.vh-search__cat:hover {
  border-color: #F97316;
  transform: translateY(-2px);
}

.vh-search__cat-name {
  font-family: 'Geologica', system-ui, sans-serif;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  color: #1A1A1E;
}

.vh-search__cat-count {
  font-family: 'Onest', system-ui, sans-serif;
  font-size: 13px;
  color: #6B6860;
}

.vh-search__empty-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin: 22px 0 0;
}

.vh-search__empty-links a {
  font-family: 'Onest', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #F97316;
  text-decoration: none;
}

.vh-search__empty-links a:hover {
  text-decoration: underline;
}

/* ── Mobile ────────────────────────────────────────────────── */

@media (max-width: 767px) {
  .vh-qs__results {
    max-height: 50vh;
  }

  .vh-qs__item {
    padding: 12px 14px;
  }

  /* WCAG 2.5.5 — same 44px floor mobile-ux.css sets everywhere else. */
  .vh-qs__all {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .vh-qs--page .vh-qs__input {
    height: 48px;
    font-size: 16px; /* below 16px iOS zooms the page on focus */
  }

  .vh-search__head {
    padding: 20px 0 4px;
  }

  /* header.css hides every action button but the cart below 768px, which left
     phones with no way into search at all - the other half of audit finding
     #1. The ID beats that rule without touching header.css, which another
     pass is working in. */
  .vh-header__actions .vh-icon-btn#vh-search-toggle {
    display: flex;
  }
}

@media (prefers-reduced-motion: reduce) {
  .vh-search__cat,
  .vh-qs__item,
  .vh-qs--page .vh-qs__form {
    transition: none;
  }

  .vh-search__cat:hover {
    transform: none;
  }
}
