/**
 * Perfamix Focus Product Carousel
 *
 * Centre-stage product carousel with blur/scale/opacity hierarchy.
 * All rules scoped behind .pfmx-focus-carousel.
 *
 * @package PerfamixChild
 */

/* ── Custom-property defaults ─────────────────────────────────── */

.pfmx-focus-carousel {
	--pfmx-fc-stage-bg: transparent;
	--pfmx-fc-stage-top-space: 112px;
	--pfmx-fc-img-height: 400px;
	--pfmx-fc-img-max-w: 82%;
	--pfmx-fc-inactive-blur: 10px;
	--pfmx-fc-inactive-opacity: 0.30;
	--pfmx-fc-inactive-scale: 0.87;
	--pfmx-fc-shadow: none;
	--pfmx-fc-speed: 700ms;
	--pfmx-fc-easing: cubic-bezier(.22, 1, .36, 1);
	--pfmx-fc-media-swap-speed: 620ms;

	/* Title / price */
	--pfmx-fc-title-color: #1a1a1a;
	--pfmx-fc-price-color: #333;

	/* Action button */
	--pfmx-fc-btn-bg: transparent;
	--pfmx-fc-btn-color: #1a1a1a;
	--pfmx-fc-btn-border: #1a1a1a;
	--pfmx-fc-btn-radius: 4px;
	--pfmx-fc-btn-bg-hover: #1a1a1a;
	--pfmx-fc-btn-color-hover: #fff;
	--pfmx-fc-btn-border-hover: #1a1a1a;

	/* Arrows */
	--pfmx-fc-arrow-bg: rgba(255, 255, 255, 0.7);
	--pfmx-fc-arrow-color: #1a1a1a;
	--pfmx-fc-arrow-border: rgba(0, 0, 0, 0.08);
	--pfmx-fc-arrow-size: 44px;
	--pfmx-fc-arrow-edge-inset: 12px;

	/* Progress rail */
	--pfmx-fc-rail-color: rgba(0, 0, 0, 0.10);
	--pfmx-fc-rail-drag-color: #1a1a1a;
	--pfmx-fc-rail-width: 320px;
	--pfmx-fc-rail-thickness: 2px;

	/* Spacing */
	--pfmx-fc-info-gap: 20px;
	--pfmx-fc-info-min-h: 120px;

	position: relative;
	width: 100%;
	min-width: 0;
	overflow: hidden;
	isolation: isolate;
	padding-block-start: var(--pfmx-fc-stage-top-space);
	padding-block-end: 8px;
	background: var(--pfmx-fc-stage-bg);
}

/* ── Progressive enhancement: hide non-active slides until JS ── */

.pfmx-focus-carousel:not(.pfmx-fc-ready) .swiper-slide:not(:first-child) {
	visibility: hidden;
	position: absolute;
	pointer-events: none;
}

.pfmx-focus-carousel:not(.pfmx-fc-ready) .pfmx-fc-arrows,
.pfmx-focus-carousel:not(.pfmx-fc-ready) .pfmx-fc-progress,
.pfmx-focus-carousel:not(.pfmx-fc-ready) .pfmx-fc-autoplay-btn {
	display: none;
}

.pfmx-focus-carousel:not(.pfmx-fc-ready) .swiper-slide:first-child {
	display: flex;
	flex-direction: column;
	align-items: center;
}

/* ── Swiper container ─────────────────────────────────────────── */

.pfmx-fc-swiper {
	position: relative;
	width: 100%;
	min-width: 0;
	max-width: 100%;
	margin-inline: auto;
	overflow: visible;
}

.pfmx-fc-swiper>.swiper-wrapper {
	position: relative;
	z-index: 1;
	display: flex;
	width: 100%;
	height: 100%;
	box-sizing: content-box;
	transition-property: transform;
	transform: translate3d(0, 0, 0);
	align-items: flex-start;
}

/* Goldsmith's public stylesheet styles `.goldsmith-swiper-wrapper`, while the
 * Elementor editor also supplies the standard `.swiper-wrapper` layout. Own
 * the essential flex rule here so editor and public page render identically. */
.pfmx-fc-swiper>.swiper-wrapper>.swiper-slide {
	position: relative;
	flex-shrink: 0;
	width: 100%;
	height: auto;
}

/* ── Slide ────────────────────────────────────────────────────── */

.pfmx-fc-slide {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	-webkit-user-select: none;
	user-select: none;
}

/* ── Image stage ──────────────────────────────────────────────── */

