/* SortControl — the library sort disclosure (spec §02 → Sort; arch 10). */

.wrap {
  position: relative;
  /* Never shrink: the search box (flex: 1) absorbs the slack, so the sort trigger
     keeps its size instead of being squeezed into the search input (which used to
     overlap it at the pane minimum). */
  flex: 0 0 auto;
  display: inline-flex;
}

/* Trigger — shows the current field + direction for recognition (council SORT).
   The standard control height, matching the search input it sits beside. */
.trigger {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  height: var(--control-height);
  padding: 0 var(--space-3);
  /* A trigger is a field, not a button (arch 09 §4) — same recipe as the
     SelectControl trigger and the search input it sits beside. */
  border: none;
  border-block-end: var(--border-width) solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--field);
  color: var(--text-secondary);
  font: inherit;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background var(--dur-fast) var(--ease),
    color var(--dur-fast) var(--ease);
}

.trigger:hover,
.trigger[aria-expanded='true'] {
  background: var(--field-hover);
  color: var(--text);
}

.trigger:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

/* The disclosed panel — portaled to <body>, positioned fixed (mirrors the
   settings popover) so it escapes the panes' overflow clipping. */
.pop {
  position: fixed;
  z-index: 1000;
  min-width: 160px;
  padding: var(--space-2);
  background: var(--layer-01);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.title {
  margin: 0 0 var(--space-2);
  padding: 0 var(--space-2);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease);
}

.field:hover {
  background: var(--layer-02);
}

.field:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -1px;
}

/* The active field is the current sort; its trailing arrow shows the direction. */
.active {
  font-weight: 600;
}
