/* ============================================================================
   asc-carousel.css - the shop's product carousels (extension/asc/carousel.twig)
   ============================================================================
   One component for every row of product cards at the foot of a product page:
   the products that fit a machine (FEATURE-BACKLOG item 18, "Toate" and one tab per group)
   and the alternatives to a product (item 19, one row, no tabs), so the two
   read as one system when they stand one under the other.

   What the research asks for (sql/machine-links/README.md, "The page block"):
     - each card carries a large image, the full name, the price and its own
       button (Baymard, cross-sell attributes);
     - the row swipes, has visible arrows, snaps, and shows a slice of the next
       card, so it is clear there is more (NN/g, carousels on touch screens);
     - a long set must also be reachable directly (NN/g: people stop after
       3 - 4 carousel pages): the tabs split it by group, each with its count,
       and each row puts the most wanted items first;
     - nothing auto-rotates, and the row never changes into another layout.
   One row per block, whatever the number of groups, keeps the page short on a
   phone. Without JavaScript the tabs stay hidden and every group is shown.
   Colours and borders are product-sections.css's, so it reads as the page.
   ============================================================================ */

.asc-car {
	clear: both;
	margin: 32px 0 24px;
	padding-top: 20px;
	border-top: 1px solid #e3e6ea;
}
.asc-car-title {
	margin: 0 0 4px;
	font-size: 22px;
	line-height: 1.25;
	font-weight: 600;
	color: #222;
}
.asc-car-intro {
	margin: 0 0 14px;
	color: #666;
}

/* ---------- the tabs (one per group) ---------------------------------------------- */
.asc-car-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 4px;
}
.asc-car-tab {
	padding: 7px 14px;
	border: 1px solid #d5dae0;
	border-radius: 18px;
	background: #fff;
	color: #333;
	font: inherit;
	font-size: 14px;
	line-height: 1.3;
	white-space: nowrap;
	cursor: pointer;
}
.asc-car-tab:hover {
	border-color: #229ac8;
	color: #229ac8;
}
.asc-car-tab[aria-selected="true"] {
	border-color: #229ac8;
	background: #229ac8;
	color: #fff;
}
.asc-car-tab-count {
	margin-left: 4px;
	opacity: .7;
}
/* on a phone the tabs are one row that scrolls sideways, not several wrapped rows */
@media (max-width: 599px) {
	.asc-car-tabs {
		flex-wrap: nowrap;
		overflow-x: auto;
		margin-right: -15px;
		padding: 0 15px 4px 0;
		scrollbar-width: none;
	}
	.asc-car-tabs::-webkit-scrollbar {
		display: none;
	}
}

/* ---------- a panel: its title (without tabs' help), then the row ---------------------- */
.asc-car-panel {
	padding-top: 12px;
}
.asc-car-panel + .asc-car-panel {
	padding-top: 22px;
}
.asc-car-js .asc-car-panel + .asc-car-panel {
	padding-top: 12px;
}
.asc-car-sub {
	margin: 0 0 8px;
	font-size: 17px;
	line-height: 1.3;
	font-weight: 600;
	color: #222;
}
.asc-car-sub span {
	font-weight: 400;
	color: #777;
}
/* with tabs, the tab names the group: the panel's own title only serves without JavaScript */
.asc-car-js [role="tabpanel"] .asc-car-sub {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
}

/* ---------- the row and its arrows ------------------------------------------------- */
.asc-car-view {
	position: relative;
}
.asc-car-track {
	display: flex;
	gap: 12px;
	margin: 0;
	padding: 2px 2px 12px;
	list-style: none;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scroll-snap-type: x mandatory;
	scroll-padding: 0 2px;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
}
.asc-car-track::-webkit-scrollbar {
	display: none;
}
/* without JavaScript the native scrollbar is the only cue, so it stays */
.asc-car:not(.asc-car-js) .asc-car-track {
	scrollbar-width: thin;
}
.asc-car-arrow {
	position: absolute;
	top: 32%;
	z-index: 2;
	width: 40px;
	height: 40px;
	margin-top: -20px;
	padding: 0;
	border: 1px solid #d5dae0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .96);
	box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
	color: #222;
	cursor: pointer;
}
.asc-car-prev {
	left: -12px;
}
.asc-car-next {
	right: -12px;
}
.asc-car-arrow span {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 10px;
	height: 10px;
	border-top: 2px solid currentColor;
	border-right: 2px solid currentColor;
}
.asc-car-prev span {
	transform: translate(-30%, -50%) rotate(-135deg);
}
.asc-car-next span {
	transform: translate(-70%, -50%) rotate(45deg);
}
.asc-car-arrow:hover {
	border-color: #229ac8;
	color: #229ac8;
}
@media (max-width: 599px) {
	.asc-car-arrow {
		width: 36px;
		height: 36px;
		margin-top: -18px;
	}
	.asc-car-prev {
		left: -6px;
	}
	.asc-car-next {
		right: -6px;
	}
}

