/*
 * CEREBRO product cards - Galaxus-inspired.
 * Palette and spacing are CSS variables so the whole card can be re-themed in one place.
 */
:root {
	--cb-ink: #010101;
	--cb-muted: #5c5c5c;
	--cb-link: #1c7bc4;
	--cb-line: #e6e6e6;
	--cb-hover: #fafafa;
	--cb-instock: #4aa82e;
	--cb-onorder: #1c8fd0;
	--cb-longlead: #7a5fa5;
	--cb-na: #9a9a9a;
	--cb-sale: #d8232a;
	--cb-font: Inter, "Helvetica Neue", Helvetica, Arial, system-ui, -apple-system, "Segoe UI", sans-serif;
}

.wd-product .cb-card,
.cb-pop {
	font-family: var(--cb-font);
	color: var(--cb-ink);
	-webkit-font-smoothing: antialiased;
}

/* Reset whatever Woodmart puts on the grid item wrapper so the card owns its look. */
.wd-product:has(> .cb-card) {
	padding: 0;
	background: transparent;
	box-shadow: none;
	border: 0;
}

.cb-card {
	position: relative;
	display: flex;
	flex-direction: column;
	height: 100%;
	padding: 16px 16px 12px;
	background: #fff;
	border: 1px solid transparent;
	transition: background-color .15s ease, border-color .15s ease;
}

.cb-card:hover,
.cb-card:focus-within {
	background: var(--cb-hover);
	border-color: var(--cb-line);
}

/* Image */
.cb-card__media {
	position: relative;
	display: block;
	aspect-ratio: 1 / 1;
	margin-bottom: 14px;
}

.cb-card__img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
	/* Lets white product shots sit cleanly on the hover background. */
	mix-blend-mode: multiply;
}

.cb-badges {
	position: absolute;
	top: 0;
	left: 0;
	display: flex;
	flex-direction: column;
	gap: 4px;
	align-items: flex-start;
}

.cb-badge {
	display: inline-block;
	padding: 2px 6px;
	font-size: 11px;
	font-weight: 600;
	line-height: 14px;
	letter-spacing: .02em;
	text-transform: uppercase;
	background: #fff;
	border: 1px solid var(--cb-ink);
	color: var(--cb-ink);
}

.cb-badge--sale {
	color: #fff;
	background: var(--cb-sale);
	border-color: var(--cb-sale);
}

/* Body */
.cb-card__body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.cb-card__meta {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	min-height: 24px;
	font-size: 13px;
	line-height: 18px;
}

.cb-card__cat {
	overflow: hidden;
	color: var(--cb-link);
	text-overflow: ellipsis;
	white-space: nowrap;
	text-decoration: none;
}

.cb-card__cat:hover {
	text-decoration: underline;
}

.cb-card__price {
	margin: 0;
	font-size: 18px;
	font-weight: 700;
	line-height: 24px;
	color: var(--cb-ink);
}

.cb-card__price .amount,
.cb-card__price bdi {
	color: inherit;
	font-weight: inherit;
}

.cb-card__price del {
	margin-right: 6px;
	font-size: 13px;
	font-weight: 400;
	color: var(--cb-muted);
}

.cb-card__price ins {
	text-decoration: none;
	color: var(--cb-sale);
	background: transparent;
}

