/*
 * Reusable brandbar and brand carousel component.
 */

.brand-carousel-shell {
	--brand-carousel-surface: var(--eventit-brandbar-surface, #F3F3F3);
	--brand-carousel-logo-color: var(--eventit-brandbar-logo-color, #A6A6A6);

	width: 100%;
}

/*
 * Global brandbar section styling. The section preset controls layout while
 * this class keeps the carousel fade and optional separators scoped.
 */
.eventit-brandbar-section {
	--eventit-brandbar-surface: #F3F3F3;
	--eventit-brandbar-logo-color: #A6A6A6;

	color: var(--color-grey-charcoal, #515151);
}

.eventit-brandbar-section--bordered {
	border-block: 1px solid rgba(2, 42, 68, 0.08);
}

/*
 * Homepage placement keeps the carousel and logo dimensions untouched while
 * reducing only the section's vertical whitespace.
 */
.eventit-brandbar-section--slim {
	padding-block: clamp(0.75rem, 1.5vw, 1.25rem);
}

.eventit-brandbar-section.eventit-section--grey {
	--eventit-brandbar-surface: #F3F3F3;

	background: #F3F3F3;
	color: var(--color-grey-charcoal, #515151);
}

.eventit-brandbar-section.eventit-section--white {
	--eventit-brandbar-surface: #fff;
}

.eventit-brandbar-section.eventit-section--blue {
	--eventit-brandbar-surface: var(--color-blue-overlay, #002238);
	--eventit-brandbar-logo-color: rgba(255, 255, 255, 0.72);
}

.eventit-brandbar-section.eventit-section--blue .brand-band__heading {
	color: var(--color-white, #f1f1f1);
}

.brand-band__heading {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.75rem;
	width: min(calc(100% - 2rem), var(--site-max-width));
	margin: 0 auto 1.5rem;
	color: var(--color-blue-dark);
	font-size: clamp(1.2rem, 2vw, 1.75rem);
	line-height: 1.2;
	text-align: center;
}

.brand-band__heading::before,
.brand-band__heading::after {
	content: "";
	display: block;
	flex: 0 1 4rem;
	height: 2px;
	background: var(--color-brand-red);
}

.brand-carousel {
	position: relative;
	overflow: hidden;
	width: 100%;
	min-width: 0;
}

.brand-carousel::before,
.brand-carousel::after {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	z-index: 1;
	width: clamp(2.5rem, 8vw, 5rem);
	pointer-events: none;
}

.brand-carousel::before {
	left: 0;
	background: linear-gradient(90deg, var(--brand-carousel-surface), rgba(243, 243, 243, 0));
}

.brand-carousel::after {
	right: 0;
	background: linear-gradient(270deg, var(--brand-carousel-surface), rgba(243, 243, 243, 0));
}

.brand-carousel__track {
	display: flex;
	width: max-content;
	transform: translateX(-33.333333%);
	will-change: transform;
	animation: eventit-brand-carousel var(--brand-carousel-duration, 28s) linear infinite;
}

.brand-carousel.is-js-enhanced .brand-carousel__track {
	animation: none;
}

.brand-carousel--pause-hover:hover .brand-carousel__track,
.brand-carousel.is-paused .brand-carousel__track {
	animation-play-state: paused;
}

.brand-carousel--manual .brand-carousel__track {
	animation: none;
}

.brand-carousel.is-paused {
	cursor: grab;
	touch-action: pan-y;
}

.brand-carousel.is-dragging {
	cursor: grabbing;
}

.brand-carousel.is-dragging,
.brand-carousel.is-dragging a {
	user-select: none;
}

.brand-carousel__list {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	width: max-content;
	margin: 0;
	padding: 0;
	list-style: none;
}

.brand-carousel__item {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	/*
	 * Each item hugs its own logo (no fixed slot width). The logo is sized by JS
	 * (sizeBrandLogo) to a constant visual AREA, so a wide wordmark and a compact
	 * mark read as the "same size" rather than being squeezed into one 3.6:1 box.
	 * A fixed row height keeps every logo on the same optical baseline and the
	 * symmetric inline padding gives an even gap to the next logo (2x = the gap).
	 */
	flex: 0 0 auto;
	min-width: 0;
	height: var(--brand-carousel-row-height, 6.5rem);
	padding-inline: 1.75rem;
	color: var(--brand-carousel-logo-color);
	font-weight: var(--font-weight-semibold);
	font-size: 1.35rem;
}

.brand-carousel__item > a,
.brand-carousel__item > span {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 100%;
	color: inherit;
}

.brand-carousel__logo-frame {
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.brand-carousel__logo {
	display: block;
	/*
	 * width/height are set per-image by JS (sizeBrandLogo). These are the pre-load
	 * fallback and the safety caps (MAX_H / MAX_W) so an unsized or ultra-wide logo
	 * can never blow the row height or width.
	 */
	width: auto;
	height: auto;
	max-height: 5.75rem;
	max-width: 15rem;
	object-fit: contain;
	user-select: none;
	-webkit-user-drag: none;
	/*
	 * Convert the coloured brand logos to grayscale, then darken so even
	 * pure-white logo parts stay visible against the #F3F3F3 brandbar surface.
	 * Tuned for that surface; no hover restore of brand colour.
	 */
	filter: grayscale(100%) brightness(0.6);
}

.brand-carousel__item > span .brand-carousel__logo {
	pointer-events: none;
}

.brand-carousel__label {
	white-space: nowrap;
}

@keyframes eventit-brand-carousel {
	from {
		transform: translateX(-33.333333%);
	}

	to {
		transform: translateX(-66.666666%);
	}
}

@media (prefers-reduced-motion: reduce) {
	.brand-carousel__track {
		width: auto;
		flex-wrap: wrap;
		gap: 0;
		transform: none;
		animation: none;
	}

	.brand-carousel__list[aria-hidden="true"] {
		display: none;
	}
}

@media (max-width: 47.9375rem) {
	.eventit-brandbar-section--slim {
		padding-block: 0.75rem;
	}

	.brand-band__heading {
		align-items: center;
		flex-direction: column;
		gap: 0.55rem;
		margin-bottom: 1.25rem;
		font-size: 1.2rem;
	}

	.brand-band__heading::before,
	.brand-band__heading::after {
		flex-basis: auto;
		width: 3.25rem;
	}
}