.pfmx-fc-img-stage {
	position: relative;
	width: 100%;
	height: var(--pfmx-fc-img-height);
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.pfmx-fc-img-stage .pfmx-fc-product-media {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
}

.pfmx-fc-image-stack {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	transition:
		filter var(--pfmx-fc-speed) var(--pfmx-fc-easing),
		opacity var(--pfmx-fc-speed) var(--pfmx-fc-easing),
		transform var(--pfmx-fc-speed) var(--pfmx-fc-easing);
	filter: blur(var(--pfmx-fc-inactive-blur));
	opacity: var(--pfmx-fc-inactive-opacity);
	transform: scale(var(--pfmx-fc-inactive-scale));
}

.pfmx-fc-img-stage .pfmx-fc-product-img {
	position: absolute;
	inset: 0;
	margin: auto;
	max-width: var(--pfmx-fc-img-max-w);
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	transition:
		opacity var(--pfmx-fc-media-swap-speed) var(--pfmx-fc-easing),
		transform var(--pfmx-fc-media-swap-speed) var(--pfmx-fc-easing),
		filter var(--pfmx-fc-media-swap-speed) var(--pfmx-fc-easing);
	box-shadow: var(--pfmx-fc-shadow);
	backface-visibility: hidden;
}

.pfmx-fc-product-img--primary {
	opacity: 1;
	filter: blur(0);
	transform: translateY(0) scale(1);
}

.pfmx-fc-product-img--secondary {
	opacity: 0;
	filter: blur(4px);
	transform: translateY(5px) scale(1.035);
}

/* Active slide image stack — no blur, full opacity, full scale */
.pfmx-fc-swiper .swiper-slide-active .pfmx-fc-image-stack {
	filter: blur(0);
	opacity: 1;
	transform: scale(1);
}

/* More distant slides: even quieter */
.pfmx-fc-swiper .swiper-slide:not(.swiper-slide-active):not(.swiper-slide-prev):not(.swiper-slide-next) .pfmx-fc-image-stack {
	opacity: calc(var(--pfmx-fc-inactive-opacity) * 0.6);
}

/* Native product-card behaviour: show the first gallery image on hover. */
@media (hover: hover) and (pointer: fine) {
	.pfmx-fc-swiper .swiper-slide-active:hover .pfmx-fc-gallery-ready .pfmx-fc-product-img--primary,
	.pfmx-fc-swiper .swiper-slide-active:focus-within .pfmx-fc-gallery-ready .pfmx-fc-product-img--primary,
	.pfmx-fc-single:hover .pfmx-fc-gallery-ready .pfmx-fc-product-img--primary,
	.pfmx-fc-single:focus-within .pfmx-fc-gallery-ready .pfmx-fc-product-img--primary {
		opacity: 0;
		filter: blur(1.5px);
		transform: translateY(-2px) scale(0.985);
	}

	.pfmx-fc-swiper .swiper-slide-active:hover .pfmx-fc-gallery-ready .pfmx-fc-product-img--secondary,
	.pfmx-fc-swiper .swiper-slide-active:focus-within .pfmx-fc-gallery-ready .pfmx-fc-product-img--secondary,
	.pfmx-fc-single:hover .pfmx-fc-gallery-ready .pfmx-fc-product-img--secondary,
	.pfmx-fc-single:focus-within .pfmx-fc-gallery-ready .pfmx-fc-product-img--secondary {
		opacity: 1;
		filter: blur(0);
		transform: translateY(0) scale(1);
	}
}

/* ── Product info ─────────────────────────────────────────────── */

.pfmx-fc-info {
	width: 100%;
	max-width: 320px;
	min-height: var(--pfmx-fc-info-min-h);
	padding-block-start: var(--pfmx-fc-info-gap);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	opacity: 0;
	visibility: hidden;
	transform: translateY(8px);
	transition:
		opacity var(--pfmx-fc-speed) var(--pfmx-fc-easing),
		visibility var(--pfmx-fc-speed) var(--pfmx-fc-easing),
		transform var(--pfmx-fc-speed) var(--pfmx-fc-easing);
}

.pfmx-fc-swiper .swiper-slide-active .pfmx-fc-info {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

/* Title */
.pfmx-fc-title {
	margin: 0;
	font-size: 15px;
	font-weight: 500;
	line-height: 1.4;
	color: var(--pfmx-fc-title-color);
	letter-spacing: 0.02em;
	overflow: hidden;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

.pfmx-fc-title a {
	color: inherit;
	text-decoration: none;
}

.pfmx-fc-title a:hover,
.pfmx-fc-title a:focus-visible {
	text-decoration: underline;
}

/* Price */
.pfmx-fc-price {
	font-size: 14px;
	font-weight: 400;
	color: var(--pfmx-fc-price-color);
	line-height: 1.4;
}

.pfmx-fc-price del {
	opacity: 0.55;
	margin-inline-end: 4px;
}

.pfmx-fc-price ins {
	text-decoration: none;
	font-weight: 600;
}

/* ── Action button ────────────────────────────────────────────── */

.pfmx-fc-action {
	margin-block-start: 4px;
	opacity: 0;
	visibility: hidden;
	filter: blur(5px);
	transform: translateY(11px) scale(0.98);
	transition:
		opacity 420ms var(--pfmx-fc-easing),
		filter 520ms var(--pfmx-fc-easing),
		transform 520ms var(--pfmx-fc-easing),
		visibility 0s linear 520ms;
}

/* Desktop hover/focus reveal on active card */
.pfmx-fc-swiper .swiper-slide-active:hover .pfmx-fc-action,
.pfmx-fc-swiper .swiper-slide-active:focus-within .pfmx-fc-action {
	opacity: 1;
	visibility: visible;
	filter: blur(0);
	transform: translateY(0) scale(1);
	transition-delay: 0s;
}

/* Touch/mobile: always visible */
@media (hover: none) {
	.pfmx-fc-swiper .swiper-slide-active .pfmx-fc-action {
		opacity: 1;
		visibility: visible;
		filter: none;
		transform: translateY(0) scale(1);
		transition-delay: 0s;
	}
}

.pfmx-fc-action .button,
.pfmx-fc-action a.button,
.pfmx-fc-action .add_to_cart_button,
.pfmx-fc-action .product_type_variable,
.pfmx-fc-action .product_type_external,
.pfmx-fc-action .product_type_grouped {
	display: inline-block;
	position: relative;
	overflow: hidden;
	isolation: isolate;
	z-index: 0;
	padding: 9px 24px;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	line-height: 1.4;
	color: var(--pfmx-fc-btn-color);
	background: var(--pfmx-fc-btn-bg);
	border: 1px solid var(--pfmx-fc-btn-border);
	border-radius: var(--pfmx-fc-btn-radius);
	cursor: pointer;
	text-decoration: none;
	transition:
		color 380ms var(--pfmx-fc-easing),
		border-color 380ms var(--pfmx-fc-easing),
		box-shadow 420ms var(--pfmx-fc-easing),
		transform 420ms var(--pfmx-fc-easing);
}

.pfmx-fc-action .button::before,
.pfmx-fc-action a.button::before {
	content: "";
	position: absolute;
	inset: -1px;
	z-index: -1;
	border-radius: inherit;
	background: var(--pfmx-fc-btn-bg-hover);
	transform: scaleX(0);
	transform-origin: left center;
	transition: transform 520ms var(--pfmx-fc-easing);
}

.pfmx-fc-action .button:hover,
.pfmx-fc-action .button:focus-visible,
.pfmx-fc-action a.button:hover,
.pfmx-fc-action a.button:focus-visible {
	color: var(--pfmx-fc-btn-color-hover);
	background: var(--pfmx-fc-btn-bg);
	border-color: var(--pfmx-fc-btn-border-hover);
	box-shadow: 0 10px 26px rgba(0, 0, 0, 0.12);
	transform: translateY(-1px);
}

.pfmx-fc-action .button:hover::before,
.pfmx-fc-action .button:focus-visible::before,
.pfmx-fc-action a.button:hover::before,
.pfmx-fc-action a.button:focus-visible::before {
	transform: scaleX(1);
}

.pfmx-fc-action .button:focus-visible {
	outline: 2px solid var(--pfmx-fc-btn-border);
	outline-offset: 2px;
}

.pfmx-fc-action .button:active {
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
	transform: translateY(0) scale(0.985);
}

@media (hover: none) {
	.pfmx-fc-action .button:active {
		color: var(--pfmx-fc-btn-color-hover);
	}

	.pfmx-fc-action .button:active::before {
		transform: scaleX(1);
	}
}

/* WC loading state */
.pfmx-fc-action .button.loading:not(.goldsmith_ajax_add_to_cart)::after {
	content: "";
	display: inline-block;
	width: 14px;
	height: 14px;
	margin-inline-start: 8px;
	border: 2px solid currentColor;
	border-block-start-color: transparent;
	border-radius: 50%;
	vertical-align: middle;
	animation: pfmx-fc-spin 0.6s linear infinite;
}

@keyframes pfmx-fc-spin {
	to {
		transform: rotate(360deg);
	}
}

/* WC added state */
.pfmx-fc-action .button.added {
	opacity: 0.7;
}

/* ── Inactive focusability — CSS safety net ───────────────────── */

.pfmx-fc-slide:not(.swiper-slide-active) .pfmx-fc-info a,
.pfmx-fc-slide:not(.swiper-slide-active) .pfmx-fc-info button,
.pfmx-fc-slide:not(.swiper-slide-active) .pfmx-fc-action a,
.pfmx-fc-slide:not(.swiper-slide-active) .pfmx-fc-action button {
	pointer-events: none;
}

.pfmx-fc-slide:not(.swiper-slide-active) .pfmx-fc-img-stage a {
	pointer-events: none;
}

/* ── Arrow controls ───────────────────────────────────────────── */

.pfmx-fc-arrows {
	position: absolute;
	inset-block-start: var(--pfmx-fc-stage-top-space);
	inset-inline-start: 0;
	inset-inline-end: 0;
	height: var(--pfmx-fc-img-height);
	pointer-events: none;
	z-index: 5;
}

.pfmx-fc-arrow {
	position: absolute;
	inset-block-start: 50%;
	transform: translateY(-50%);
	display: flex;
	align-items: center;
	justify-content: center;
	width: var(--pfmx-fc-arrow-size);
	height: var(--pfmx-fc-arrow-size);
	min-width: 44px;
	min-height: 44px;
	padding: 0;
	margin: 0;
	border: 1px solid var(--pfmx-fc-arrow-border);
	border-radius: 50%;
	background: var(--pfmx-fc-arrow-bg);
	color: var(--pfmx-fc-arrow-color);
	cursor: pointer;
	pointer-events: auto;
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	transition: background 200ms ease, border-color 200ms ease, opacity 200ms ease;
	z-index: 6;
	-webkit-appearance: none;
	appearance: none;
	outline: none;
	font-family: inherit;
	line-height: 1;
}

.pfmx-fc-arrow:hover {
	background: rgba(255, 255, 255, 0.9);
	border-color: rgba(0, 0, 0, 0.15);
}

.pfmx-fc-arrow:focus-visible {
	outline: 2px solid var(--pfmx-fc-arrow-color);
	outline-offset: 2px;
}

.pfmx-fc-arrow--prev {
	inset-inline-start: var(--pfmx-fc-arrow-edge-inset);
}

.pfmx-fc-arrow--next {
	inset-inline-end: var(--pfmx-fc-arrow-edge-inset);
}

.pfmx-fc-arrow svg {
	width: 18px;
	height: 18px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* RTL arrow direction handled by logical properties; SVG mirrors via transform */
[dir="rtl"] .pfmx-fc-arrow svg {
	transform: scaleX(-1);
}

.pfmx-fc-arrow.swiper-button-disabled {
	opacity: 0.3;
	cursor: default;
	pointer-events: none;
}

/* ── Controls bar (progress + autoplay) ───────────────────────── */

.pfmx-fc-controls {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding-block: 16px 8px;
}

/* ── Autoplay toggle ──────────────────────────────────────────── */

.pfmx-fc-autoplay-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	min-width: 44px;
	min-height: 44px;
	padding: 0;
	margin: 0;
	border: none;
	border-radius: 50%;
	background: transparent;
	color: var(--pfmx-fc-arrow-color);
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	outline: none;
	flex-shrink: 0;
}

.pfmx-fc-autoplay-btn:focus-visible {
	outline: 2px solid var(--pfmx-fc-arrow-color);
	outline-offset: 2px;
}

.pfmx-fc-autoplay-btn svg {
	width: 16px;
	height: 16px;
	fill: currentColor;
}

.pfmx-fc-autoplay-btn .pfmx-fc-icon-play {
	display: none;
}

.pfmx-fc-autoplay-btn .pfmx-fc-icon-pause {
	display: block;
}

.pfmx-fc-autoplay-btn[data-pfmx-state="paused"] .pfmx-fc-icon-play {
	display: block;
}

.pfmx-fc-autoplay-btn[data-pfmx-state="paused"] .pfmx-fc-icon-pause {
	display: none;
}

/* ── Progress rail (Swiper scrollbar) ─────────────────────────── */

.pfmx-fc-progress {
	position: relative;
	width: var(--pfmx-fc-rail-width);
	max-width: 80%;
	height: 44px;
	/* touch hit area */
	display: flex;
	align-items: center;
	cursor: pointer;
}

.pfmx-fc-progress .swiper-scrollbar {
	position: relative;
	width: 100%;
	height: var(--pfmx-fc-rail-thickness);
	background: var(--pfmx-fc-rail-color);
	border-radius: 99px;
	overflow: visible;
}

.pfmx-fc-progress .swiper-scrollbar-drag {
	height: 100%;
	background: var(--pfmx-fc-rail-drag-color);
	border-radius: 99px;
	cursor: grab;
	position: relative;
}

.pfmx-fc-progress .swiper-scrollbar-drag::before {
	content: "";
	position: absolute;
	inset-block-start: 50%;
	inset-inline-start: 0;
	inset-inline-end: 0;
	height: 44px;
	transform: translateY(-50%);
}

.pfmx-fc-progress .swiper-scrollbar-drag:active {
	cursor: grabbing;
}

/* ── Editor placeholder ───────────────────────────────────────── */

.pfmx-fc-editor-notice {
	padding: 40px 20px;
	text-align: center;
	color: #666;
	font-size: 14px;
	line-height: 1.6;
	background: #f9f9f9;
	border: 1px dashed #ccc;
	border-radius: 6px;
}

.pfmx-fc-editor-notice strong {
	display: block;
	margin-block-end: 6px;
	font-size: 15px;
	color: #333;
}

/* ── Single product (no carousel) ─────────────────────────────── */

.pfmx-fc-single {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	padding: 20px;
}

.pfmx-fc-single .pfmx-fc-img-stage {
	max-width: 400px;
}

.pfmx-fc-single .pfmx-fc-image-stack {
	filter: none;
	opacity: 1;
	transform: none;
}

.pfmx-fc-single .pfmx-fc-info {
	opacity: 1;
	visibility: visible;
	transform: none;
}

.pfmx-fc-single .pfmx-fc-action {
	opacity: 1;
	visibility: visible;
	filter: none;
	transform: none;
	transition-delay: 0s;
}

/* ── Mobile arrows hide ───────────────────────────────────────── */

.pfmx-fc-arrows--hide-mobile .pfmx-fc-arrow {
	display: flex;
}

@media (max-width: 767px) {
	.pfmx-fc-arrows--hide-mobile .pfmx-fc-arrow {
		display: none;
	}
}

/* ── Responsive defaults ──────────────────────────────────────── */

@media (max-width: 1024px) {
	.pfmx-focus-carousel {
		--pfmx-fc-stage-top-space: 52px;
		--pfmx-fc-img-height: 320px;
		--pfmx-fc-img-max-w: 88%;
		--pfmx-fc-inactive-blur: 8px;
		--pfmx-fc-rail-width: 240px;
	}
}

@media (max-width: 767px) {
	.pfmx-focus-carousel {
		--pfmx-fc-stage-top-space: 28px;
		--pfmx-fc-img-height: 260px;
		--pfmx-fc-img-max-w: 92%;
		--pfmx-fc-inactive-blur: 6px;
		--pfmx-fc-rail-width: 180px;
		--pfmx-fc-info-min-h: 100px;
		--pfmx-fc-arrow-edge-inset: 18px;
	}

	/* Keep the carousel concept legible on phones: the adjacent products peek
	 * into the viewport and lean slightly toward the active product. */
	.pfmx-fc-swiper .swiper-slide-prev .pfmx-fc-image-stack {
		opacity: 0.34;
		transform: translateX(10%) scale(var(--pfmx-fc-inactive-scale));
	}

	.pfmx-fc-swiper .swiper-slide-next .pfmx-fc-image-stack {
		opacity: 0.34;
		transform: translateX(-10%) scale(var(--pfmx-fc-inactive-scale));
	}

	[dir="rtl"] .pfmx-fc-swiper .swiper-slide-prev .pfmx-fc-image-stack {
		transform: translateX(-10%) scale(var(--pfmx-fc-inactive-scale));
	}

	[dir="rtl"] .pfmx-fc-swiper .swiper-slide-next .pfmx-fc-image-stack {
		transform: translateX(10%) scale(var(--pfmx-fc-inactive-scale));
	}

	.pfmx-fc-info {
		max-width: 240px;
	}

}

/* ── Reduced motion ───────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {

	.pfmx-fc-image-stack,
	.pfmx-fc-img-stage img,
	.pfmx-fc-info,
	.pfmx-fc-action,
	.pfmx-fc-arrow {
		transition-duration: 0.01ms !important;
	}
}

/* ── Filter fallback ──────────────────────────────────────────── */

@supports not (filter: blur(1px)) {
	.pfmx-fc-image-stack {
		filter: none;
	}
}
