/* The archive's toolbar: sorting as pills, the page size, the result count.
   The pills match the filter chips beside the grid. Colours are the Elementor kit's own
   (blue, ink and text), so a change to the site colours changes these too. */

.wcg-archive-bar {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	justify-content: space-between;
	gap: 8px 16px;
	width: 100%;
}

.wcg-archive-bar__count { order: 1; }

/* The sorting widget keeps its place in the page's own widget, only its width is the bar's. */
.wcg-archive-bar > .elementor-widget {
	order: 2;
	flex: 1 1 0;
	min-width: 0;
	width: auto;
	max-width: none;
	margin: 0;
}

.wcg-archive-bar .wcg-archive-bar__per-page { order: 3; }

.wcg-archive-bar .wcg-sort { justify-content: safe center; }

.wcg-archive-bar__count {
	flex: 0 0 auto;
	margin: 0;
	white-space: nowrap;
	color: var(--text-tertiary);
	font-size: 14px;
	line-height: 1.4;
}

.wcg-archive-bar__per-page {
	display: inline-flex;
	flex: 0 0 auto;
	white-space: nowrap;
	align-items: center;
	gap: 8px;
	margin: 0 0 0 auto;
	color: var(--text-tertiary);
	font-size: 14px;
	line-height: 1.4;
}

.wcg-archive-bar .wcg-archive-bar__select {
	width: auto;
	min-width: 64px;
	height: var(--control-sm);
	margin: 0;
	padding: 0 32px 0 12px;
	border: var(--border-hairline) solid var(--input-border);
	border-radius: var(--input-radius);
	background-color: var(--input-bg);
	color: var(--input-text);
	font-size: 14px;
	font-weight: 700;
	line-height: 1.3;
}

.wcg-archive-bar .wcg-archive-bar__select:focus {
	background-color: var(--input-focus-bg);
}

/* ----------------------------------------------------------- sort pills */

/* The select stays for the filter to read; the pills are what is seen. */
.jet-sorting.wcg-sort--pills .jet-sorting-select {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	border: 0;
	white-space: nowrap;
}

.wcg-sort {
	display: flex;
	flex-wrap: nowrap;
	gap: 6px;
	overflow-x: auto;
	padding: 4px;
}

.wcg-sort .wcg-sort__pill.wcg-sort__pill {
	/* Design system v3 Chip: 32px, hairline border-default, label 14/600. */
	display: inline-flex;
	align-items: center;
	flex: 0 0 auto;
	box-sizing: border-box;
	height: var(--control-sm);
	margin: 0;
	padding: 0 12px;
	border: var(--border-hairline) solid var(--chip-border);
	border-radius: var(--chip-radius);
	background: var(--chip-bg);
	color: var(--text-secondary);
	font-size: 14px;
	font-weight: 500;
	line-height: 1;
	white-space: nowrap;
	cursor: pointer;
	box-shadow: none;
	transition: var(--motion-control);
}

.wcg-sort .wcg-sort__pill.wcg-sort__pill:hover,
.wcg-sort .wcg-sort__pill.wcg-sort__pill:focus-visible {
	border-color: var(--border-control);
	background: var(--bg-surface);
	color: var(--text-primary);
}

.wcg-sort .wcg-sort__pill.wcg-sort__pill.is-active,
.wcg-sort .wcg-sort__pill.wcg-sort__pill.is-active:hover {
	border-color: var(--chip-selected-bg);
	background: var(--chip-selected-bg);
	color: var(--chip-selected-text);
}

.wcg-sort .wcg-sort__pill.wcg-sort__pill:focus-visible {
	outline: 2px solid var(--border-focus);
	outline-offset: 2px;
}

/* When the count, the pills and the page size do not fit on one line
   (archive-toolbar.js measures it), the pills get a line of their own under
   the count and the page size, and scroll sideways there: every way to sort
   one swipe away, never squeezed between the other two. */
.wcg-archive-bar.is-stacked { flex-wrap: wrap; }
.wcg-archive-bar.is-stacked .wcg-archive-bar__per-page { order: 2; }

.wcg-archive-bar.is-stacked > .elementor-widget {
	order: 3;
	flex-basis: 100%;
	min-width: 0;
}

.wcg-archive-bar.is-stacked .wcg-sort {
	justify-content: flex-start;
	scroll-snap-type: x proximity;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
}

.wcg-archive-bar.is-stacked .wcg-sort::-webkit-scrollbar {
	display: none;
}

.wcg-archive-bar.is-stacked .wcg-sort .wcg-sort__pill.wcg-sort__pill {
	scroll-snap-align: start;
}

@media (prefers-reduced-motion: reduce) {
	.wcg-sort .wcg-sort__pill.wcg-sort__pill {
		transition: none;
	}
}

/* DS v3.5: a field's edge goes one step darker under the pointer. */
.wcg-archive-bar .wcg-archive-bar__select:hover:not(:focus) {
	border-color: var(--input-hover-border);
}
