/**
 * Hero slider Inzolia — fons estàtic + slides de producte.
 * Alçada fixa (Figma 680): tots els slides apilats amb ranures idèntiques.
 */

.inz-hero-slider,
.wp-block-inzolia-hero-slider {
	--inz-hero-vi: var(--wp--preset--color--brand-primary, #9e1a1a);
	--inz-hero-h: 680px;
	--inz-hero-pad-y: 0;
	--inz-hero-pad-x: clamp(1.25rem, 4vw, 2.5rem);
	--inz-hero-copy-w: min(100%, 36rem);
	/* rem (no em): les ranures han de cabre el font-size real de cada slot */
	--inz-hero-title-h: 6.35rem; /* 2 × 2.75rem × 1.15 */
	/* Label «A partir de» + import gran (abans 3.8rem tallava el label) */
	--inz-hero-price-h: 5.15rem;
	--inz-hero-text-h: 13.2rem; /* equilibri amb la ranura de preu més alta */
	--inz-hero-btn-h: 52px;
	position: relative;
	isolation: isolate;
	box-sizing: border-box;
	width: 100vw;
	max-width: 100vw;
	margin-left: calc(50% - 50vw);
	margin-right: calc(50% - 50vw);
	height: var(--inz-hero-h) !important;
	min-height: var(--inz-hero-h) !important;
	max-height: var(--inz-hero-h);
	background-color: #333;
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	color: #fff;
	overflow: hidden;
}

.wp-block-post-content .wp-block-inzolia-hero-slider,
.entry-content .wp-block-inzolia-hero-slider,
.wp-block-group .wp-block-inzolia-hero-slider,
.is-layout-constrained > .wp-block-inzolia-hero-slider,
.is-layout-flow > .wp-block-inzolia-hero-slider {
	width: 100vw !important;
	max-width: 100vw !important;
	margin-left: calc(50% - 50vw) !important;
	margin-right: calc(50% - 50vw) !important;
}

.inz-hero-slider::before {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(
		90deg,
		rgba(30, 30, 30, 0.72) 0%,
		rgba(30, 30, 30, 0.45) 48%,
		rgba(30, 30, 30, 0.2) 100%
	);
	z-index: 0;
	pointer-events: none;
}

.inz-hero-slider__inner {
	position: relative;
	z-index: 1;
	width: min(100%, var(--wp--style--global--wide-size, 1200px));
	height: 100%;
	margin-inline: auto;
	padding: 0 var(--inz-hero-pad-x);
	padding-bottom: 2.5rem; /* espai dots */
	box-sizing: border-box;
}

/* Tots els slides = mateix rectangle absolut → alçada idèntica */
.inz-hero-slider__slide {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 var(--inz-hero-pad-x);
	padding-bottom: 2.5rem;
	box-sizing: border-box;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	z-index: 0;
	transition: opacity 0.25s ease;
}

.inz-hero-slider__slide.is-active {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	z-index: 1;
}

.inz-hero-slider__content {
	display: grid;
	grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
	gap: clamp(1.5rem, 4vw, 3rem);
	align-items: center;
	width: min(100%, var(--wp--style--global--wide-size, 1200px));
	height: min(100%, 520px);
	max-height: 100%;
}

/* Ranures fixes: títol / preu / text / botons → mateixa geometria a cada slide */
.inz-hero-slider__copy {
	display: grid;
	grid-template-rows:
		var(--inz-hero-title-h)
		var(--inz-hero-price-h)
		var(--inz-hero-text-h)
		var(--inz-hero-btn-h);
	row-gap: 0.75rem;
	align-content: center;
	align-self: center;
	width: 100%;
	max-width: var(--inz-hero-copy-w);
	height: auto;
	min-height: 0;
}

.inz-hero-slider__title {
	margin: 0;
	padding: 0;
	font-size: clamp(1.75rem, 3.2vw, 2.75rem);
	line-height: 1.15;
	font-weight: 600;
	color: #fff;
	height: 100%;
	max-height: 100%;
	overflow: hidden;
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	align-self: end;
}

.inz-hero-slider__price {
	display: flex;
	align-items: center;
	margin: 0;
	padding: 0;
	font-size: clamp(2rem, 4vw, 3.25rem);
	font-weight: 700;
	line-height: 1.15;
	color: #fff;
	height: 100%;
	min-height: 0;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}

/* Stack label + import: no heretar white-space/ellipsis del slot */
.inz-hero-slider__price:has(.inz-price-from) {
	align-items: flex-end;
	overflow: visible;
	white-space: normal;
	text-overflow: unset;
}

.inz-hero-slider__price:empty::before {
	content: "\00a0";
}

.inz-hero-slider__price .amount,
.inz-hero-slider__price .woocommerce-Price-amount,
.inz-hero-slider__price bdi {
	font-size: inherit;
	font-weight: inherit;
	line-height: inherit;
	color: inherit;
}

.inz-hero-slider__price del {
	opacity: 0.65;
	font-size: 0.55em;
	margin-right: 0.35em;
}

.inz-hero-slider__price .inz-price-from {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	justify-content: flex-end;
	gap: 0.2rem;
	min-width: 0;
	max-width: 100%;
	white-space: normal;
	line-height: 1.15;
}

.inz-hero-slider__price .inz-price-from__label {
	display: block;
	font-size: clamp(0.75rem, 1.2vw, 0.9rem);
	font-weight: 500;
	line-height: 1.25;
	letter-spacing: 0.01em;
	opacity: 0.9;
	white-space: nowrap;
}

.inz-hero-slider__price .inz-price-from__amount {
	display: block;
	font-size: inherit;
	font-weight: inherit;
	line-height: 1.1;
	white-space: nowrap;
}

.inz-hero-slider__text {
	margin: 0;
	padding: 0;
	height: 100%;
	max-height: 100%;
	min-height: 0;
	overflow: hidden;
	font-size: clamp(0.95rem, 1.4vw, 1.05rem);
	line-height: 1.55;
	color: rgba(255, 255, 255, 0.92);
	/* Sense -webkit-box/line-clamp: tallaria malament <p>/<ul> niuats */
}

.inz-hero-slider__text p,
.inz-hero-slider__text ul,
.inz-hero-slider__text ol {
	margin: 0 0 0.5em;
}

.inz-hero-slider__text p:last-child,
.inz-hero-slider__text ul:last-child,
.inz-hero-slider__text ol:last-child {
	margin-bottom: 0;
}

.inz-hero-slider__text ul,
.inz-hero-slider__text ol {
	padding-left: 1.15em;
}

.inz-hero-slider__text li {
	margin: 0.2em 0;
	padding: 0;
	line-height: 1.45;
}

.inz-hero-slider__text:empty::before {
	content: "\00a0";
}

.inz-hero-slider__actions {
	display: flex;
	flex-wrap: nowrap;
	align-items: stretch;
	align-self: end;
	gap: 0.75rem;
	margin: 0;
	width: auto;
	max-width: 100%;
	height: var(--inz-hero-btn-h);
}

.inz-hero-slider__btn.button,
.inz-hero-slider__btn {
	box-sizing: border-box !important;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	gap: 0.5rem;
	flex: 0 0 auto;
	width: auto;
	min-width: 0;
	height: var(--inz-hero-btn-h) !important;
	min-height: var(--inz-hero-btn-h) !important;
	max-height: var(--inz-hero-btn-h) !important;
	padding: 0 1.1rem !important;
	margin: 0 !important;
	border-radius: 4px !important;
	border-width: 1px !important;
	border-style: solid !important;
	font-size: 0.95rem !important;
	font-weight: 600 !important;
	line-height: 1 !important;
	text-decoration: none !important;
	text-align: center !important;
	white-space: nowrap;
	box-shadow: none !important;
	cursor: pointer;
	transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.inz-hero-slider__btn span {
	display: inline-flex;
	align-items: center;
	line-height: 1;
}

.inz-hero-slider__btn--cart {
	background: var(--inz-hero-vi) !important;
	color: #fff !important;
	border-color: var(--inz-hero-vi) !important;
}

.inz-hero-slider__btn--cart:hover,
.inz-hero-slider__btn--cart:focus-visible {
	background: color-mix(in srgb, var(--inz-hero-vi) 88%, #000) !important;
	color: #fff !important;
}

.inz-hero-slider__btn--detail {
	background: rgba(40, 40, 40, 0.55) !important;
	color: #fff !important;
	border-color: rgba(255, 255, 255, 0.75) !important;
}

.inz-hero-slider__btn--detail:hover,
.inz-hero-slider__btn--detail:focus-visible {
	background: rgba(255, 255, 255, 0.12) !important;
	border-color: #fff !important;
}

.inz-hero-slider__cart-icon,
.inz-hero-slider__btn .dms3-icon,
.inz-hero-slider__btn .ph {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	font-size: 1.15em;
	line-height: 1 !important;
	width: 1.15em;
	height: 1.15em;
}

.inz-hero-slider__media {
	display: flex;
	justify-content: center;
	align-items: center;
	height: 100%;
	min-height: 0;
}

.inz-hero-slider__media-link {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	max-width: min(100%, 420px);
	height: min(100%, 480px);
}

.inz-hero-slider__product-img {
	display: block;
	width: 100%;
	height: 100%;
	max-height: 480px;
	object-fit: contain;
	object-position: center;
	filter: drop-shadow(0 18px 28px rgba(0, 0, 0, 0.35));
}

.inz-hero-slider__nav {
	position: absolute;
	top: 50%;
	z-index: 3;
	transform: translateY(-50%);
	width: 2.75rem;
	height: 2.75rem;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: #fff;
	font-size: 2.75rem;
	line-height: 1;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.35));
	transition: color 0.15s ease, opacity 0.15s ease, transform 0.15s ease;
}

.inz-hero-slider__nav-icon {
	display: block;
	line-height: 1;
}

.inz-hero-slider__nav:hover,
.inz-hero-slider__nav:focus-visible {
	color: #fff;
	opacity: 0.85;
}

.inz-hero-slider__nav--prev {
	left: clamp(0.5rem, 2vw, 1.25rem);
}

.inz-hero-slider__nav--next {
	right: clamp(0.5rem, 2vw, 1.25rem);
}

.inz-hero-slider__dots {
	position: absolute;
	z-index: 3;
	left: 50%;
	bottom: 1.25rem;
	transform: translateX(-50%);
	display: flex;
	align-items: center;
	gap: 0.45rem;
}

.inz-hero-slider__dot {
	width: 8px;
	height: 8px;
	padding: 0;
	border: 0;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.45);
	cursor: pointer;
	transition: width 0.2s ease, background-color 0.2s ease;
}

