/* Base Reset for Selectify */
.selectify-select-dropdowns {
  position: relative;
  display: flex;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  text-align: start;
  align-items: center;
  justify-content: space-between;
  inline-size: auto;
  min-inline-size: 230px;
  max-inline-size: fit-content;
}

/* Selected Options Display */
.selectify-select-dropdowns .selectify-selected-display {
  display: flex;
  min-inline-size: 230px;
  min-block-size: var(--selectify-ui-field-height, 2.75em);
  padding: var(--selectify-select-padding);
  flex-grow: 0;
  align-items: center;
  justify-content: end;
  gap: 0.5rem;
}

/* Selected Option Item */
.selectify-select-dropdowns .selectify-selected-options {
  display: flex;
  inline-size: calc(100% - 30px);
  flex-grow: 1;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-inline: 0 26px;
}

/* Individual Selected Item */
.selectify-select-dropdowns .selectify-selected-one-option {
  display: flex;
  padding: 0.125em 0.75em;
  padding-inline-end: 8px;
  border: 1px solid var(--selectify-select-border-color, var(--r-br));
  border-radius: .75rem;
  font-size: .75rem;
  font-weight: 525;
  font-variation-settings: initial;
  line-height: 1.2;
  vertical-align: .125em;
  align-items: center;
  gap: 0.125rem;
}

/* Remove Tag Button */
.selectify-select-dropdowns .remove-tag {
  display: flex;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  transition: background-color 120ms ease;
  align-items: center;
  justify-content: center;
}

/* Dropdown Arrow */
.selectify-select-dropdowns .selectify-dorpdown-arrow {
  display: inline-flex;
  inline-size: 26px;
  cursor: pointer;
  align-items: center;
}

.selectify-select-dropdowns .selectify-dorpdown-arrow svg {
  inline-size: 24px;
  block-size: 24px;
  transition: transform 160ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Opened Dropdown Arrow */
.selectify-select-dropdowns.selectify-opened .selectify-dorpdown-arrow svg {
  transform: rotate(180deg);
}

.selectify-select-dropdowns.opens-up .selectify-available-display,
.selectify-select-dropdowns.opens-down .selectify-selected-display {
  border-end-end-radius: var(--selectify-dropdown-flush-end-end, 0) !important;
  border-end-start-radius: var(--selectify-dropdown-flush-end-start, 0) !important;
}

.selectify-select-dropdowns.opens-up .selectify-selected-display,
.selectify-select-dropdowns.opens-down .selectify-available-display {
  border-start-start-radius: var(--selectify-dropdown-flush-start-start, 0) !important;
  border-start-end-radius: var(--selectify-dropdown-flush-start-end, 0) !important;
}

/* Dropdown Display */
.selectify-select-dropdowns .selectify-available-display {
  position: absolute;
  inset-block-start: 100%;
  inset-inline: 0 auto;
  z-index: 6000;
  display: none;
  overflow: hidden auto;
  inline-size: auto;
  min-inline-size: 100%;
  max-inline-size: none;
  max-block-size: 18rem;
  padding: 4px;
}

/* Available Option Item */
.selectify-select-dropdowns .selectify-available-one-option {
  display: flex;
  padding: 0.5rem 0.75rem;
  font-size: var(--selectify-ui-font-size, 1em);
  font-weight: normal;
  line-height: 1;
  cursor: pointer;
  transition:
    background-color 120ms ease,
    box-shadow 120ms ease;
  align-items: center;
}

.checkbox.selectify-select-dropdowns .selectify-available-one-option {
  gap: 0.5rem;
}

.selectify-select-dropdowns .selectify-available-one-option * {
  font-weight: normal;
}

/* Search Input */
.selectify-select-dropdowns .search-input {
  position: relative;
}

.selectify-select-dropdowns .options-inner {
  position: relative;
}

.selectify-select-dropdowns .options-inner .selectify-select-footer {
  position: sticky;
  inset-block-end: 0;
  inset-inline: 0;
  background: var(--selectify-select-bg, var(--r-bg));
}

/* RTL: arrow icon mirror only (layout uses logical properties). A mirror,
   not a 180deg turn, so the closed arrow still points down. */
html[dir="rtl"] .selectify-select-dropdowns .selectify-dorpdown-arrow {
  scale: -1 1;
}

/* ============================================
   Rail & Halo look (dropdown, searchable, tags, dropdown checkbox).
   Colors are derived only from --selectify-* variables,
   currentColor and transparent; no literal color.
   Field line = border color mixed 45% toward the text color.
   Ring = focus color mixed 65% toward the text color.
   Halo = ring at 22%. Rail (selection bar) = ring.
   ============================================ */

/* Field. */
body .selectify-select.selectify-select-dropdowns .selectify-selected-display {
  min-block-size: var(--selectify-ui-field-height, 2.75em);
  border: 1px solid color-mix(in srgb, var(--selectify-select-border-color, var(--r-br, transparent)) 45%, var(--selectify-select-color, currentColor));
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--selectify-select-color, currentColor) 4%, transparent);
  transition:
    border-color 120ms ease,
    box-shadow 160ms ease,
    background-color 120ms ease;
  gap: 0.5rem;
}

