/* REX Gallery Sort UI — scoped to the public gallery archive only. */
.rex-gallery-page .rex-archive-sort {
  position: relative;
  isolation: isolate;
}

.rex-gallery-page .rex-archive-sort .rex-gallery-sort-native {
  position: absolute !important;
  inline-size: 1px !important;
  block-size: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.rex-gallery-page .rex-gallery-sort-ui {
  position: relative;
  min-inline-size: 170px;
  font: inherit;
  color: var(--rex-color-text, #ededD6);
  direction: rtl;
}

.rex-gallery-page .rex-gallery-sort-trigger {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  inline-size: 100%;
  min-block-size: 46px;
  padding: 0 15px;
  border: 1px solid rgba(210, 178, 120, .28);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(7, 27, 34, .96), rgba(3, 16, 21, .96));
  color: var(--rex-color-text, #ededD6);
  font: inherit;
  font-size: .9rem;
  font-weight: 700;
  line-height: 1;
  text-align: right;
  cursor: pointer;
  outline: none;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.025),
    0 10px 26px rgba(0,0,0,.18);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition:
    border-color .2s ease,
    background .2s ease,
    box-shadow .2s ease,
    color .2s ease;
}

.rex-gallery-page .rex-gallery-sort-trigger:hover,
.rex-gallery-page .rex-gallery-sort-trigger:focus-visible,
.rex-gallery-page .rex-gallery-sort-ui.is-open .rex-gallery-sort-trigger {
  border-color: rgba(210, 178, 120, .58);
  color: #f1d48f;
  background:
    linear-gradient(180deg, rgba(8, 31, 38, .98), rgba(3, 18, 23, .98));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.035),
    0 0 0 3px rgba(210,178,120,.055),
    0 12px 30px rgba(0,0,0,.24);
}

.rex-gallery-page .rex-gallery-sort-trigger__label {
  min-inline-size: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rex-gallery-page .rex-gallery-sort-trigger__chevron {
  inline-size: 17px;
  block-size: 17px;
  flex: 0 0 auto;
  color: #d2b278;
  transition: transform .2s ease;
}

.rex-gallery-page .rex-gallery-sort-ui.is-open .rex-gallery-sort-trigger__chevron {
  transform: rotate(180deg);
}

.rex-gallery-page .rex-gallery-sort-menu {
  position: absolute;
  z-index: 1005;
  inset-block-start: calc(100% + 8px);
  inset-inline: 0;
  display: grid;
  gap: 3px;
  margin: 0;
  padding: 6px;
  border: 1px solid rgba(210,178,120,.24);
  border-radius: 15px;
  background:
    linear-gradient(180deg, rgba(5, 24, 30, .99), rgba(2, 12, 16, .995));
  box-shadow:
    0 20px 46px rgba(0,0,0,.5),
    inset 0 1px 0 rgba(255,255,255,.025);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-5px) scale(.985);
  transform-origin: top center;
  transition:
    opacity .16s ease,
    visibility .16s ease,
    transform .16s ease;
}

.rex-gallery-page .rex-gallery-sort-ui.is-open .rex-gallery-sort-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.rex-gallery-page .rex-gallery-sort-option {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  inline-size: 100%;
  min-block-size: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: rgba(237,237,214,.76);
  font: inherit;
  font-size: .88rem;
  font-weight: 650;
  text-align: right;
  cursor: pointer;
  outline: none;
  transition:
    color .16s ease,
    background .16s ease;
}

.rex-gallery-page .rex-gallery-sort-option::after {
  content: "";
  inline-size: 6px;
  block-size: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: transparent;
  box-shadow: 0 0 0 1px rgba(210,178,120,.16);
}

.rex-gallery-page .rex-gallery-sort-option:hover,
.rex-gallery-page .rex-gallery-sort-option:focus-visible {
  color: #f3ddaa;
  background: rgba(56, 116, 125, .13);
}

.rex-gallery-page .rex-gallery-sort-option.is-selected {
  color: #e9c978;
  background:
    linear-gradient(90deg, rgba(210,178,120,.025), rgba(210,178,120,.105));
}

.rex-gallery-page .rex-gallery-sort-option.is-selected::after {
  background: #d2b278;
  box-shadow: 0 0 12px rgba(210,178,120,.45);
}

@media (max-width: 767px) {
  .rex-gallery-page .rex-gallery-sort-ui {
    min-inline-size: 154px;
  }

  .rex-gallery-page .rex-gallery-sort-trigger {
    min-block-size: 44px;
    padding-inline: 13px;
    border-radius: 13px;
    font-size: .86rem;
  }

  .rex-gallery-page .rex-gallery-sort-menu {
    border-radius: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rex-gallery-page .rex-gallery-sort-trigger,
  .rex-gallery-page .rex-gallery-sort-trigger__chevron,
  .rex-gallery-page .rex-gallery-sort-menu,
  .rex-gallery-page .rex-gallery-sort-option {
    transition: none !important;
  }
}
