/* Розробка та дизайн: Oleg Dez · dezoleg@gmail.com · https://dez.kiev.ua */
/*
 * neova/product-cards. Розміри з макета головної (design/text/index.json):
 * D — вертикальна картка, фото на surface 312 px, тіло 24 px, назва 22, підзаголовок 15, фасування 14, ціна 16 / 700;
 * M — горизонтальна, фото 120 px зліва, тіло 16 px, назва 16, підзаголовок 13, фасування 12, ціна 15 / 700.
 */

.neova-product-cards__label {
	margin: 0 0 var(--wp--preset--spacing--30);
	color: var(--wp--preset--color--muted);
	font-size: var(--wp--preset--font-size--meta);
}

.neova-product-cards__list {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--wp--preset--spacing--40);
	margin: 0;
	padding: 0;
	list-style: none;
}

@media (min-width: 768px) {
	.neova-product-cards--grid .neova-product-cards__list,
	.neova-product-cards--related .neova-product-cards__list {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: var(--wp--preset--spacing--50);
	}
}

@media (min-width: 1200px) {
	.neova-product-cards--grid .neova-product-cards__list,
	.neova-product-cards--related .neova-product-cards__list {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

.neova-product-cards__extra {
	display: flex;
}

.neova-product-cards__extra > * {
	flex: 1 1 auto;
	margin: 0;
}

/* ---------- Картка ---------- */

.neova-product-card {
	position: relative;
	display: grid;
	grid-template-columns: var(--wp--custom--product-card--media-mobile) minmax(0, 1fr);
	margin: 0;
	border: var(--wp--custom--line--width) solid var(--wp--preset--color--line);
	background-color: var(--wp--preset--color--white);
	transition: border-color .15s ease;
}

.neova-product-card:hover {
	border-color: var(--wp--preset--color--primary);
}

.neova-product-card__media {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: var(--wp--preset--spacing--20);
	background-color: var(--wp--preset--color--surface);
}

.neova-product-card__media img {
	display: block;
	width: 100%;
	height: 100%;
	max-height: var(--wp--custom--product-card--media-height);
	object-fit: contain;
}

.neova-product-card__body {
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--20);
	min-width: 0;
	padding: var(--wp--preset--spacing--40);
}

.neova-product-card__body > * {
	margin: 0;
}

.neova-product-card__category {
	display: none;
	color: var(--wp--preset--color--muted);
	font-size: var(--wp--preset--font-size--meta);
	line-height: var(--wp--custom--line-height--tight);
}

.neova-product-card__title {
	color: var(--wp--preset--color--ink);
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--h-3-card);
	font-weight: 500;
	line-height: var(--wp--custom--line-height--h-3-card);
	text-transform: uppercase;
	overflow-wrap: anywhere;
}

.neova-product-card__link {
	color: inherit;
	text-decoration: none;
}

/* Уся картка клікабельна через посилання в назві; «Купити» — над ним. */
.neova-product-card__link::after {
	content: "";
	position: absolute;
	inset: 0;
}

.neova-product-card:hover .neova-product-card__link {
	text-decoration: underline;
	text-decoration-thickness: var(--wp--custom--line--width);
	text-underline-offset: 0.15em;
}

.neova-product-card__link:focus-visible {
	outline: none;
}

.neova-product-card:has(.neova-product-card__link:focus-visible) {
	outline: var(--wp--custom--focus--width) solid var(--wp--preset--color--primary);
	outline-offset: var(--wp--custom--focus--offset);
}

.neova-product-card__subtitle {
	color: var(--wp--preset--color--body-text);
	font-size: var(--wp--preset--font-size--meta);
	line-height: var(--wp--custom--line-height--small);
}

.neova-product-card__packing {
	color: var(--wp--preset--color--muted);
	font-size: var(--wp--preset--font-size--caption);
	line-height: var(--wp--custom--line-height--tight);
}

.neova-product-card__packing-label {
	display: none;
}

.neova-product-card__footer {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--wp--preset--spacing--30);
	margin-top: auto;
	padding-top: var(--wp--preset--spacing--30);
}

.neova-product-card__price {
	margin: 0;
	color: var(--wp--preset--color--ink);
	font-size: var(--wp--preset--font-size--button-m);
	font-weight: 700;
	line-height: var(--wp--custom--line-height--tight);
	white-space: nowrap;
}

.neova-product-card__buy {
	position: relative;
	z-index: 1;
}

/* ---------- ≥ 768 px: вертикальна картка ---------- */

@media (min-width: 768px) {
	.neova-product-card {
		grid-template-columns: minmax(0, 1fr);
		grid-template-rows: auto 1fr;
	}

	.neova-product-card__media {
		height: var(--wp--custom--product-card--media-height);
		padding: var(--wp--preset--spacing--40);
	}

	.neova-product-card__body {
		gap: var(--wp--preset--spacing--30);
		padding: var(--wp--preset--spacing--50);
	}

	.neova-product-card__category {
		display: block;
	}

	.neova-product-card__subtitle {
		font-size: var(--wp--preset--font-size--button-m);
	}

	.neova-product-card__packing {
		font-size: var(--wp--preset--font-size--small);
	}

	.neova-product-card__packing-label {
		display: inline;
	}

	.neova-product-card__footer {
		margin-top: auto;
		padding-top: var(--wp--preset--spacing--40);
		border-top: var(--wp--custom--line--width) solid var(--wp--preset--color--line);
	}

	.neova-product-card__price {
		font-size: var(--wp--preset--font-size--base);
	}
}

/* ---------- Сайдбар статті: одна колонка, вертикальна картка ---------- */

@media (min-width: 1200px) {
	.neova-product-cards--sidebar .neova-product-card {
		grid-template-columns: minmax(0, 1fr);
	}

	.neova-product-cards--sidebar .neova-product-card__buy {
		flex: 1 1 100%;
	}
}

/* 768–1199: у статті сайдбар під текстом — картка обмеженої ширини. */
@media (min-width: 768px) and (max-width: 1199px) {
	.neova-product-cards--sidebar .neova-product-cards__list {
		max-width: var(--wp--custom--article--sidebar);
	}
}
