/* Popular Products — ACF block.
   Reuses Shop the Lineup card styles with a Product Category-width layout. */

.ortega-popular-products {
	/* Shop the Lineup card tokens — required so reused __learn-more / hover
	   rules resolve (Related Products gets these via .ortega-shop-the-lineup). */
	--ortega-stl-blue: #0058a4;
	--ortega-stl-blue-hover: #093272;
	--ortega-stl-navy: #092450;
	--ortega-stl-yellow: #ffe400;
	--ortega-stl-card-bg: var(--wp--preset--color--blue-200, #e9f2f9);
	--ortega-stl-card-hover: #093272;
	--ortega-pp-blue: var(--ortega-stl-blue);
	--ortega-pp-content-max: 1372px;
	--ortega-pp-grid-gap: clamp(1rem, 2.5vw, 2.375rem);
	--ortega-pp-carousel-gutter: clamp(1rem, 4vw, 3rem);
	box-sizing: border-box;
	color: var(--ortega-stl-navy);
	max-width: 100vw;
	overflow-x: clip;
	padding: clamp(2rem, 5vw, 4rem) clamp(1rem, 4vw, 3rem);
	position: relative;
	width: 100%;
}

.ortega-popular-products__inner {
	box-sizing: border-box;
	display: grid;
	gap: clamp(1.5rem, 4vw, 3rem);
	margin-inline: auto;
	max-width: min(var(--ortega-pp-content-max), 100%);
	width: 100%;
}

.ortega-popular-products__head {
	align-items: center;
	display: flex;
	gap: clamp(0.75rem, 2vw, 1.25rem);
	justify-content: center;
	margin: 0;
	text-align: center;
}

.ortega-popular-products__flourish {
	aspect-ratio: 66 / 20;
	display: block;
	flex: 0 0 auto;
	height: auto;
	object-fit: contain;
	width: clamp(24px, 4vw, 57px);
}

.ortega-popular-products__flourish--right {
	transform: scaleX(-1);
}

.ortega-popular-products__title {
	color: var(--ortega-pp-blue);
	font-family: var(--ortega-font-display);
	font-size: clamp(2.25rem, 7vw, 5rem);
	font-weight: 700;
	letter-spacing: 0.02em;
	line-height: 0.87;
	margin: 0;
	text-align: center;
	text-transform: uppercase;
}

.ortega-popular-products.is-text-entrance-pending .ortega-popular-products__title,
.ortega-popular-products.is-text-entrance-pending .ortega-popular-products__flourish {
	visibility: hidden;
}

.ortega-popular-products.is-cards-entrance-pending .ortega-popular-products__grid-item {
	opacity: 0;
	visibility: hidden;
}

.ortega-popular-products__grid {
	gap: var(--ortega-pp-grid-gap);
	min-width: 0;
	width: 100%;
}

.ortega-popular-products__grid-item {
	min-width: 0;
}

.ortega-popular-products .ortega-shop-the-lineup__card {
	align-items: center;
	background-color: transparent;
	border-radius: 20px;
	flex: initial;
	gap: 1rem;
	min-width: 0;
	padding: clamp(1rem, 2.5vw, 1.5rem);
	text-align: center;
	transition: background-color 0.25s ease, color 0.25s ease;
}

.ortega-popular-products .ortega-shop-the-lineup__card-media-link {
	margin-inline: auto;
	max-width: 100%;
}

.ortega-popular-products .ortega-shop-the-lineup__card-body {
	align-items: center;
	text-align: center;
	width: 100%;
}

.ortega-popular-products .ortega-shop-the-lineup__card-title {
	margin-inline: auto;
	max-width: 16rem;
	text-align: center;
}

.ortega-popular-products-placeholder {
	background: #f7f7f8;
	border: 1px dashed #0058a4;
	color: #0058a4;
	padding: 24px;
	text-align: center;
}

/* Mobile — horizontal product carousel */

@media (max-width: 781px) {
	.ortega-popular-products__inner {
		gap: clamp(1.25rem, 4vw, 2rem);
	}

	.ortega-popular-products__grid {
		align-items: stretch;
		display: flex;
		gap: clamp(0.85rem, 2vw, 1.25rem);
		margin-inline: calc(50% - 50vw);
		max-width: 100vw;
		overflow-x: auto;
		overscroll-behavior-x: contain;
		padding-inline-start: var(--ortega-pp-carousel-gutter);
		scroll-behavior: auto;
		scroll-padding-inline: var(--ortega-pp-carousel-gutter);
		scroll-snap-type: x mandatory;
		-webkit-overflow-scrolling: touch;
		width: 100vw;
	}

	.ortega-popular-products__grid::after {
		content: "";
		flex: 0 0 var(--ortega-pp-carousel-gutter);
	}

	.ortega-popular-products__grid::-webkit-scrollbar {
		display: none;
	}

	.ortega-popular-products__grid {
		-ms-overflow-style: none;
		scrollbar-width: none;
	}

	.ortega-popular-products__grid-item {
		display: flex;
		flex: 0 0 min(78vw, 300px);
		flex-direction: column;
		scroll-snap-align: start;
	}

	.ortega-popular-products .ortega-shop-the-lineup__card {
		background-color: var(--wp--preset--color--blue-200, #e9f2f9);
		flex: 1 1 auto;
		height: 100%;
		width: 100%;
	}
}

/* Desktop — shared card layout from tablet up */

@media (min-width: 782px) {
	.ortega-popular-products {
		--ortega-pp-grid-gap: 38px;
		overflow-x: visible;
		padding-block: clamp(2rem, 5vw, 4rem);
		padding-inline: 0;
	}

	.ortega-popular-products__inner {
		max-width: min(var(--ortega-pp-content-max), 100%);
	}

	.ortega-popular-products__grid-item {
		display: flex;
		flex-direction: column;
		min-height: 0;
	}

	.ortega-popular-products .ortega-shop-the-lineup__card {
		flex: 1 1 auto;
		height: auto;
		max-width: 100%;
		min-height: 0;
		padding-block: clamp(1.25rem, 2vw, 2.5rem);
		width: 100%;
	}

	.ortega-popular-products .ortega-shop-the-lineup__card-body {
		flex: 1 1 auto;
		min-height: 0;
	}

	.ortega-popular-products .ortega-shop-the-lineup__card-media {
		--ortega-stl-media-height: clamp(150px, 12vw, 280px);
	}

	.ortega-popular-products .ortega-shop-the-lineup__card-title {
		font-size: clamp(18px, 1.5vw, 28px);
	}
}

/* Tablet — horizontal carousel (2 cards + peek), like Shop the Lineup */

@media (min-width: 782px) and (max-width: 1199px) {
	.ortega-popular-products {
		--ortega-pp-slide-gap: clamp(0.85rem, 2vw, 1.5rem);
		--ortega-pp-track-gutter: 32px;
		--ortega-pp-card-width: calc((100vw - (2 * var(--ortega-pp-track-gutter)) - var(--ortega-pp-slide-gap)) / 2.2);
	}

	.ortega-popular-products__inner {
		overflow-x: clip;
	}

	.ortega-popular-products__grid {
		display: flex;
		gap: var(--ortega-pp-slide-gap);
		margin-inline: calc(50% - 50vw);
		max-width: 100vw;
		overflow-x: auto;
		overscroll-behavior-x: contain;
		padding-inline: var(--ortega-pp-track-gutter);
		scroll-behavior: auto;
		scroll-padding-inline: var(--ortega-pp-track-gutter);
		scroll-snap-type: x mandatory;
		-webkit-overflow-scrolling: touch;
		width: 100vw;
	}

	.ortega-popular-products__grid::-webkit-scrollbar {
		display: none;
	}

	.ortega-popular-products__grid {
		-ms-overflow-style: none;
		scrollbar-width: none;
	}

	.ortega-popular-products__grid-item {
		flex: 0 0 min(var(--ortega-pp-card-width), 360px);
		scroll-snap-align: start;
	}

	.ortega-popular-products .ortega-shop-the-lineup__card {
		background-color: var(--wp--preset--color--blue-200, #e9f2f9);
	}

	.ortega-popular-products .ortega-shop-the-lineup__card-media {
		--ortega-stl-media-height: clamp(200px, 30vw, 260px);
	}
}

@media (min-width: 1200px) and (max-width: 1399px) {
	.ortega-popular-products {
		padding: clamp(1rem, 4vw, 2.5rem) clamp(1rem, 4vw, 3rem);
	}
}

@media (min-width: 1200px) {
	.ortega-popular-products__grid {
		display: grid;
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}

	.ortega-popular-products .ortega-shop-the-lineup__card {
		border-radius: 24px;
		gap: 1.5rem;
		padding-block: 40px;
	}

	.ortega-popular-products .ortega-shop-the-lineup__card-body {
		gap: 1.25rem;
	}

	.ortega-popular-products .ortega-shop-the-lineup__card-title {
		font-size: 28px;
		letter-spacing: 0.02em;
		line-height: 1.25;
	}

	.ortega-popular-products .ortega-shop-the-lineup__learn-more {
		font-size: 16px;
		min-height: 46px;
		padding: 16px 22px;
	}
}

/*
 * Card hover — navy panel + yellow type/CTAs. Available on any fine pointer
 * (not only ≥1200px); matches shop-the-lineup / product-category.
 */
@media (hover: hover) and (pointer: fine) {
	.ortega-popular-products .ortega-shop-the-lineup__card:hover,
	.ortega-popular-products .ortega-shop-the-lineup__card:focus-within {
		background-color: var(--ortega-stl-card-hover, #093272);
	}

	.ortega-popular-products .ortega-shop-the-lineup__card:hover .ortega-shop-the-lineup__card-title,
	.ortega-popular-products .ortega-shop-the-lineup__card:focus-within .ortega-shop-the-lineup__card-title,
	.ortega-popular-products .ortega-shop-the-lineup__card:hover .ortega-shop-the-lineup__card-title-link,
	.ortega-popular-products .ortega-shop-the-lineup__card:focus-within .ortega-shop-the-lineup__card-title-link,
	.ortega-popular-products .ortega-shop-the-lineup__card:hover .ortega-shop-the-lineup__card-title-link:hover,
	.ortega-popular-products .ortega-shop-the-lineup__card:focus-within .ortega-shop-the-lineup__card-title-link:hover,
	.ortega-popular-products .ortega-shop-the-lineup__card:hover .ortega-shop-the-lineup__card-title-link:focus-visible,
	.ortega-popular-products .ortega-shop-the-lineup__card:focus-within .ortega-shop-the-lineup__card-title-link:focus-visible {
		color: var(--ortega-stl-yellow, #ffe400);
	}

	.ortega-popular-products .ortega-shop-the-lineup__card:hover .ortega-shop-the-lineup__learn-more,
	.ortega-popular-products .ortega-shop-the-lineup__card:focus-within .ortega-shop-the-lineup__learn-more {
		background-color: var(--ortega-stl-blue, #0058a4);
		color: var(--ortega-stl-yellow, #ffe400);
	}

	.ortega-popular-products .ortega-shop-the-lineup__card:hover .ortega-shop-the-lineup__find-it,
	.ortega-popular-products .ortega-shop-the-lineup__card:focus-within .ortega-shop-the-lineup__find-it {
		color: var(--ortega-stl-yellow, #ffe400);
	}

	.ortega-popular-products .ortega-shop-the-lineup__card:hover .ortega-shop-the-lineup__find-it-icon,
	.ortega-popular-products .ortega-shop-the-lineup__card:focus-within .ortega-shop-the-lineup__find-it-icon,
	.ortega-popular-products .ortega-shop-the-lineup__card:hover .ortega-shop-the-lineup__find-it::after,
	.ortega-popular-products .ortega-shop-the-lineup__card:focus-within .ortega-shop-the-lineup__find-it::after {
		filter: brightness(0) saturate(100%) invert(88%) sepia(69%) saturate(749%) hue-rotate(358deg) brightness(104%) contrast(104%);
	}
}

@media (min-width: 1400px) {
	.ortega-popular-products {
		padding-block: clamp(2rem, 5vw, 4rem);
		padding-inline: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ortega-popular-products.is-text-entrance-pending .ortega-popular-products__title,
	.ortega-popular-products.is-text-entrance-pending .ortega-popular-products__flourish {
		visibility: visible;
	}

	.ortega-popular-products.is-cards-entrance-pending .ortega-popular-products__grid-item {
		opacity: 1;
		visibility: visible;
	}

	.ortega-popular-products__grid {
		scroll-behavior: auto;
	}
}