body .selectify-select.selectify-select-dropdowns .selectify-selected-options {
  min-inline-size: 0;
}

body .selectify-select.selectify-select-dropdowns .selectify-selected-display:hover {
  border-color: color-mix(in srgb, var(--selectify-select-focus-border-color, var(--selectify-select-focus-border, currentColor)) 65%, var(--selectify-select-color, currentColor));
}

/* Keyboard focus: the field wears the ring and halo; the combobox draws nothing. */
body .selectify-select.selectify-select-dropdowns:focus,
body .selectify-select.selectify-select-dropdowns:focus-visible {
  outline: none;
  box-shadow: none;
}

body .selectify-select.selectify-select-dropdowns:focus-visible .selectify-selected-display {
  outline: 2px solid color-mix(in srgb, var(--selectify-select-focus-border-color, var(--selectify-select-focus-border, currentColor)) 65%, var(--selectify-select-color, currentColor));
  outline-offset: 2px;
  box-shadow: 0 0 0 6px color-mix(in srgb, color-mix(in srgb, var(--selectify-select-focus-border-color, var(--selectify-select-focus-border, currentColor)) 65%, var(--selectify-select-color, currentColor)) 22%, transparent);
}

/* Open: field and menu read as one sheet, with the same halo as focus. */
body .selectify-select.selectify-select-dropdowns.selectify-opened .selectify-selected-display {
  border-color: color-mix(in srgb, var(--selectify-select-focus-border-color, var(--selectify-select-focus-border, currentColor)) 65%, var(--selectify-select-color, currentColor));
  box-shadow: 0 0 0 6px color-mix(in srgb, color-mix(in srgb, var(--selectify-select-focus-border-color, var(--selectify-select-focus-border, currentColor)) 65%, var(--selectify-select-color, currentColor)) 22%, transparent);
}

body .selectify-select.selectify-select-dropdowns.selectify-opened.opens-down .selectify-selected-display {
  border-block-end-color: color-mix(in srgb, color-mix(in srgb, var(--selectify-select-border-color, var(--r-br, transparent)) 45%, var(--selectify-select-color, currentColor)) 40%, transparent);
}

body .selectify-select.selectify-select-dropdowns.selectify-opened.opens-up .selectify-selected-display {
  border-block-start-color: color-mix(in srgb, color-mix(in srgb, var(--selectify-select-border-color, var(--r-br, transparent)) 45%, var(--selectify-select-color, currentColor)) 40%, transparent);
}

