/**
 * Perfamix Shop the Scene / Hotspot Products
 *
 * Two-column scene + product slider with bidirectional hotspot sync.
 * All rules scoped behind .pfmx-hotspot-products.
 *
 * @package PerfamixChild
 */

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

.pfmx-hotspot-products {
	--pfmx-hp-scene-w: 50%;
	--pfmx-hp-panel-w: 50%;
	--pfmx-hp-gap: 0px;
	--pfmx-hp-min-h: 500px;
	--pfmx-hp-scene-ratio: 1 / 1;
	--pfmx-hp-scene-radius: 0px;
	--pfmx-hp-outer-radius: 0px;
	--pfmx-hp-panel-bg: #f7f5f2;
	--pfmx-hp-section-bg: transparent;
	--pfmx-hp-card-max-w: 340px;
	--pfmx-hp-product-image-radius: 8px;
	--pfmx-hp-overlap: 24px;

	/* Scene image */
	--pfmx-hp-scene-fit: cover;
	--pfmx-hp-scene-pos: center center;
	--pfmx-hp-scene-overlay: transparent;
	--pfmx-hp-scene-overlay-opacity: 0;

	/* Hotspots */
	--pfmx-hp-dot-size: 11px;
	--pfmx-hp-hit-size: 44px;
	--pfmx-hp-hit-border-w: 1px;
	--pfmx-hp-hit-border: rgba(255,255,255,0.68);
	--pfmx-hp-hit-border-active: #fff;
	--pfmx-hp-dot-bg: rgba(255,255,255,0.85);
	--pfmx-hp-dot-border: rgba(0,0,0,0.25);
	--pfmx-hp-dot-bg-active: #fff;
	--pfmx-hp-dot-border-active: #1a1a1a;
	--pfmx-hp-outer-ring-color: rgba(255,255,255,0.9);
	--pfmx-hp-outer-ring-size: 8px;
	--pfmx-hp-ring-w: 2px;
	--pfmx-hp-active-scale: 1.15;
	--pfmx-hp-badge-bg: rgba(30,30,30,0.72);
	--pfmx-hp-badge-border: rgba(255,255,255,0.15);
	--pfmx-hp-badge-blur: 8px;
	--pfmx-hp-badge-radius: 6px;
	--pfmx-hp-badge-color: #fff;
	--pfmx-hp-focus-ring: #1a1a1a;

	/* Controls */
	--pfmx-hp-arrow-size: 36px;
	--pfmx-hp-arrow-color: #1a1a1a;
	--pfmx-hp-arrow-bg: rgba(255,255,255,0.7);
	--pfmx-hp-arrow-border: rgba(0,0,0,0.08);
	--pfmx-hp-counter-color: #666;
	--pfmx-hp-rail-bg: rgba(0,0,0,0.1);
	--pfmx-hp-rail-fill: #1a1a1a;
	--pfmx-hp-rail-h: 2px;
	--pfmx-hp-dock-bg: rgba(255,255,255,0.6);
	--pfmx-hp-dock-border: rgba(0,0,0,0.06);
	--pfmx-hp-dock-blur: 12px;
	--pfmx-hp-dock-radius: 12px;
	--pfmx-hp-dock-shadow: 0 2px 12px rgba(0,0,0,0.06);

	position: relative;
	background: var(--pfmx-hp-section-bg);
	border-radius: var(--pfmx-hp-outer-radius);
	overflow: hidden;
}

/* ── Layout ───────────────────────────────────────────────────── */

.pfmx-hp-layout {
	display: flex;
	gap: var(--pfmx-hp-gap);
	min-height: var(--pfmx-hp-min-h);
}

/* ── Scene column ─────────────────────────────────────────────── */

.pfmx-hp-scene {
	position: relative;
	flex: 0 0 var(--pfmx-hp-scene-w);
	max-width: var(--pfmx-hp-scene-w);
	overflow: hidden;
	border-radius: var(--pfmx-hp-scene-radius);
}

.pfmx-hp-picture {
	display: block;
	width: 100%;
	height: 100%;
}

.pfmx-hp-picture img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: var(--pfmx-hp-scene-fit);
	object-position: var(--pfmx-hp-scene-pos);
	aspect-ratio: var(--pfmx-hp-scene-ratio);
}

/* Scene overlay */
.pfmx-hp-scene::after {
	content: "";
	position: absolute;
	inset: 0;
	background: var(--pfmx-hp-scene-overlay);
	opacity: var(--pfmx-hp-scene-overlay-opacity);
	pointer-events: none;
}

/* ── Hotspots container ───────────────────────────────────────── */

.pfmx-hp-hotspots {
	position: absolute;
	inset: 0;
	z-index: 2;
}

/* ── Individual hotspot ───────────────────────────────────────── */

.pfmx-hp-hotspot {
	position: absolute;
	inset-inline-start: var(--pfmx-hp-x);
	top: var(--pfmx-hp-y);
	transform: translate(-50%, -50%);
	width: var(--pfmx-hp-hit-size);
	height: var(--pfmx-hp-hit-size);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	margin: 0;
	border: var(--pfmx-hp-hit-border-w) solid var(--pfmx-hp-hit-border);
	border-radius: 50%;
	background: transparent;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	outline: none;
	z-index: 3;
	transition: border-color 250ms ease;
}

