/* Search pill */
header form {
  position: relative;
  display: flex;
  align-items: center;
  margin: 0;
}

header .form-item,
header .js-form-item,
header .form-group,
header .form-actions {
  margin: 0;
}

/* Visually hidden label (still read by screen readers) */
header label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

header input[type="search"],
header input[type="text"] {
  width: clamp(150px, 14vw, 180px);
  height: 48px;
  padding: 0 1rem 0 2.9rem;
  color: #fff;
  font-size: .9375rem;
  background: var(--hero-glass);
  border: 1px solid rgba(255, 255, 255, .55);
  border-radius: 999px;
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: none;
  transition: background-color 200ms ease;
}

header input::placeholder {
  color: rgba(255, 255, 255, .92);
  opacity: 1;
}

header input[type="search"]:focus,
header input[type="text"]:focus {
  background: rgba(9, 30, 62, .8);
}

/* Expanding search: pinned to the right edge, so it grows toward the left */
header input[type="search"]:focus,
header input[type="text"]:focus,
header input[type="search"]:not(:placeholder-shown),
header input[type="text"]:not(:placeholder-shown) {
  width: clamp(220px, 24vw, 320px);
}

header input:focus::placeholder {
  color: transparent; /* placeholder fades out on click */
}

@media (prefers-reduced-motion: no-preference) {
  header input[type="search"],
  header input[type="text"] {
    transition: width 350ms cubic-bezier(.4, 0, .2, 1), background-color 200ms ease;
  }

  header input::placeholder {
    transition: color 200ms ease;
  }
}

/* Submit button becomes the magnifier icon inside the pill */
header button[type="submit"],
header input[type="submit"] {
  position: absolute;
  z-index: 1;
  left: .8rem;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  box-shadow: none;
  font-size: 0;
  color: transparent;
  cursor: pointer;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23fff' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001q.044.06.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1 1 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0'/%3E%3C/svg%3E") center / 18px no-repeat;
}
