.woodcha-home-products {
	background: var(--woodcha-section-background);
}

.woodcha-home-products[hidden] {
	display: none;
}

.woodcha-home-products__grid {
	--woodcha-shelf-gutter: calc((100vw - var(--woodcha-shell)) / 2);
	--woodcha-shelf-card-width: 23%;
	--woodcha-shelf-scrollbar: rgba(36, 33, 29, 0.22);
	display: flex;
	gap: 14px;
	/* Bleed at both edges; padding keeps card widths and snap alignment shell-based. */
	margin-inline: calc(-1 * var(--woodcha-shelf-gutter));
	overflow-x: auto;
	overscroll-behavior-inline: contain;
	padding-bottom: 16px;
	padding-inline: var(--woodcha-shelf-gutter);
	scrollbar-color: var(--woodcha-shelf-scrollbar) transparent;
	scrollbar-width: thin;
	scroll-padding-inline: var(--woodcha-shelf-gutter);
	scroll-snap-type: x mandatory;
}

.woodcha-home-products__grid:hover,
.woodcha-home-products__grid:focus-within {
	--woodcha-shelf-scrollbar: rgba(36, 33, 29, 0.38);
}

/* Fallback for engines that do not support the standard scrollbar properties. */
.woodcha-home-products__grid::-webkit-scrollbar {
	height: 4px;
}

.woodcha-home-products__grid::-webkit-scrollbar-thumb {
	background: var(--woodcha-shelf-scrollbar);
	border-radius: var(--woodcha-radius-pill);
}

.woodcha-home-products__grid::-webkit-scrollbar-track {
	background: transparent;
}

.woodcha-product-card {
	display: flex;
	flex: 0 0 var(--woodcha-shelf-card-width);
	flex-direction: column;
	min-width: 0;
	scroll-snap-align: start;
}

.woodcha-home-products__heading > a {
	align-items: center;
	border: 1px solid rgba(99, 38, 52, 0.42);
	border-radius: var(--woodcha-radius-pill);
	color: var(--woodcha-ume);
	display: inline-flex;
	font-size: 14px;
	font-weight: 650;
	justify-content: center;
	min-height: 44px;
	padding: 10px 18px;
	text-decoration: none;
	transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease;
}

.woodcha-home-products__heading > a:hover {
	background: var(--woodcha-ume);
	border-color: var(--woodcha-ume);
	color: var(--woodcha-surface);
}

.woodcha-home-products__heading > a:focus-visible {
	outline: 2px solid var(--woodcha-ume);
	outline-offset: 4px;
}

.woodcha-product-card--grains {
	--product-bg: var(--woodcha-category-grains);
}

.woodcha-product-card--fruit {
	--product-bg: var(--woodcha-category-fruit);
}

.woodcha-product-card--sweets {
	--product-bg: var(--woodcha-category-sweets);
}

.woodcha-product-card__media {
	align-items: center;
	background: var(--product-bg, var(--woodcha-surface));
	border-radius: var(--woodcha-radius-md);
	display: flex;
	flex-shrink: 0;
	height: clamp(290px, 29vw, 410px);
	justify-content: center;
	overflow: hidden;
}

.woodcha-product-card__media img {
	height: 100%;
	object-fit: contain;
	object-position: center;
	padding: 14px;
	transition: transform 260ms ease;
	width: 100%;
}

.woodcha-product-card__link:hover .woodcha-product-card__media img {
	transform: scale(1.025);
}

.woodcha-product-card__link {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	min-width: 0;
	text-decoration: none;
}

.woodcha-product-card__details {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	min-width: 0;
	padding: 20px 5px 0;
}

.woodcha-product-card__category {
	color: rgba(36, 33, 29, 0.7);
	display: block;
	font-size: 13px;
	font-weight: 500;
	letter-spacing: normal;
	line-height: 1.3;
	margin-bottom: 7px;
	text-transform: none;
}

.woodcha-product-card__details h3 {
	font-size: clamp(20px, 1.8vw, 26px);
	font-weight: 590;
	letter-spacing: -0.025em;
	line-height: 1.15;
	/* Two-line fallback; shared grid rows below size to the actual titles. */
	min-block-size: 2.3em;
}

.woodcha-product-card__quantity {
	color: rgba(36, 33, 29, 0.67);
	/* Homepage only: switch back to block to restore the retained package details. */
	display: none;
	flex-shrink: 0;
	font-size: 13px;
	line-height: 1.25;
	margin-inline-start: auto;
	text-align: end;
	white-space: nowrap;
}

.woodcha-product-card__description {
	color: rgba(36, 33, 29, 0.62);
	display: block;
	font-size: 13px;
	line-height: 1.45;
	margin-top: 9px;
}

.woodcha-product-card__footer {
	align-items: baseline;
	display: flex;
	gap: 12px;
	margin-top: auto;
	min-width: 0;
	padding-top: 12px;
}

.woodcha-product-card__price {
	display: block;
	font-size: 14px;
	font-weight: 650;
	min-width: 0;
}

@supports (grid-template-rows: subgrid) {
	.woodcha-home-products__grid {
		display: grid;
		grid-auto-columns: var(--woodcha-shelf-card-width);
		grid-auto-flow: column;
		/* Photo, category, title, description, price/quantity — shared across cards. */
		grid-template-rows: auto auto auto 1fr auto;
		row-gap: 0;
	}

	.woodcha-product-card,
	.woodcha-product-card__link,
	.woodcha-product-card__details {
		display: grid;
		grid-template-columns: minmax(0, 1fr);
		grid-template-rows: subgrid;
		row-gap: 0;
	}

	.woodcha-product-card,
	.woodcha-product-card__link {
		grid-row: span 5;
	}

	.woodcha-product-card__details {
		grid-row: span 4;
	}

	.woodcha-product-card__details h3 {
		min-block-size: 0;
	}
}

@media (max-width: 980px) {
	.woodcha-home-products__grid {
		--woodcha-shelf-card-width: 43%;
	}
}

@media (max-width: 560px) {
	.woodcha-home-products__grid {
		--woodcha-shelf-card-width: min(70vw, 300px);
	}

	.woodcha-product-card__media {
		/* Square mobile tiles show more of the next card without cropping the product. */
		height: var(--woodcha-shelf-card-width);
	}

	.woodcha-product-card__details {
		padding-top: 16px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.woodcha-home-products__heading > a {
		transition: none;
	}

	.woodcha-product-card__media img {
		transition: none;
	}
}
