/*
 * WP Catalogue - neutral, theme-agnostic base styles.
 * Colours come from custom properties on .wpc; a theme or adapter overrides them. Text colour is inherited.
 */
.wpc {
	--wpc-accent: #1d4ed8;
	--wpc-accent-contrast: #fff;
	--wpc-border: rgba(100, 116, 139, 0.45);
	--wpc-soft: rgba(100, 116, 139, 0.14);
	--wpc-focus: #f59e0b;
	--wpc-surface: #fff;
	--wpc-radius: 6px;
	--wpc-gap: 1rem;
	box-sizing: border-box;
	margin: 0 0 2rem;
	max-width: 100%;
}

.wpc *,
.wpc *::before,
.wpc *::after {
	box-sizing: border-box;
}

.wpc-screen-reader-text {
	border: 0;
	clip: rect(0 0 0 0);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	white-space: nowrap;
	width: 1px;
}

.wpc a:focus-visible,
.wpc button:focus-visible,
.wpc input:focus-visible {
	outline: 3px solid var(--wpc-focus);
	outline-offset: 2px;
}

/* Search */
.wpc-search {
	display: flex;
	gap: 0.5rem;
	margin: 0 0 0.75rem;
	max-width: 36rem;
}

.wpc-search__input {
	background: transparent;
	border: 1px solid var(--wpc-border);
	border-radius: var(--wpc-radius);
	color: inherit;
	flex: 1 1 auto;
	font: inherit;
	min-height: 2.75rem;
	min-width: 0;
	padding: 0.5rem 0.75rem;
}

.wpc-button {
	background: var(--wpc-accent);
	border: 1px solid var(--wpc-accent);
	border-radius: var(--wpc-radius);
	color: var(--wpc-accent-contrast);
	cursor: pointer;
	font: inherit;
	min-height: 2.75rem;
	padding: 0.5rem 1.1rem;
}

/* With JavaScript the list updates while typing, so the button only stays for keyboard/assistive technology (Enter submits too). */
.wpc-js .wpc-search .wpc-button {
	border: 0;
	clip: rect(0 0 0 0);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
}

.wpc-js .wpc-search .wpc-button:focus-visible {
	clip: auto;
	height: auto;
	margin: 0;
	overflow: visible;
	padding: 0.5rem 1.1rem;
	position: static;
	width: auto;
}

/* Filter bar: one row per taxonomy, label on the left */
.wpc-filter-region {
	display: flex;
	flex-direction: column;
}

.wpc-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1.5rem;
	margin: 0 0 0.75rem;
}

/* Chip rows take a full line; dropdowns (a long taxonomy, the sort) sit side by side with their label above. */
.wpc-filters > .wpc-filter {
	flex: 1 1 100%;
}

.wpc-filters > .wpc-filter--dropdown {
	align-items: stretch;
	flex: 0 1 15rem;
	flex-direction: column;
	gap: 0.25rem;
}

.wpc-filter--dropdown .wpc-filter__label {
	flex: none;
	font-size: 0.85rem;
}

.wpc-filter {
	align-items: baseline;
	display: flex;
	gap: 0.5rem 1rem;
	margin: 0;
}

.wpc-filter__label {
	flex: 0 0 5.5rem;
	font-weight: 600;
}