/* Single value: plain text, never a chip. */
body .selectify-select.selectify-select-dropdowns:not([data-multiple="true"]) .selectify-selected-one-option {
  overflow: hidden;
  min-inline-size: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  font-size: inherit;
  font-weight: var(--selectify-ui-value-weight, 500);
}

body .selectify-select.selectify-select-dropdowns:not([data-multiple="true"]) .selectify-selected-one-option > span {
  overflow: hidden;
  min-inline-size: 0;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Arrow: 20px icon in a 24px box. */
body .selectify-select.selectify-select-dropdowns .selectify-dorpdown-arrow {
  inline-size: 24px;
  block-size: 24px;
  flex: none;
  justify-content: center;
}

body .selectify-select.selectify-select-dropdowns .selectify-dorpdown-arrow svg {
  inline-size: 20px;
  block-size: 20px;
}

/* Disabled. */
body .selectify-select.selectify-select-dropdowns.selectify-disabled,
body .selectify-select.selectify-select-dropdowns[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 1;
}

body .selectify-select.selectify-select-dropdowns.selectify-disabled .selectify-selected-display,
body .selectify-select.selectify-select-dropdowns[aria-disabled="true"] .selectify-selected-display {
  border-style: dashed;
  border-color: color-mix(in srgb, var(--selectify-select-border-color, var(--r-br, transparent)) 45%, var(--selectify-select-color, currentColor));
  box-shadow: none;
  background: var(--selectify-select-disabled-bg, var(--r-bg));
  color: color-mix(in srgb, var(--selectify-select-color, currentColor) 60%, transparent);
  cursor: not-allowed;
}

/* Error: a stronger line plus a glyph, so the state is not color alone. */
body .selectify-select.selectify-select-dropdowns[aria-invalid="true"] .selectify-selected-display,
body .wrapper-selectify.error > .selectify-select.selectify-select-dropdowns .selectify-selected-display,
body .form-item--error .selectify-select.selectify-select-dropdowns .selectify-selected-display {
  border: 2px solid var(--selectify-checkbox-invalid-border-color, color-mix(in srgb, var(--selectify-select-focus-border-color, var(--selectify-select-focus-border, currentColor)) 65%, var(--selectify-select-color, currentColor)));
}

body .selectify-select.selectify-select-dropdowns[aria-invalid="true"] .selectify-selected-display::before,
body .wrapper-selectify.error > .selectify-select.selectify-select-dropdowns .selectify-selected-display::before,
body .form-item--error .selectify-select.selectify-select-dropdowns .selectify-selected-display::before {
  background: var(--selectify-checkbox-invalid-border-color, currentColor);
  flex: none;
  content: "";
  inline-size: 16px;
  block-size: 16px;
  mask: url("../icons/error.svg") center / contain no-repeat;
}

/* Menu sheet, fused to the field (one border, one shadow). */
body .selectify-select.selectify-select-dropdowns .selectify-available-display {
  padding: 4px;
  border: 1px solid color-mix(in srgb, var(--selectify-select-focus-border-color, var(--selectify-select-focus-border, currentColor)) 65%, var(--selectify-select-color, currentColor));
  box-shadow:
    var(--selectify-dropdown-shadow, 0 0 transparent),
    0 6px 0 0 color-mix(in srgb, color-mix(in srgb, var(--selectify-select-focus-border-color, var(--selectify-select-focus-border, currentColor)) 65%, var(--selectify-select-color, currentColor)) 22%, transparent),
    6px 0 0 0 color-mix(in srgb, color-mix(in srgb, var(--selectify-select-focus-border-color, var(--selectify-select-focus-border, currentColor)) 65%, var(--selectify-select-color, currentColor)) 22%, transparent),
    -6px 0 0 0 color-mix(in srgb, color-mix(in srgb, var(--selectify-select-focus-border-color, var(--selectify-select-focus-border, currentColor)) 65%, var(--selectify-select-color, currentColor)) 22%, transparent);
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

body .selectify-select.selectify-select-dropdowns.opens-down .selectify-available-display {
  border-block-start-width: 0;
}

body .selectify-select.selectify-select-dropdowns.opens-up .selectify-available-display {
  border-block-end-width: 0;
  box-shadow:
    var(--selectify-dropdown-shadow, 0 0 transparent),
    0 -6px 0 0 color-mix(in srgb, color-mix(in srgb, var(--selectify-select-focus-border-color, var(--selectify-select-focus-border, currentColor)) 65%, var(--selectify-select-color, currentColor)) 22%, transparent),
    6px 0 0 0 color-mix(in srgb, color-mix(in srgb, var(--selectify-select-focus-border-color, var(--selectify-select-focus-border, currentColor)) 65%, var(--selectify-select-color, currentColor)) 22%, transparent),
    -6px 0 0 0 color-mix(in srgb, color-mix(in srgb, var(--selectify-select-focus-border-color, var(--selectify-select-focus-border, currentColor)) 65%, var(--selectify-select-color, currentColor)) 22%, transparent);
}

/* Menu enter: fade, 4px slide and a slight scale from the field edge. */
@keyframes selectify-sheet-in-down {
  from {
    opacity: 0;
    translate: 0 -4px;
    scale: 1 0.98;
  }
}

@keyframes selectify-sheet-in-up {
  from {
    opacity: 0;
    translate: 0 4px;
    scale: 1 0.98;
  }
}

body .selectify-select.selectify-select-dropdowns .selectify-available-display.toggled {
  transform-origin: top center;
  animation: selectify-sheet-in-down 160ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

body .selectify-select.selectify-select-dropdowns.opens-up .selectify-available-display.toggled {
  transform-origin: bottom center;
  animation-name: selectify-sheet-in-up;
}

/* Options: rows take the theme's size (checkbox and taggable rows here, the
   single-choice lists override below), no separators, rounded and inset by the
   sheet padding. */
body .selectify-select.selectify-select-dropdowns .selectify-available-one-option {
  min-block-size: var(--selectify-ui-row-height-check, 2.25em);
  padding-block: 0.5rem;
  padding-inline: var(--selectify-ui-pad-inline, 0.75em);
  border: 0;
  border-radius: var(--selectify-ui-radius, calc(var(--selectify-select-border-radius, 0.25rem) * 1.5));
  line-height: 1.3;
  transition:
    background-color 120ms ease,
    box-shadow 120ms ease,
    color 120ms ease;
  gap: var(--selectify-ui-gap, 0.625em);
}

/* Hover and keyboard: hover fill plus a half-strength rail. */
body .selectify-select.selectify-select-dropdowns .selectify-available-one-option:hover,
body .selectify-select.selectify-select-dropdowns .selectify-available-one-option:focus-visible {
  box-shadow: inset 3px 0 0 color-mix(in srgb, color-mix(in srgb, var(--selectify-select-focus-border-color, var(--selectify-select-focus-border, currentColor)) 65%, var(--selectify-select-color, currentColor)) 50%, transparent);
  background: var(--selectify-option-hover-bg, var(--r-bg));
}

html[dir="rtl"] body .selectify-select.selectify-select-dropdowns .selectify-available-one-option:hover,
html[dir="rtl"] body .selectify-select.selectify-select-dropdowns .selectify-available-one-option:focus-visible {
  box-shadow: inset -3px 0 0 color-mix(in srgb, color-mix(in srgb, var(--selectify-select-focus-border-color, var(--selectify-select-focus-border, currentColor)) 65%, var(--selectify-select-color, currentColor)) 50%, transparent);
}

body .selectify-select.selectify-select-dropdowns .selectify-available-one-option:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--selectify-select-focus-border-color, var(--selectify-select-focus-border, currentColor)) 65%, var(--selectify-select-color, currentColor));
  outline-offset: -2px;
}

