/* Panel that replaces the native select popup (see custom-select.js).
   Variants: --field (filter dropdowns), --inline (sort), --bare (careers search bar). */
.cselect__native {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.cselect {
  position: relative;
  display: inline-flex;
  min-width: 0;
}
.cselect__button {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-width: 0;
  color: rgba(255, 255, 255, 0.85);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  line-height: normal;
  text-align: left;
  cursor: pointer;
  transition:
    color var(--dur-hover) var(--ease-out),
    background-color var(--dur-hover) var(--ease-out);
}
.cselect__value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cselect__chevron {
  flex-shrink: 0;
  transition: transform 200ms var(--ease-out);
}
.cselect.is-open .cselect__chevron {
  transform: rotate(180deg);
}
.cselect__button:hover {
  color: var(--color-white);
}
.cselect__button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}
.cselect__button:focus-visible {
  outline: 2px solid var(--color-sky);
  outline-offset: 2px;
  border-radius: 8px;
}

/* Positioned by custom-select.js against the viewport (fixed), so containers with overflow: hidden never cut it. */
.cselect__list {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 60;
  max-height: 320px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px;
  border: 1px solid var(--white-10);
  border-radius: 12px;
  background: #111a33;
  box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.6);
  animation: cselect-in 160ms var(--ease-out);
}
.cselect__list:focus {
  outline: none;
}
.cselect__list[hidden] {
  display: none;
}
@keyframes cselect-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
}
.cselect__list.is-up {
  animation-name: cselect-in-up;
}
@keyframes cselect-in-up {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .cselect__list {
    animation: none;
  }
}
.cselect__option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  line-height: 20px;
  color: rgba(255, 255, 255, 0.85);
  white-space: nowrap;
}
.cselect__option.is-focused {
  background: var(--white-08);
  color: var(--color-white);
}
.cselect__option[aria-selected='true'] {
  color: var(--color-lavender);
}
.cselect__check {
  opacity: 0;
}
.cselect__option[aria-selected='true'] .cselect__check {
  opacity: 1;
}

/* --field: fills the dropdown box. */
.cselect--field {
  width: 100%;
  height: 100%;
}
.cselect--field .cselect__button {
  height: 100%;
  padding: 0 16px;
  border-radius: 12px;
}
.cselect--field.is-active .cselect__button {
  color: var(--color-white);
  background: rgba(0, 102, 255, 0.25);
}
/* --inline: "Sort by  Most recent ⌄" — text-sized trigger, panel aligned right. */
.cselect--inline .cselect__button {
  gap: 6px;
  padding: 4px 6px;
  border-radius: 8px;
  color: var(--color-white);
}
.cselect--inline .cselect__button:hover {
  background: var(--white-06, rgba(255, 255, 255, 0.06));
}
/* --bare: careers hero search fields. */
.cselect--bare {
  width: 100%;
}
.cselect--bare .cselect__button {
  padding: 0;
}

/* A chosen value (also after a reload with ?department=… / ?service=…) reads as selected. */
.cselect.has-value .cselect__button {
  color: var(--color-white);
}
.cselect--bare.has-value .cselect__value {
  color: var(--color-lavender);
}
.cselect__button:focus-visible,
.cselect.is-open .cselect__button {
  outline: none;
}
.cselect.is-open.cselect--field .cselect__button,
.cselect--field .cselect__button:focus-visible {
  box-shadow: inset 0 0 0 1px var(--color-lavender);
}
.cselect.is-open.cselect--bare .cselect__button,
.cselect--bare .cselect__button:focus-visible {
  color: var(--color-white);
}
.cselect--inline .cselect__button:focus-visible,
.cselect.is-open.cselect--inline .cselect__button {
  background: rgba(255, 255, 255, 0.06);
}

/* Before the script runs (first paint after a reload) the native select already looks like the custom button. */
select[data-custom-select]:not(.cselect__native) {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent url('/assets/icons/chevron-down-16.svg') right 0 center / 14px no-repeat;
  padding-right: 22px;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
}
select[data-custom-select='cselect--field']:not(.cselect__native) {
  width: 100%;
  height: 100%;
  padding: 0 40px 0 16px;
  background-position: right 16px center;
  border-radius: 12px;
}
select[data-custom-select] option {
  color: #080d1c;
}