.wpc-chips {
	display: flex;
	flex: 1 1 auto;
	flex-wrap: wrap;
	gap: 0.4rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.wpc-chip {
	align-items: center;
	border: 1px solid var(--wpc-border);
	border-radius: 999px;
	color: inherit;
	display: inline-flex;
	gap: 0.3rem;
	line-height: 1.2;
	min-height: 2.25rem;
	padding: 0.25rem 0.85rem;
	text-decoration: none;
}

.wpc-chip:hover {
	border-color: var(--wpc-accent);
}

.wpc-chip.is-active {
	background: var(--wpc-accent);
	border-color: var(--wpc-accent);
	color: var(--wpc-accent-contrast);
}

.wpc-chip__count {
	font-size: 0.9em;
	opacity: 0.8;
}

/* Logos and drawings: show the whole image instead of cropping it */
.wpc--image-contain .wpc-card__media {
	background: #f4f5f7;
}

.wpc .wpc--image-contain .wpc-card__media img,
.wpc.wpc--image-contain .wpc-card__media img {
	object-fit: contain;
	padding: 0.4rem;
}

/* Long lists: a dropdown of links (a <details>, so it works without JavaScript) */
.wpc-dropdown {
	max-width: 100%;
	position: relative;
}

.wpc-dropdown__summary {
	align-items: center;
	border: 1px solid var(--wpc-border);
	border-radius: var(--wpc-radius);
	cursor: pointer;
	display: flex;
	gap: 0.5rem;
	justify-content: space-between;
	list-style: none;
	min-height: 2.5rem;
	padding: 0.3rem 0.8rem;
}

.wpc-dropdown__summary::-webkit-details-marker {
	display: none;
}

.wpc-dropdown__summary::after {
	border-bottom: 2px solid currentcolor;
	border-right: 2px solid currentcolor;
	content: "";
	flex: none;
	height: 0.5rem;
	transform: translateY(-0.1rem) rotate(45deg);
	width: 0.5rem;
}

.wpc-dropdown[open] .wpc-dropdown__summary::after {
	transform: translateY(0.1rem) rotate(-135deg);
}

.wpc-dropdown__list {
	background: var(--wpc-surface);
	border: 1px solid var(--wpc-border);
	border-radius: var(--wpc-radius);
	box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
	left: 0;
	list-style: none;
	margin: 0.25rem 0 0;
	max-height: 18rem;
	max-width: min(30rem, 92vw);
	min-width: 100%;
	overflow-y: auto;
	width: max-content;
	padding: 0.25rem;
	position: absolute;
	z-index: 20;
}

.wpc-dropdown__item {
	border-radius: 4px;
	line-height: 1.35;
	color: inherit;
	display: flex;
	gap: 0.5rem;
	justify-content: space-between;
	padding: 0.45rem 0.6rem;
	text-decoration: none;
}

.wpc-dropdown__item:hover,
.wpc-dropdown__item.is-active {
	background: var(--wpc-soft);
}

.wpc-dropdown__item.is-active {
	font-weight: 600;
}

/* Active filters summary */
.wpc-active {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem 0.6rem;
	margin: 0 0 0.75rem;
	order: 1;
}

.wpc-filters {
	order: 2;
}

.wpc-active__label {
	font-weight: 600;
}

.wpc-active__list {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.wpc-active__item {
	align-items: center;
	background: var(--wpc-soft);
	border: 1px solid var(--wpc-border);
	border-radius: 999px;
	color: inherit;
	display: inline-flex;
	gap: 0.4rem;
	line-height: 1.2;
	min-height: 2rem;
	padding: 0.15rem 0.7rem;
	text-decoration: none;
}

.wpc-active__item:hover {
	border-color: var(--wpc-accent);
}

.wpc-active__x {
	font-size: 1.15em;
	line-height: 1;
}

.wpc-reset {
	color: var(--wpc-accent);
	text-decoration: underline;
}

.wpc-filter-toggle,
.wpc-panel-done {
	display: none;
}

.wpc-status {
	margin: 0 0 0.75rem;
	opacity: 0.85;
}

.wpc-results[aria-busy="true"] {
	opacity: 0.5;
	pointer-events: none;
}

.wpc-empty {
	background: var(--wpc-soft);
	border-radius: var(--wpc-radius);
	padding: 1rem 1.25rem;
}

/* Sections */
.wpc-group {
	margin: 0 0 1.5rem;
}

.wpc h2.wpc-group__title {
	border-bottom: 2px solid var(--wpc-border);
	font-size: 1.5rem;
	line-height: 1.25;
	margin: 0 0 1rem;
	padding-bottom: 0.4rem;
}

.wpc-group__count {
	font-size: 0.7em;
	font-weight: 400;
	opacity: 0.75;
}

.wpc .wpc-group--collapsible h2.wpc-group__title {
	border-bottom-width: 1px;
	margin-bottom: 0;
	padding-bottom: 0;
}

.wpc .wpc-group--collapsible.is-open h2.wpc-group__title {
	margin-bottom: 1rem;
	padding-bottom: 0.4rem;
}

.wpc-group__toggle {
	align-items: center;
	color: inherit;
	display: flex;
	gap: 0.5rem;
	min-height: 3rem;
	text-decoration: none;
}

.wpc .wpc-group__toggle:hover,
.wpc .wpc-group__toggle:focus,
.wpc .wpc-group__toggle:visited {
	color: inherit;
}

.wpc-group__toggle::after {
	border-bottom: 2px solid currentcolor;
	border-right: 2px solid currentcolor;
	content: "";
	flex: none;
	height: 0.55rem;
	margin-left: auto;
	transform: translateY(-0.15rem) rotate(45deg);
	transition: transform 0.15s ease;
	width: 0.55rem;
}

.wpc-group__toggle[aria-expanded="true"]::after {
	transform: translateY(0.1rem) rotate(-135deg);
}

.wpc-group--collapsible:not(.is-open) .wpc-group__body {
	display: none;
}

/* Cards: 1 column on phones, 2 on tablets, 4 from 1200px; equal heights per row, fixed image ratio */
.wpc-grid {
	display: grid;
	gap: var(--wpc-gap);
	grid-template-columns: 1fr;
}

@media (min-width: 640px) {
	.wpc-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 1200px) {
	.wpc-grid {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

.wpc-card {
	background: var(--wpc-surface);
	border: 1px solid var(--wpc-border);
	border-radius: var(--wpc-radius);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	position: relative;
	transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.wpc-card:hover {
	border-color: var(--wpc-accent);
	box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
}

.wpc-card__media {
	aspect-ratio: 16 / 9;
	background: var(--wpc-soft);
	overflow: hidden;
}

.wpc .wpc-card__media img {
	display: block;
	height: 100%;
	max-width: none;
	object-fit: cover;
	width: 100%;
}

.wpc-card__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 0.4rem;
	padding: 0.7rem 0.9rem 0.9rem;
}

.wpc .wpc-card h3.wpc-card__title {
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	display: -webkit-box;
	font-family: inherit;
	font-size: 1rem;
	font-weight: 700;
	letter-spacing: normal;
	line-height: 1.3;
	margin: 0;
	min-height: 2.6em;
	overflow: hidden;
	padding: 0;
	text-transform: none;
}

.wpc-card__title a {
	color: inherit;
	text-decoration: none;
}

/* The title link covers the whole card, so the card is one link; its focus ring is the card's outline. */
.wpc-card__title a::after {
	content: "";
	inset: 0;
	position: absolute;
}

.wpc .wpc-card__title a:focus-visible {
	outline: none;
}

.wpc .wpc-card__title a:focus-visible::after {
	border-radius: var(--wpc-radius);
	outline: 3px solid var(--wpc-focus);
	outline-offset: -3px;
}

.wpc-card__terms {
	display: flex;
	flex-wrap: wrap;
	font-size: 0.78rem;
	gap: 0.3rem;
	height: 1.5rem;
	list-style: none;
	margin: 0;
	overflow: hidden;
	padding: 0;
}

.wpc-card__terms:empty {
	display: none;
}

.wpc-card__term span {
	background: var(--wpc-soft);
	border-radius: 999px;
	color: inherit;
	display: inline-block;
	line-height: 1.5;
	padding: 0 0.6rem;
	white-space: nowrap;
}

.wpc-card__excerpt {
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	display: -webkit-box;
	font-size: 0.9rem;
	line-height: 1.45;
	margin: 0;
	overflow: hidden;
}

.wpc-more-wrap {
	margin: 0.75rem 0 0;
	text-align: right;
}

.wpc-more {
	color: var(--wpc-accent);
	font-weight: 600;
	text-decoration: none;
}

.wpc-more::after {
	content: " \2192";
}

.wpc-more:hover {
	text-decoration: underline;
}

/* Pagination */
.wpc-pagination {
	margin: 1.5rem 0 0;
}

.wpc-pagination__list {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.wpc-pagination__link {
	border: 1px solid var(--wpc-border);
	border-radius: var(--wpc-radius);
	color: inherit;
	display: inline-block;
	min-width: 2.5rem;
	padding: 0.4rem 0.75rem;
	text-align: center;
	text-decoration: none;
}

.wpc-pagination__link.is-current {
	background: var(--wpc-accent);
	border-color: var(--wpc-accent);
	color: var(--wpc-accent-contrast);
}

/* Archive page wrapper (core template; the Avada adapter has its own) */
.wpc-archive {
	margin: 0 auto;
	max-width: 76rem;
	padding: 1rem 16px;
}

.wpc-archive__title {
	margin: 0 0 1rem;
}

.wpc-notice {
	background: var(--wpc-soft);
	border-radius: var(--wpc-radius);
	padding: 0.75rem 1rem;
}

/* Related items: a grid; the title shows on hover or focus (always on touch screens and for items without an image) */
.wpc-related {
	margin: 2rem 0;
}

.wpc-related__grid {
	display: grid;
	gap: 0.75rem;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 10.5rem), 1fr));
	list-style: none;
	margin: 0;
	padding: 0;
}

.wpc-related__link {
	border-radius: var(--wpc-radius);
	color: #fff;
	display: block;
	overflow: hidden;
	position: relative;
	text-decoration: none;
}

.wpc-related__media img {
	aspect-ratio: 4 / 3;
	display: block;
	height: auto;
	object-fit: cover;
	width: 100%;
}

.wpc-related__title {
	background: rgba(0, 0, 0, 0.7);
	bottom: 0;
	color: #fff;
	font-size: 0.9rem;
	left: 0;
	line-height: 1.3;
	padding: 0.5rem 0.6rem;
	position: absolute;
	right: 0;
	transform: translateY(100%);
	transition: transform 0.2s ease;
}

.wpc-related__link:hover .wpc-related__title,
.wpc-related__link:focus-visible .wpc-related__title {
	transform: none;
}

@media (hover: none) {
	.wpc-related__title {
		transform: none;
	}
}

.wpc-related__item--no-image .wpc-related__link {
	border: 1px solid rgba(100, 116, 139, 0.45);
	color: inherit;
	padding: 1rem;
}

.wpc-related__item--no-image .wpc-related__title {
	background: none;
	color: inherit;
	padding: 0;
	position: static;
	transform: none;
}

@media (prefers-reduced-motion: reduce) {
	.wpc-related__title {
		transition: none;
	}
}

@media (max-width: 767px) {
	.wpc-filter {
		align-items: stretch;
		flex-direction: column;
		gap: 0.3rem;
	}

	.wpc-filter__label {
		flex: none;
	}

	.wpc-dropdown {
		width: 100%;
	}

	.wpc-filters > .wpc-filter--dropdown {
		flex: 1 1 100%;
	}

	.wpc-chip,
	.wpc-active__item {
		min-height: 2.75rem;
	}

	/* With JavaScript the filters collapse into a panel opened by the "Filters (n)" button (without it they are just listed). */
	.wpc-js .wpc-filter-toggle {
		align-items: center;
		background: transparent;
		border: 1px solid var(--wpc-border);
		border-radius: var(--wpc-radius);
		color: inherit;
		cursor: pointer;
		display: flex;
		font: inherit;
		font-weight: 600;
		justify-content: space-between;
		margin: 0 0 0.75rem;
		min-height: 2.75rem;
		order: 0;
		padding: 0.4rem 0.9rem;
		width: 100%;
	}

	.wpc-js .wpc-filter-toggle::after {
		border-bottom: 2px solid currentcolor;
		border-right: 2px solid currentcolor;
		content: "";
		height: 0.5rem;
		transform: translateY(-0.1rem) rotate(45deg);
		width: 0.5rem;
	}

	.wpc-js .wpc-filter-toggle[aria-expanded="true"]::after {
		transform: translateY(0.1rem) rotate(-135deg);
	}

	.wpc-js .wpc-filters:not(.is-open) {
		display: none;
	}

	.wpc-js .wpc-filters.is-open {
		border: 1px solid var(--wpc-border);
		border-radius: var(--wpc-radius);
		gap: 0.9rem;
		padding: 0.9rem;
	}

	.wpc-js .wpc-panel-done {
		background: var(--wpc-accent);
		border: 0;
		border-radius: var(--wpc-radius);
		color: var(--wpc-accent-contrast);
		cursor: pointer;
		display: block;
		font: inherit;
		min-height: 2.75rem;
		padding: 0.5rem 1rem;
	}

	.wpc-search {
		flex-wrap: wrap;
	}

	.wpc-search .wpc-button {
		flex: 1 1 100%;
	}
}
