/* ==========================================================================
   dissolveX — styled dropdowns for partials/select.js
   Moved out of polish.css so a page that is not a landing page (the buy page)
   can use the same dropdown. Every landing page loads it (head_end.html).
   Colours fall back to the landing palette where its variables are absent.
   ========================================================================== */

/* --- Styled dropdowns (partials/select.js) ----------------------------------
   The trigger keeps the field's own classes, so it looks exactly like the
   other inputs; only the list below it is drawn here. White, rounded, with
   the site's green for the hovered, focused and chosen option. */

.dx-select {
    position: relative;
}

.dx-select-native {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
}

.dx-select-trigger {
    display: flex;
    align-items: center;
    text-align: left;
    cursor: pointer;
    line-height: 1.3;
}

.dx-select-value {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dx-select-trigger.is-placeholder .dx-select-value {
    color: #94a3b8;
}

/* A field that used to show the browser's own arrow gets the site's chevron. */
.dx-select-trigger--arrow {
    padding-right: 32px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 11px center;
    background-size: 13px;
}

/* An inline dropdown (a filter in a toolbar) stays as wide as it was. */
.dx-select:has(> .dx-select-native:not(.form-select)) {
    display: inline-block;
}

/* The combobox kind (select.js, data-dx-combobox): the same field, typed into. */
.dx-select--combo .dx-select-trigger {
    display: block;
    cursor: text;
}

.dx-select--combo .dx-select-trigger::placeholder {
    color: #94a3b8;
}

.dx-select-option[hidden] {
    display: none;
}

.dx-select.is-open .dx-select-trigger {
    background-color: #ffffff;
    border-color: var(--dx-emerald, #10b981);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
}

.dx-select-trigger[aria-invalid="true"] {
    border-color: #ef4444;
}

.dx-select-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 30;
    /* As wide as the field; a narrow field (the country code) lets its list
       grow to fit the options instead of wrapping each one. */
    box-sizing: border-box;
    min-width: 100%;
    width: max-content;
    max-width: max(100%, 13.75rem);
    margin: 0;
    padding: 6px;
    list-style: none;
    max-height: 280px;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #ffffff;
    border: 1px solid rgba(16, 185, 129, 0.22);
    border-radius: 12px;
    box-shadow: 0 16px 36px rgba(15, 57, 43, 0.12), 0 2px 6px rgba(15, 23, 42, 0.06);
    transform-origin: top center;
    animation: dx-select-in 140ms var(--dx-ease-out, cubic-bezier(0.23, 1, 0.32, 1));
}

.dx-select--up .dx-select-menu {
    top: auto;
    bottom: calc(100% + 6px);
    transform-origin: bottom center;
}

.dx-select-option {
    position: relative;
    padding: 9px 34px 9px 12px;
    border-radius: 8px;
    font-size: 0.86rem;
    line-height: 1.35;
    color: #0f172a;
    white-space: normal;
    overflow-wrap: anywhere;
    cursor: pointer;
    user-select: none;
}

.dx-select-option.is-active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--dx-ink, #0b2b20);
}

.dx-select-option[aria-selected="true"] {
    color: var(--dx-emerald-deep, #047857);
    font-weight: 600;
}

/* A check marks the chosen option, drawn in CSS so the markup stays text. */
.dx-select-option[aria-selected="true"]::after {
    content: "";
    position: absolute;
    right: 14px;
    top: 50%;
    width: 5px;
    height: 10px;
    margin-top: -6px;
    border: solid var(--dx-emerald-deep, #047857);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

@keyframes dx-select-in {
    from {
        opacity: 0;
        transform: translateY(-4px) scale(0.98);
    }
}

.dx-select--up .dx-select-menu {
    animation-name: dx-select-in-up;
}

@keyframes dx-select-in-up {
    from {
        opacity: 0;
        transform: translateY(4px) scale(0.98);
    }
}

@media (prefers-reduced-motion: reduce) {
    .dx-select-menu,
    .dx-select--up .dx-select-menu {
        animation: dx-select-fade 120ms ease;
    }

    @keyframes dx-select-fade {
        from {
            opacity: 0;
        }
    }
}
