/**
 * "THE TRENDS" dynamic product carousel (best sellers) with quick-add
 * size swatches. Layout mirrors .tb-trends but with product body/price
 * and a working add-to-cart popover.
 */

.tb-pcarousel {
	--tb-pc-side: 28px;
	--tb-pc-card: 300px;
	--tb-pc-card-mobile: 210px;
	--tb-pc-media: 380px;
	background: var(--tb-white);
	padding-block: 32px;
}

.tb-pcarousel__header {
	padding: 10px var(--tb-pc-side) 6px;
	text-align: center;
}

.tb-pcarousel__heading {
	margin: 0 auto;
	font-family: var(--tb-font-display);
	font-size: 36px;
	line-height: 1.15;
	font-weight: 800;
	letter-spacing: 0.02em;
	text-transform: uppercase;
}

.tb-pcarousel__wrap {
	position: relative;
	width: 100%;
	padding: 0 var(--tb-pc-side) 10px;
}

.tb-pcarousel__footer {
	display: flex;
	justify-content: center;
	margin-top: 16px;
}

.tb-pcarousel__scroll {
	display: flex;
	flex-wrap: nowrap;
	gap: 14px;
	overflow-x: auto;
	scroll-behavior: smooth;
	scroll-snap-type: x proximity;
	padding: 8px 2px 12px;
	scrollbar-width: none;
	-ms-overflow-style: none;
	cursor: grab;
	user-select: none;
	touch-action: pan-y;
}

.tb-pcarousel__scroll.is-dragging {
	scroll-behavior: auto;
	cursor: grabbing;
	scroll-snap-type: none;
}

.tb-pcarousel__scroll::-webkit-scrollbar {
	display: none;
	width: 0;
	height: 0;
}

.tb-pcarousel__card {
	position: relative;
	flex: 0 0 clamp(170px, 16vw, var(--tb-pc-card));
	width: clamp(170px, 16vw, var(--tb-pc-card));
	scroll-snap-align: start;
}

.tb-pcarousel__media-link {
	display: block;
	text-decoration: none;
	color: inherit;
}

.tb-pcarousel__media {
	position: relative;
	width: 100%;
	height: var(--tb-pc-media);
	overflow: hidden;
	background: var(--tb-card-bg);
	border: 1px solid var(--tb-border-hair);
}

.tb-pcarousel__img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	transition: opacity 0.35s ease;
}

.tb-pcarousel__img--hover {
	opacity: 0;
}

.tb-pcarousel__card:hover .tb-pcarousel__img--hover {
	opacity: 1;
}

.tb-pcarousel__card:hover .tb-pcarousel__img--primary {
	opacity: 0;
}

.tb-pcarousel__badge {
	position: absolute;
	top: 10px;
	left: 10px;
	z-index: 2;
	background: var(--tb-black);
	color: var(--tb-white);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	padding: 4px 8px;
}