.inz-hero-slider__dot.is-active,
.inz-hero-slider__dot[aria-selected="true"] {
	width: 24px;
	background: #fff;
}

.inz-hero-slider--empty {
	min-height: 180px;
	height: auto !important;
	max-height: none;
	display: grid;
	place-items: center;
	padding: 2rem;
	background: #333;
	color: #fff;
	text-align: center;
}

@supports (width: 100dvw) {
	.inz-hero-slider,
	.wp-block-inzolia-hero-slider,
	.wp-block-post-content .wp-block-inzolia-hero-slider,
	.entry-content .wp-block-inzolia-hero-slider,
	.wp-block-group .wp-block-inzolia-hero-slider,
	.is-layout-constrained > .wp-block-inzolia-hero-slider,
	.is-layout-flow > .wp-block-inzolia-hero-slider {
		width: 100dvw !important;
		max-width: 100dvw !important;
		margin-left: calc(50% - 50dvw) !important;
		margin-right: calc(50% - 50dvw) !important;
	}
}

@media (max-width: 781px) {
	.inz-hero-slider,
	.wp-block-inzolia-hero-slider {
		--inz-hero-title-h: auto;
		--inz-hero-price-h: auto;
		--inz-hero-text-h: none;
		--inz-hero-nav-size: 2.25rem;
		/* Franja fletxes + dots sota els CTAs */
		--inz-hero-nav-band: calc(var(--inz-hero-nav-size) + 3.25rem);
		/* Alçada segons contingut (slide actiu en relative) */
		height: auto !important;
		min-height: 0 !important;
		max-height: none;
	}

	.inz-hero-slider__inner {
		height: auto;
		min-height: 0;
		padding-bottom: 0;
	}

	.inz-hero-slider__slide {
		align-items: stretch;
		position: absolute;
		inset: 0;
		/* Sense pad-x: ja el porta __inner (evita doble sagnat) */
		padding-left: 0;
		padding-right: 0;
		padding-bottom: var(--inz-hero-nav-band);
	}

	/* El slide actiu marca l’alçada del hero; la resta resten apilats */
	.inz-hero-slider__slide.is-active {
		position: relative;
		inset: auto;
		height: auto;
	}

	.inz-hero-slider__content {
		display: flex;
		flex-direction: column;
		grid-template-columns: none;
		align-items: stretch;
		text-align: left;
		height: auto;
		max-height: none;
		gap: 0.75rem;
	}

	.inz-hero-slider__copy {
		display: flex;
		flex-direction: column;
		align-items: stretch;
		flex: 0 1 auto;
		max-width: none;
		width: 100%;
		min-height: 0;
		height: auto;
		row-gap: 0.45rem;
		text-align: left;
	}

	.inz-hero-slider__title {
		-webkit-line-clamp: 3;
		line-clamp: 3;
		align-self: stretch;
		height: auto;
		max-height: none;
		overflow: hidden;
		font-size: clamp(1.5rem, 6vw, 2rem);
		text-align: left;
	}

	.inz-hero-slider__price {
		height: auto;
		overflow: visible;
		font-size: clamp(1.75rem, 7vw, 2.5rem);
		justify-content: flex-start;
		text-align: left;
	}

	.inz-hero-slider__price:has(.inz-price-from) {
		align-items: flex-start;
	}

	.inz-hero-slider__price .inz-price-from {
		align-items: flex-start;
	}

	.inz-hero-slider__text {
		flex: 0 1 auto;
		width: 100%;
		max-width: none;
		margin-inline: 0;
		height: auto;
		max-height: none;
		overflow: visible;
		text-align: left;
	}

	.inz-hero-slider__actions {
		justify-content: flex-start;
		flex-wrap: wrap;
		align-self: stretch;
		width: 100%;
		max-width: 100%;
		height: auto;
		margin-top: 0.35rem;
		margin-bottom: 0;
		padding-inline: 0;
		gap: 0.6rem;
		box-sizing: border-box;
	}

	.inz-hero-slider__btn.button,
	.inz-hero-slider__btn {
		flex: 0 1 auto;
		white-space: nowrap;
		font-size: 0.85rem !important;
		padding-inline: 0.9rem !important;
	}

	/* Imatge a banda esquerra, tan gran com càpiga fins a 50vh */
	.inz-hero-slider__media {
		order: -1;
		flex-shrink: 0;
		justify-content: flex-start;
		align-items: flex-start;
		width: 100%;
		height: auto;
		max-height: 50vh;
	}

	.inz-hero-slider__media-link {
		justify-content: flex-start;
		width: 100%;
		max-width: none;
		height: auto;
		max-height: 50vh;
	}

	.inz-hero-slider__product-img {
		display: block;
		width: 100%;
		height: auto;
		max-height: 50vh;
		object-fit: contain;
		object-position: left center;
	}

	/* Fletxes a la franja inferior, mai sobre els CTAs */
	.inz-hero-slider__nav {
		top: auto;
		bottom: 2.35rem;
		transform: none;
		width: var(--inz-hero-nav-size);
		height: var(--inz-hero-nav-size);
		font-size: var(--inz-hero-nav-size);
	}

	.inz-hero-slider__nav--prev {
		left: var(--inz-hero-pad-x);
	}

	.inz-hero-slider__nav--next {
		right: var(--inz-hero-pad-x);
	}
}
