/* Header search bar (template-parts/search/panel.php), from the reference chrome.css
   .chrome-search, restyled after the owner's reference: a cream bar fixed to the top of the
   viewport, over the header and a dimmed page, holding one field with search, voice search
   and close. Recent searches and predictive results (template-parts/search/predict.php)
   open under it. No focus ring on the field for pointer users; keyboard users get one
   (.is-kbd). Rules sit under .hg-search-bar, so the older panel rules in drawers.css
   (.hg-search-panel, .hg-predict) no longer decide anything here. */

.hg-search-bar-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgb(0 0 0 / 0.68);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.hg-search-bar-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.hg-search-bar {
  /* Page cream for the bar, and the home bands' deeper cream (home-card-fan.css) for the field. */
  --hg-search-bar-bg: var(--hg-bg);
  --hg-search-field-bg: #eae0d2;
  /* Placeholder and secondary text: --hg-text at 70% keeps about 5:1 on the field. */
  --hg-search-muted: rgb(26 24 22 / 0.7);
  /* Below the admin bar, which stays fixed above 600px wide, like the sticky header. */
  --hg-search-bar-top: var(--wp-admin--admin-bar--height, 0px);
  position: fixed;
  inset-block-start: var(--hg-search-bar-top);
  inset-inline: 0;
  z-index: 1000;
  max-block-size: calc(100vh - var(--hg-search-bar-top));
  max-block-size: calc(100dvh - var(--hg-search-bar-top));
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--hg-search-bar-bg);
  color: var(--hg-text);
  box-shadow: 0 2px 3px rgb(0 0 0 / 0.09);
  font-family: var(--hg-font-body);
  font-size: 14px;
  line-height: 1.6;
  transform: translateY(-100%);
  visibility: hidden;
  /* Ease-out: the bar moves on the first frame and settles softly. */
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 0.4s;
}
.hg-search-bar.is-open {
  transform: none;
  visibility: visible;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 0s;
}
@media (max-width: 600px) {
  .hg-search-bar { --hg-search-bar-top: 0px; }
}

.hg-search-bar__top,
.hg-search-bar__below {
  box-sizing: border-box;
  max-width: 1300px;
  margin-inline: auto;
  padding-inline: 15px;
}
.hg-search-bar__top {
  padding-block: 30px;
}
.hg-search-bar__form {
  margin: 0;
}
.hg-search-bar__field {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  min-height: 52px;
  padding-inline: 4px;
  border-radius: var(--hg-radius);
  background: var(--hg-search-field-bg);
}
.hg-search-bar.is-kbd .hg-search-bar__field:has(> .hg-search-bar__input:focus-visible) {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

/* Two classes so the Ecomus button colours, padding and hover fill stay out. */
.hg-search-bar .hg-search-bar__btn {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  box-shadow: none;
  color: inherit;
  cursor: pointer;
  transition: background-color 0.3s ease, color 0.3s ease;
}
.hg-search-bar .hg-search-bar__btn[hidden] {
  display: none;
}
.hg-search-bar .hg-search-bar__btn:hover {
  background: rgb(26 24 22 / 0.08);
  color: inherit;
}
.hg-search-bar .hg-search-bar__btn::after {
  content: none;
}
.hg-search-bar .hg-search-bar__btn:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: -2px;
}
.hg-search-bar__btn svg {
  display: block;
  pointer-events: none;
}
.hg-search-bar__btn--submit svg {
  width: 20px;
  height: 20px;
}
.hg-search-bar__btn--voice svg {
  width: 13px;
  height: 19px;
}
.hg-search-bar__btn--close svg {
  width: 16px;
  height: 16px;
}
/* Listening: the accent fill, and a ring that pulses while the microphone is open. */
.hg-search-bar .hg-search-bar__btn--voice[aria-pressed="true"] {
  background: var(--hg-accent);
  color: #fff;
  animation: hg-search-listen 1.4s ease-out infinite;
}
.hg-search-bar .hg-search-bar__btn--voice[aria-pressed="true"]:focus-visible {
  outline-color: var(--hg-text);
  outline-offset: 2px;
}
@keyframes hg-search-listen {
  0% { box-shadow: 0 0 0 0 rgb(180 32 38 / 0.45); }
  100% { box-shadow: 0 0 0 10px rgb(180 32 38 / 0); }
}

