/* KALTERA listbox: a styled list instead of the browser's native menu.

   The real <select> stays in the form, hidden, and keeps the value. The button looks like
   the site's other fields, and the list looks like the gate's practice list. */

.klist {
  position: relative;
}

/* The select underneath is kept, not shown. */
.klist select[hidden] {
  display: none;
}

.klist__btn {
  display: flex;
  align-items: center;
  width: 100%;
  height: 52px;
  padding: 0 44px 0 16px;
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  background: rgb(255 255 255 / 0.35);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%2316262B' stroke-opacity='.55' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  color: var(--text);
  font-family: var(--f-body);
  font-weight: 400;
  font-size: 16px;
  text-align: left;
  cursor: pointer;
  transition:
    border-color 200ms var(--ease-out),
    background-color 200ms var(--ease-out);
}

.klist__btn:hover {
  border-color: var(--green);
}

.klist__btn:focus-visible {
  outline: 2px solid var(--brass-deep);
  outline-offset: 1px;
  border-color: var(--green);
}

.klist__btn[aria-expanded="true"] {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgb(18 112 126 / 0.12);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 6.5 6 1.5l5 5' fill='none' stroke='%2312707E' stroke-width='1.5'/%3E%3C/svg%3E");
}

.klist__value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.klist__value.is-placeholder {
  color: var(--ink-muted);
}

/* The list. */
.klist__list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  max-height: 320px;
  margin: 0;
  padding: 6px;
  overflow: auto;
  overscroll-behavior: contain;
  list-style: none;
  border: 1px solid var(--rule-strong);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 22px 48px -20px rgb(22 38 43 / 0.4);
}

.klist__list[hidden] {
  display: none;
}

.klist__list:focus {
  outline: none;
}

.klist__opt {
  padding: 10px 12px;
  border-radius: 6px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.35;
  cursor: pointer;
}

.klist__opt.is-active {
  background: var(--vellum);
  color: var(--green);
}

.klist__opt[aria-selected="true"] {
  color: var(--heading);
  font-weight: 500;
}

.klist__opt[aria-selected="true"].is-active {
  color: var(--heading);
}

.klist__opt.is-disabled {
  opacity: 0.45;
  cursor: default;
}