.pfmx-hp-hotspot.is-active {
	border-color: var(--pfmx-hp-hit-border-active);
}

.pfmx-hp-hotspot:focus-visible {
	outline: 2px solid var(--pfmx-hp-focus-ring);
	outline-offset: 2px;
}

/* Visible dot */
.pfmx-hp-hotspot::before {
	content: "";
	width: var(--pfmx-hp-dot-size);
	height: var(--pfmx-hp-dot-size);
	border-radius: 50%;
	background: var(--pfmx-hp-dot-bg);
	border: var(--pfmx-hp-ring-w) solid var(--pfmx-hp-dot-border);
	transition: transform 350ms cubic-bezier(.22,1,.36,1),
	            background 250ms ease,
	            border-color 250ms ease;
	flex-shrink: 0;
}

/* Independently controllable outer ring — no hardcoded black halo. */
.pfmx-hp-hotspot::after {
	content: "";
	position: absolute;
	left: 50%;
	top: 50%;
	width: calc(var(--pfmx-hp-dot-size) + var(--pfmx-hp-outer-ring-size));
	height: calc(var(--pfmx-hp-dot-size) + var(--pfmx-hp-outer-ring-size));
	border: 1px solid var(--pfmx-hp-outer-ring-color);
	border-radius: 50%;
	opacity: 0;
	transform: translate(-50%, -50%) scale(.72);
	pointer-events: none;
	transition: opacity 250ms ease, transform 350ms cubic-bezier(.22,1,.36,1);
}

/* Active state */
.pfmx-hp-hotspot.is-active::before {
	background: var(--pfmx-hp-dot-bg-active);
	border-color: var(--pfmx-hp-dot-border-active);
	transform: scale(var(--pfmx-hp-active-scale));
}

/* Restrained outer-ring pulse — runs at most twice. */
@keyframes pfmx-hp-pulse {
	0% { opacity: .28; transform: translate(-50%, -50%) scale(.72); }
	65% { opacity: .1; }
	100% { opacity: 0; transform: translate(-50%, -50%) scale(1.55); }
}

.pfmx-hp-hotspot.is-active::after {
	opacity: .22;
	transform: translate(-50%, -50%) scale(1);
	animation: pfmx-hp-pulse 1s ease 2;
}

/* Glass ordinal badge */
.pfmx-hp-badge {
	position: absolute;
	top: -4px;
	inset-inline-end: -4px;
	padding: 1px 5px;
	font-size: 9px;
	font-weight: 700;
	line-height: 1.4;
	color: var(--pfmx-hp-badge-color);
	background: var(--pfmx-hp-badge-bg);
	border: 1px solid var(--pfmx-hp-badge-border);
	border-radius: var(--pfmx-hp-badge-radius);
	backdrop-filter: blur(var(--pfmx-hp-badge-blur));
	-webkit-backdrop-filter: blur(var(--pfmx-hp-badge-blur));
	pointer-events: none;
	opacity: 0;
	transform: scale(0.8);
	transition: opacity 250ms ease, transform 250ms ease;
	z-index: 2;
}

.pfmx-hp-hotspot.is-active .pfmx-hp-badge {
	opacity: 1;
	transform: scale(1);
}

/* ── Product panel ────────────────────────────────────────────── */

.pfmx-hp-products {
	flex: 0 0 var(--pfmx-hp-panel-w);
	max-width: var(--pfmx-hp-panel-w);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	background: var(--pfmx-hp-panel-bg);
	padding: 32px 24px;
	position: relative;
	overflow: hidden;
}

/* ── Heading ──────────────────────────────────────────────────── */

.pfmx-hp-eyebrow {
	margin: 0 0 4px;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: #999;
}

.pfmx-hp-heading-text {
	margin: 0 0 6px;
	font-size: 20px;
	font-weight: 600;
	color: #1a1a1a;
	line-height: 1.3;
}

.pfmx-hp-desc {
	margin: 0 0 20px;
	font-size: 13px;
	color: #666;
	line-height: 1.5;
	max-width: 320px;
	text-align: center;
}

.pfmx-hp-heading:empty {
	display: none;
}

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

.pfmx-hp-swiper {
	width: 100%;
	max-width: var(--pfmx-hp-card-max-w);
	overflow: hidden;
}

.pfmx-hp-swiper .swiper-wrapper {
	display: flex;
	align-items: stretch;
}

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

.pfmx-hp-slide {
	width: 100%;
	flex-shrink: 0;
	display: flex;
	justify-content: center;
}

/* Constrain the Goldsmith product card within the slide */
.pfmx-hp-slide .goldsmith-loop-product {
	width: 100%;
	max-width: var(--pfmx-hp-card-max-w);
	margin: 0 auto;
}

/* Keep Goldsmith's native card and give its media a controlled finish. */
.pfmx-hp-slide .goldsmith-product-thumb {
	display: block;
	overflow: hidden;
	border-radius: var(--pfmx-hp-product-image-radius);
}