/* Three classes so the Ecomus input, hover and focus rules stay out. */
.hg-search-bar .hg-search-bar__field .hg-search-bar__input {
  flex: 1 1 auto;
  min-width: 0;
  height: 44px;
  margin: 0;
  padding: 0 4px;
  border: 0;
  border-radius: 0;
  outline: none;
  box-shadow: none;
  background: transparent;
  color: inherit;
  font: inherit;
  /* 16px keeps iOS from zooming into the field. */
  font-size: 16px;
  line-height: 44px;
  -webkit-appearance: none;
  appearance: none;
  /* Ecomus transitions every input property, visibility included, which kept the field
     hidden (and unfocusable) on the first frame of the open. */
  transition: none;
}
.hg-search-bar .hg-search-bar__input::placeholder {
  color: var(--hg-search-muted);
  opacity: 1;
}
.hg-search-bar .hg-search-bar__input::-webkit-search-cancel-button,
.hg-search-bar .hg-search-bar__input::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}

/* The live region shows only for voice search errors; counts stay screen-reader text. */
.hg-search-bar__status {
  margin: 0;
  padding-block-end: 16px;
  color: var(--hg-accent-text);
  font-size: 14px;
  line-height: 1.5;
}
.hg-search-bar__results:empty {
  display: none;
}

