/* Themed enhancement of the catalogue's existing sort control. */
#collection .sort-dropdown { position: relative; display: grid; min-width: 0; }
/* Retain the native field's dimensions and the existing app change handler. */
#collection .sort-dropdown > select { grid-area: 1 / 1; visibility: hidden; pointer-events: none; }
#collection .sort-trigger {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: space-between;
  gap: 8px; width: 100%; min-width: 0; padding: 6px 3px; border: 0;
  background: transparent; color: #fff1f5; font-size: 10px; text-align: left;
}
#collection .sort-trigger::after {
  content: ''; flex: none; width: 6px; height: 6px; margin: -3px 3px 0 0;
  border-right: 1px solid currentColor; border-bottom: 1px solid currentColor; transform: rotate(45deg);
}
#collection .sort-trigger[aria-expanded="true"]::after { margin-top: 3px; transform: rotate(225deg); }
#collection .sort-dropdown:has([aria-expanded="true"]) { z-index: 10; }
#collection .sort-options {
  position: absolute; top: calc(100% + 7px); right: 0; z-index: 10;
  width: max(100%, 226px); max-width: calc(100vw - 32px); max-height: 240px;
  overflow-y: auto; overscroll-behavior: contain; margin: 0; padding: 6px;
  list-style: none; border: 1px solid #ffe4ee70; border-radius: 10px;
  background: linear-gradient(145deg, #6c3a50f7, #492438fa); color: #fff1f5;
  box-shadow: 0 12px 28px #30132655, inset 0 1px 0 #ffe4ee22;
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
#collection .sort-options[hidden] { display: none; }
#collection .sort-options[data-above] { top: auto; bottom: calc(100% + 7px); }
#collection .sort-option {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 44px; padding: 10px 12px; border-radius: 5px;
  font-size: 14px; line-height: 1.4; cursor: pointer;
}
#collection .sort-option::after { content: ''; flex: none; width: 12px; }
#collection .sort-option[data-active] { background: #a76b8659; box-shadow: inset 0 0 0 1px #ffe4ee60; }
#collection .sort-option[aria-selected="true"] { background: #f5cede; color: #482335; }
#collection .sort-option[aria-selected="true"]::after { content: '✓'; }
@media (max-width: 700px) {
  #collection .sort-dropdown { flex: 1; }
  #collection .sort-trigger {
    min-height: 44px; padding: 9px 12px; border: 1px solid #ffe4ee70; border-radius: 8px;
    background: #59304780; font-size: 16px;
  }
  #collection .sort-option { font-size: 16px; }
}
