/**
 * GH-C004 shared brand card and GH-C004A/B controller presentation.
 *
 * The plugin owns brand data and markup. The Partdo child theme owns this
 * presentation layer wherever the shared renderer is used.
 */

.gh-brand-card {
	background: var(--gh-color-white);
	border: 1px solid var(--gh-color-border);
	border-radius: var(--gh-category-card-radius);
	color: var(--gh-color-ink);
	display: flex;
	flex-direction: column;
	min-height: 190px;
	overflow: hidden;
	text-decoration: none;
	transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.gh-brand-card__visual {
	align-items: center;
	background: var(--gh-color-surface);
	display: flex;
	flex: 1;
	justify-content: center;
	min-height: 140px;
	padding: var(--gh-space-3);
}

.gh-brand-card__logo {
	display: block;
	height: auto;
	max-height: 96px;
	max-width: 82%;
	object-fit: contain;
	width: auto;
}

.gh-brand-card__wordmark {
	color: var(--gh-color-ink);
	font-family: var(--gh-font-family);
	font-size: clamp(16px, 1.7vw, 23px);
	font-weight: 800;
	letter-spacing: 0.04em;
	overflow-wrap: anywhere;
	text-align: center;
	text-transform: uppercase;
}

.gh-brand-card__content {
	display: grid;
	gap: var(--gh-space-1) var(--gh-space-3);
	grid-template-columns: minmax(0, 1fr) auto;
	padding: var(--gh-space-4);
}

.gh-brand-card__name {
	font-family: var(--gh-font-family);
	font-size: 15px;
	font-weight: 700;
	line-height: 1.35;
	overflow-wrap: anywhere;
}

.gh-brand-card__arrow {
	color: var(--gh-color-primary-dark);
	font-size: 18px;
	transition: transform 180ms ease;
}

.gh-brand-card__count {
	color: var(--gh-color-muted);
	font-size: 12px;
	grid-column: 1 / -1;
}

.gh-brand-card:hover {
	border-color: var(--gh-color-primary);
	box-shadow: 0 12px 28px rgba(31, 42, 47, 0.1);
	color: var(--gh-color-ink);
	transform: translateY(-2px);
}

.gh-brand-card:hover .gh-brand-card__arrow {
	transform: translateX(2px);
}

.gh-brand-card:focus-visible {
	outline: 3px solid var(--gh-color-focus);
	outline-offset: 3px;
}

.gh-brand-listing .gh-brand-card[hidden],
.gh-brand-listing__empty[hidden] {
	display: none !important;
}

/* GH-C004A Dynamic Brand Listing */

.gh-brand-listing {
	display: grid;
	gap: var(--gh-space-5);
	min-width: 0;
}

.gh-brand-listing__description,
.gh-featured-brands__description {
	color: var(--gh-color-muted);
	font: 400 16px/1.6 var(--gh-font-family);
	max-width: 720px;
}

.gh-brand-listing__description > :first-child,
.gh-featured-brands__description > :first-child {
	margin-top: 0;
}

.gh-brand-listing__description > :last-child,
.gh-featured-brands__description > :last-child {
	margin-bottom: 0;
}

.gh-brand-listing__description a,
.gh-featured-brands__description a {
	color: var(--gh-color-primary-dark);
	text-decoration: underline;
}

.gh-brand-listing__tools {
	display: flex;
	gap: var(--gh-space-5);
	justify-content: space-between;
}

.gh-brand-listing__az {
	align-items: center;
	display: flex;
	flex: 1;
	flex-wrap: wrap;
	gap: var(--gh-space-1);
}

.gh-brand-listing .gh-brand-listing__letter {
	appearance: none;
	background: transparent;
	border: 0;
	border-radius: var(--gh-radius-md);
	color: var(--gh-color-ink);
	font: 700 13px/1 var(--gh-font-family);
	min-height: 36px;
	min-width: 32px;
	padding: 8px;
	transition: background-color 160ms ease, color 160ms ease;
}

.gh-brand-listing .gh-brand-listing__letter:hover:not(:disabled) {
	background: var(--gh-color-surface);
	color: var(--gh-color-primary-dark);
}

.gh-brand-listing .gh-brand-listing__letter.is-active {
	background: var(--gh-color-primary);
	color: var(--gh-color-white);
}

.gh-brand-listing .gh-brand-listing__letter:disabled {
	color: var(--gh-color-muted);
	cursor: default;
	opacity: 0.35;
}

.gh-brand-listing .gh-brand-listing__letter:focus-visible,
.gh-featured-brands .gh-featured-brands__control:focus-visible {
	outline: 3px solid var(--gh-color-focus);
	outline-offset: 2px;
}

.gh-brand-listing__search {
	display: grid;
	flex: 0 1 280px;
	gap: var(--gh-space-1);
}

.gh-brand-listing__search label {
	color: var(--gh-color-ink);
	font: 600 13px/1.4 var(--gh-font-family);
}

.gh-brand-listing__search input[type="search"] {
	background: var(--gh-color-white);
	border: 1px solid var(--gh-color-border);
	border-radius: var(--gh-radius-md);
	color: var(--gh-color-ink);
	font: 400 16px/1.4 var(--gh-font-family);
	min-height: 48px;
	padding: 10px 14px;
	width: 100%;
}

.gh-brand-listing__search input[type="search"]:focus {
	border-color: var(--gh-color-focus);
	box-shadow: 0 0 0 1px var(--gh-color-focus);
	outline: 0;
}

.gh-brand-listing__grid,
.gh-brand-grid {
	display: grid;
	gap: var(--gh-brand-gap, 20px);
	grid-template-columns: repeat(var(--gh-brand-columns, 6), minmax(0, 1fr));
	min-width: 0;
}

.gh-brand-listing__empty,
.gh-featured-brands__empty {
	background: var(--gh-color-surface);
	border-radius: var(--gh-radius-md);
	color: var(--gh-color-muted);
	margin: 0;
	padding: var(--gh-space-5);
	text-align: center;
}

/* GH-C004B Featured Brands */

.gh-featured-brands {
	display: grid;
	gap: var(--gh-space-5);
	min-width: 0;
}

.gh-featured-brands__header {
	align-items: flex-end;
	display: flex;
	gap: var(--gh-space-4);
	justify-content: space-between;
}

.gh-featured-brands__intro {
	display: grid;
	gap: var(--gh-space-2);
}

.gh-featured-brands__title {
	color: var(--gh-color-ink);
	font: 700 clamp(28px, 3vw, 36px)/1.15 var(--gh-font-family);
	margin: 0;
}

.gh-featured-brands__description {
	margin: 20px 0;
}

.gh-featured-brands__controls {
	display: flex;
	gap: var(--gh-space-2);
}

.gh-featured-brands .gh-featured-brands__control {
	appearance: none;
	align-items: center;
	background: var(--gh-color-white);
	border: 1px solid var(--gh-color-border);
	border-radius: var(--gh-radius-md);
	color: var(--gh-color-primary-dark);
	display: inline-flex;
	font-size: 18px;
	height: 42px;
	justify-content: center;
	padding: 0;
	width: 42px;
}

.gh-featured-brands .gh-featured-brands__control:hover:not(:disabled) {
	background: var(--gh-color-primary);
	border-color: var(--gh-color-primary);
	color: var(--gh-color-white);
}

.gh-featured-brands .gh-featured-brands__control:disabled {
	cursor: default;
	opacity: 0.35;
}

.gh-featured-brands__items {
	min-width: 0;
}

.gh-featured-brands--grid .gh-featured-brands__items {
	display: grid;
	gap: var(--gh-brand-gap, 20px);
	grid-template-columns: repeat(var(--gh-brand-columns, 5), minmax(0, 1fr));
}

.gh-featured-brands__item {
	min-width: 0;
}

.gh-featured-brands__item > .gh-brand-card {
	height: 100%;
}

.gh-featured-brands--carousel .gh-featured-brands__items {
	display: flex;
	gap: var(--gh-brand-gap, 20px);
	overflow-x: auto;
	overscroll-behavior-inline: contain;
	padding: 4px 4px var(--gh-space-3);
	scroll-behavior: smooth;
	scroll-snap-type: inline mandatory;
	scrollbar-width: none;
}

.gh-featured-brands--carousel .gh-featured-brands__items::-webkit-scrollbar {
	display: none;
}

.gh-featured-brands--carousel .gh-featured-brands__item {
	flex: 0 0 calc((100% - ((var(--gh-brand-columns, 5) - 1) * var(--gh-brand-gap, 20px))) / var(--gh-brand-columns, 5));
	scroll-snap-align: start;
}

.gh-featured-brands--editorial .gh-featured-brands__items {
	display: grid;
	gap: var(--gh-brand-gap, 20px);
	grid-auto-rows: minmax(190px, auto);
	grid-template-columns: repeat(4, minmax(0, 1fr));
}

.gh-featured-brands--editorial.gh-featured-brands--feature-left .gh-featured-brands__item.is-featured {
	grid-column: span 2;
	grid-row: span 2;
}

.gh-featured-brands--editorial.gh-featured-brands--feature-center .gh-featured-brands__item.is-featured {
	grid-column: 2 / span 2;
	grid-row: span 2;
}

.gh-featured-brands--editorial.gh-featured-brands--balanced .gh-featured-brands__item:nth-child(1),
.gh-featured-brands--editorial.gh-featured-brands--balanced .gh-featured-brands__item:nth-child(2) {
	grid-column: span 2;
}

@media (max-width: 1024px) {
	.gh-brand-listing__grid,
	.gh-brand-grid,
	.gh-featured-brands--grid .gh-featured-brands__items {
		grid-template-columns: repeat(var(--gh-brand-columns-tablet, 3), minmax(0, 1fr));
	}

	.gh-featured-brands--carousel .gh-featured-brands__item {
		flex-basis: calc((100% - ((var(--gh-brand-columns-tablet, 3) - 1) * var(--gh-brand-gap, 20px))) / var(--gh-brand-columns-tablet, 3));
	}

	.gh-featured-brands--editorial .gh-featured-brands__items {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.gh-featured-brands--editorial .gh-featured-brands__item.is-featured {
		grid-column: span 2;
	}
}

@media (max-width: 767px) {
	.gh-brand-listing__tools,
	.gh-featured-brands__header {
		align-items: stretch;
		flex-direction: column;
	}

	.gh-brand-listing__search {
		flex-basis: auto;
		width: 100%;
	}

	.gh-brand-listing__grid,
	.gh-brand-grid,
	.gh-featured-brands--grid .gh-featured-brands__items {
		grid-template-columns: repeat(var(--gh-brand-columns-mobile, 2), minmax(0, 1fr));
	}

	.gh-featured-brands__controls {
		align-self: flex-end;
	}

	.gh-featured-brands--carousel .gh-featured-brands__item {
		flex-basis: calc((100% - ((var(--gh-brand-columns-mobile, 2) - 1) * var(--gh-brand-gap, 20px))) / var(--gh-brand-columns-mobile, 2));
	}

	.gh-featured-brands--editorial .gh-featured-brands__items {
		grid-template-columns: repeat(var(--gh-brand-columns-mobile, 2), minmax(0, 1fr));
		grid-auto-rows: auto;
	}

	.gh-featured-brands--editorial .gh-featured-brands__item,
	.gh-featured-brands--editorial .gh-featured-brands__item.is-featured {
		grid-column: auto;
		grid-row: auto;
	}

	.gh-brand-card {
		min-height: 190px;
	}

	.gh-brand-card__visual {
		min-height: 120px;
		padding: var(--gh-space-4);
	}

	.gh-brand-card__content {
		padding: var(--gh-space-3);
	}
}

@media (prefers-reduced-motion: reduce) {
	.gh-brand-card,
	.gh-brand-card__arrow,
	.gh-featured-brands--carousel .gh-featured-brands__items {
		scroll-behavior: auto;
		transition-duration: 0.01ms;
	}
}
