/*
 * Glide Select — React Bits "Glide Select" (https://reactbits.dev/micro/glide-select)의 CSS를 옮긴 것 (바닐라 포트).
 * © David Haz — MIT + Commons Clause, 전문은 같은 폴더의 LICENSE-react-bits.md. 이 사이트의 일부로만 쓰고, 따로 떼어 재배포하지 않는다.
 * 클래스 이름·치수·타이밍·이징·동작 줄임(prefers-reduced-motion) 규칙은 원본 그대로다. 바뀐 것은 아래뿐이다.
 *   1. 색 기본값을 사이트의 검은 팔레트에 맞췄다 (원본 값은 각 줄 옆에 적어 둠).
 *   2. 원래 <select>를 숨기는 규칙, 폼 칸 너비를 꽉 채우는 [data-full] 규칙을 더했다.
 *   3. 키보드 초점 링을 더했다 (원본은 outline: none뿐이라 Tab으로 왔을 때 초점이 보이지 않는다).
 * 색·크기·시간 변수는 JS가 옵션에 따라 루트 요소에 인라인으로 다시 넣는다.
 */

.glide-select {
  --gs-accent: #7C88FF;    /* 원본 #f5f5f5 — 체크 표시 색. 사이트 강조색을 쓴다 */
  --gs-surface: #24262C;   /* 원본 #27272a — 버튼·메뉴 바탕. 패널(#151619) 위에서 원본만큼 떠 보이도록, 사이트 회색의 푸른 기를 맞췄다 */
  --gs-highlight: #3A3D45; /* 원본 #3f3f46 — 하이라이트 알약 */
  --gs-text: #ECEDEF;      /* 원본 #f5f5f5 */
  --gs-radius: 10px;
  --gs-inner-radius: 6px;
  --gs-chip: 32px;
  --gs-row: 30px;
  --gs-font: 13px;
  --gs-menu-w: 176px;
  --gs-pop: 180ms;
  --gs-pop-out: 120ms;
  --gs-glide: 220ms;
  --gs-origin: top left;
  --gs-ease-out: cubic-bezier(0.23, 1, 0.32, 1);

  position: relative;
  display: inline-block;
  /* (포트에서 추가) 세로 flex·grid 칸 안에서는 inline-block이 무시되고 칸 너비로 늘어난다.
     너비를 fit-content로 정해 두면 늘어나지 않고 원본처럼 버튼 너비만 차지한다 (가로 flex의 세로 정렬은 그대로 따른다) */
  width: fit-content;
}

/* (포트에서 추가) fullWidth 옵션: 폼의 다른 입력칸처럼 칸 너비를 꽉 채운다. 메뉴도 min-width: 100%라 같이 넓어진다 */
.glide-select[data-full] {
  display: block;
  width: 100%;
}

.glide-select[data-full] .glide-select__trigger {
  width: 100%;
}

.glide-select[data-full] .glide-select__label {
  flex: 1 1 auto;
  text-align: left;
}

/* (포트에서 추가) 값의 출처인 원래 <select>는 폼 안에 그대로 두고 화면에서만 숨긴다.
   select 태그까지 붙여 페이지의 select { width: 100%; padding … } 규칙보다 우선하게 했다 */
select.glide-select__native {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
}

.glide-select[data-disabled] {
  opacity: 0.5;
}

.glide-select__trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: var(--gs-chip);
  margin: 0;
  padding: 0 8px 0 10px;
  border: 0;
  border-radius: var(--gs-inner-radius);
  background: var(--gs-surface);
  color: var(--gs-text);
  font-family: inherit;
  font-size: var(--gs-font);
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition:
    background-color 100ms ease,
    transform 160ms var(--gs-ease-out);
}

/* (포트에서 추가) 키보드로 왔을 때만 초점 링. 마우스·터치로 누를 때는 보이지 않는다 */
.glide-select__trigger:focus-visible {
  outline: 2px solid var(--gs-accent);
  outline-offset: 2px;
}

.glide-select__trigger:disabled {
  cursor: default;
}