/* Selected: full rail, active fill, weight 600 (shape cue, not color alone). */
body .selectify-select.selectify-select-dropdowns .selectify-available-one-option.s-selected,
body .selectify-select.selectify-select-dropdowns .selectify-available-one-option[aria-selected="true"] {
  box-shadow: inset 3px 0 0 color-mix(in srgb, var(--selectify-select-focus-border-color, var(--selectify-select-focus-border, currentColor)) 65%, var(--selectify-select-color, currentColor));
  background: var(--selectify-option-active-bg, var(--r-bg));
}

html[dir="rtl"] body .selectify-select.selectify-select-dropdowns .selectify-available-one-option.s-selected,
html[dir="rtl"] body .selectify-select.selectify-select-dropdowns .selectify-available-one-option[aria-selected="true"] {
  box-shadow: inset -3px 0 0 color-mix(in srgb, var(--selectify-select-focus-border-color, var(--selectify-select-focus-border, currentColor)) 65%, var(--selectify-select-color, currentColor));
}

body .selectify-select.selectify-select-dropdowns .selectify-available-one-option.s-selected,
body .selectify-select.selectify-select-dropdowns .selectify-available-one-option.s-selected * {
  font-weight: 600;
}

/* Single-choice lists (dropdown, dropdown with search): the chosen value sits
   under its label, never louder than it; tighter rows show about 7 options. */