.pfmx-hp-slide .goldsmith-product-thumb img {
	border-radius: inherit;
}

.pfmx-hp-slide .goldsmith-product-name,
.pfmx-hp-slide .goldsmith-product-name a {
	visibility: visible;
	opacity: 1;
}

/* ── No-JS fallback ───────────────────────────────────────────── */

.pfmx-hotspot-products:not(.pfmx-hp-ready) .pfmx-hp-slide:not(:first-child) {
	display: none;
}

.pfmx-hotspot-products:not(.pfmx-hp-ready) .pfmx-hp-control-dock {
	display: none;
}

/* ── Control dock ─────────────────────────────────────────────── */

.pfmx-hp-control-dock {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	margin-block-start: 20px;
	padding: 8px 16px;
	background: var(--pfmx-hp-dock-bg);
	border: 1px solid var(--pfmx-hp-dock-border);
	border-radius: var(--pfmx-hp-dock-radius);
	backdrop-filter: blur(var(--pfmx-hp-dock-blur));
	-webkit-backdrop-filter: blur(var(--pfmx-hp-dock-blur));
	box-shadow: var(--pfmx-hp-dock-shadow);
}

/* Arrows */
.pfmx-hp-arrow {
	display: flex;
	align-items: center;
	justify-content: center;
	width: var(--pfmx-hp-arrow-size);
	height: var(--pfmx-hp-arrow-size);
	min-width: 44px;
	min-height: 44px;
	padding: 0;
	margin: 0;
	border: 1px solid var(--pfmx-hp-arrow-border);
	border-radius: 50%;
	background: var(--pfmx-hp-arrow-bg);
	color: var(--pfmx-hp-arrow-color);
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	outline: none;
	transition: background 200ms ease, border-color 200ms ease, opacity 200ms ease;
	flex-shrink: 0;
}

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

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

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

[dir="rtl"] .pfmx-hp-arrow svg {
	transform: scaleX(-1);
}

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

/* Counter */
.pfmx-hp-counter {
	font-size: 12px;
	font-weight: 600;
	color: var(--pfmx-hp-counter-color);
	letter-spacing: 0.06em;
	white-space: nowrap;
	min-width: 50px;
	text-align: center;
	font-variant-numeric: tabular-nums;
}

/* Progress rail */
.pfmx-hp-rail {
	position: relative;
	width: 80px;
	height: var(--pfmx-hp-rail-h);
	background: var(--pfmx-hp-rail-bg);
	border-radius: 99px;
	overflow: hidden;
	flex-shrink: 0;
}

.pfmx-hp-rail-fill {
	position: absolute;
	inset-block-start: 0;
	inset-inline-start: 0;
	height: 100%;
	background: var(--pfmx-hp-rail-fill);
	border-radius: 99px;
	transition: width 350ms cubic-bezier(.22,1,.36,1);
	width: 0%;
}

/* ── Live region ──────────────────────────────────────────────── */

.pfmx-hp-live-region {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0,0,0,0);
	white-space: nowrap;
	border: 0;
	margin: 0;
	padding: 0;
}

/* ── Editor notice ────────────────────────────────────────────── */

.pfmx-hp-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-hp-editor-notice strong {
	display: block;
	margin-block-end: 6px;
	font-size: 15px;
	color: #333;
}

/* ── Responsive: tablet ───────────────────────────────────────── */

@media (max-width: 1024px) {
	.pfmx-hotspot-products {
		--pfmx-hp-min-h: 420px;
		--pfmx-hp-card-max-w: 280px;
	}
}

/* ── Responsive: mobile stacked ───────────────────────────────── */

@media (max-width: 767px) {
	.pfmx-hotspot-products {
		--pfmx-hp-scene-ratio: 16 / 10;
		--pfmx-hp-card-max-w: 300px;
		--pfmx-hp-min-h: auto;
	}

	.pfmx-hp-layout {
		flex-direction: column;
	}

	.pfmx-hp-scene {
		flex: none;
		max-width: 100%;
		width: 100%;
	}

	.pfmx-hp-products {
		flex: none;
		max-width: 100%;
		width: calc(100% - 24px);
		margin-inline: auto;
		margin-block-start: calc(-1 * var(--pfmx-hp-overlap));
		border-radius: 16px 16px 0 0;
		z-index: 3;
		position: relative;
	}

	.pfmx-hp-picture img {
		aspect-ratio: var(--pfmx-hp-scene-ratio);
	}

	/* Use mobile hotspot coordinates */
	.pfmx-hp-hotspot {
		inset-inline-start: var(--pfmx-hp-x-mobile, var(--pfmx-hp-x));
		top: var(--pfmx-hp-y-mobile, var(--pfmx-hp-y));
	}
}

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

@media (prefers-reduced-motion: reduce) {
	.pfmx-hp-hotspot::before,
	.pfmx-hp-hotspot::after,
	.pfmx-hp-badge,
	.pfmx-hp-rail-fill,
	.pfmx-hp-arrow {
		transition-duration: 0.01ms !important;
	}

	.pfmx-hp-hotspot.is-active::after {
		animation: none;
	}
}