@media (hover: hover) and (pointer: fine) {
  .glide-select__trigger:not(:disabled):hover {
    background: color-mix(in srgb, var(--gs-highlight) 60%, var(--gs-surface));
  }
}

.glide-select__trigger[aria-expanded='true'] {
  background: color-mix(in srgb, var(--gs-highlight) 60%, var(--gs-surface));
}

.glide-select__trigger:not(:disabled):active {
  transform: scale(0.97);
}

.glide-select__label[data-empty] {
  opacity: 0.6;
}

.glide-select[data-swap] .glide-select__label {
  animation: gs-swap 160ms ease;
}

@keyframes gs-swap {
  from {
    opacity: 0.6;
    filter: blur(2px);
  }
}

.glide-select__chevron {
  display: inline-flex;
  color: color-mix(in srgb, var(--gs-text) 55%, transparent);
  transition: transform 200ms var(--gs-ease-out);
}

.glide-select__trigger[aria-expanded='true'] .glide-select__chevron {
  transform: rotate(180deg);
}

.glide-select__menu {
  position: absolute;
  z-index: 20;
  width: var(--gs-menu-w);
  min-width: 100%;
  padding: 4px;
  border-radius: var(--gs-radius);
  background: var(--gs-surface);
  box-shadow: 0 4px 16px color-mix(in srgb, #000 22%, transparent);
  transform-origin: var(--gs-origin);
  opacity: 0;
  transform: scale(0.95);
  transition:
    opacity var(--gs-pop) var(--gs-ease-out),
    transform var(--gs-pop) var(--gs-ease-out);
}

.glide-select__menu[data-state='open'] {
  opacity: 1;
  transform: none;
}

.glide-select__menu[data-state='closed'] {
  transition-duration: var(--gs-pop-out);
  pointer-events: none;
}

.glide-select__menu[data-side='bottom'] {
  top: calc(100% + 6px);
}

.glide-select__menu[data-side='top'] {
  bottom: calc(100% + 6px);
}

.glide-select__menu[data-align='left'] {
  left: 0;
}

.glide-select__menu[data-align='right'] {
  right: 0;
}

.glide-select__list {
  position: relative;
  display: grid;
  gap: 1px;
  touch-action: none;
}

.glide-select__pill {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: var(--gs-row);
  border-radius: var(--gs-inner-radius);
  background: var(--gs-highlight);
  opacity: 0;
  pointer-events: none;
  transition:
    transform var(--gs-glide) var(--gs-ease-out),
    opacity 150ms ease;
}

.glide-select__option {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--gs-row);
  padding: 0 8px 0 10px;
  border-radius: var(--gs-inner-radius);
  color: var(--gs-text);
  font-size: var(--gs-font);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 150ms ease;
}

.glide-select__option[aria-selected='true'] {
  background: color-mix(in srgb, var(--gs-highlight) 60%, transparent);
}

.glide-select__list[data-live] .glide-select__option[aria-selected='true'] {
  background: transparent;
}

.glide-select__name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  font-weight: 500;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.glide-select__tag {
  flex-shrink: 0;
  color: color-mix(in srgb, var(--gs-text) 55%, transparent);
  font-size: calc(var(--gs-font) - 2px);
}

.glide-select__check {
  display: inline-flex;
  flex-shrink: 0;
  color: var(--gs-accent);
  visibility: hidden;
}

.glide-select__check[data-on] {
  visibility: visible;
}

@media (prefers-reduced-motion: reduce) {
  .glide-select__menu {
    transform: none !important;
    transition: opacity var(--gs-pop) ease;
  }

  .glide-select__menu[data-state='closed'] {
    transition-duration: var(--gs-pop-out);
  }

  .glide-select__pill {
    transition: opacity 150ms ease;
  }

  .glide-select__chevron {
    transition: none;
  }

  .glide-select__trigger {
    transition: background-color 100ms ease;
  }

  .glide-select__trigger:not(:disabled):active {
    transform: none;
  }

  .glide-select[data-swap] .glide-select__label {
    animation: none;
  }
}