.cb-card__title {
	margin: 0;
	font-size: 14px;
	font-weight: 700;
	line-height: 19px;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.cb-card__title a {
	color: var(--cb-ink);
	text-decoration: none;
}

.cb-card__title a:hover {
	text-decoration: underline;
}

.cb-card__specs {
	margin: 0;
	overflow: hidden;
	font-size: 13px;
	line-height: 18px;
	color: var(--cb-muted);
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* Rating */
.cb-card__rating {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-top: 4px;
	font-size: 12px;
	line-height: 16px;
	color: var(--cb-muted);
}

.cb-stars {
	--cb-rating: 0%;
	position: relative;
	display: inline-block;
	width: 70px;
	height: 14px;
	background: linear-gradient(90deg, var(--cb-ink) var(--cb-rating), #d6d6d6 var(--cb-rating));
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='70' height='14' viewBox='0 0 70 14'%3E%3Cg id='s'%3E%3Cpath d='M7 .8l1.9 4.1 4.5.5-3.3 3.1.9 4.4L7 10.6 3 12.9l.9-4.4L.6 5.4l4.5-.5z'/%3E%3C/g%3E%3Cuse href='%23s' x='14'/%3E%3Cuse href='%23s' x='28'/%3E%3Cuse href='%23s' x='42'/%3E%3Cuse href='%23s' x='56'/%3E%3C/svg%3E") no-repeat center / 70px 14px;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='70' height='14' viewBox='0 0 70 14'%3E%3Cg id='s'%3E%3Cpath d='M7 .8l1.9 4.1 4.5.5-3.3 3.1.9 4.4L7 10.6 3 12.9l.9-4.4L.6 5.4l4.5-.5z'/%3E%3C/g%3E%3Cuse href='%23s' x='14'/%3E%3Cuse href='%23s' x='28'/%3E%3Cuse href='%23s' x='42'/%3E%3Cuse href='%23s' x='56'/%3E%3C/svg%3E") no-repeat center / 70px 14px;
}

/* Availability indicator */
.cb-avail-wrap {
	position: relative;
	flex: 0 0 auto;
}

.cb-avail {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	margin: 0;
	padding: 0;
	line-height: 1;
	background: transparent;
	border: 0;
	border-radius: 50%;
	cursor: pointer;
	transition: background-color .15s ease;
}

.cb-avail:hover,
.cb-avail[aria-expanded="true"] {
	background: rgba(0, 0, 0, .06);
}

.cb-avail--instock,
.cb-pop__row--instock .cb-pop__icon { color: var(--cb-instock); }
.cb-avail--onorder,
.cb-pop__row--onorder .cb-pop__icon { color: var(--cb-onorder); }
.cb-avail--longlead,
.cb-pop__row--longlead .cb-pop__icon { color: var(--cb-longlead); }
.cb-avail--na,
.cb-pop__row--na .cb-pop__icon { color: var(--cb-na); }

.cb-state-na .cb-card__img,
.cb-state-na .cb-card__price {
	opacity: .55;
}

/* Availability popover */
.cb-pop {
	z-index: 100000;
	box-sizing: border-box;
	width: 260px;
	padding: 14px 16px;
	font-size: 13px;
	line-height: 18px;
	background: #fff;
	border: 1px solid var(--cb-line);
	border-radius: 4px;
	box-shadow: 0 6px 24px rgba(0, 0, 0, .14);
}

.cb-pop[hidden] {
	display: none;
}

.cb-pop__title {
	margin-bottom: 8px;
	font-size: 14px;
	font-weight: 700;
}

.cb-pop__row {
	display: flex;
	align-items: flex-start;
	gap: 8px;
}

.cb-pop__icon {
	flex: 0 0 auto;
	display: inline-flex;
	margin-top: 1px;
}

/* Actions */
.cb-card__actions {
	position: absolute;
	right: 12px;
	bottom: 10px;
	display: flex;
	gap: 6px;
	opacity: 0;
	transform: translateY(4px);
	transition: opacity .15s ease, transform .15s ease;
}

.cb-card:hover .cb-card__actions,
.cb-card:focus-within .cb-card__actions {
	opacity: 1;
	transform: none;
}

@media (hover: none) {
	.cb-card__actions {
		opacity: 1;
		transform: none;
	}
}

.cb-card__actions .button,
.cb-card__actions .cb-cart {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	min-height: 0;
	margin: 0;
	padding: 0;
	font-size: 0;
	line-height: 0;
	color: var(--cb-ink);
	background: #fff;
	border: 1px solid var(--cb-line);
	border-radius: 50%;
	box-shadow: none;
	text-indent: -9999px;
	overflow: hidden;
	transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

.cb-card__actions .button > *,
.cb-card__actions .cb-cart > * {
	display: none;
}

.cb-card__actions .button::before,
.cb-card__actions .cb-cart::before {
	content: "";
	position: static;
	display: block;
	width: 18px;
	height: 18px;
	margin: 0;
	text-indent: 0;
	background: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='20' r='1.5'/%3E%3Ccircle cx='18' cy='20' r='1.5'/%3E%3Cpath d='M2 3h3l2.7 12.4a1 1 0 0 0 1 .8h8.9a1 1 0 0 0 1-.8L20 7H6'/%3E%3C/svg%3E") no-repeat center / contain;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='20' r='1.5'/%3E%3Ccircle cx='18' cy='20' r='1.5'/%3E%3Cpath d='M2 3h3l2.7 12.4a1 1 0 0 0 1 .8h8.9a1 1 0 0 0 1-.8L20 7H6'/%3E%3C/svg%3E") no-repeat center / contain;
}

.cb-card__actions .button::after {
	display: none;
}

.cb-card__actions .button:hover,
.cb-card__actions .button:focus-visible {
	color: #fff;
	background: var(--cb-ink);
	border-color: var(--cb-ink);
}

.cb-card__actions .button.loading::before {
	opacity: .4;
}

.cb-card__actions .added_to_cart {
	display: none;
}

/* Woodmart sets global button and price styles; these win by specificity. */
.wd-product .cb-card .cb-avail {
	box-sizing: border-box;
	width: 24px;
	height: 24px;
	min-width: 24px;
	min-height: 0;
	margin: 0;
	padding: 0;
	background: transparent;
	border: 0;
	border-radius: 50%;
	box-shadow: none;
}

.wd-product .cb-card .cb-avail:hover,
.wd-product .cb-card .cb-avail[aria-expanded="true"] {
	background: rgba(0, 0, 0, .06);
}

.wd-product .cb-card .cb-avail svg {
	display: block;
	flex: none;
	width: 16px;
	height: 16px;
}

.wd-product .cb-card .cb-card__price,
.wd-product .cb-card .cb-card__price .amount,
.wd-product .cb-card .cb-card__price bdi {
	color: var(--cb-ink);
	font-family: var(--cb-font);
	font-size: 18px;
	font-weight: 700;
}

.wd-product .cb-card .cb-card__price del,
.wd-product .cb-card .cb-card__price del .amount {
	color: var(--cb-muted);
	font-size: 13px;
	font-weight: 400;
}

.wd-product .cb-card .cb-card__price ins,
.wd-product .cb-card .cb-card__price ins .amount {
	color: var(--cb-sale);
}

.wd-product .cb-card .cb-card__title,
.wd-product .cb-card .cb-card__title a {
	font-family: var(--cb-font);
	font-size: 14px;
	font-weight: 700;
	color: var(--cb-ink);
}

.wd-product .cb-card .cb-card__specs,
.wd-product .cb-card .cb-card__cat {
	font-family: var(--cb-font);
}

.wd-product .cb-card .cb-card__cat {
	color: var(--cb-link);
}

.wd-product .cb-card .cb-avail--instock { color: var(--cb-instock); }
.wd-product .cb-card .cb-avail--onorder { color: var(--cb-onorder); }
.wd-product .cb-card .cb-avail--longlead { color: var(--cb-longlead); }
.wd-product .cb-card .cb-avail--na { color: var(--cb-na); }

/* Reserve a bottom row for the cart button so it never covers the title or specs. */
.wd-product .cb-card {
	padding-bottom: 54px;
}

.wd-product .cb-card__actions {
	right: 12px;
	bottom: 12px;
}

.wd-product .cb-card .cb-card__title {
	word-break: break-word;
}


/* ---------------------------------------------------------------------------
 * Single product page
 * ------------------------------------------------------------------------- */
.cb-stock {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin: 12px 0 16px;
	padding: 12px 14px;
	font-family: var(--cb-font);
	font-size: 14px;
	line-height: 20px;
	color: var(--cb-ink);
	background: var(--cb-hover);
	border: 1px solid var(--cb-line);
	border-left-width: 4px;
	border-radius: 4px;
}

.cb-stock__icon {
	display: inline-flex;
	flex: none;
	margin-top: 2px;
}

.cb-stock__icon svg {
	width: 20px;
	height: 20px;
}

.cb-stock__text {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.cb-stock__text strong {
	font-size: 15px;
	font-weight: 700;
}

.cb-stock__text span {
	color: var(--cb-muted);
}

.cb-stock--instock { border-left-color: var(--cb-instock); }
.cb-stock--instock .cb-stock__icon { color: var(--cb-instock); }
.cb-stock--onorder { border-left-color: var(--cb-onorder); }
.cb-stock--onorder .cb-stock__icon { color: var(--cb-onorder); }
.cb-stock--longlead { border-left-color: var(--cb-longlead); }
.cb-stock--longlead .cb-stock__icon { color: var(--cb-longlead); }
.cb-stock--na { border-left-color: var(--cb-na); }
.cb-stock--na .cb-stock__icon { color: var(--cb-na); }

/* The add-to-cart widget carries a second, hidden stock line; do not show the block twice. */
.wd-single-add-cart > .elementor-widget-container > .cb-stock {
	display: none;
}

.single-product .wd-single-price .price {
	font-family: var(--cb-font);
	font-size: 32px;
	font-weight: 700;
	line-height: 40px;
	color: var(--cb-ink);
}

.single-product .wd-single-price .price .amount,
.single-product .wd-single-price .price bdi {
	color: inherit;
	font-weight: inherit;
}

.single-product .wd-single-price .price del,
.single-product .wd-single-price .price del .amount {
	font-size: 18px;
	font-weight: 400;
	color: var(--cb-muted);
}

.single-product .wd-single-price .price ins,
.single-product .wd-single-price .price ins .amount {
	color: var(--cb-sale);
	text-decoration: none;
}

.single-product .wd-single-title .product_title {
	font-family: var(--cb-font);
	font-weight: 700;
	color: var(--cb-ink);
}

.single-product .wd-single-meta,
.single-product .wd-single-meta .sku_wrapper {
	font-family: var(--cb-font);
	font-size: 13px;
	color: var(--cb-muted);
}

.single-product .single_add_to_cart_button.button {
	font-family: var(--cb-font);
	font-weight: 600;
	color: #fff;
	background: var(--cb-ink);
	border-color: var(--cb-ink);
	border-radius: 4px;
	box-shadow: none;
}

.single-product .single_add_to_cart_button.button:hover {
	background: #2b2b2b;
	border-color: #2b2b2b;
}

/* Woodmart hides the stock widget unless it contains a .stock element; ours is a different block. */
.single-product .wd-single-stock-status:has(.cb-stock) {
	display: block;
}

.wd-sticky-btn .cb-stock {
	display: none;
}
