/* Product card + product grids */

.bb-grid {
	display: grid;
	gap: 12px;
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 700px) {
	.bb-grid {
		gap: 16px;
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (min-width: 1100px) {
	.bb-grid {
		gap: 20px;
	}

	.bb-grid--4 {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}

	.bb-grid--5 {
		grid-template-columns: repeat(5, minmax(0, 1fr));
	}
}

.bb-card {
	position: relative;
	display: flex;
	flex-direction: column;
	background: var(--bb-white);
	min-width: 0;
}

.bb-card__media {
	position: relative;
	display: block;
	aspect-ratio: 1;
	padding: 24px 24px 8px;
}

.bb-card__img {
	display: block;
	width: 100%;
	height: 100%;
	overflow: hidden;
}

.bb-card__media img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	transition: transform 0.3s;
}

/* The whole card is clickable: the title link stretches over it. */
.bb-card__title a::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
}

.bb-card {
	transition: box-shadow 0.2s, transform 0.2s;
}

.bb-card:hover,
.bb-card:focus-within {
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
	transform: translateY(-2px);
}

.bb-card:hover .bb-card__media img {
	transform: scale(1.04);
}

.bb-card:hover .bb-card__title a,
.bb-card:focus-within .bb-card__title a {
	color: var(--bb-orange);
}

@media (prefers-reduced-motion: reduce) {
	.bb-card,
	.bb-card__media img {
		transition: none;
	}

	.bb-card:hover,
	.bb-card:hover .bb-card__media img {
		transform: none;
	}
}

.bb-card__flags {
	position: absolute;
	top: 12px;
	left: 12px;
	z-index: 2; /* above the card-wide link layer (z-index 1) so the icon can be hovered */
	display: flex;
	align-items: center;
	gap: 6px;
}

.bb-stock {
	flex: none;
}

/* Tooltip on the stock icon */
.bb-stock-tip {
	position: relative;
	display: flex;
	cursor: help;
}

.bb-stock-tip::after {
	content: attr(data-tip);
	position: absolute;
	top: 50%;
	left: calc(100% + 8px);
	z-index: 3;
	padding: 6px 12px;
	background: #666;
	color: #fff;
	font-family: var(--bb-font-body);
	font-size: 14px;
	line-height: 1.3;
	white-space: nowrap;
	opacity: 0;
	pointer-events: none;
	transform: translateY(-50%);
	transition: opacity 0.12s;
}

.bb-stock-tip:hover::after {
	opacity: 1;
}

.bb-card__stock {
	/* Visually hidden in grid view (the icon + tooltip say it), still read by screen readers. */
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

.bb-card__stock--in {
	color: #1a9c2f;
}

.bb-card__stock--out {
	color: #d62020;
}

.bb-card__new {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 2;
	padding: 1px 10px;
	background: var(--bb-dark);
	color: #fff;
	font-family: var(--bb-font-head);
	font-size: 15px;
	font-weight: 700;
	letter-spacing: 0.06em;
	line-height: 1.4;
	text-transform: uppercase;
}

.bb-badge {
	padding: 1px 8px;
	background: var(--bb-sale);
	color: #fff;
	font-family: var(--bb-font-head);
	font-size: 15px;
	font-weight: 500;
	line-height: 1.4;
}

.bb-card__body {
	padding: 8px 14px 16px;
	text-align: center;
}

.bb-card__title {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	min-height: 2.3em;
	margin-bottom: 8px;
	font-size: 16px;
	font-weight: 500;
	line-height: 1.15;
	text-transform: none;
}

.bb-card__title a:hover {
	color: var(--bb-orange);
}

.bb-card__price {
	font-family: var(--bb-font-head);
	font-size: 20px;
	font-weight: 700;
	color: var(--bb-orange);
}

.bb-card__price del {
	margin-right: 6px;
	color: var(--bb-muted);
	font-size: 15px;
	font-weight: 400;
}

.bb-card__price ins {
	text-decoration: none;
}

.bb-card__price .screen-reader-text {
	position: absolute;
}
