/* Affiliate Carousel — front-end styles
   Deliberately avoids setting background/text colours so the block
   inherits whatever the theme/page around it is using. */

.wpac-carousel {
	--wpac-img-height: 60px;
	--wpac-gap: 40px;
	--wpac-duration: 30s;

	position: relative;
	width: 100%;
	max-width: 100%;
	overflow: hidden;
	font-family: inherit;
	color: inherit;
	background: transparent;
	box-sizing: border-box;
	padding: 10px 0;
}

.wpac-carousel * {
	box-sizing: border-box;
}

/* Fade the edges so images scroll in/out smoothly rather than clipping hard. */
.wpac-mode-scroll {
	-webkit-mask-image: linear-gradient(to right, transparent 0, #000 5%, #000 95%, transparent 100%);
	mask-image: linear-gradient(to right, transparent 0, #000 5%, #000 95%, transparent 100%);
}

.wpac-track {
	display: flex;
	align-items: center;
	gap: var(--wpac-gap);
	width: max-content;
}

/* Static mode: no animation, wraps naturally and centers. */
.wpac-mode-static .wpac-track {
	width: 100%;
	flex-wrap: wrap;
	justify-content: center;
}

/* Scrolling mode: animated horizontal loop. */
.wpac-mode-scroll .wpac-track {
	flex-wrap: nowrap;
	animation-name: wpac-scroll-left;
	animation-duration: var(--wpac-duration);
	animation-timing-function: linear;
	animation-iteration-count: infinite;
	will-change: transform;
}

.wpac-direction-right .wpac-track {
	animation-name: wpac-scroll-right;
}

.wpac-pause-hover .wpac-track:hover,
.wpac-pause-hover .wpac-track:focus-within {
	animation-play-state: paused;
}

@keyframes wpac-scroll-left {
	from { transform: translateX(0); }
	to   { transform: translateX(-50%); }
}

@keyframes wpac-scroll-right {
	from { transform: translateX(-50%); }
	to   { transform: translateX(0); }
}

.wpac-item {
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: flex-start;
	text-align: center;
}

.wpac-image-stack {
	position: relative;
	display: inline-block;
	height: var(--wpac-img-height);
	line-height: 0;
}

.wpac-item img {
	display: block;
	height: var(--wpac-img-height);
	width: auto;
	max-width: none;
	object-fit: contain;
	background: transparent;
	transition: opacity 0.2s ease, filter 0.2s ease, transform 0.2s ease;
}

/* Hover image is stacked on top of the base image and faded in on hover/focus. */
.wpac-img-hover {
	position: absolute;
	top: 0;
	left: 0;
	opacity: 0;
}

.wpac-link:hover .wpac-img-hover,
.wpac-link:focus .wpac-img-hover {
	opacity: 1;
}

.wpac-link:hover .wpac-img-base,
.wpac-link:focus .wpac-img-base {
	opacity: 0;
}

.wpac-link {
	display: inline-flex;
	flex-direction: column;
	align-items: center;
	text-decoration: none;
	outline-offset: 4px;
}

/* Only used when there is no separate hover image supplied. */
.wpac-item:not(.wpac-item-has-hover) .wpac-link:hover img,
.wpac-item:not(.wpac-item-has-hover) .wpac-link:focus img {
	opacity: 0.85;
	transform: translateY(-2px);
}

/* Optional grayscale-to-colour hover effect (applies to the base image only). */
.wpac-grayscale .wpac-img-base {
	filter: grayscale(100%);
}

.wpac-grayscale .wpac-link:hover .wpac-img-base,
.wpac-grayscale .wpac-link:focus .wpac-img-base {
	filter: grayscale(0%);
}

/* Brand name heading: intentionally does NOT set font-family/size/weight/colour
   so it inherits whatever the theme defines for this heading level. Only spacing
   and layout are controlled here. */
.wpac-name {
	margin: 8px 0 0 0;
	line-height: 1.2;
}

.wpac-has-names .wpac-item {
	justify-content: flex-start;
}

@media (prefers-reduced-motion: reduce) {
	.wpac-mode-scroll .wpac-track {
		animation: none;
	}
	.wpac-mode-scroll {
		overflow-x: auto;
	}
}