body .selectify-select.selectify-select-dropdowns.selectify-dropdown-widget:not([data-multiple="true"]) .selectify-selected-one-option,
body .selectify-select.selectify-select-dropdowns.selectify-dropdown-searchable-widget:not([data-multiple="true"]) .selectify-selected-one-option {
  font-size: var(--selectify-ui-single-size, 1em);
  font-weight: var(--selectify-ui-value-weight, 500);
}

body .selectify-select.selectify-dropdown-widget .selectify-available-one-option,
body .selectify-select.selectify-dropdown-searchable-widget .selectify-available-one-option {
  min-block-size: var(--selectify-ui-row-height, 2.125em);
  padding-block: 0.375rem;
  font-size: var(--selectify-ui-single-size, 1em);
}

body .selectify-select.selectify-dropdown-widget .selectify-available-one-option *,
body .selectify-select.selectify-dropdown-searchable-widget .selectify-available-one-option * {
  font-size: inherit;
}

/* Trailing check on the selected row (the dropdown checkbox has its own box). */
body .selectify-select.selectify-dropdown-widget .selectify-available-one-option.s-selected::after,
body .selectify-select.selectify-dropdown-searchable-widget .selectify-available-one-option.s-selected::after,
body .selectify-select.selectify-dropdown-tags-widget .selectify-available-one-option.s-selected::after {
  background: color-mix(in srgb, var(--selectify-select-focus-border-color, var(--selectify-select-focus-border, currentColor)) 65%, var(--selectify-select-color, currentColor));
  flex: none;
  content: "";
  inline-size: 18px;
  block-size: 18px;
  margin-inline-start: auto;
  mask: url("../icons/check.svg") center / contain no-repeat;
}

/* Rows the dropdown checkbox disables at the selection limit. */
body .selectify-select.selectify-dropdown-checkbox-widget .selectify-available-one-option[aria-disabled="true"] {
  color: color-mix(in srgb, var(--selectify-select-color, currentColor) 60%, transparent);
}

/* Search field: first in the sheet, sticky, divided from the options. */
body .selectify-select.selectify-select-dropdowns .selectify-available-display .search-input {
  position: sticky;
  inset-block-start: -4px;
  z-index: 1;
  margin-block-end: 4px;
  padding-block-end: 4px;
  border-block-end: 1px solid color-mix(in srgb, color-mix(in srgb, var(--selectify-select-border-color, var(--r-br, transparent)) 45%, var(--selectify-select-color, currentColor)) 40%, transparent);
  background: var(--selectify-select-bg, var(--r-bg));
}

