/* ---------------------------------------------------------------------------
 * Site search — the field, the header trigger and the results page.
 * See inc/back/search.php and search.php.
 *
 * Every colour is var(--token, literal) because design_tokens can be switched
 * off, and then the fallback is what a visitor actually sees. The values reuse
 * tokens already on the site rather than inventing a second fallback for any
 * of them — the thing tests/design-tokens.test.php fails a build for.
 * ------------------------------------------------------------------------- */

/* --- the header trigger ---------------------------------------------------
 * Sized like the cart beside it: a 24px pointer target (WCAG 2.5.8) with 18px
 * of artwork inside, which is the split header.css already documents — the
 * target is an accessibility floor, not a drawing decision. */
.header-search-btn {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--ww-c-on-dark, #F9F9F9);
}

.header-search-btn__icon {
  display: block;
  width: 18px;
  height: 18px;
}

/* --- the field ----------------------------------------------------------- */
.ww-search {
  display: flex;
  align-items: stretch;
  gap: 0;
  width: 100%;
  max-width: 34rem;
}

/* Two classes deep, because style.css's normalize styles input[type="text"]
   and friends at (0,1,1) with width:100% and 16px of padding — the specificity
   trap the quote drawer's quantity field was caught by. */
.ww-search .ww-search__input {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  /* 16px is a FLOOR, not a preference: mobile Safari zooms the whole page when
     a focused input is under 16px, and the page never zooms back. */
  font-size: 1rem;
  line-height: 1.5;
  padding: var(--ww-space-3, 12px) var(--ww-space-4, 16px);
  border: 1px solid var(--ww-c-border, #767676);
  border-right: 0;
  border-radius: var(--ww-radius-control, 8px) 0 0 var(--ww-radius-control, 8px);
  background: var(--ww-c-surface, #FFFFFF);
  color: var(--ww-c-ink, #0C1E13);
}

.ww-search .ww-search__input::placeholder {
  color: var(--ww-c-text, #4F4F4F);
  opacity: 1;
}

.ww-search .ww-search__submit {
  appearance: none;
  border: 0;
  cursor: pointer;
  padding: 0 var(--ww-space-4, 16px);
  border-radius: 0 var(--ww-radius-control, 8px) var(--ww-radius-control, 8px) 0;
  background: var(--ww-c-accent-fill, #0F6037);
  color: var(--ww-c-on-dark, #F9F9F9);
  display: flex;
  align-items: center;
  transition: background-color var(--ww-dur-base, 200ms) var(--ww-ease-out, cubic-bezier(0.22, 1, 0.36, 1));
}

.ww-search .ww-search__submit:hover,
.ww-search .ww-search__submit:focus-visible {
  background: var(--ww-c-accent-fill-dk, var(--ww-oxide-dk, #0C5331));
}

/* The mobile menu sits on a light sheet, so the field needs its own ground. */
.ww-search--mob {
  margin-top: var(--ww-space-4, 16px);
  max-width: none;
}

/* --- the dialog ---------------------------------------------------------- */
.ww-search-popup .popup-content {
  padding: var(--ww-space-6, 24px);
}

.ww-search-popup__title {
  margin: 0 0 var(--ww-space-4, 16px);
  font-size: clamp(1.25rem, 1.19rem + 0.26vw, 1.5rem);
  line-height: 1.2;
  color: var(--ww-c-ink, #0C1E13);
}

.ww-search-popup__hint {
  margin: var(--ww-space-3, 12px) 0 0;
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--ww-c-text, #4F4F4F);
}

/* --- the results page ---------------------------------------------------- */
.ww-search-page__title {
  margin-block: var(--ww-space-4, 16px) var(--ww-space-2, 8px);
  font-size: clamp(1.5rem, 1.35rem + 0.65vw, 2rem);
  line-height: 1.2;
  color: var(--ww-c-ink, #0C1E13);
  /* A query is user input and can be one long unbroken string. */
  overflow-wrap: anywhere;
}

.ww-search-page__count {
  margin-block: 0 var(--ww-section-tight, 32px);
  color: var(--ww-c-text, #4F4F4F);
}

.ww-search-page__section {
  margin-block: var(--ww-section-tight, 32px) var(--ww-space-3, 12px);
  font-size: 1.125rem;
  color: var(--ww-c-ink, #0C1E13);
}

.ww-search-page__pages {
  margin: 0;
  padding-left: var(--ww-space-5, 20px);
}

/* Prose links: underlined at rest. Colour alone would fail WCAG 1.4.1. */
.ww-search-page__pages a,
.ww-search-page__browse {
  color: var(--ww-c-accent, #0F6037);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ww-search-page__empty {
  max-width: var(--ww-measure-wide, 40rem);
  margin-block: var(--ww-section-tight, 32px);
}

.ww-search-page__hint {
  color: var(--ww-c-text, #4F4F4F);
  margin-block: 0 var(--ww-space-4, 16px);
}

/* The results page has no facet sidebar, so the grid takes the full width —
   cust.css hides .col-md-3 globally and facets.css only reveals it under
   .ww-has-facets, which a search page never carries. */
.ww-search-page .catalog_products {
  margin-top: 0;
}
