/* Rota sliding rows (carousel.js). Colours follow the active theme. */
.rota-cr {
	--rcr-ink: var(--wp--preset--color--contrast, #1d2327);
	--rcr-base: var(--wp--preset--color--base, #fff);
	--rcr-line: var(--wp--preset--color--line, rgba(0, 0, 0, .12));
	--rcr-accent: var(--wp--preset--color--primary, #3858e9);
	--rcr-fl: 0px;
	--rcr-fr: 0px;
	position: relative;
	min-width: 0;
	max-width: 100%;
}

.rota-cr.is-scrollable:not(.is-start) { --rcr-fl: 40px; }
.rota-cr.is-scrollable:not(.is-end) { --rcr-fr: 40px; }

.rota-cr .rota-cr-track {
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scroll-behavior: smooth;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
}

.rota-cr .rota-cr-track::-webkit-scrollbar { display: none; }

.rota-cr.is-scrollable .rota-cr-track {
	-webkit-mask-image: linear-gradient(to right, transparent 0, #000 var(--rcr-fl), #000 calc(100% - var(--rcr-fr)), transparent 100%);
	mask-image: linear-gradient(to right, transparent 0, #000 var(--rcr-fl), #000 calc(100% - var(--rcr-fr)), transparent 100%);
}

.rota-cr-track:focus-visible {
	outline: 2px solid var(--rcr-accent);
	outline-offset: 4px;
	border-radius: 6px;
}

.rota-cr-btn {
	position: absolute;
	top: calc(50% - 10px);
	z-index: 3;
	display: grid;
	place-items: center;
	width: 42px;
	height: 42px;
	margin: 0;
	padding: 0;
	border: 1px solid var(--rcr-line);
	border-radius: 50%;
	background: var(--rcr-base);
	color: var(--rcr-ink);
	box-shadow: 0 6px 18px rgba(0, 0, 0, .14);
	cursor: pointer;
	opacity: 0;
	pointer-events: none;
	transform: translateY(-50%) scale(.9);
	transition: opacity .2s, transform .2s, background-color .2s, color .2s;
}

.rota-cr-btn.is-prev { left: 6px; }
.rota-cr-btn.is-next { right: 6px; }

.rota-cr.is-scrollable .rota-cr-btn:not(:disabled) {
	opacity: 1;
	pointer-events: auto;
	transform: translateY(-50%) scale(1);
}

.rota-cr-btn:hover,
.rota-cr-btn:focus-visible {
	background: var(--rcr-accent);
	border-color: var(--rcr-accent);
	color: #fff;
}

.rota-cr-btn:focus-visible {
	outline: 2px solid var(--rcr-accent);
	outline-offset: 2px;
}

.rota-cr-bar {
	display: none;
	position: relative;
	height: 3px;
	margin: 12px auto 0;
	max-width: 160px;
	border-radius: 3px;
	background: var(--rcr-line);
	overflow: hidden;
}

.rota-cr.is-scrollable .rota-cr-bar { display: block; }

.rota-cr-bar span {
	display: block;
	height: 100%;
	border-radius: 3px;
	background: var(--rcr-accent);
	transition: transform .15s ease-out;
}

@media (hover: none) {
	.rota-cr-btn { display: none; }
}

@media (prefers-reduced-motion: reduce) {
	.rota-cr-track { scroll-behavior: auto; }
	.rota-cr-btn,
	.rota-cr-bar span { transition: none; }
}

/* ===== WooCommerce product gallery: one big picture, a sliding strip below ===== */
.woocommerce-product-gallery .flex-viewport,
.woocommerce-product-gallery > .woocommerce-product-gallery__wrapper > .woocommerce-product-gallery__image:first-child {
	border-radius: 14px;
	overflow: hidden;
}

/* Without the slider script every picture is still listed: show the first only. */
.woocommerce-product-gallery:not(:has(.flex-viewport)) .woocommerce-product-gallery__wrapper > .woocommerce-product-gallery__image:not(:first-child) {
	display: none;
}

.woocommerce-product-gallery .flex-control-thumbs,
.woocommerce div.product div.images .flex-control-thumbs {
	display: flex !important;
	flex-wrap: nowrap;
	gap: 10px;
	margin: 12px 0 0 !important;
	padding: 2px !important;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	list-style: none;
	scrollbar-width: none;
}

.woocommerce-product-gallery .flex-control-thumbs li,
.woocommerce div.product div.images .flex-control-thumbs li {
	flex: 0 0 calc((100% - 40px) / 5);
	width: auto !important;
	max-width: none;
	margin: 0 !important;
	float: none !important;
	list-style: none;
	scroll-snap-align: start;
}

.woocommerce-product-gallery .flex-control-thumbs img,
.woocommerce div.product div.images .flex-control-thumbs li img {
	display: block;
	width: 100%;
	aspect-ratio: 1;
	object-fit: cover;
	border: 2px solid transparent;
	border-radius: 10px;
	opacity: .55;
	cursor: pointer;
	transition: opacity .2s, border-color .2s;
}

.woocommerce-product-gallery .flex-control-thumbs img:hover,
.woocommerce-product-gallery .flex-control-thumbs img:focus-visible {
	opacity: .9;
}

.woocommerce-product-gallery .flex-control-thumbs img.flex-active,
.woocommerce div.product div.images .flex-control-thumbs li img.flex-active {
	opacity: 1;
	border-color: var(--wp--preset--color--primary, #3858e9);
}

.woocommerce-product-gallery .flex-control-thumbs img:focus-visible {
	outline: 2px solid var(--wp--preset--color--primary, #3858e9);
	outline-offset: 2px;
}

.rota-cr--thumbs .rota-cr-btn {
	top: calc(50% - 7px);
	width: 34px;
	height: 34px;
}

.rota-cr--thumbs .rota-cr-bar { margin-top: 10px; }

@media (max-width: 600px) {
	.woocommerce-product-gallery .flex-control-thumbs li,
	.woocommerce div.product div.images .flex-control-thumbs li {
		flex-basis: calc((100% - 30px) / 4.4);
	}
}

/* ===== Related products and the footer never overlap ===== */
body .woocommerce .related.products,
body .woocommerce .upsells.products,
body .wp-block-woocommerce-related-products,
body .wp-block-woocommerce-product-collection {
	clear: both;
	padding-bottom: clamp(32px, 5vw, 64px);
}

body .woocommerce .related.products::after,
body .wp-block-woocommerce-related-products::after {
	content: "";
	display: table;
	clear: both;
}

.wp-site-blocks > footer,
.wp-site-blocks > .wp-block-template-part:last-child {
	clear: both;
	position: relative;
}

/* ===== WooCommerce classic loops in Rota themes: readable sale badge and old price ===== */
.woocommerce span.onsale {
	background-color: var(--wp--preset--color--primary, #3858e9);
	color: var(--wp--preset--color--on-primary, #fff);
}

.woocommerce ul.products li.product .price del,
.woocommerce div.product p.price del {
	color: var(--wp--preset--color--contrast-2, #4a5568);
	opacity: 1;
}