body .selectify-select.selectify-select-dropdowns .search-input input {
  inline-size: 100%;
  min-block-size: var(--selectify-ui-search-height, 2.5em);
  margin: 0;
}

body .selectify-select.selectify-select-dropdowns .search-input .manage-search {
  inset-block-start: 10px;
  inset-inline-start: 10px;
  inline-size: 20px;
  block-size: 20px;
  opacity: 1;
}

/* Footer: sticky at the bottom of the sheet on a hairline. */
body .selectify-select.selectify-select-dropdowns .options-inner .selectify-select-footer {
  inset-block-end: -4px;
  margin-block-start: 4px;
  padding-block: 6px 2px;
  border-block-start: 1px solid color-mix(in srgb, color-mix(in srgb, var(--selectify-select-border-color, var(--r-br, transparent)) 45%, var(--selectify-select-color, currentColor)) 40%, transparent);
  justify-content: flex-end;
}

/* Tags: 28px pills tinted from the ring (not the dropdown checkbox summary). */
body .selectify-select.selectify-select-dropdowns[data-multiple="true"]:not(.selectify-dropdown-checkbox-widget) .selectify-selected-options .selectify-selected-one-option {
  min-block-size: 28px;
  padding-block: 0;
  padding-inline: 10px 2px;
  border: 1px solid color-mix(in srgb, color-mix(in srgb, var(--selectify-select-focus-border-color, var(--selectify-select-focus-border, currentColor)) 65%, var(--selectify-select-color, currentColor)) 35%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, color-mix(in srgb, var(--selectify-select-focus-border-color, var(--selectify-select-focus-border, currentColor)) 65%, var(--selectify-select-color, currentColor)) 14%, transparent);
  color: var(--selectify-select-color, currentColor);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.25;
  animation: selectify-chip-in 120ms ease;
  gap: 2px;
}

body .selectify-select.selectify-select-dropdowns[data-multiple="true"]:not(.selectify-dropdown-checkbox-widget) .selectify-selected-options .selectify-selected-one-option:not(:has(.remove-tag)) {
  padding-inline: 10px;
}

@keyframes selectify-chip-in {
  from {
    opacity: 0;
  }
}

/* Remove button: a 24px round target, icon in the chip text color. */
body .selectify-select.selectify-select-dropdowns .remove-tag {
  border-radius: 50%;
  color: inherit;
  flex: none;
  inline-size: 24px;
  block-size: 24px;
  margin-block: -2px;
}

body .selectify-select.selectify-select-dropdowns .remove-tag svg {
  inline-size: 14px;
  block-size: 14px;
  fill: currentcolor;
}

body .selectify-select.selectify-select-dropdowns .remove-tag:hover {
  background: color-mix(in srgb, color-mix(in srgb, var(--selectify-select-focus-border-color, var(--selectify-select-focus-border, currentColor)) 65%, var(--selectify-select-color, currentColor)) 18%, transparent);
}

body .selectify-select.selectify-select-dropdowns .remove-tag:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--selectify-select-focus-border-color, var(--selectify-select-focus-border, currentColor)) 65%, var(--selectify-select-color, currentColor));
  outline-offset: 1px;
  background: color-mix(in srgb, color-mix(in srgb, var(--selectify-select-focus-border-color, var(--selectify-select-focus-border, currentColor)) 65%, var(--selectify-select-color, currentColor)) 18%, transparent);
}

/* 390px: the field takes the full width and the sheet stays inside the screen. */
@media (width <= 36rem) {
  body .wrapper-selectify:not(.views-exposed-form__item):has(> .selectify-select-dropdowns) {
    display: block;
  }

  body .selectify-select.selectify-select-dropdowns,
  body .selectify-select.selectify-select-dropdowns .selectify-selected-display {
    inline-size: 100%;
    min-inline-size: 0;
    max-inline-size: none;
  }

  body .selectify-select.selectify-select-dropdowns .selectify-available-display {
    max-block-size: min(18rem, 60vh);
  }
}
