/* Collection filter drawer: a bottom sheet on phones, a side drawer from 801px. */
.filter-drawer {
  position: fixed;
  inset: auto 0 0 0;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: 88dvh;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 22px 22px 0 0;
  background: #13131e;
  color: var(--cream);
  overflow: hidden;
}

.filter-drawer[open] {
  display: flex;
  animation: drawer-up 220ms ease-out;
}

.filter-drawer::backdrop {
  background: rgba(8, 8, 14, .6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.drawer-panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: 88dvh;
}

.drawer-grab {
  flex: none;
  width: 42px;
  height: 5px;
  margin: 10px auto 6px;
  border-radius: 3px;
  background: #3a3950;
}

.drawer-head {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
  padding: 4px 18px 12px;
  border-bottom: 1px solid var(--hairline);
}

.drawer-head h2 {
  margin: 0 auto 0 0;
  color: var(--cream);
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 500;
  outline: none;
}

.drawer-reset {
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  background: none;
  color: var(--mint);
  font: inherit;
  font-size: .88rem;
  cursor: pointer;
}

.drawer-close {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 247, 232, .2);
  border-radius: 50%;
  background: #101019;
  color: var(--cream);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}

.drawer-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0 18px 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.drawer-section h3 {
  margin: 18px 0 10px;
  color: var(--pink);
  font-family: var(--ui);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.drawer-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.drawer-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid rgba(169, 147, 255, .3);
  border-radius: 22px;
  background: #191827;
  color: var(--cream);
  font: inherit;
  font-size: .86rem;
  text-align: left;
  cursor: pointer;
}

.drawer-option small {
  color: var(--muted-cream);
  font-size: .74rem;
}

.drawer-option[aria-pressed="true"] {
  border-color: var(--pink);
  background: rgba(243, 107, 155, .16);
}

.drawer-option[aria-pressed="true"] small {
  color: var(--cream);
}

.drawer-option:focus-visible {
  border-color: var(--pink);
}

@media (hover: hover) {
  .drawer-option:not(:disabled):hover {
    border-color: var(--pink);
  }
}

.drawer-option:disabled {
  opacity: .38;
  cursor: default;
}

.drawer-hint {
  margin: 10px 0 0;
  color: var(--muted-cream);
  font-size: .76rem;
  line-height: 1.45;
}

.drawer-set-search {
  box-sizing: border-box;
  width: 100%;
  min-height: 44px;
  margin: 0 0 10px;
  padding: 0 16px;
  border: 1px solid rgba(255, 247, 232, .2);
  border-radius: 22px;
  background: #101019;
  color: var(--cream);
  font: inherit;
  font-size: .9rem;
}

.drawer-set-search:focus-visible {
  border-color: var(--pink);
  outline: none;
}

.drawer-more {
  min-height: 44px;
  padding: 0 6px;
  border: 0;
  background: none;
  color: var(--mint);
  font: inherit;
  font-size: .84rem;
  font-weight: 600;
  cursor: pointer;
}

.drawer-empty {
  margin: 0;
  color: var(--muted-cream);
  font-size: .84rem;
}

.drawer-foot {
  flex: none;
  padding: 12px 18px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--hairline);
  background: #13131e;
}

.drawer-show {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--pink);
  border-radius: 25px;
  background: var(--pink);
  color: #17121b;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.drawer-show.is-empty {
  background: transparent;
  color: var(--cream);
}

@media (min-width: 801px) {
  .filter-drawer {
    inset: 0 0 0 auto;
    width: 420px;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 22px 0 0 22px;
  }

  .filter-drawer[open] {
    animation-name: drawer-in;
  }

  .drawer-panel {
    height: 100%;
    max-height: 100dvh;
  }

  .drawer-grab {
    display: none;
  }

  .drawer-head {
    padding-top: 18px;
  }
}

@keyframes drawer-up {
  from { transform: translateY(100%); }
  to { transform: none; }
}

@keyframes drawer-in {
  from { transform: translateX(100%); }
  to { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .filter-drawer[open] {
    animation: none;
  }
}