.tb-pcarousel__quick-toggle {
	position: absolute;
	right: 10px;
	bottom: 10px;
	z-index: 3;
	width: 32px;
	height: 32px;
	border-radius: var(--tb-radius-pill);
	border: 1px solid var(--tb-black);
	background: var(--tb-white);
	color: var(--tb-black);
	font-size: 18px;
	line-height: 1;
	font-weight: 700;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.tb-pcarousel__quick-toggle:hover {
	background: var(--tb-black);
	color: var(--tb-white);
}

.tb-pcarousel__swatches {
	position: absolute;
	inset: auto 0 0 0;
	z-index: 4;
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 10px;
	background: rgba(255, 255, 255, 0.94);
	border-top: 1px solid var(--tb-border-hair);
}

/* [hidden] and .tb-pcarousel__swatches{display:flex} have equal specificity,
   so without this the flex rule wins the cascade and the panel never hides. */
.tb-pcarousel__swatches[hidden] {
	display: none;
}

.tb-pcarousel__swatch-row {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.tb-pcarousel__swatch-hint {
	margin: 0;
	font-size: 11px;
	color: #c0392b;
}

.tb-pcarousel__swatch {
	min-width: 38px;
	height: 32px;
	padding: 0 8px;
	border: 1px solid var(--tb-black);
	background: var(--tb-white);
	color: var(--tb-black);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.04em;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.tb-pcarousel__swatch:hover:not(:disabled) {
	background: var(--tb-black);
	color: var(--tb-white);
}

.tb-pcarousel__swatch:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.tb-pcarousel__swatch.is-error {
	border-color: #c0392b;
	color: #c0392b;
}

.tb-pcarousel__swatch--gender.is-selected {
	background: var(--tb-black);
	color: var(--tb-white);
}

.tb-pcarousel__body {
	margin-top: 10px;
}

.tb-pcarousel__title {
	display: block;
	font-family: var(--tb-font-sans);
	font-size: 14px;
	line-height: 1.3;
	font-weight: 600;
	color: var(--tb-text);
	text-decoration: none;
}

.tb-pcarousel__title:hover {
	opacity: 0.72;
}

.tb-pcarousel__price {
	margin-top: 4px;
	display: flex;
	align-items: center;
	gap: 8px;
	font-family: var(--tb-font-sans);
	font-size: 14px;
}

.tb-pcarousel__price-old {
	color: rgba(0, 0, 0, 0.45);
	text-decoration: line-through;
}

.tb-pcarousel__price-now {
	font-weight: 700;
	color: var(--tb-text);
}

.tb-pcarousel__arrow,
.tb-pcarousel__card,
.tb-pcarousel__title {
	outline-offset: 3px;
}

.tb-pcarousel__arrow:focus-visible,
.tb-pcarousel__title:focus-visible,
.tb-pcarousel__media-link:focus-visible {
	outline: 2px solid var(--tb-black);
	outline-offset: 3px;
}

.tb-pcarousel__arrow {
	position: absolute;
	top: 38%;
	transform: translateY(-50%);
	z-index: 5;
	width: 46px;
	height: 46px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: var(--tb-radius-pill);
	border: 1px solid var(--tb-border-soft);
	background: rgba(255, 255, 255, 0.86);
	color: var(--tb-black);
	cursor: pointer;
}

.tb-pcarousel__arrow:hover {
	border-color: rgba(0, 0, 0, 0.48);
	background: rgba(255, 255, 255, 0.92);
}

.tb-pcarousel__arrow--prev {
	left: 14px;
}

.tb-pcarousel__arrow--next {
	right: 14px;
}

.tb-pcarousel__arrow-icon {
	position: relative;
	width: 14px;
	height: 14px;
	display: block;
}

.tb-pcarousel__arrow-icon::before {
	content: "";
	position: absolute;
	inset: 0;
	border-top: 1.6px solid currentColor;
	border-right: 1.6px solid currentColor;
	transform: rotate(45deg);
}

.tb-pcarousel__arrow-icon--prev::before {
	transform: rotate(-135deg);
}

.tb-pcarousel__dots {
	display: flex;
	justify-content: center;
	gap: 8px;
	margin-top: 12px;
}

.tb-pcarousel__dot {
	width: 28px;
	height: 4px;
	background: var(--tb-black);
	opacity: 0.2;
	transition: opacity 0.2s ease;
}

.tb-pcarousel__dot.is-active {
	opacity: 1;
}

@media (max-width: 749px) {
	.tb-pcarousel {
		padding-block: 24px;
	}

	.tb-pcarousel__header {
		padding: 10px 16px 6px;
	}

	.tb-pcarousel__wrap {
		padding: 0 14px 10px;
	}

	.tb-pcarousel__card {
		flex-basis: var(--tb-pc-card-mobile);
		width: var(--tb-pc-card-mobile);
		min-width: var(--tb-pc-card-mobile);
	}

	.tb-pcarousel__media {
		height: 280px;
	}

	.tb-pcarousel__arrow {
		width: 40px;
		height: 40px;
		top: 36%;
	}
}
