/*
 * TCAP Merchandising - the parts blocks below the product description.
 *
 * Enqueued on single-product pages only, and only while tcap_rel_enabled().
 * Every selector targets a class the server prints: there is no JavaScript in
 * slice 1, and no class that script adds later, so WP Rocket's Remove Unused
 * CSS has nothing here to strip. (The RUCSS safelist entry for .tcap-rel* is
 * still added at G6, per the plan.)
 *
 * Each row scrolls sideways with CSS scroll-snap. Four cards fit on desktop.
 * A phone shows one card and the edge of the next, which is the cue to swipe.
 *
 * Colours follow the Part (single) template: #334bf5 buttons that darken to
 * #071dc2, #071dc2 part titles, #404345 prices, 12px uppercase button text.
 */

.tcap-rel {
	margin: 0 0 28px;
}

/* The Oxygen element styles its h2 by ID (28px). Four headings at that size
   crowd the page, so this one rule has to win outright. */
.tcap-rel__h {
	margin: 0 0 12px;
	font-size: 22px !important;
	line-height: 1.3;
	text-align: left;
}

.tcap-rel__row {
	--tcap-rel-gap: 16px;
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: calc((100% - 3 * var(--tcap-rel-gap)) / 4);
	gap: var(--tcap-rel-gap);
	margin: 0;
	padding: 2px 2px 10px;
	list-style: none;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scroll-snap-type: x mandatory;
	scroll-padding-left: 2px;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: thin;
}

.tcap-rel__card {
	display: flex;
	flex-direction: column;
	min-width: 0;
	margin: 0;
	padding: 12px;
	box-sizing: border-box;
	background: #fff;
	border: 1px solid #dfe3ea;
	border-radius: 8px;
	scroll-snap-align: start;
}

.tcap-rel__link {
	display: block;
	color: inherit;
	text-decoration: none;
}

.tcap-rel__link img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 1 / 1;
	object-fit: contain;
	box-sizing: border-box;
	background: #fff;
	border: 1px solid #eef1f5;
	border-radius: 6px;
}

/* No photo: the part number, large, on a neutral grey-blue tile. */
.tcap-rel__tile {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	aspect-ratio: 1 / 1;
	padding: 12px;
	box-sizing: border-box;
	background: #e6ebf2;
	border: 1px solid #d5dde8;
	border-radius: 6px;
}

.tcap-rel__tile-sku {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
	font-size: 24px;
	font-weight: 600;
	line-height: 1.2;
	letter-spacing: 0.02em;
	color: #34445a;
	text-align: center;
	overflow-wrap: anywhere;
}

.tcap-rel__sku {
	display: block;
	margin-top: 10px;
	font-size: 13px;
	line-height: 1.4;
	color: #6b7280;
	overflow-wrap: anywhere;
}

.tcap-rel__title {
	display: -webkit-box;
	margin-top: 2px;
	overflow: hidden;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.35;
	color: #071dc2;
	overflow-wrap: anywhere;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	line-clamp: 3;
}

.tcap-rel__link:hover .tcap-rel__title,
.tcap-rel__link:focus-visible .tcap-rel__title {
	text-decoration: underline;
}

/* margin-top: auto lines prices and buttons up along the bottom of the row. */
.tcap-rel__price {
	display: block;
	margin-top: auto;
	padding-top: 10px;
	font-size: 18px;
	font-weight: 600;
	line-height: 1.3;
	color: #404345;
}

.tcap-rel__view {
	display: block;
	margin-top: 10px;
	padding: 10px 12px;
	background: #334bf5;
	border: 1px solid #334bf5;
	border-radius: 4px;
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 1px;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	text-transform: uppercase;
}

.tcap-rel__view:hover,
.tcap-rel__view:focus-visible {
	background: #071dc2;
	border-color: #071dc2;
	color: #fff;
}

.tcap-rel__link:focus-visible,
.tcap-rel__view:focus-visible {
	outline: 2px solid #071dc2;
	outline-offset: 2px;
}

.tcap-rel__note {
	margin: 0 0 8px;
	font-size: 14px;
	line-height: 1.5;
	color: #4b5563;
}

/* Tablet: two cards and a peek. */
@media (max-width: 991px) {
	.tcap-rel__row {
		grid-auto-columns: calc((100% - 2 * var(--tcap-rel-gap)) / 2.4);
	}
}

/* Phone: about 1.3 cards - one whole card and the edge of the next. */
@media (max-width: 599px) {
	.tcap-rel__h {
		font-size: 20px !important;
	}

	.tcap-rel__row {
		--tcap-rel-gap: 12px;
		grid-auto-columns: calc((100% - var(--tcap-rel-gap)) / 1.3);
	}

	.tcap-rel__tile-sku {
		font-size: 22px;
	}
}
