/**
 * Products Carousel (hash b4e7a3).
 *
 * Layout only. Card looks come from the TheGem loop-item template, never from here.
 * Colours default to currentColor so the carousel inherits the surrounding text colour until
 * the Style controls say otherwise. Sizes are driven by CSS variables set by the controls.
 */

.pcr-b4e7a3 {
	--pcr-b4e7a3-item-w: 300px;
	--pcr-b4e7a3-gap: 0px;

	position: relative;
	width: 100%;
	min-width: 0;
}

/* Editor-only message. */
.pcr-b4e7a3--notice {
	padding: 24px;
	border: 1px dashed currentColor;
	opacity: 0.7;
	text-align: center;
}

.pcr-b4e7a3__notice {
	margin: 0;
}

/* The viewport clips the track, so cards past the edge peek in or stay hidden. */
.pcr-b4e7a3__viewport {
	overflow: hidden;
	/* Horizontal drags are ours, vertical gestures still scroll the page. */
	touch-action: pan-y;
}

.pcr-b4e7a3__track {
	position: relative;
	display: flex;
	flex-wrap: nowrap;
	align-items: stretch;
	gap: var(--pcr-b4e7a3-gap);
	will-change: transform;
	transform: translate3d(0, 0, 0);
	margin-top: -2px;
	margin-bottom: -2px;
}

/* Fixed width cards. max-width stops a card ever being wider than the viewport. */
.pcr-b4e7a3__item {
	display: flex;
	flex: 0 0 var(--pcr-b4e7a3-item-w);
	width: var(--pcr-b4e7a3-item-w);
	max-width: 100%;
	box-sizing: border-box;
	min-width: 0;
	margin-left: -2px;

	/* Cards stack: the neighbour slides over a card that is leaving or entering (see script.js). */
	position: relative;
	z-index: 1;
}

/* The card that goes to the back, or comes from behind, sits under its neighbours. */
.pcr-b4e7a3__item.is-leaving,
.pcr-b4e7a3__item.is-entering {
	z-index: 0;
	will-change: transform, opacity;
	pointer-events: none;
}

/* Equal height cards: the template wrapper fills the item. */
.pcr-b4e7a3__item > .thegem-template-wrapper {
	flex: 1 1 auto;
	min-width: 0;
	width: 100%;
}

.pcr-b4e7a3__item img {
	-webkit-user-drag: none;
}

.pcr-b4e7a3.is-dragging .pcr-b4e7a3__viewport {
	cursor: grabbing;
	user-select: none;
	-webkit-user-select: none;
}

.pcr-b4e7a3.is-dragging .pcr-b4e7a3__item a {
	pointer-events: none;
}

/* Navigation bar */
.pcr-b4e7a3__nav {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 16px;
	position: absolute;
	top: 100%;
	right: 0;
	width: 100%;
	z-index: 5;
	box-sizing: border-box;
	width: 240px;
	flex-wrap: nowrap;
}
@media (min-width:1025px) {
	.pcr-b4e7a3__nav {
		width: 100%;
		left: 0;
		justify-content: flex-start;
	}
}

/* Everything fits: nothing to navigate. */
.pcr-b4e7a3.is-static .pcr-b4e7a3__nav {
	display: none;
}

.pcr-b4e7a3__arrows {
	display: inline-flex;
	align-items: center;
	gap: 0;
}

.pcr-b4e7a3__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: var(--pcr-b4e7a3-arrow-box, 32px);
	height: var(--pcr-b4e7a3-arrow-box, 32px);
	margin: 0;
	padding: 6px;
	font-size: var(--pcr-b4e7a3-arrow-icon, 14px);
	line-height: 1;
	color: var(--pcr-b4e7a3-arrow-color, currentColor);
	background: var(--pcr-b4e7a3-arrow-bg, transparent);
	border: 1px solid currentColor;
	border-radius: 50%;
	cursor: pointer;
	transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.pcr-b4e7a3__btn:hover,
.pcr-b4e7a3__btn:focus-visible {
	color: var(--pcr-b4e7a3-arrow-color-hover, var(--pcr-b4e7a3-arrow-color, currentColor));
	background: var(--pcr-b4e7a3-arrow-bg-hover, var(--pcr-b4e7a3-arrow-bg, transparent));
}

.pcr-b4e7a3__btn svg,
.pcr-b4e7a3__btn i {
	width: 1em;
	height: 1em;
	font-size: inherit;
	fill: currentColor;
}

/* The built-in chevrons are stroked paths, not filled shapes. */
.pcr-b4e7a3__btn .pcr-b4e7a3__svg {
	fill: none;
}

.pcr-b4e7a3__dots {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.pcr-b4e7a3__dot {
	position: relative;
	width: var(--pcr-b4e7a3-dot-size, 10px);
	height: var(--pcr-b4e7a3-dot-size, 10px);
	margin: 0;
	padding: 0;
	color: inherit;
	background: transparent;
	border: 1px solid var(--pcr-b4e7a3-dot-color, currentColor);
	border-radius: 50%;
	cursor: pointer;
	transition: background-color 0.2s ease, border-color 0.2s ease, width 0.2s ease, height 0.2s ease;
}

/* A larger invisible hit area, so the small dots are easy to tap. */
.pcr-b4e7a3__dot::after {
	content: '';
	position: absolute;
	top: -8px;
	right: -4px;
	bottom: -8px;
	left: -4px;
}

/* The active dot is a little bigger than the rest (Active dot size control). */
.pcr-b4e7a3__dot.is-active {
	width: var(--pcr-b4e7a3-dot-active-size, 14px);
	height: var(--pcr-b4e7a3-dot-active-size, 14px);
	background: var(--pcr-b4e7a3-dot-active, currentColor);
	border-color: var(--pcr-b4e7a3-dot-active, currentColor);
}

.pcr-b4e7a3__btn:focus-visible,
.pcr-b4e7a3__dot:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
	.pcr-b4e7a3__btn,
	.pcr-b4e7a3__dot {
		transition: none;
	}
}
