.postal-form {
  position: relative;
}

.postal-form > button[aria-busy="true"] {
  opacity: 0.7;
  cursor: progress;
}

.postal-form > button[type="submit"] {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.postal-form > button[type="submit"]::after {
  content: "";
  position: absolute;
  top: -60%;
  bottom: -60%;
  left: -70%;
  width: 45%;
  background: linear-gradient(90deg, transparent, #ffffffa6, transparent);
  transform: translateX(0) skewX(-18deg);
  opacity: 0;
  pointer-events: none;
  z-index: -1;
}

@keyframes postal-button-shine {
  0% {
    transform: translateX(0) skewX(-18deg);
    opacity: 0;
  }

  10% {
    opacity: 1;
  }

  55% {
    transform: translateX(400%) skewX(-18deg);
    opacity: 1;
  }

  65%,
  100% {
    transform: translateX(400%) skewX(-18deg);
    opacity: 0;
  }
}

@keyframes postal-button-glow {
  0%,
  100% {
    box-shadow:
      0 0 0 0 #00cc8800,
      0 0 10px #00cc8833;
  }

  50% {
    box-shadow:
      0 0 0 4px #00cc8833,
      0 0 24px #00cc8873;
  }
}

.hero:has(.postal-autocomplete--hero .postal-suggestions:not([hidden])) {
  overflow: visible;
  z-index: 3;
}

.postal-autocomplete {
  position: relative;
  min-width: 0;
}

.postal-autocomplete--hero {
  position: static;
  flex: 1;
}

.postal-autocomplete--hero .postal-label {
  height: 100%;
}

.postal-input-stack {
  position: relative;
  display: block;
  flex: 1;
  min-width: 0;
}

.postal-autocomplete--hero .postal-label input {
  padding-right: 26px;
}

.postal-autocomplete--hero.is-postal-valid .postal-label input {
  padding-top: 5px;
  padding-bottom: 21px;
}

.postal-selected-city {
  position: absolute;
  left: 0;
  right: 26px;
  bottom: 4px;
  overflow: hidden;
  color: #187c4d;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
  text-overflow: ellipsis;
  pointer-events: none;
}

.postal-validation-mark {
  position: absolute;
  top: 50%;
  right: 0;
  width: 20px;
  height: 20px;
  color: #168a53;
  transform: translateY(-50%);
  pointer-events: none;
}

.postal-validation-mark svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: #e5f5ec;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.postal-validation-mark svg path {
  fill: none;
}

.postal-autocomplete [hidden] {
  display: none !important;
}

.contact-grid > .postal-autocomplete {
  color: var(--form-text);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
}

.postal-autocomplete--contact .postal-input-stack {
  margin-top: 7px;
}

.contact-grid .postal-autocomplete input {
  margin-top: 0;
  padding-right: 40px;
}

.postal-autocomplete--contact .postal-validation-mark {
  right: 12px;
}

.contact-grid .is-postal-valid input,
.contact-grid input.is-postal-verified {
  border-color: #218758;
  box-shadow: 0 0 0 2px #21875812;
}

.postal-suggestions {
  position: absolute;
  top: calc(100% + 9px);
  left: 0;
  right: 0;
  z-index: 40;
  overflow: hidden;
  padding: 6px;
  border: 1px solid #dce6df;
  border-radius: 10px;
  background: #fff;
  color: #252b27;
  box-shadow: 0 14px 40px #0003;
  text-align: left;
}

.postal-autocomplete--contact .postal-suggestions {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  width: auto;
  margin-top: 0;
  z-index: 40;
}

.postal-suggestions-info {
  margin: 0;
  padding: 8px 10px;
  color: #66716a;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.5;
}

.postal-suggestions-list {
  max-height: 235px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  margin: 0;
  padding: 0;
  list-style: none;
  touch-action: pan-y pinch-zoom;
  -webkit-user-select: none;
  user-select: none;
}

.postal-suggestion {
  display: flex;
  align-items: baseline;
  gap: 13px;
  min-height: 42px;
  padding: 10px;
  border-radius: 6px;
  color: #252b27;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
  cursor: pointer;
}

.postal-suggestion:hover,
.postal-suggestion[aria-selected="true"] {
  background: #edf7f0;
  color: #17613c;
}

.postal-suggestion-code {
  flex: 0 0 5ch;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.postal-suggestion-city {
  min-width: 0;
  overflow-wrap: anywhere;
}

.postal-suggestions-credit {
  margin-top: 4px;
  padding: 7px 10px 3px;
  border-top: 1px solid #edf0ed;
  color: #778078;
  font-size: 10px;
  font-weight: 400;
  line-height: 1.5;
}

.postal-suggestions-credit a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

@media (max-width: 720px) {
  .postal-autocomplete--hero.is-postal-valid .postal-label input {
    padding-top: 5px;
    padding-bottom: 19px;
  }
}

@media (max-width: 380px) {
  .postal-autocomplete--hero .postal-label > svg {
    display: none;
  }
}

@media (forced-colors: active) {
  .postal-suggestions,
  .postal-suggestion[aria-selected="true"] {
    border: 1px solid CanvasText;
  }
  .postal-validation-mark svg {
    fill: Canvas;
    stroke: CanvasText;
  }
}

@media (prefers-reduced-motion: no-preference) {
  body:not(.modal-open)
    .postal-form:has(.postal-autocomplete--hero.is-postal-valid)
    > button[type="submit"]:not(:disabled):not([aria-busy="true"]) {
    animation: postal-button-glow 2.2s ease-in-out infinite;
  }

  body:not(.modal-open)
    .postal-form:has(.postal-autocomplete--hero.is-postal-valid)
    > button[type="submit"]:not(:disabled):not([aria-busy="true"])::after {
    animation: postal-button-shine 2.2s ease-in-out infinite;
  }
}
