/**
 * Category archive hub: search field, category filter combobox, empty state, load more.
 * The controls mirror the global search results block so both listings read as one system.
 */

.category-hub {
	--category-hub-accent: var(--amm-palette-primary-1, #005762);
	--category-hub-surface: var(--amm-palette-primary-3, #fff);
	--category-hub-page-bg: var(--amm-palette-background, #f7f9fc);
	--category-hub-text: var(--amm-palette-primary-2, var(--amm-text-primary-color, #1e1e1e));
	--category-hub-muted: var(--amm-palette-text-secondary, var(--amm-text-secondary-color, #525252));
	--category-hub-border: var(--amm-palette-text-tertiary, var(--amm-text-tertiary-color, #f3f3f3));
}

/* Controls row — mirrors the global search results controls. */
.category-hub__controls {
	margin-bottom: clamp(1.5rem, 3vw, 2.25rem);
}

.category-hub__control-row {
	align-items: center;
	column-gap: 30px;
	display: grid;
	grid-template-columns: minmax(280px, 1fr) minmax(0, 1fr);
	justify-content: space-between;
	row-gap: 12px;
}

@media (max-width: 860px) {
	.category-hub__control-row {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* Search field */
.category-hub__form {
	display: block;
	position: relative;
	width: 100%;
}

.category-hub__search-icon {
	align-items: center;
	appearance: none;
	background: transparent;
	border: 0;
	bottom: 0;
	color: var(--category-hub-accent);
	cursor: pointer;
	display: inline-flex;
	height: 24px;
	justify-content: center;
	left: 20px;
	margin: auto 0;
	padding: 0;
	position: absolute;
	top: 0;
	width: 24px;
	z-index: 1;
}

.category-hub__search-icon svg {
	display: block;
	height: 100%;
	width: 100%;
}

.category-hub__input {
	background: var(--category-hub-page-bg);
	border: 1px solid var(--category-hub-border);
	border-radius: 14px;
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
	color: var(--category-hub-text);
	font: inherit;
	font-size: 16px;
	height: 64px;
	line-height: 1.4;
	outline: none;
	padding: 0 56px 0 64px;
	transition: border-color 160ms ease, box-shadow 160ms ease;
	width: 100%;
}

.category-hub__input:focus {
	border-color: var(--category-hub-accent);
	box-shadow: 0 0 0 3px rgb(var(--amm-palette-primary-1-rgb, 0 87 98) / 0.12);
}

.category-hub__input::-webkit-search-cancel-button {
	appearance: none;
}

/* The reference field has no clear control, but this one filters live, so a one-click
   reset earns its place. */
.category-hub__search-clear {
	align-items: center;
	appearance: none;
	background: transparent;
	border: 0;
	bottom: 0;
	color: var(--category-hub-muted);
	cursor: pointer;
	display: inline-flex;
	font-size: 1.25rem;
	height: 24px;
	justify-content: center;
	line-height: 1;
	margin: auto 0;
	padding: 0;
	position: absolute;
	right: 20px;
	top: 0;
	width: 24px;
}

.category-hub__search-clear[hidden] {
	display: none;
}

.category-hub__search-clear:hover,
.category-hub__search-clear:focus-visible {
	color: var(--category-hub-text);
}

/* Category filter combobox */
.category-hub__filter {
	margin: 0;
	position: relative;
	width: 100%;
}

.category-hub__filter-combobox {
	margin: 0;
	position: relative;
	width: 100%;
}

.category-hub__filter-control {
	align-items: center;
	background: var(--category-hub-surface);
	border: 1px solid var(--category-hub-border);
	border-radius: 14px;
	color: var(--category-hub-text);
	/* Nothing is typed here — the whole control opens the panel. */
	cursor: pointer;
	display: flex;
	flex-wrap: wrap;
	font-size: 14px;
	font-weight: 700;
	gap: 6px;
	line-height: 21px;
	min-height: 39px;
	padding: 6px 40px 6px 20px;
	position: relative;
	width: 100%;
}

.category-hub__filter-control:focus-within {
	border-color: var(--category-hub-accent);
}

.category-hub__filter-toggle {
	align-items: center;
	appearance: none;
	background: transparent;
	border: 0;
	bottom: 0;
	color: var(--category-hub-text);
	cursor: pointer;
	display: inline-flex;
	height: 32px;
	justify-content: center;
	margin: auto 0;
	opacity: 0.65;
	padding: 0;
	position: absolute;
	right: 8px;
	top: 0;
	transition: opacity 160ms ease, transform 160ms ease;
	width: 32px;
}

.category-hub__filter-toggle svg {
	display: block;
	height: 16px;
	width: 16px;
}

.category-hub__filter-toggle:hover,
.category-hub__filter-toggle:focus {
	color: var(--category-hub-accent);
	opacity: 1;
}

.category-hub__filter-toggle[aria-expanded="true"] {
	transform: rotate(180deg);
}

.category-hub__filter-tokens {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.category-hub__filter-token {
	align-items: center;
	background: var(--category-hub-accent);
	border: 1px solid var(--category-hub-accent);
	border-radius: 999px;
	color: var(--amm-palette-primary-3, #fff);
	cursor: pointer;
	display: inline-flex;
	font: inherit;
	font-size: 12px;
	font-weight: 700;
	gap: 6px;
	line-height: 1.4;
	max-width: 100%;
	padding: 4px 10px;
	text-decoration: none;
}

.category-hub__filter-token:hover,
.category-hub__filter-token:focus {
	background: var(--category-hub-text);
	border-color: var(--category-hub-text);
	color: var(--amm-palette-primary-3, #fff);
}

.category-hub__filter-placeholder {
	color: var(--category-hub-muted);
	cursor: pointer;
	flex: 1 1 120px;
	font-weight: 700;
	line-height: 21px;
	min-width: 90px;
	padding: 2px 0;
}

.category-hub__filter-placeholder[hidden] {
	display: none;
}

.category-hub__filter-results {
	background: var(--category-hub-surface);
	border: 1px solid var(--category-hub-border);
	border-radius: 14px;
	box-shadow: 0 10px 30px rgba(24, 24, 27, 0.12);
	display: flex;
	flex-direction: column;
	left: 0;
	margin-top: 6px;
	max-height: 22rem;
	position: absolute;
	right: 0;
	top: 100%;
	z-index: 60;
}

.category-hub__filter-results[hidden] {
	display: none;
}

.category-hub__filter-options {
	overflow-y: auto;
	padding: 6px 0;
}

.category-hub__filter-option {
	align-items: center;
	background: transparent;
	color: var(--category-hub-text);
	cursor: pointer;
	display: flex;
	font-size: 14px;
	font-weight: 500;
	gap: 10px;
	line-height: 1.4;
	margin: 0;
	padding: 10px 20px;
	text-align: left;
	text-decoration: none;
	width: 100%;
}

.category-hub__filter-option:hover,
.category-hub__filter-option:focus-visible {
	background: rgba(24, 24, 27, 0.06);
}

.category-hub__filter-option[aria-selected="true"] {
	font-weight: 700;
}

.category-hub__filter-option-label {
	flex: 1 1 auto;
	min-width: 0;
}

.category-hub__filter-option-count {
	color: var(--category-hub-muted);
	flex: 0 0 auto;
	font-size: 12px;
	font-weight: 700;
}

/* Cards, empty state, load more */
.category-hub__cards[aria-busy="true"] {
	opacity: 0.55;
	transition: opacity 0.15s ease;
}

.category-hub__empty[hidden],
.category-hub__load-more-wrap[hidden] {
	display: none;
}

.category-hub__empty {
	padding: clamp(3rem, 8vw, 6rem) 1rem;
	text-align: center;
}

.category-hub__empty-title {
	font-size: 1.5rem;
	font-weight: 700;
	margin: 0 0 0.5rem;
}

.category-hub__empty-text {
	color: var(--amm-text-secondary-color, #757575);
	margin: 0;
}

.category-hub__load-more-wrap {
	display: flex;
	justify-content: center;
	margin-top: clamp(2rem, 4vw, 3rem);
}

.category-hub__load-more {
	background: var(--category-hub-accent);
	border: none;
	border-radius: 999px;
	color: var(--amm-palette-primary-3, #fff);
	cursor: pointer;
	font-family: inherit;
	font-size: 1rem;
	font-weight: 600;
	padding: 0.75rem 2rem;
	transition: opacity 0.15s ease;
}

.category-hub__load-more:hover:not(:disabled),
.category-hub__load-more:focus-visible:not(:disabled) {
	opacity: 0.9;
}

.category-hub__load-more:disabled {
	cursor: not-allowed;
	opacity: 0.55;
}
