/**
 * Global header search — scoped under .global-site-search.
 * Contact + search share one nav row (.nav-list__item--contact-search).
 */

.global-site-search {
  position: relative;
  width: 100%;
  min-width: 0;
  margin: 0;
  z-index: 10060;
}

.global-site-search__inner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1rem 0.45rem 1.1rem;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid rgba(148, 163, 184, 0.55);
  border-radius: 999px;
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.global-site-search__inner:focus-within {
  border-color: rgba(11, 92, 171, 0.55);
  box-shadow: 0 0 0 3px rgba(11, 92, 171, 0.15), 0 4px 18px rgba(15, 23, 42, 0.08);
}

.global-site-search__icon {
  flex-shrink: 0;
  width: 1.15rem;
  height: 1.15rem;
  color: #64748b;
  pointer-events: none;
}

.global-site-search__input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  font-size: 1rem;
  line-height: 1.45;
  color: #0f172a;
  outline: none;
  padding: 0.35rem 0;
}

.global-site-search__input::placeholder {
  color: #94a3b8;
}

.global-site-search__clear {
  flex-shrink: 0;
  display: none;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.25);
  color: #475569;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease;
}

.global-site-search__clear:hover,
.global-site-search__clear:focus-visible {
  background: rgba(148, 163, 184, 0.45);
  outline: none;
}

.global-site-search__clear.is-visible {
  display: inline-flex;
}

.global-site-search__spinner {
  position: absolute;
  right: 2.5rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.1rem;
  height: 1.1rem;
  border: 2px solid rgba(11, 92, 171, 0.2);
  border-top-color: rgba(11, 92, 171, 0.85);
  border-radius: 50%;
  display: none;
  animation: global-search-spin 0.65s linear infinite;
}

.global-site-search.is-loading .global-site-search__spinner {
  display: block;
}

@keyframes global-search-spin {
  to {
    transform: translateY(-50%) rotate(360deg);
  }
}

.global-site-search__panel {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 0.45rem);
  max-height: min(18rem, 50vh);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.14), 0 4px 12px rgba(15, 23, 42, 0.06);
  opacity: 1;
  transform: translateY(0);
  scrollbar-color: rgba(148, 163, 184, 0.65) transparent;
  scrollbar-width: thin;
  z-index: 100000;
}

/* JS sets position:fixed on desktop so the list is not clipped by the header/nav */
.global-site-search__panel.is-open {
  display: block !important;
  visibility: visible !important;
}

.global-site-search__hint,
.global-site-search__empty {
  margin: 0;
  padding: 0.85rem 1rem;
  font-size: 0.9rem;
  line-height: 1.55;
  color: #64748b;
  text-align: center;
}

.global-site-search__empty {
  color: #475569;
}

.global-site-search__list {
  list-style: none;
  margin: 0;
  padding: 0.35rem 0;
}

.global-site-search__item {
  margin: 0;
  border-bottom: 1px solid rgba(241, 245, 249, 0.95);
}

.global-site-search__item:last-child {
  border-bottom: none;
}

.global-site-search__link {
  display: block;
  padding: 0.65rem 1rem;
  font-size: 0.92rem;
  line-height: 1.5;
  color: #0f172a;
  text-decoration: none;
  transition: background 0.15s ease;
}

.global-site-search__link:hover,
.global-site-search__link:focus-visible {
  background: rgba(11, 92, 171, 0.06);
  outline: none;
}

.global-site-search__hit {
  color: #dc2626;
  background: none;
  font-weight: 700;
  padding: 0;
}

.site-header .header-inner {
  overflow: visible;
}

/* One flex item: Contact link + search field stay together */
.nav-list__item--contact-search {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.65rem;
}

.nav-list__item--contact-search .nav-link--inline-contact {
  flex-shrink: 0;
}

.nav-list__item--contact-search .global-site-search {
  flex: 1 1 20rem;
  min-width: 17rem;
  max-width: 36rem;
}

@media (min-width: 768px) {
  /* Avoid clipping the results dropdown */
  .site-header .primary-nav,
  .site-header .nav-panel,
  .site-header .nav-list {
    overflow: visible;
  }

  .nav-list__item--contact-search .global-site-search__inner {
    min-height: 2.8rem;
  }
}

@media (max-width: 767px) {
  .nav-list__item--contact-search {
    flex-direction: column;
    align-items: stretch;
    grid-column: 1 / -1;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(148, 163, 184, 0.35);
    gap: 0.85rem;
  }

  .nav-list__item--contact-search .global-site-search {
    max-width: none;
    min-width: 0;
  }

  .nav-list__item--contact-search .global-site-search__panel.is-open {
    position: fixed !important;
    left: 1rem !important;
    right: 1rem !important;
    top: 5.25rem !important;
    width: auto !important;
    max-width: 36rem;
    margin-left: auto;
    margin-right: auto;
    z-index: 100001 !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .global-site-search__spinner {
    animation: none;
    border-top-color: rgba(11, 92, 171, 0.5);
  }
}