/* Recent searches */
.hg-search-bar__suggest {
  padding: 0 0 20px;
}
.hg-search-bar__suggest[hidden],
.hg-search-bar__suggest:not(:has(> :not([hidden]))) {
  display: none;
}
.hg-search-bar__group[hidden] {
  display: none;
}
.hg-search-bar__group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.hg-search-bar__group-title {
  margin: 0 0 12px;
  color: inherit;
  font-family: var(--hg-font-heading);
  font-size: 22px;
  font-weight: 800;
  line-height: 1.1;
  text-transform: uppercase;
}
.hg-search-bar .hg-search-bar__clear {
  min-height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
}
.hg-search-bar .hg-search-bar__clear::after {
  content: none;
}
.hg-search-bar__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.hg-search-bar .hg-search-bar__chips a {
  display: inline-block;
  padding: 6px 12px;
  border: 1px solid var(--hg-line-strong);
  border-radius: 999px;
  color: inherit;
  font-size: 13px;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.hg-search-bar .hg-search-bar__chips a:hover {
  border-color: currentColor;
}

/* Predictive results (template-parts/search/predict.php), from .chrome-predict. */
.hg-search-bar .hg-predict__heading {
  margin: 10px 0 15px;
  color: inherit;
  font-family: var(--hg-font-heading);
  font-size: 29px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: normal;
  text-transform: uppercase;
}
.hg-search-bar .hg-predict__queries {
  margin-block-end: 30px;
}
.hg-search-bar .hg-predict__chips {
  margin: 0;
  padding: 0;
  list-style: none;
}
.hg-search-bar .hg-predict__chips li {
  display: inline-block;
}
.hg-search-bar .hg-predict__chip {
  display: inline-block;
  margin-block: 0 10px;
  margin-inline: 0 10px;
  padding: 2px 9px;
  border: 1px solid var(--hg-line);
  border-radius: 3px;
  background: var(--hg-search-field-bg);
  color: inherit;
  font-size: 12px;
  line-height: 19.2px;
  text-align: center;
  text-decoration: none;
}
.hg-search-bar .hg-predict__chip:hover {
  border-color: currentColor;
}
/* The matched words in any predictive result: bold in the surrounding colour, never the
   browser's yellow mark (the owner turned yellow highlights down). */
.hg-search-bar .hg-search-bar__results mark {
  padding: 0;
  background: none;
  color: inherit;
  font-weight: 700;
}
.hg-search-bar .hg-predict__tabs {
  display: flex;
  margin-block-start: 20px;
  border-block-end: 1px solid var(--hg-line);
  overflow-x: auto;
  scrollbar-width: none;
}
.hg-search-bar .hg-predict__tab {
  position: relative;
  flex: none;
  margin: 0;
  margin-inline-end: 30px;
  padding: 16px 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--hg-search-muted);
  font: inherit;
  font-size: 16px;
  line-height: 25.6px;
  letter-spacing: normal;
  text-transform: none;
  cursor: pointer;
  opacity: 1;
}
/* The underline is ::before; ::after carries the Ecomus button shine and the older panel underline. */
.hg-search-bar .hg-predict__tabs .hg-predict__tab::after {
  content: none;
}
.hg-search-bar .hg-predict__tab:hover {
  background: none;
  color: var(--hg-text);
}
.hg-search-bar .hg-predict__tab[aria-selected="true"] {
  color: var(--hg-text);
}
.hg-search-bar .hg-predict__tab[aria-selected="true"]::before {
  content: "";
  position: absolute;
  inset: auto 0 -1px;
  height: 2px;
  background: currentColor;
}
.hg-search-bar .hg-predict__tab:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: -2px;
}
.hg-search-bar .hg-predict__panel {
  padding-block: 20px;
}
.hg-search-bar .hg-predict__panel[hidden] {
  display: none;
}
.hg-search-bar .hg-predict__panel:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}
.hg-search-bar .hg-predict__row {
  display: flex;
  gap: 14px;
  margin: 0;
  padding: 0 0 10px;
  list-style: none;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  overscroll-behavior-x: contain;
}
.hg-search-bar .hg-predict__cell {
  flex: 0 0 calc((100% + 14px) * 0.15 - 14px);
  min-width: 0;
  scroll-snap-align: start;
}
.hg-search-bar .hg-predict__card {
  display: grid;
  color: inherit;
  text-align: center;
  text-decoration: none;
}
.hg-search-bar .hg-predict__media {
  position: relative;
  display: block;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border: 1px solid #232323;
  border-radius: 10px;
  background: #fff;
}
.hg-search-bar .hg-predict__media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 0;
  object-fit: cover;
}
.hg-search-bar .hg-predict__badge {
  position: absolute;
  z-index: 1;
  inset-block-start: 10px;
  inset-inline-start: 10px;
  padding: 4px 10px;
  border-radius: 10px;
  background: #000;
  color: #fff;
  font-size: 11px;
  line-height: 13.2px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.hg-search-bar .hg-predict__title {
  display: -webkit-box;
  margin-block-start: 10px;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.6;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
}
.hg-search-bar .hg-predict__price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 0 7px;
  margin-block-start: 5px;
  font-size: 14px;
  line-height: 1.2;
}
.hg-search-bar .hg-predict__price strong {
  font-weight: 700;
}
.hg-search-bar .hg-predict__price s {
  color: var(--hg-search-muted);
  font-size: 12px;
}
.hg-search-bar .hg-predict__links {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.hg-search-bar .hg-predict__links a {
  color: inherit;
  font-size: 14px;
}
.hg-search-bar .hg-predict__all {
  display: block;
  padding: 10px 0;
  border-block-start: 1px solid var(--hg-line);
  color: inherit;
  font-size: 16px;
  font-weight: 700;
  line-height: 25.6px;
  text-align: center;
  text-decoration: none;
}
.hg-search-bar .hg-predict__all:hover {
  text-decoration: underline;
}
.hg-search-bar .hg-predict__empty {
  margin: 0;
  padding: 0 0 20px;
}

@media (max-width: 749px) {
  .hg-search-bar__top,
  .hg-search-bar__below {
    padding-inline: 20px;
  }
  .hg-search-bar__top {
    padding-block: 20px;
  }
  .hg-search-bar .hg-predict__heading {
    font-size: 22px;
  }
  .hg-search-bar .hg-predict__cell {
    flex-basis: calc((100% + 14px) * 0.4 - 14px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .hg-search-bar,
  .hg-search-bar.is-open,
  .hg-search-bar-overlay,
  .hg-search-bar .hg-search-bar__btn {
    transition-duration: 0s;
    transition-delay: 0s;
  }
  .hg-search-bar .hg-search-bar__btn--voice[aria-pressed="true"] {
    animation: none;
  }
}