/* ---------- the cards: five and a slice on a desktop, three on a tablet, two on a phone */
/* position: relative keeps every absolutely placed child (the phone's visually hidden button
   text) inside the card, so the row clips it: placed against the row's parent instead, the
   cards scrolled out of view stretched the whole page wider than a phone's screen */
.asc-card {
	position: relative;
	flex: 0 0 calc((100% - 5 * 12px) / 5.3);
	min-width: 0;
	display: flex;
	flex-direction: column;
	padding: 10px;
	border: 1px solid #e3e6ea;
	border-radius: 8px;
	background: #fff;
	scroll-snap-align: start;
}
@media (max-width: 991px) {
	.asc-card {
		flex-basis: calc((100% - 3 * 12px) / 3.3);
	}
}
@media (max-width: 599px) {
	.asc-car-track {
		gap: 10px;
	}
	.asc-card {
		flex-basis: calc((100% - 10px) / 2.15);
		padding: 8px;
	}
}
.asc-card:hover {
	border-color: #c9d1da;
	box-shadow: 0 2px 10px rgba(0, 0, 0, .07);
}
.asc-card-img {
	display: block;
	margin: 0 0 8px;
	aspect-ratio: 1 / 1;
}
.asc-card-img img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}
/* in "Toate" each card says which group it belongs to; among the alternatives, how it differs */
.asc-card-group {
	overflow: hidden;
	margin-bottom: 2px;
	font-size: 12px;
	font-weight: 600;
	color: #229ac8;
	white-space: nowrap;
	text-overflow: ellipsis;
}
.asc-card-name {
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
	min-height: calc(3 * 1.35em);
	margin-bottom: 4px;
	color: #222;
	font-size: 14px;
	line-height: 1.35;
}
.asc-card-name:hover,
.asc-card-name:focus {
	color: #229ac8;
}
.asc-card-code {
	overflow: hidden;
	font-size: 12px;
	color: #888;
	white-space: nowrap;
	text-overflow: ellipsis;
}
.asc-card-buy {
	margin-top: auto;
	padding-top: 6px;
}
.asc-card-price {
	display: block;
	font-size: 16px;
	font-weight: 600;
	color: #222;
}
.asc-card-old {
	font-size: 13px;
	font-weight: 400;
	color: #999;
	text-decoration: line-through;
}
.asc-card-cart {
	width: 100%;
	margin-top: 8px;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}
/* on a phone: no code, smaller name; price and a round cart button side by side */
@media (max-width: 599px) {
	.asc-card-name {
		font-size: 13px;
	}
	.asc-card-code {
		display: none;
	}
	.asc-card-buy {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 6px;
	}
	.asc-card-price {
		min-width: 0;
		font-size: 15px;
		line-height: 1.2;
	}
	.asc-card-old {
		display: block;
		font-size: 12px;
	}
	.asc-card-cart {
		flex: none;
		width: 40px;
		height: 40px;
		margin: 0;
		padding: 0;
		border-radius: 50%;
		font-size: 16px;
	}
	.asc-card-cart-text {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
	}
}

/* ---------- the link under the row (the alternatives' category) -------------------- */
.asc-car-more {
	margin: 4px 0 0;
	font-size: 14px;
	font-weight: 600;
}

.asc-car-tab:focus-visible,
.asc-car-arrow:focus-visible,
.asc-card-cart:focus-visible,
.asc-card-name:focus-visible {
	outline: 2px solid #229ac8;
	outline-offset: 2px;
}
