/**
 * Mafron Category Coverflow.
 *
 * Tokens fall back to sensible values, so the carousel looks right on any
 * theme, and inherits the Mafron palette when the theme provides it.
 *
 * Order: tokens, no-JS fallback, stage, card, chrome, states, responsive.
 */

/* ==========================================================================
   1. Tokens
   ========================================================================== */

.mafcf {
	--mafcf-card-w: min(var(--mafcf-w, 340px), 78vw);
	--mafcf-card-h: calc(var(--mafcf-card-w) * 1.32);

	--mafcf-gold: var(--maf-gold, #c08d2d);
	--mafcf-gold-600: var(--maf-gold-600, #a8761f);
	--mafcf-ink: var(--maf-ink, #171717);
	--mafcf-ink-2: var(--maf-ink-2, #3d3d3d);
	--mafcf-muted: var(--maf-muted, #6e6e6e);
	--mafcf-bg: var(--maf-bg, #fff);
	--mafcf-line: var(--maf-line, #ece5d9);
	--mafcf-radius: var(--maf-radius, 8px);
	--mafcf-shadow: var(--maf-shadow, 0 18px 44px rgba(28, 28, 28, .09));
	--mafcf-shadow-lg: var(--maf-shadow-lg, 0 30px 70px rgba(28, 28, 28, .14));
	--mafcf-display: var(--maf-display, inherit);

	position: relative;
	margin: 0 auto;
	max-width: 100%;
}

.mafcf *,
.mafcf *::before,
.mafcf *::after { box-sizing: border-box; }

.mafcf-sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.mafcf__head {
	text-align: center;
	margin-bottom: 34px;
}

.mafcf__eyebrow {
	margin: 0 0 8px;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: .16em;
	text-transform: uppercase;
	color: var(--mafcf-gold-600);
}

.mafcf__heading {
	margin: 0;
	font-family: var(--mafcf-display);
	font-size: clamp(28px, 3.4vw, 40px);
	line-height: 1.15;
	letter-spacing: -.02em;
	color: var(--mafcf-ink);
}

.mafcf-empty {
	padding: 14px 18px;
	border: 1px dashed var(--mafcf-line);
	border-radius: var(--mafcf-radius);
	color: var(--mafcf-muted);
	font-size: 14px;
}

/* ==========================================================================
   2. Viewport — a scrollable row until the script upgrades it
   ========================================================================== */

.mafcf__viewport {
	position: relative;
	perspective: 1500px;
	perspective-origin: 50% 45%;
}

.mafcf__track {
	display: flex;
	gap: 20px;
	list-style: none;
	margin: 0;
	padding: 4px 4px 18px;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	transform-style: preserve-3d;
}

.mafcf__item {
	flex: 0 0 var(--mafcf-card-w);
	width: var(--mafcf-card-w);
	height: var(--mafcf-card-h);
	scroll-snap-align: center;
	transform-style: preserve-3d;
}

.mafcf.is-ready .mafcf__track {
	display: block;
	overflow: visible;
	height: var(--mafcf-card-h);
	padding: 0;
	margin: 26px 0 40px;
}

.mafcf.is-ready .mafcf__item {
	position: absolute;
	top: 0;
	left: 50%;
	margin-left: calc(var(--mafcf-card-w) / -2);
	will-change: transform, opacity;
	transition: transform .55s cubic-bezier(.22, .61, .36, 1),
		opacity .55s cubic-bezier(.22, .61, .36, 1);
}

/* Dragging follows the pointer, so no easing while a drag is in flight. */
.mafcf.is-dragging .mafcf__item { transition: none; }

.mafcf.is-dragging { cursor: grabbing; }
.mafcf.is-ready .mafcf__viewport { cursor: grab; touch-action: pan-y; }

/* ==========================================================================
   3. Card
   ========================================================================== */

.mafcf__card {
	height: 100%;
	border-radius: calc(var(--mafcf-radius) + 4px);
	background: var(--mafcf-bg);
	border: 1px solid var(--mafcf-line);
	box-shadow: var(--mafcf-shadow);
	overflow: hidden;
	transition: box-shadow .45s ease, border-color .45s ease;
}

.mafcf--reflect .is-active .mafcf__card {
	-webkit-box-reflect: below 12px linear-gradient(transparent 64%, rgba(0, 0, 0, .18));
}

.is-active .mafcf__card {
	box-shadow: var(--mafcf-shadow-lg);
	border-color: color-mix(in srgb, var(--mafcf-gold) 34%, var(--mafcf-line));
}

.mafcf__link {
	display: flex;
	flex-direction: column;
	height: 100%;
	color: inherit;
	text-decoration: none;
}

.mafcf__link:focus-visible {
	outline: 2px solid var(--mafcf-gold);
	outline-offset: -2px;
}

.mafcf__media {
	position: relative;
	display: block;
	flex: 1 1 auto;
	min-height: 0;
	overflow: hidden;
	background: #f2ede4;
}

.mafcf__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transform: scale(1.02);
	transition: transform .7s cubic-bezier(.22, .61, .36, 1);
}

.is-active .mafcf__link:hover .mafcf__img { transform: scale(1.07); }

/* A soft top-light pass, plus a scrim so the icon badge stays legible. */
.mafcf__sheen {
	position: absolute;
	inset: 0;
	background:
		linear-gradient(180deg, rgba(255, 255, 255, .22) 0%, rgba(255, 255, 255, 0) 42%),
		linear-gradient(180deg, rgba(23, 23, 23, 0) 55%, rgba(23, 23, 23, .38) 100%);
	pointer-events: none;
}

.mafcf__body {
	position: relative;
	flex: 0 0 auto;
	display: block;
	padding: 22px 24px 24px;
	text-align: left;
}

.mafcf__icon {
	position: absolute;
	top: -26px;
	left: 24px;
	display: grid;
	place-items: center;
	width: 52px;
	height: 52px;
	border-radius: 50%;
	background: var(--mafcf-gold);
	color: #fff;
	box-shadow: 0 10px 22px rgba(192, 141, 45, .34);
}

.mafcf__icon svg { width: 24px; height: 24px; }

.mafcf__title {
	display: block;
	margin: 12px 0 6px;
	font-family: var(--mafcf-display);
	font-size: 21px;
	font-weight: 800;
	line-height: 1.25;
	letter-spacing: -.01em;
	color: var(--mafcf-ink);
}

.mafcf__text {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	font-size: 14.5px;
	line-height: 1.6;
	color: var(--mafcf-muted);
}

.mafcf__count {
	display: block;
	margin-top: 10px;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: .1em;
	text-transform: uppercase;
	color: var(--mafcf-gold-600);
}

.mafcf__cta {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin-top: 16px;
	font-size: 14px;
	font-weight: 700;
	color: var(--mafcf-gold-600);
}

.mafcf__cta svg {
	width: 18px;
	height: 18px;
	transition: transform .3s ease;
}

.mafcf__link:hover .mafcf__cta svg { transform: translateX(4px); }

/* Off-centre cards are decoration: dim them and keep them out of the tab order. */
.mafcf.is-ready .mafcf__item:not(.is-active) .mafcf__card {
	filter: saturate(.82);
}

.mafcf.is-ready .mafcf__item.is-hidden {
	visibility: hidden;
	pointer-events: none;
}

/* ==========================================================================
   4. Chrome — arrows and dots
   ========================================================================== */

.mafcf__nav {
	position: absolute;
	top: 50%;
	z-index: 60;
	display: grid;
	place-items: center;
	width: 46px;
	height: 46px;
	margin: 0;
	padding: 0;
	transform: translateY(-50%);
	border: 1px solid var(--mafcf-line);
	border-radius: 50%;
	background: var(--mafcf-bg);
	color: var(--mafcf-ink);
	box-shadow: 0 8px 20px rgba(28, 28, 28, .12);
	cursor: pointer;
	transition: background .25s ease, color .25s ease, transform .25s ease, opacity .25s ease;
}

.mafcf__nav svg { width: 20px; height: 20px; }
.mafcf__nav--prev { left: 8px; }
.mafcf__nav--next { right: 8px; }

.mafcf__nav:hover:not(:disabled) {
	background: var(--mafcf-gold);
	border-color: var(--mafcf-gold);
	color: #fff;
}

.mafcf__nav:focus-visible {
	outline: 2px solid var(--mafcf-gold);
	outline-offset: 3px;
}

.mafcf__nav:disabled {
	opacity: .35;
	cursor: default;
}

.mafcf__dots {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 10px;
	margin-top: 6px;
}

.mafcf__dot {
	width: 9px;
	height: 9px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: color-mix(in srgb, var(--mafcf-ink) 22%, transparent);
	cursor: pointer;
	transition: width .3s ease, background .3s ease;
}

.mafcf__dot[aria-current="true"] {
	width: 26px;
	border-radius: 5px;
	background: var(--mafcf-gold);
}

.mafcf__dot:focus-visible {
	outline: 2px solid var(--mafcf-gold);
	outline-offset: 3px;
}

/* ==========================================================================
   5. Responsive and motion preferences
   ========================================================================== */

@media (max-width: 782px) {
	.mafcf__nav--prev { left: 0; }
	.mafcf__nav--next { right: 0; }
}

@media (max-width: 560px) {
	.mafcf {
		--mafcf-card-w: min(var(--mafcf-w, 340px), 82vw);
		--mafcf-card-h: calc(var(--mafcf-card-w) * 1.42);
	}

	.mafcf__nav {
		width: 40px;
		height: 40px;
	}

	.mafcf__body { padding: 20px 20px 22px; }
	.mafcf__title { font-size: 19px; }
}

@media (prefers-reduced-motion: reduce) {
	.mafcf.is-ready .mafcf__item,
	.mafcf__img,
	.mafcf__cta svg {
		transition-duration: .01ms !important;
	}
}
