/**
 * Layali Upsell — "You might also like" slider.
 * Token-bound (--ly-*). Falls back to literal values if the theme isn't active.
 */

/* =============================================================================
   Shell
   ============================================================================= */

.ly-upsell {
	width: 100%;
	font-family: var(--ly-text-body, 'DM Sans', sans-serif);
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.ly-upsell__title {
	margin: 0;
	font-family: var(--ly-text-heading, 'Bricolage Grotesque', sans-serif);
	font-weight: 700;
	font-size: clamp(1rem, 1.5vw, 1.25rem);
	color: var(--ly-color-primary, #53225e);
	line-height: 1.2;
}

/* =============================================================================
   Viewport + track (scroll-snap, one slide visible at a time)
   ============================================================================= */

.ly-upsell__viewport {
	position: relative;
	width: 100%;
}

.ly-upsell__track {
	display: flex;
	gap: 16px;
	overflow-x: auto;
	overflow-y: hidden;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	scrollbar-width: none;
}

.ly-upsell__track::-webkit-scrollbar {
	display: none;
}

/* =============================================================================
   Card — wide, flat horizontal layout
   ============================================================================= */

.ly-upsell__card {
	flex: 0 0 100%;
	width: 100%;
	box-sizing: border-box;
	display: grid;
	grid-template-columns: 96px 1fr auto;
	gap: 18px;
	align-items: center;
	padding: 16px 24px 16px 16px;
	background-color: var(--ly-color-surface, #fbf5ef);
	border-radius: 18px;
	scroll-snap-align: start;
	position: relative;
}

/* Whole-card click target: stretch the product-name link across the entire
   card so a tap anywhere (image, price, padding, gaps) navigates — previously
   only the image / name / CTA sub-links were tappable, so taps on the card body
   did nothing (most noticeable on touch). The CTA is lifted above the overlay
   so it keeps its own hover/focus; both go to the same product URL regardless. */
.ly-upsell__name::after {
	content: '';
	position: absolute;
	inset: 0;
	z-index: 1;
}

.ly-upsell__cta {
	position: relative;
	z-index: 2;
}

.ly-upsell__image {
	display: block;
	width: 96px;
	height: 96px;
	border-radius: 14px;
	overflow: hidden;
	background: rgba(0, 0, 0, 0.04);
	flex-shrink: 0;
}

.ly-upsell__image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.ly-upsell__body {
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.ly-upsell__name {
	font-family: var(--ly-text-heading, 'Bricolage Grotesque', sans-serif);
	font-weight: 700;
	font-size: 1.05rem;
	line-height: 1.2;
	color: var(--ly-color-primary, #53225e);
	text-decoration: none;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ly-upsell__name:hover {
	color: var(--ly-color-secondary, #ff7477);
}

.ly-upsell__desc {
	margin: 0;
	font-size: 0.9rem;
	color: var(--ly-color-text-muted, #4a4a52);
	line-height: 1.35;
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp: 1;
	line-clamp: 1;
	-webkit-box-orient: vertical;
}

.ly-upsell__price {
	margin-top: 4px;
	font-size: 1rem;
	font-weight: 700;
	color: var(--ly-color-secondary, #ff7477);
	display: inline-flex;
	align-items: baseline;
	gap: 10px;
	flex-wrap: wrap;
}

.ly-upsell__price del,
.ly-upsell__price del .amount {
	color: var(--ly-color-text-muted, #4a4a52);
	font-weight: 400;
	text-decoration: line-through;
}

.ly-upsell__price ins,
.ly-upsell__price ins .amount,
.ly-upsell__price .amount {
	text-decoration: none;
}

/* =============================================================================
   Badge — top-right of card, plays the WC "Featured" role
   ============================================================================= */

.ly-upsell__badge {
	position: absolute;
	top: 16px;
	right: 24px;
	display: inline-block;
	background-color: var(--ly-color-secondary, #ff7477);
	color: #ffffff;
	font-family: var(--ly-text-body, 'DM Sans', sans-serif);
	font-weight: 600;
	font-size: 0.85rem;
	line-height: 1.2;
	padding: 6px 14px;
	border-radius: 999px;
}

/* =============================================================================
   CTA — right side of the card row
   ============================================================================= */

.ly-upsell__cta {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: var(--ly-color-primary, #53225e);
	font-weight: 600;
	font-size: 0.95rem;
	text-decoration: underline;
	text-underline-offset: 4px;
	white-space: nowrap;
	transition: color 150ms ease;
}

.ly-upsell__cta:hover {
	color: var(--ly-color-secondary, #ff7477);
}

/* =============================================================================
   Controls — dots + arrows under the card
   ============================================================================= */

.ly-upsell__controls {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
}

.ly-upsell__arrow {
	width: 28px;
	height: 28px;
	border-radius: 999px;
	background: transparent;
	color: var(--ly-color-primary, #53225e);
	border: 0;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: color 150ms ease, opacity 150ms ease;
}

.ly-upsell__arrow:hover:not(:disabled) {
	color: var(--ly-color-secondary, #ff7477);
}

.ly-upsell__arrow:disabled {
	opacity: 0.3;
	cursor: not-allowed;
}

.ly-upsell__dots {
	display: inline-flex;
	align-items: center;
	gap: 10px;
}

.ly-upsell__dot {
	width: 12px;
	height: 12px;
	border-radius: 999px;
	background: transparent;
	border: 1.5px solid var(--ly-color-primary, #53225e);
	cursor: pointer;
	padding: 0;
	transition: background-color 150ms ease;
}

.ly-upsell__dot[aria-current="true"] {
	background-color: var(--ly-color-primary, #53225e);
}

.ly-upsell__dot:hover {
	background-color: var(--ly-color-secondary, #ff7477);
	border-color: var(--ly-color-secondary, #ff7477);
}

.ly-upsell__arrow:focus-visible,
.ly-upsell__dot:focus-visible {
	outline: 2px solid var(--ly-color-focus-ring, #ff7477);
	outline-offset: 2px;
}

/* =============================================================================
   Mobile
   ============================================================================= */

@media (max-width: 640px) {
	.ly-upsell__card {
		grid-template-columns: 72px 1fr;
		gap: 12px;
		padding: 14px 16px;
	}
	.ly-upsell__image {
		width: 72px;
		height: 72px;
	}
	.ly-upsell__cta {
		grid-column: 1 / -1;
		justify-content: flex-end;
	}
	.ly-upsell__badge {
		top: 12px;
		right: 16px;
		font-size: 0.75rem;
		padding: 4px 10px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ly-upsell__track {
		scroll-behavior: auto;
	}
	.ly-upsell__arrow,
	.ly-upsell__dot,
	.ly-upsell__cta {
		transition: none;
	}
}
