/*
 * Product card: photo (hover swaps to the second photo), badge, quick add,
 * title + price row, colour and type lines.
 * --njf-card-ratio and --njf-card-fit are set by the grid/collection widgets.
 */

.njf-card {
	--njf-card-fg: var(--njf-fg, #111);
	--njf-card-line: color-mix(in srgb, var(--njf-card-fg) 20%, transparent);

	display: flex;
	flex-direction: column;
	min-width: 0;
	margin: 0;
	padding: 0;
	color: var(--njf-card-fg);
	list-style: none;
}

.njf-card .njf-card__frame {
	position: relative;
}

.njf-card .njf-card__media {
	position: relative;
	display: block;
	aspect-ratio: var(--njf-card-ratio, 1 / 1);
	overflow: hidden;
	background: var(--njf-card-bg, var(--njf-surface, #f5f5f5));
}

.njf-card .njf-card__img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: var(--njf-card-fit, cover);
	transition: opacity 0.35s ease, transform 0.5s ease;
}

.njf-card .njf-card__img--alt {
	opacity: 0;
}

@media (hover: hover) {
	.njf-card .njf-card__media--hover:hover .njf-card__img--alt,
	.njf-card .njf-card__frame:focus-within .njf-card__media--hover .njf-card__img--alt {
		opacity: 1;
	}
}

/* "On Model" view (collection toggle): show the second photo. */
.njf-view-model .njf-card .njf-card__media--hover .njf-card__img--alt {
	opacity: 1;
}

.njf-card.is-sold-out .njf-card__img {
	opacity: 0.6;
}

.njf-card .njf-card__badge {
	position: absolute;
	top: 12px;
	left: 12px;
	z-index: 1;
	padding: 3px 8px;

	/* The source theme's frosted tag; darkened a little so it reads on white product photos too. */
	background: color-mix(in srgb, var(--njf-bg, #000) 55%, transparent);
	backdrop-filter: blur(6px);
	color: var(--njf-card-fg);
	font-size: 13px;
	font-weight: 400;
	line-height: 1.3;
}

.njf-card .njf-card__info {
	margin-top: 10px;
	padding-top: 12px;
	border-top: 1px solid var(--njf-card-line);
}

.njf-card .njf-card__row {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 6px;
}

.njf-card .njf-card__title {
	color: inherit;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.3;
	text-decoration: none;
}

.njf-card .njf-card__title:hover,
.njf-card .njf-card__title:focus {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 3px;
}

.njf-card .njf-card__price {
	flex-shrink: 0;
	font-size: 14px;
	text-align: right;
}

.njf-card .njf-card__price del {
	margin-right: 6px;
	color: color-mix(in srgb, var(--njf-card-fg) 55%, transparent);
}

.njf-card .njf-card__price del .amount {
	color: inherit;
}

.njf-card .njf-card__price ins {
	background: none;
	color: inherit;
	text-decoration: none;
}

.njf-card .njf-card__meta {
	margin: 0;
	color: color-mix(in srgb, var(--njf-card-fg) 62%, transparent);
	font-size: 13px;
	line-height: 1.7;
}

.njf-card .njf-card__rating {
	display: flex;
	align-items: center;
	gap: 6px;
	margin: 6px 0 0;
}

.njf-card .njf-card__stars {
	position: relative;
	display: inline-block;
	color: color-mix(in srgb, var(--njf-card-fg) 25%, transparent);
	font-size: 14px;
	line-height: 1;
	letter-spacing: 1px;
}

.njf-card .njf-card__stars-fill {
	position: absolute;
	top: 0;
	left: 0;
	overflow: hidden;
	color: #f5a623;
	white-space: nowrap;
}

.njf-card .njf-card__count {
	font-size: 11px;
}

/* Quick add: a bar along the bottom of the photo on hover; a round + on touch screens. */
.njf-card .njf-card__qa {
	position: absolute;
	right: 10px;
	bottom: 10px;
	left: 10px;
	z-index: 2;
}

.njf-card .njf-card__qa .njf-card__qa-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	width: 100%;
	min-height: 40px;
	margin: 0;
	padding: 0 12px;
	border: 0;
	border-radius: 0;
	background: var(--njf-card-fg);
	color: var(--njf-bg, #fff);
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	cursor: pointer;
}

.njf-card .njf-card__qa .njf-card__qa-btn:hover,
.njf-card .njf-card__qa .njf-card__qa-btn:focus-visible {
	background: var(--njf-accent, var(--njf-card-fg));
	color: #fff;
}

.njf-card .njf-card__qa-plus {
	font-size: 16px;
	font-weight: 400;
	line-height: 1;
}

.njf-card .njf-card__qa.is-open .njf-card__qa-btn {
	display: none;
}

.njf-card .njf-card__qa.is-loading {
	opacity: 0.6;
	pointer-events: none;
}

.njf-card .njf-card__qa-list {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 10px;
	background: var(--njf-card-fg);
}

.njf-card .njf-card__qa-list[hidden] {
	display: none;
}

.njf-card .njf-card__qa-list .njf-card__qa-opt {
	flex: 1 1 auto;
	min-height: 34px;
	margin: 0;
	padding: 0 10px;
	border: 1px solid color-mix(in srgb, var(--njf-bg, #fff) 30%, transparent);
	border-radius: 0;
	background: transparent;
	color: var(--njf-bg, #fff);
	font-size: 12px;
	font-weight: 600;
	letter-spacing: normal;
	text-transform: none;
	cursor: pointer;
}

.njf-card .njf-card__qa-list .njf-card__qa-opt:hover,
.njf-card .njf-card__qa-list .njf-card__qa-opt:focus-visible {
	border-color: var(--njf-bg, #fff);
	background: var(--njf-bg, #fff);
	color: var(--njf-card-fg);
}

@media (hover: hover) {
	.njf-card .njf-card__qa {
		opacity: 0;
		transform: translateY(6px);
		transition: opacity 0.2s ease, transform 0.2s ease;
	}

	.njf-card .njf-card__frame:hover .njf-card__qa,
	.njf-card .njf-card__qa:focus-within,
	.njf-card .njf-card__qa.is-open {
		opacity: 1;
		transform: none;
	}
}

@media (hover: none) {
	.njf-card .njf-card__qa:not(.is-open) {
		left: auto;
	}

	.njf-card .njf-card__qa .njf-card__qa-btn {
		width: 38px;
		height: 38px;
		min-height: 38px;
		padding: 0;
		border-radius: 50%;
	}

	.njf-card .njf-card__qa-text {
		display: none;
	}

	.njf-card .njf-card__qa-plus {
		font-size: 20px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.njf-card .njf-card__img,
	.njf-card .njf-card__qa {
		transition: none;
	}
}

.njf-visually-hidden {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}
