/* Header search modal — desktop command palette style */
.hsm[hidden] {
  display: none !important;
}

.hsm {
  position: fixed;
  inset: 0;
  z-index: 420;
  display: grid;
  place-items: start center;
  padding: 8vh 1rem 2rem;
}

.hsm__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 17, 20, 0.48);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: hsm-fade 0.2s ease;
}

.hsm__dialog {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
  max-height: min(78vh, 720px);
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  background: #fff;
  border: 1px solid rgba(17, 17, 20, 0.1);
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.28);
  overflow: hidden;
  animation: hsm-rise 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.hsm__top {
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid rgba(17, 17, 20, 0.08);
  background: #fafafa;
}

.hsm__form {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.5rem;
  align-items: center;
}

.hsm__field {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 48px;
  padding: 0 0.9rem;
  border-radius: 14px;
  border: 1px solid rgba(17, 17, 20, 0.12);
  background: #fff;
}

.hsm__field:focus-within {
  border-color: rgba(154, 0, 2, 0.45);
  box-shadow: 0 0 0 3px rgba(154, 0, 2, 0.12);
}

.hsm__field img {
  opacity: 0.45;
  flex-shrink: 0;
}

.hsm__field input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 1rem;
  color: #111114;
  outline: none;
}

.hsm__submit {
  min-height: 48px;
  padding-inline: 1.15rem;
  border-radius: 14px;
}

.hsm__close {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(17, 17, 20, 0.1);
  border-radius: 12px;
  background: #fff;
  color: #111114;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.hsm__close:hover {
  background: rgba(17, 17, 20, 0.04);
}

.hsm__body {
  overflow: auto;
  padding: 1rem 1.1rem 1.35rem;
  display: grid;
  gap: 1.25rem;
}

.hsm__section-head h3 {
  margin: 0 0 0.65rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #6b7280;
}

.hsm__brands {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 0.55rem;
}

.hsm__brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 88px;
  padding: 0.55rem 0.35rem;
  border-radius: 14px;
  border: 1px solid transparent;
  background: #f5f6f8;
  color: #111114;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s, transform 0.15s;
}

.hsm__brand img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  background: transparent;
}

.hsm__brand-fallback {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(154, 0, 2, 0.08);
  color: #9a0002;
  font-weight: 800;
}

.hsm__brand:hover {
  background: #fff;
  border-color: rgba(154, 0, 2, 0.22);
}

.hsm__brand.is-active {
  background: rgba(154, 0, 2, 0.08);
  border-color: rgba(154, 0, 2, 0.4);
  color: #9a0002;
}

.hsm__brand:active {
  transform: scale(0.97);
}

.hsm__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.hsm__chip {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(17, 17, 20, 0.12);
  background: #fff;
  color: #111114;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s, color 0.18s;
}

.hsm__chip:hover,
.hsm__chip--link:hover {
  border-color: rgba(154, 0, 2, 0.3);
  color: #9a0002;
  background: rgba(154, 0, 2, 0.05);
}

.hsm__chip.is-active {
  border-color: rgba(154, 0, 2, 0.45);
  background: rgba(154, 0, 2, 0.1);
  color: #9a0002;
}

.hsm__chip--body {
  gap: 0.4rem;
  padding-inline: 0.65rem 0.9rem;
}

.hsm__chip--body img {
  width: 36px;
  height: 22px;
  object-fit: contain;
}

.hsm__chips--bodies {
  gap: 0.5rem;
}


@keyframes hsm-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes hsm-rise {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .hsm__backdrop,
  .hsm__dialog {
    animation: none;
  }
}

@media (max-width: 768px) {
  .hsm {
    display: none !important;
  }
}
