/*
 * WestVibe — Service Categories Carousel
 * Pure-CSS marquee with premium card interactions.
 * BEM prefix: .wv-service-categories / .wv-category-card
 * Loaded only when wv_service_category CPT exists.
 */

/* ─── Custom Properties (local overrides) ─────────────────────────────────── */
.wv-service-categories {
	--wv-sc-gap:      clamp(18px, 2.4vw, 28px);
	--wv-sc-duration: 42s;
}

/* ─── Section ────────────────────────────────────────────────────────────── */
.wv-service-categories {
	position: relative;
	overflow-x: clip;      /* clip horizontal without creating a scroll container */
	background:
		radial-gradient(circle at 12% 10%, rgba(200, 164, 93, 0.10), transparent 32%),
		linear-gradient(180deg, var(--wv-white, #ffffff) 0%, var(--wv-ivory, #fbf7ef) 100%);
}

/* Decorative top-edge gold rule */
.wv-service-categories::before {
	content: '';
	position: absolute;
	inset-inline: 0;
	top: 0;
	height: 1px;
	background: linear-gradient(
		90deg,
		transparent,
		rgba(200, 164, 93, 0.35) 30%,
		rgba(200, 164, 93, 0.55) 50%,
		rgba(200, 164, 93, 0.35) 70%,
		transparent
	);
}

/* ─── Header block ─────────────────────────────────────────────────────────── */
.wv-service-categories__header {
	text-align: center;
	margin-bottom: clamp(36px, 5vw, 64px);
	padding-inline: 24px;
}

.wv-service-categories__title {
	color: var(--wv-text-dark, #111111);
	font-family: var(--wv-font-display, 'Playfair Display', serif);
	font-size: clamp(2.2rem, 5vw, 4.2rem);
	font-weight: 700;
	margin: 10px 0 16px;
	line-height: 1.12;
}

.wv-service-categories__desc {
	color: var(--wv-muted, #6f685f);
	font-size: clamp(0.95rem, 1.5vw, 1.05rem);
	max-width: 62ch;
	margin: 0 auto;
	line-height: 1.65;
}

/* ─── Carousel Viewport ────────────────────────────────────────────────────── */
.wv-service-categories__carousel {
	position: relative;
	overflow-x: clip;
	padding-block: 24px;
	padding-inline: clamp(24px, 4vw, 72px);
	box-sizing: border-box;
	cursor: default;
	-webkit-user-select: none;
	        user-select: none;
}

/* Soft edge fade — masks partially-visible cards, no hard cut */
.wv-service-categories__carousel::before,
.wv-service-categories__carousel::after {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	z-index: 5;
	width: clamp(32px, 6vw, 110px);
	pointer-events: none;
}

.wv-service-categories__carousel::before {
	left: 0;
	background: linear-gradient(90deg, var(--wv-ivory, #fbf7ef), rgba(251, 247, 239, 0));
}

.wv-service-categories__carousel::after {
	right: 0;
	background: linear-gradient(270deg, var(--wv-ivory, #fbf7ef), rgba(251, 247, 239, 0));
}

/* ─── Marquee Track ─────────────────────────────────────────────────────────── */
/*
 * The track holds TWO identical lists. The animation moves by -50%,
 * which is exactly one list width → seamless infinite loop.
 */
.wv-service-categories__marquee {
	display: flex;
	width: max-content;
	animation: wvMarquee var(--wv-sc-duration) linear infinite;
	will-change: transform;
}

@keyframes wvMarquee {
	from { transform: translateX(0); }
	to   { transform: translateX(-50%); }
}

/* ─── Item List ─────────────────────────────────────────────────────────────── */
.wv-service-categories__list {
	display: flex;
	gap: var(--wv-sc-gap);
	padding-inline: calc(var(--wv-sc-gap) / 2);   /* half-gap at each edge keeps
	                                                  equal spacing between lists */
	list-style: none;
	margin: 0;
	padding-block: 0;
}

/* ─── Card Wrapper <li> ─────────────────────────────────────────────────────── */
.wv-service-categories__item {
	flex: 0 0 auto;
	list-style: none;
}

/* ─── Card ───────────────────────────────────────────────────────────────────── */
.wv-category-card {
	display: block;
	position: relative;
	width: clamp(280px, 22vw, 390px);
	height: clamp(430px, 34vw, 560px);
	overflow: hidden;
	border-radius: 32px;
	text-decoration: none;
	color: inherit;

	/* Subtle gold ring + rich shadow */
	box-shadow:
		0 24px 70px rgba(17, 17, 17, 0.12),
		0 0 0 1px rgba(200, 164, 93, 0.20);

	/* GPU composite layer */
	transform: translateZ(0);
	transition:
		transform    0.45s cubic-bezier(0.22, 1, 0.36, 1),
		box-shadow   0.45s ease;
}

.wv-category-card:hover,
.wv-category-card:focus-visible {
	transform: translateY(-8px);
	box-shadow:
		0 34px 90px rgba(17, 17, 17, 0.18),
		0 0 0 1px rgba(200, 164, 93, 0.46);
	outline: none;
}

/* Inner gold border frame */
.wv-category-card::after {
	content: '';
	position: absolute;
	inset: 14px;
	border: 1px solid rgba(234, 216, 174, 0.50);
	border-radius: 24px;
	opacity: 0.45;
	pointer-events: none;
	transition: opacity 0.4s ease, transform 0.4s ease;
}

.wv-category-card:hover::after,
.wv-category-card:focus-visible::after {
	opacity: 1;
	transform: scale(0.985);
}

/* ─── Media (figure) ────────────────────────────────────────────────────────── */
.wv-category-card__media {
	position: absolute;
	inset: 0;
	margin: 0;
	overflow: hidden;
}

.wv-category-card__img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition:
		opacity   0.75s ease,
		transform 0.90s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Primary image: visible by default */
.wv-category-card__img--primary {
	opacity: 1;
	transform: scale(1);
}

/* Secondary image: hidden by default */
.wv-category-card__img--secondary {
	opacity: 0;
	transform: scale(1.04);
}

/* Cross-fade on hover / focus */
.wv-category-card:hover     .wv-category-card__img--primary,
.wv-category-card:focus-visible .wv-category-card__img--primary {
	opacity: 0;
	transform: scale(1.04);
}

.wv-category-card:hover     .wv-category-card__img--secondary,
.wv-category-card:focus-visible .wv-category-card__img--secondary {
	opacity: 1;
	transform: scale(1.02);
}

/* ─── Gradient Veil ─────────────────────────────────────────────────────────── */
.wv-category-card__veil {
	position: absolute;
	inset: 0;
	background:
		linear-gradient(
			to top,
			rgba(17, 17, 17, 0.70)  0%,
			rgba(17, 17, 17, 0.22) 48%,
			rgba(255, 255, 255, 0.04) 100%
		),
		radial-gradient(
			circle at 50% 0%,
			rgba(200, 164, 93, 0.22),
			transparent 38%
		);
	pointer-events: none;
}

/* ─── Card Content ──────────────────────────────────────────────────────────── */
.wv-category-card__content {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	padding: 32px;
	z-index: 2;
	transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.wv-category-card:hover .wv-category-card__content,
.wv-category-card:focus-visible .wv-category-card__content {
	transform: translateY(-6px);
}

.wv-category-card__index {
	display: block;
	font-size: 0.68rem;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--wv-gold, #c8a45d);
	margin-bottom: 8px;
}

.wv-category-card__title {
	font-family: var(--wv-font-display, 'Playfair Display', serif);
	font-size: clamp(1.35rem, 2.2vw, 1.75rem);
	font-weight: 700;
	color: #ffffff;
	margin: 0 0 10px;
	letter-spacing: 0.02em;
	line-height: 1.2;
	text-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.wv-category-card__desc {
	font-size: 0.875rem;
	color: rgba(255, 255, 255, 0.78);
	line-height: 1.55;
	margin: 0 0 16px;
	/* 2-line clamp */
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.wv-category-card__cta {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--wv-gold, #c8a45d);
	border-bottom: 1px solid rgba(200, 164, 93, 0.45);
	padding-bottom: 2px;
	transition: border-color 0.28s ease;
}

.wv-category-card__cta::after {
	content: '→';
	font-size: 0.9em;
	transition: transform 0.28s ease;
}

.wv-category-card:hover .wv-category-card__cta,
.wv-category-card:focus-visible .wv-category-card__cta {
	border-color: rgba(200, 164, 93, 0.85);
}

.wv-category-card:hover .wv-category-card__cta::after,
.wv-category-card:focus-visible .wv-category-card__cta::after {
	transform: translateX(4px);
}

/* ─── Pause state (set by JS on hover/focus) ───────────────────────────────── */
[data-wv-sc-carousel]:hover .wv-service-categories__marquee,
[data-wv-sc-carousel]:focus-within .wv-service-categories__marquee {
	animation-play-state: paused;
}

/* ─── Reduced-Motion Fallback ──────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
	.wv-service-categories__marquee {
		animation: none;
		flex-wrap: wrap;
		width: 100%;
		justify-content: center;
		padding-inline: 24px;
		gap: var(--wv-sc-gap);
	}

	/* Hide the duplicate list */
	.wv-service-categories__list:last-child {
		display: none;
	}

	.wv-category-card__img--primary,
	.wv-category-card__img--secondary,
	.wv-category-card__content,
	.wv-category-card {
		transition: none;
	}
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 1200px) {
	.wv-category-card {
		width: clamp(280px, 28vw, 360px);
		height: clamp(420px, 42vw, 520px);
	}
}

@media (max-width: 900px) {
	.wv-service-categories__carousel {
		padding-inline: clamp(18px, 4vw, 36px);
	}

	.wv-category-card {
		width: clamp(260px, 42vw, 340px);
		height: clamp(400px, 58vw, 500px);
	}
}

@media (max-width: 768px) {
	.wv-category-card {
		width: 76vw;
		height: clamp(380px, 70vw, 480px);
	}

	.wv-category-card__content {
		padding: 24px;
	}

	.wv-service-categories__list {
		padding-inline: 20px;
	}
}

@media (max-width: 560px) {
	.wv-service-categories {
		padding-block: 64px;
	}

	.wv-service-categories__header {
		margin-bottom: 36px;
	}

	.wv-service-categories__carousel {
		padding-inline: 18px;
	}

	.wv-service-categories__list {
		gap: 16px;
	}
}

@media (max-width: 480px) {
	.wv-category-card {
		width: 78vw;
		height: 440px;
	}
}
