.leaflet-control-geocoder {
  /* custom properties for theming */
  --leaflet-control-geocoder-background: white;
  --leaflet-control-geocoder-color: black;
  --leaflet-control-geocoder-muted-color: #666;
  --leaflet-control-geocoder-error-color: #444;
  --leaflet-control-geocoder-border-color: #ccc;
  --leaflet-control-geocoder-hover-background: #f5f5f5;

  /* white like Leaflet's controls, also on pages with color-scheme: dark */
  color-scheme: light;
  border-radius: 4px;
  background: var(--leaflet-control-geocoder-background);
  color: var(--leaflet-control-geocoder-color);
  min-inline-size: 26px;
  min-block-size: 26px;

  .leaflet-touch & {
    min-inline-size: 30px;
    min-block-size: 30px;
  }
}

.leaflet-control-geocoder-icon {
  display: inline-block;
  border-radius: 4px;
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  background-color: var(--leaflet-control-geocoder-background);
  color: var(--leaflet-control-geocoder-color);
  cursor: pointer;
  vertical-align: middle;

  .leaflet-touch & {
    width: 30px;
    height: 30px;
  }

  /* drawn in currentColor, so that it adapts to forced colors mode */
  &::before {
    content: '';
    display: block;
    inline-size: 100%;
    block-size: 100%;
    background-color: currentColor;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12.2 13l3.4 6.6c.6 1.1 2.5-.4 2-1.2l-4-6.2z'/%3E%3Ccircle cx='10.8' cy='8.9' r='3.9' fill='none' stroke='%23000' stroke-width='1.5'/%3E%3C/svg%3E")
      no-repeat center / 24px;
  }

  .leaflet-control-geocoder-throbber &::before {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' stroke='%23000' stroke-linecap='round' stroke-width='1.6' viewBox='0 0 24 24'%3E%3Cdefs/%3E%3Cg%3E%3Cpath stroke-opacity='.1' d='M14 8.4l3-5'/%3E%3Cpath stroke-opacity='.2' d='M15.6 10l5-3'/%3E%3Cpath stroke-opacity='.3' d='M16.2 12H22'/%3E%3Cpath stroke-opacity='.4' d='M15.6 14l5 3m-6.5-1.4l2.9 5'/%3E%3Cpath stroke-opacity='.5' d='M12 16.2V22m-2-6.4l-3 5'/%3E%3Cpath stroke-opacity='.6' d='M8.4 14l-5 3'/%3E%3Cpath stroke-opacity='.7' d='M7.8 12H2'/%3E%3Cpath stroke-opacity='.8' d='M8.4 10l-5-3'/%3E%3Cpath stroke-opacity='.9' d='M10 8.4l-3-5'/%3E%3Cpath d='M12 7.8V2'/%3E%3C/g%3E%3C/svg%3E");
    animation: leaflet-control-geocoder-spin 1s steps(12) infinite;

    @media (prefers-reduced-motion: reduce) {
      animation-duration: 6s;
    }
  }
}

@keyframes leaflet-control-geocoder-spin {
  to {
    rotate: 1turn;
  }
}

.leaflet-control-geocoder-form {
  display: none;
  vertical-align: middle;

  .leaflet-control-geocoder-expanded & {
    display: inline-block;
  }

  input {
    font: inherit;
    /* at least 16px, so that iOS doesn't zoom in on focus */
    font-size: max(1rem, 1em);
    color: inherit;
    border: 0;
    background-color: transparent;
    /* rem: grows with the user's text size */
    inline-size: 15.5rem;
  }
}

.leaflet-control-geocoder-error {
  margin-block-start: 8px;
  margin-inline-start: 8px;
  display: block;
  color: var(--leaflet-control-geocoder-error-color);
}

.leaflet-control-geocoder-alternatives {
  display: block;
  inline-size: 17rem;
  list-style: none;
  padding: 0;
  margin: 0;

  li {
    white-space: nowrap;
    display: block;
    overflow: hidden;
    padding-block: 5px;
    padding-inline: 8px;
    text-align: start;
    text-overflow: ellipsis;
    cursor: pointer;

    &:not(:last-child) {
      border-block-end: 1px solid var(--leaflet-control-geocoder-border-color);
    }

    &:hover {
      background-color: var(--leaflet-control-geocoder-hover-background);
    }
  }
}

.leaflet-control-geocoder-alternatives-minimized {
  display: none;
}

.leaflet-control-geocoder-selected {
  background-color: var(--leaflet-control-geocoder-hover-background);
  /* not by color alone: visible with low contrast and in forced colors mode */
  outline: 2px solid currentColor;
  outline-offset: -2px;

  @media (forced-colors: active) {
    outline-color: Highlight;
  }
}

.leaflet-control-geocoder-address-context {
  color: var(--leaflet-control-geocoder-muted-color);
}

/* hidden visually, but read by screen readers */
.leaflet-control-geocoder-visually-hidden:where(:not(:focus-within, :active)) {
  position: absolute !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  white-space: nowrap !important;
}
