/* ---------- Custom dropdown (pages/shared/js/select.js) ---------- */

/* !important: page styles for the original select (e.g. .cmp__select width:100%) must not resize it. */
.dd-native {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    min-height: 0 !important;
    padding: 0 !important;
    overflow: hidden;
    clip-path: inset(50%);
    opacity: 0;
    pointer-events: none;
}

.dd {
    position: relative;
    display: flex;
    align-items: center;
    text-align: left;
    white-space: nowrap;
    background-image: none !important;
}

.dd span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.dd::after {
    content: "";
    position: absolute;
    right: 12px;
    top: 50%;
    width: 16px;
    height: 16px;
    margin-top: -8px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e6f53a' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat center / contain;
    transition: transform .2s cubic-bezier(.16, 1, .3, 1);
}

.dd[aria-expanded="true"] {
    background-color: var(--ink-3);
}

.dd[aria-expanded="true"]::after {
    transform: rotate(180deg);
}

.dd:focus-visible {
    outline: 2px solid var(--yellow);
    outline-offset: -2px;
}

.dd__list {
    position: fixed;
    z-index: 200;
    max-width: calc(100vw - 16px);
    max-height: 320px;
    margin: 0;
    padding: 6px;
    overflow-y: auto;
    list-style: none;
    background: var(--ink-2);
    border-top: 2px solid var(--yellow);
    color: var(--white);
    box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .6);
    scrollbar-width: thin;
    scrollbar-color: var(--ink-3) transparent;
    outline: 0;
    animation: dd-in .18s cubic-bezier(.16, 1, .3, 1);
}

.dd__list.is-up {
    border-top: 0;
    border-bottom: 2px solid var(--yellow);
    animation-name: dd-in-up;
}

.dd__list li {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    padding: 0 12px 0 34px;
    white-space: nowrap;
    cursor: pointer;
}

.dd__list li.is-active {
    background: var(--ink-3);
}

.dd__list li[aria-selected="true"] {
    position: relative;
    color: var(--yellow);
}

.dd__list li[aria-selected="true"]::before {
    content: "";
    position: absolute;
    left: 12px;
    width: 14px;
    height: 14px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e6f53a' stroke-width='3'%3E%3Cpath d='M4 12l5 5L20 6'/%3E%3C/svg%3E") no-repeat center / contain;
}

@keyframes dd-in {
    from { opacity: 0; transform: translateY(-6px); }
}

@keyframes dd-in-up {
    from { opacity: 0; transform: translateY(6px); }
}

@media (prefers-reduced-motion: reduce) {
    .dd__list { animation: none; }
    .dd::after { transition: none; }
}
