/**
 * Shop by Brand widget.
 *
 * Colours come from currentColor and a couple of neutral tones, so the tiles
 * sit comfortably inside whatever the theme is doing.
 */

.pcv-brands {
	--pcv-cols: 2;
	--pcv-gap: 10px;
	--pcv-radius: 10px;
	--pcv-line: rgba(0, 0, 0, .12);
	--pcv-soft: rgba(0, 0, 0, .04);
	margin-bottom: 20px;
}

.pcv-brands__heading {
	margin: 0 0 12px;
	font-size: 18px;
}

.pcv-brands__grid {
	display: grid;
	grid-template-columns: repeat(var(--pcv-cols), minmax(0, 1fr));
	gap: var(--pcv-gap);
}

.pcv-brands__item {
	min-width: 0;
}

/* ------------------------------------------------------------------ */
/* Tile                                                                */
/* ------------------------------------------------------------------ */

.pcv-brands__tile {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	min-height: 92px;
	margin: 0;
	padding: 14px 10px;
	border: 1px solid var(--pcv-line);
	border-radius: var(--pcv-radius);
	background: #fff;
	color: inherit;
	font: inherit;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.pcv-brands__tile:hover,
.pcv-brands__tile:focus-visible {
	border-color: currentColor;
	box-shadow: 0 4px 14px rgba(0, 0, 0, .08);
	transform: translateY(-1px);
	text-decoration: none;
}

.pcv-brands__item.is-open .pcv-brands__tile {
	border-color: currentColor;
	border-bottom-left-radius: 0;
	border-bottom-right-radius: 0;
}

.pcv-brands__logo {
	display: grid;
	place-items: center;
	width: 100%;
	height: 40px;
}

.pcv-brands__logo img {
	max-width: 80%;
	max-height: 40px;
	width: auto;
	height: auto;
	object-fit: contain;
}

.pcv-brands__logo em {
	font-style: normal;
	font-size: 24px;
	font-weight: 800;
	opacity: .25;
}

.pcv-brands__name {
	font-size: 13px;
	font-weight: 600;
	line-height: 1.3;
	overflow-wrap: anywhere;
}

/* ------------------------------------------------------------------ */
/* Caret                                                               */
/* ------------------------------------------------------------------ */

.pcv-brands__caret {
	width: 8px;
	height: 8px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	opacity: .45;
	transform: rotate(45deg) translate(-2px, -2px);
	transition: transform .2s ease;
}

.pcv-brands__item.is-open .pcv-brands__caret {
	opacity: .9;
	transform: rotate(-135deg) translate(-2px, -2px);
}

/* ------------------------------------------------------------------ */
/* Model list                                                          */
/* ------------------------------------------------------------------ */

.pcv-brands__models {
	grid-column: 1 / -1;
	margin-top: -1px;
	padding: 12px 14px;
	border: 1px solid currentColor;
	border-radius: 0 0 var(--pcv-radius) var(--pcv-radius);
	background: var(--pcv-soft);
}

.pcv-brands__models ul {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	gap: 2px 14px;
	margin: 0 0 10px;
	padding: 0;
	max-height: 320px;
	overflow-y: auto;
	list-style: none;
}

.pcv-brands__models li {
	margin: 0;
	list-style: none;
}

.pcv-brands__models a {
	display: block;
	padding: 5px 6px;
	border-radius: 6px;
	font-size: 13px;
	line-height: 1.35;
	text-decoration: none;
	color: inherit;
	opacity: .85;
}

.pcv-brands__models a:hover,
.pcv-brands__models a:focus-visible {
	background: rgba(0, 0, 0, .06);
	opacity: 1;
	text-decoration: none;
}

.pcv-brands__all {
	display: inline-block;
	padding-top: 8px;
	border-top: 1px solid var(--pcv-line);
	width: 100%;
	font-size: 12.5px;
	font-weight: 600;
	text-decoration: none;
}

.pcv-brands__all:hover {
	text-decoration: underline;
}

/* ------------------------------------------------------------------ */
/* Narrow columns: the panel stops trying to be a grid                 */
/* ------------------------------------------------------------------ */

@media (max-width: 480px) {
	.pcv-brands {
		--pcv-cols: 2 !important;
		--pcv-gap: 8px;
	}

	.pcv-brands__models ul {
		grid-template-columns: 1fr;
		max-height: 260px;
	}
}

/* Dark themes: let the tiles follow the page instead of staying white. */
@media (prefers-color-scheme: dark) {
	.pcv-brands:not(.pcv-brands--light) .pcv-brands__tile {
		background: rgba(255, 255, 255, .04);
	}
}
