/*
 * Interaction adapted from Dropdown menu interaction by Aaron Iker.
 * Copyright (c) 2026 Aaron Iker (https://codepen.io/aaroniker/pen/MWgjERQ)
 *
 * The MIT License (MIT)
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

.project-select.pm-select {
  position: relative;
  isolation: isolate;
  --pm-select-offset: 0px;
}

.project-select.pm-select:after {
  display: none;
}

.project-select.pm-select > select,
.pm-select-accessible-value {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.pm-select-trigger {
  position: relative;
  display: block;
  z-index: 2;
  width: 100%;
  height: 44px;
  padding: 0 34px 0 12px;
  border: 1px solid var(--control-border);
  border-radius: 7px;
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s ease,box-shadow .15s ease;
}

.pm-select-trigger:hover {
  border-color: var(--border-hover);
}

.pm-select-trigger:focus-visible,.pm-select.is-open .pm-select-trigger {
  outline: 2px solid var(--focus-border);
  outline-offset: 2px;
  border-color: var(--focus-border);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.pm-select-trigger:disabled {
  background: var(--surface-soft);
  color: var(--muted);
  cursor: default;
}

.pm-select-window {
  display: block;
  height: 42px;
  overflow: hidden;
}

.pm-select-track {
  display: block;
  transform: translateY(var(--pm-select-offset));
  transition: transform .28s cubic-bezier(.2,.8,.2,1);
}

.pm-select-track > span {
  display: block;
  height: 44px;
  line-height: 42px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pm-select-indicator {
  position: absolute;
  top: 12px;
  right: 13px;
  width: 7px;
  height: 18px;
  color: var(--accent);
}

.pm-select-indicator:before,.pm-select-indicator:after {
  content: "";
  position: absolute;
  width: 6px;
  height: 6px;
  opacity: .55;
  transform: rotate(45deg) scale(.8);
  transition: opacity .15s ease;
}

.pm-select-indicator:before {
  top: 1px;
  border-left: 1.5px solid currentColor;
  border-top: 1.5px solid currentColor;
}

.pm-select-indicator:after {
  top: 9px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
}

.pm-select.is-open,.pm-select.is-tilt-up,.pm-select.is-tilt-down {
  z-index: 30;
}

.pm-select.is-open .pm-select-indicator:before,
.pm-select.is-tilt-up .pm-select-indicator:before,
.pm-select.is-tilt-down .pm-select-indicator:after {
  opacity: 1;
}

.pm-select-menu {
  position: absolute;
  top: 44px;
  right: 0;
  left: 0;
  z-index: 1;
  padding: 4px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-raised);
  color: var(--muted);
  box-shadow: 0 8px 24px var(--shadow-raised);
  outline: 0;
  scrollbar-width: thin;
}

.pm-select-menu[hidden] {
  display: none;
}

.pm-select.is-open .pm-select-menu {
  animation: pm-select-reveal .2s cubic-bezier(.2,.8,.2,1) both;
}

.pm-select[data-select-center].is-open .pm-select-menu {
  z-index: 3;
}

@media (prefers-reduced-motion: no-preference) {
  .pm-select[data-select-center].is-open .pm-select-menu {
    animation: pm-select-reveal-center .18s ease-out backwards;
  }
}

@keyframes pm-select-reveal-center {
  from { opacity: 0; clip-path: inset(38% 0 round 8px); }
  to { opacity: 1; clip-path: inset(0 round 8px); }
}

.pm-select-option {
  position: relative;
  height: 44px;
  padding: 0 28px 0 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  line-height: 44px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  transition: background .12s,color .12s;
}

.pm-select-option.is-active {
  background: var(--accent-soft);
  color: var(--text);
}

.pm-select-option[aria-selected=true] {
  color: var(--text);
}

.pm-select-option[aria-selected=true]:after {
  content: "";
  position: absolute;
  top: 17px;
  right: 10px;
  width: 5px;
  height: 9px;
  border-right: 1.5px solid var(--accent);
  border-bottom: 1.5px solid var(--accent);
  transform: rotate(45deg);
}

.pm-select-option[aria-disabled=true] {
  color: var(--muted);
  cursor: default;
}

.pm-select.is-tilt-up .pm-select-trigger {
  animation: pm-select-tilt-up .28s ease;
}

.pm-select.is-tilt-down .pm-select-trigger {
  animation: pm-select-tilt-down .28s ease;
}

@keyframes pm-select-reveal {
  from {opacity: 0; transform: translateY(-4px) scale(.98);}
  to {opacity: 1; transform: translateY(0) scale(1);}
}

@keyframes pm-select-tilt-up {
  45% {transform: perspective(500px) rotateX(7deg);}
}

@keyframes pm-select-tilt-down {
  45% {transform: perspective(500px) rotateX(-7deg);}
}

@media(prefers-reduced-motion:reduce) {
  .pm-select-track,.pm-select-trigger,.pm-select-indicator:before,.pm-select-indicator:after,.pm-select-option {
    transition: none;
  }
  .pm-select.is-open .pm-select-menu,.pm-select.is-tilt-up .pm-select-trigger,.pm-select.is-tilt-down .pm-select-trigger {
    animation: none;
  }
}
