/*
 * MC Link Carousel v1.0.8 - tile slider for Journal 2
 * Look (tile, name, arrows) comes from Journal's skin via its own classes:
 * .product-grid-item / .product-wrapper / .image / .name and .owl-buttons .owl-prev / .owl-next.
 * This file only handles sliding, tile width and arrow visibility.
 * MCE Digital - https://www.mcedigital.nl
 */

/* Columns: desktop value comes from the module setting (inline --mc-cols-desktop) */
.mc_link_carousel {
	--mc-gap: 20px;
	--mc-cols: var(--mc-cols-desktop, 4);
	position: relative;
}

/* Horizontal track: native swipe on touch devices, tiles snap into place */
.mc_link_carousel_track {
	display: flex;
	gap: var(--mc-gap);
	overflow-x: auto;
	overflow-y: hidden;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior-x: contain;
	scrollbar-width: none;
	-ms-overflow-style: none;
	/* Own stacking context: Journal's tile hover z-index stays inside the track, below the arrows */
	position: relative;
	z-index: 1;
	isolation: isolate;
}

.mc_link_carousel_track::-webkit-scrollbar {
	display: none;
}

/* Tile width: (100% - gaps) / visible columns */
.mc_link_carousel_item {
	flex: 0 0 calc((100% - (var(--mc-cols) - 1) * var(--mc-gap)) / var(--mc-cols));
	min-width: 0;
	scroll-snap-align: start;
}

/* Journal tile fills the slide */
.mc_link_carousel .product-grid-item {
	display: block;
	width: 100%;
}

/*
 * Journal puts margin-right: 20px on .product-wrapper (its spacing between products).
 * Here the track gap (20px) already does that, so remove it: images are flush with the
 * carousel edges on both sides and 20px apart, and both arrows sit identically.
 */
.mc_link_carousel .mc_link_carousel_item .product-grid-item .product-wrapper {
	margin-right: 0;
}

.mc_link_carousel .product-grid-item .image img {
	display: block;
	width: 100%;
	height: auto;
}

/*
 * Arrows: Journal's own arrow styles are scoped to .journal-carousel, so they do not
 * reach this carousel. Values below are copied from the Journal product carousel
 * (inspector, dev) and scoped to .mc_link_carousel.
 */
.mc_link_carousel .owl-buttons.side-buttons {
	display: block;
}

.mc_link_carousel .owl-buttons.side-buttons div {
	position: absolute;
	top: 50%;
	z-index: 10;
	width: 32px;
	height: 32px;
	margin: -17px 0 0;
	border-radius: 50%;
	background-color: rgb(192, 231, 106);
	color: #fff;
	cursor: pointer;
	transition: color .2s, background-color .2s, opacity .2s;
}

.mc_link_carousel .owl-buttons.side-buttons .owl-prev {
	left: 10px;
}

.mc_link_carousel .owl-buttons.side-buttons .owl-next {
	right: 10px;
}

/* Chevron icon drawn in CSS (white, like the Journal arrows) */
.mc_link_carousel .owl-buttons.side-buttons div::before {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 9px;
	height: 9px;
	border-top: 2px solid currentColor;
	border-right: 2px solid currentColor;
}

.mc_link_carousel .owl-buttons.side-buttons .owl-prev::before {
	transform: translate(-30%, -50%) rotate(-135deg);
}

.mc_link_carousel .owl-buttons.side-buttons .owl-next::before {
	transform: translate(-70%, -50%) rotate(45deg);
}

/* Arrows: hidden only when all tiles fit */
.mc_link_carousel_static .mc_link_carousel_controls {
	display: none;
}

.mc_link_carousel .owl-buttons div:focus-visible {
	outline: 2px solid #333;
	outline-offset: 2px;
}

/* Breakpoints match the Journal product carousel (itemsCustom: 760 => 3, 0 => 2) */

/* Tablet: 760-979px */
@media (max-width: 979px) {
	.mc_link_carousel {
		--mc-cols: min(var(--mc-cols-desktop, 4), 3);
	}
}

/* Mobile: below 760px */
@media (max-width: 759px) {
	.mc_link_carousel {
		--mc-cols: min(var(--mc-cols-desktop, 4), 2);
	}
}

@media (prefers-reduced-motion: reduce) {
	.mc_link_carousel_track {
		scroll-behavior: auto;
	}
}
