/**
 * MuscleCare Hero Carousel
 *
 * Slides reuse the Gymnax hero classes (.pq-banner, .banner-img, .pq-banner-info …), so the
 * theme's hero styles apply. This file adds the carousel, the hero sizing that used to live in
 * Additional CSS for the old "Slick Slider" widget, and the product / badge slides.
 * Square corners throughout (site rule); only colours from the theme variables.
 */

.mchc {
	--mchc-lime: var(--primary-color, #e3ff04);
	--mchc-dark: var(--dark-color, #0a0c00);
	--mchc-nav: 48px;
	--mchc-nav-bottom: 20px;
	--mchc-dot: 10px;
	--mchc-dot-active: 30px;
	--mchc-dot-gap: 12px;
	--mchc-dots-w: calc((var(--mchc-n, 3) - 1) * (var(--mchc-dot) + var(--mchc-dot-gap)) + var(--mchc-dot-active));
	position: relative;
	overflow: hidden;
	background: var(--mchc-dark);
}

/* Before Slick starts, or without it: the first slide only. */
.mchc-track:not(.slick-initialized) > .mchc-slide ~ .mchc-slide {
	display: none;
}

.mchc .mchc-slide {
	position: relative;
	overflow: hidden;
}

/* ---------- Slick: equal-height slides, drag cursor ---------- */

/* gymnax-core's slick.css gives every slide 20px side margins and Slick adds 30px under a
   slider with dots; neither belongs on a full-width hero. */
.mchc .slick-slide {
	margin: 0;
}

.mchc .slick-dotted.slick-slider {
	margin-bottom: 0;
}

.mchc .slick-track {
	display: flex;
}

.mchc .slick-track::before,
.mchc .slick-track::after {
	display: none;
}

.mchc .slick-initialized .mchc-slide {
	float: none;
	height: auto;
}

.mchc .slick-list {
	cursor: grab;
}

.mchc .slick-list:active {
	cursor: grabbing;
}

.mchc .slick-list:focus,
.mchc .slick-slide:focus {
	outline: none;
}

.mchc .slick-list:focus-visible {
	outline: 2px solid var(--mchc-lime);
	outline-offset: -2px;
}

.mchc img {
	-webkit-user-drag: none;
	user-select: none;
}

/* ---------- Hero size (was Additional CSS, scoped to the old widget) ---------- */

@media (min-width: 768px) {
	.mchc .pq-banner .pq-banner-info .banner-left .pt-section-title .pt-title-heading {
		font-size: 60px;
	}
}

/* Desktop: the hero is exactly as tall as the photo (photo width x 1777/2560, at the theme's
   photo widths 76% / 68% / 61% / 55%), so the photo meets the category marquee below. */
@media (min-width: 1024px) {
	.mchc .pq-banner .pq-banner-info {
		min-height: 52.75vw;
		padding-top: 100px;
		padding-bottom: 40px;
		justify-content: center;
	}

	.mchc .pq-banner .banner-img {
		bottom: 0;
	}

	.mchc .pq-banner .banner-img img {
		display: block;
		width: 100%;
		height: 100%;
		object-fit: cover;
		object-position: right bottom;
	}
}

@media (min-width: 1200px) {
	.mchc .pq-banner .pq-banner-info {
		min-height: 47.2vw;
	}
}

@media (min-width: 1500px) {
	.mchc .pq-banner .pq-banner-info {
		min-height: 42.34vw;
	}
}

@media (min-width: 1700px) {
	.mchc .pq-banner .pq-banner-info {
		min-height: 38.18vw;
	}
}

/* Tablet / phone: the theme stacks text over a full-width photo (column-reverse). Slick sets
   slides to display:block, so restore the flex column; extra height goes under the text. */
@media (max-width: 1023px) {
	.mchc .slick-initialized .mchc-slide.pq-banner {
		display: flex;
	}

	.mchc .mchc-slide > .container {
		flex: 1 0 auto;
	}

	/* Every photo box has the slide-1 shape (2560 x 1777), whatever photo is uploaded, so
	   all slides stay the same height and the bullets keep their place. Wider or taller
	   photos are cropped to fit. */
	.mchc .pq-banner .banner-img {
		aspect-ratio: 2560 / 1777;
		overflow: hidden;
	}

	.mchc .pq-banner .banner-img img {
		display: block;
		width: 100%;
		height: 100%;
		object-fit: cover;
	}
}

/* ---------- Photo shade + badges (photo slides) ---------- */

@media (min-width: 1024px) {
	.mchc .mchc-media--shade::after {
		content: "";
		position: absolute;
		inset: 0;
		pointer-events: none;
		background: linear-gradient(90deg, var(--mchc-dark) 0%, rgba(10, 12, 0, 0.78) 22%, rgba(10, 12, 0, 0) 52%);
	}
}

.mchc .mchc-badges {
	position: absolute;
	z-index: 2;
	right: 7%;
	bottom: 16%;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 14px;
	pointer-events: none;
}

.mchc .mchc-badge {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	min-width: 150px;
	padding: 14px 20px 16px;
	background: var(--mchc-lime);
	color: var(--mchc-dark);
	rotate: -4deg;
	box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.mchc .mchc-badge--2 {
	margin-right: 28px;
	background: var(--mchc-dark);
	color: #fff;
	border: 1px solid var(--mchc-lime);
	rotate: 3deg;
}

.mchc .mchc-badge__big {
	font-family: var(--title-fonts);
	font-size: 64px;
	font-weight: 600;
	line-height: 0.95;
	letter-spacing: 1px;
	text-transform: uppercase;
}

.mchc .mchc-badge--2 .mchc-badge__big {
	color: var(--mchc-lime);
}

.mchc .mchc-badge__small {
	margin-top: 6px;
	font-family: var(--title-fonts);
	font-size: 14px;
	font-weight: 500;
	line-height: 1.3;
	letter-spacing: 2px;
	text-transform: uppercase;
}

/* Keep clear of the side arrows (shown from 1440px). */
@media (min-width: 1440px) {
	.mchc .mchc-badges {
		right: 11%;
	}
}

/* Below 1440px the arrows sit at the bottom, so the badges can hug the right edge and stay
   off the person in the photo. */
@media (min-width: 1024px) and (max-width: 1439px) {
	.mchc .mchc-badges {
		right: 3%;
	}
}

@media (max-width: 1199px) {
	.mchc .mchc-badge__big {
		font-size: 46px;
	}
}

@media (max-width: 1023px) {
	.mchc .mchc-badges {
		top: 8%;
		right: 5%;
		bottom: auto;
	}
}

@media (max-width: 767px) {
	.mchc .mchc-badges {
		gap: 8px;
	}

	.mchc .mchc-badge {
		min-width: 0;
		padding: 8px 12px 10px;
	}

	.mchc .mchc-badge--2 {
		margin-right: 14px;
	}

	.mchc .mchc-badge__big {
		font-size: 30px;
	}

	.mchc .mchc-badge__small {
		margin-top: 3px;
		font-size: 10px;
		letter-spacing: 1px;
	}
}

/* ---------- Product showcase slide ---------- */

.mchc .mchc-slide--products {
	background:
		radial-gradient(55% 70% at 78% 58%, rgba(227, 255, 4, 0.1), rgba(227, 255, 4, 0) 70%),
		var(--mchc-dark);
}

/* Desktop: products fill the right half of the container, centred in the hero. */
.mchc .mchc-products-layer {
	position: absolute;
	inset: 0;
	z-index: 1;
	pointer-events: none;
}

.mchc .mchc-products-layer > .container {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	height: 100%;
	padding-top: 100px;
	padding-bottom: 40px;
}

.mchc .mchc-products {
	position: relative;
	width: 50%;
	pointer-events: auto;
}

@media (min-width: 1024px) {
	.mchc .mchc-slide--products .pq-banner-info .banner-left {
		width: 46%;
	}
}

.mchc .mchc-products__list {
	--mchc-cols: 3;
	position: relative;
	z-index: 1;
	display: grid;
	grid-template-columns: repeat(var(--mchc-cols), minmax(0, 1fr));
	gap: 18px;
	align-items: start;
	margin: 0;
	padding: 0;
	list-style: none;
}

.mchc .mchc-products--1 .mchc-products__list {
	--mchc-cols: 1;
	max-width: 300px;
	margin-left: auto;
}

.mchc .mchc-products--2 .mchc-products__list {
	--mchc-cols: 2;
}

.mchc .mchc-products--4 .mchc-products__list {
	--mchc-cols: 4;
	gap: 14px;
}

.mchc .mchc-product {
	position: relative;
	isolation: isolate;
	margin: 0;
	padding: 0;
}

/* Middle tile sits higher, with a lime block behind it. */
.mchc .mchc-products--3 .mchc-product:nth-child(2) {
	top: -28px;
}

.mchc .mchc-products--3 .mchc-product:nth-child(2)::before {
	content: "";
	position: absolute;
	z-index: -1;
	inset: 14px -14px -14px 14px;
	background: var(--mchc-lime);
}

.mchc .mchc-product__link {
	display: flex;
	flex-direction: column;
	height: 100%;
	background: #16190b;
	border: 1px solid rgba(255, 255, 255, 0.08);
	color: #fff;
	text-decoration: none;
	transition: border-color 0.3s ease;
}

.mchc .mchc-product__link:hover,
.mchc .mchc-product__link:focus-visible {
	border-color: var(--mchc-lime);
	color: #fff;
}

.mchc .mchc-product__link:focus-visible {
	outline: 2px solid var(--mchc-lime);
	outline-offset: 2px;
}

.mchc .mchc-product__media {
	display: flex;
	align-items: center;
	justify-content: center;
	aspect-ratio: 1 / 1;
	padding: 10%;
	overflow: hidden;
	background: #fff;
}

.mchc .mchc-product__media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
	border-radius: 0;
	mix-blend-mode: multiply;
	transition: transform 0.5s ease;
}

.mchc .mchc-product__link:hover .mchc-product__media img {
	transform: scale(1.06);
}

.mchc .mchc-product__body {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 12px 14px 14px;
}

.mchc .mchc-product__cat {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-family: var(--body-fonts);
	font-size: 12px;
	line-height: 1.4;
	letter-spacing: 1.5px;
	text-transform: uppercase;
	color: rgba(255, 255, 255, 0.6);
}

.mchc .mchc-product__name {
	display: -webkit-box;
	min-height: 2.6em;
	overflow: hidden;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	font-family: var(--title-fonts);
	font-size: 16px;
	font-weight: 500;
	line-height: 1.3;
	text-transform: uppercase;
	color: #fff;
	transition: color 0.3s ease;
}

.mchc .mchc-product__link:hover .mchc-product__name {
	color: var(--mchc-lime);
}

.mchc .mchc-product__price {
	font-family: var(--body-fonts);
	font-size: 18px;
	font-weight: 500;
	line-height: 1.3;
	color: var(--mchc-lime);
}

.mchc .mchc-product__price del {
	margin-right: 6px;
	font-size: 0.8em;
	color: rgba(255, 255, 255, 0.55);
}

.mchc .mchc-product__price ins {
	text-decoration: none;
}

/* Outlined background word above the tiles. */
.mchc .mchc-watermark {
	position: absolute;
	z-index: 0;
	top: 0;
	right: -4px;
	transform: translateY(-78%);
	font-family: var(--title-fonts);
	font-size: clamp(64px, 8.5vw, 132px);
	font-weight: 700;
	line-height: 1;
	letter-spacing: 2px;
	text-transform: uppercase;
	white-space: nowrap;
	color: transparent;
	-webkit-text-stroke: 1px rgba(227, 255, 4, 0.35);
	pointer-events: none;
	user-select: none;
}

/* Tablet / phone: the products take the photo's place, in a box of the photo's shape. */
@media (max-width: 1023px) {
	.mchc .mchc-products-layer {
		position: relative;
		inset: auto;
		flex: 1 0 auto;
		aspect-ratio: 2560 / 1777;
		pointer-events: auto;
	}

	/* Spare height (shorter copy than slide 1) goes to the products, not under the button. */
	.mchc .mchc-slide--products > .container {
		flex-grow: 0;
	}

	.mchc .mchc-products-layer > .container {
		justify-content: center;
		padding-top: 32px;
		padding-bottom: 72px;
	}

	.mchc .mchc-products {
		width: 100%;
		max-width: 640px;
	}

	.mchc .mchc-products--3 .mchc-product:nth-child(2) {
		top: -16px;
	}

	.mchc .mchc-watermark {
		right: auto;
		left: 50%;
		transform: translate(-50%, -72%);
		font-size: 15vw;
	}
}

@media (max-width: 575px) {
	.mchc .mchc-products-layer > .container {
		padding-top: 16px;
		padding-bottom: 56px;
	}

	.mchc .mchc-products__list {
		gap: 10px;
	}

	.mchc .mchc-products--3 .mchc-product:nth-child(2) {
		top: -10px;
	}

	.mchc .mchc-products--3 .mchc-product:nth-child(2)::before {
		inset: 8px -8px -8px 8px;
	}

	.mchc .mchc-product__body {
		gap: 2px;
		padding: 8px 8px 10px;
	}

	.mchc .mchc-product__cat {
		display: none;
	}

	.mchc .mchc-product__name {
		font-size: 12px;
	}

	.mchc .mchc-product__price {
		font-size: 14px;
	}
}

/* ---------- Arrows and bullets ---------- */

/* Gymnax styles every [type="button"]; reset it for the carousel controls. */
.mchc .mchc-arrow[type="button"],
.mchc .mchc-dot[type="button"] {
	margin: 0;
	padding: 0;
	border-radius: 0;
	box-shadow: none;
	font-size: 0;
	line-height: 0;
	letter-spacing: 0;
	text-transform: none;
	cursor: pointer;
}

.mchc .mchc-arrow[type="button"] {
	position: absolute;
	z-index: 6;
	bottom: var(--mchc-nav-bottom);
	display: flex !important; /* Slick's jQuery .show() writes an inline display: inline-block. */
	align-items: center;
	justify-content: center;
	width: var(--mchc-nav);
	height: var(--mchc-nav);
	overflow: hidden;
	background: rgba(10, 12, 0, 0.55);
	border: 1px solid rgba(227, 255, 4, 0.6);
	color: var(--mchc-lime);
	transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.mchc .mchc-arrow[type="button"]:focus {
	background: rgba(10, 12, 0, 0.55);
	color: var(--mchc-lime);
}

.mchc .mchc-arrow[type="button"]:hover,
.mchc .mchc-arrow[type="button"]:focus-visible {
	background: var(--mchc-lime);
	border-color: var(--mchc-lime);
	color: var(--mchc-dark);
}

.mchc .mchc-arrow[type="button"]:focus-visible,
.mchc .mchc-dot[type="button"]:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 3px;
}

.mchc .mchc-arrow svg {
	display: block;
	width: 22px;
	height: 22px;
}

/* Below 1440px the arrows sit beside the bullets, bottom centre. */
.mchc .mchc-arrow--prev[type="button"] {
	left: calc(50% - var(--mchc-dots-w) / 2 - 20px - var(--mchc-nav));
}

.mchc .mchc-arrow--next[type="button"] {
	right: calc(50% - var(--mchc-dots-w) / 2 - 20px - var(--mchc-nav));
}

/* From 1440px there is room in the page margin: arrows at the sides, vertically centred. */
@media (min-width: 1440px) {
	.mchc .mchc-arrow[type="button"] {
		top: 50%;
		bottom: auto;
		margin-top: calc(var(--mchc-nav) / -2);
	}

	.mchc .mchc-arrow--prev[type="button"] {
		left: 16px;
	}

	.mchc .mchc-arrow--next[type="button"] {
		right: 16px;
	}
}

.mchc .mchc-dots {
	position: absolute;
	z-index: 6;
	bottom: var(--mchc-nav-bottom);
	left: 50%;
	display: flex;
	align-items: center;
	gap: var(--mchc-dot-gap);
	height: var(--mchc-nav);
	margin: 0;
	padding: 0;
	list-style: none;
	transform: translateX(-50%);
}

.mchc .mchc-dots li {
	display: flex;
	margin: 0;
	padding: 0;
	line-height: 0;
}

.mchc .mchc-dot[type="button"] {
	position: relative;
	display: block;
	width: var(--mchc-dot);
	height: var(--mchc-dot);
	overflow: visible;
	background: rgba(255, 255, 255, 0.55);
	border: 0;
	transition: width 0.35s ease, background-color 0.35s ease;
}

/* Bigger tap target than the 10px square. */
.mchc .mchc-dot[type="button"]::after {
	content: "";
	position: absolute;
	inset: -12px -6px;
}

.mchc .mchc-dot[type="button"]:hover,
.mchc .mchc-dot[type="button"]:focus {
	background: #fff;
	color: inherit;
}

.mchc .slick-active > .mchc-dot[type="button"] {
	width: var(--mchc-dot-active);
	background: var(--mchc-lime);
}

.mchc .mchc-dot .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
}

@media (max-width: 767px) {
	.mchc {
		--mchc-nav: 40px;
		--mchc-nav-bottom: 12px;
	}
}

/* ---------- Phones (767px and below): photo first, text under it, bullets only ---------- */

@media (max-width: 767px) {
	.mchc {
		container-type: inline-size; /* lets the bullets use the carousel width (cqw) */
	}

	/* The theme puts the text above the photo (column-reverse). Show the photo first, below
	   the transparent header (77px at 576-767px, a little less on narrow phones where the
	   logo shrinks), then the text. */
	.mchc .mchc-slide.pq-banner {
		flex-direction: column;
		padding-top: 77px;
	}

	/* Bullets on the bottom edge of the photo / products box (77px header space + box height),
	   instead of under the text. */
	.mchc .mchc-dots {
		top: calc(77px + 100vw * 1777 / 2560 - 40px);
		top: calc(77px + 100cqw * 1777 / 2560 - 40px);
		bottom: auto;
	}

	/* On a busy photo: solid bullets with a thin dark edge so they read on any image. */
	.mchc .mchc-dot[type="button"] {
		background: #fff;
		box-shadow: 0 0 0 1px rgba(10, 12, 0, 0.5), 0 1px 4px rgba(0, 0, 0, 0.45);
	}

	.mchc .slick-active > .mchc-dot[type="button"] {
		background: var(--mchc-lime);
	}

	.mchc .pq-banner .pq-banner-info {
		padding-top: 28px;
	}

	/* Product slide: the products box keeps the photo's shape, so the heading starts at the
	   same height on every slide; spare height goes under the text. */
	.mchc .mchc-products-layer {
		flex: 0 0 auto;
	}

	.mchc .mchc-slide--products > .container {
		flex-grow: 1;
	}

	/* Bottom space keeps the tiles clear of the bullets. */
	.mchc .mchc-products-layer > .container {
		padding-top: 40px;
		padding-bottom: 56px;
	}

	.mchc .mchc-arrow[type="button"] {
		display: none !important; /* Overrides Slick's inline display; swipe and bullets remain. */
	}
}

@media (max-width: 575px) {
	.mchc .mchc-products-layer > .container {
		padding-top: 28px;
		padding-bottom: 52px;
	}

	.mchc .mchc-watermark {
		font-size: 12vw;
	}
}

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: no-preference) {
	/* Text and tiles rise in when their slide becomes the current one. */
	.mchc .mchc-anim {
		transition: opacity 0.6s ease, transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
		transition-delay: calc(var(--mchc-i, 0) * 90ms + 150ms);
	}

	.mchc .slick-slide:not(.slick-current) .mchc-anim {
		opacity: 0;
		transform: translateY(26px);
		transition-duration: 0.25s;
		transition-delay: 0s;
	}

	/* First paint: the photo wipes in from the right (as the theme's hero did) and the text rises. */
	.mchc .mchc-slide--first .mchc-media {
		animation: mchc-reveal 1.3s cubic-bezier(0.645, 0.045, 0.355, 1) 0.4s backwards;
	}

	.mchc .mchc-slide--first .mchc-anim {
		animation: mchc-rise 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) backwards;
		animation-delay: calc(var(--mchc-i, 0) * 120ms + 200ms);
	}
}

@keyframes mchc-reveal {
	from {
		opacity: 0;
		transform: translateX(5%);
		clip-path: inset(0 0 0 100%);
	}
}

@keyframes mchc-rise {
	from {
		opacity: 0;
		transform: translateY(26px);
	}
}
