/* Catalogue fixes: retain the existing product data and image composition. */
.hv-rail .wc-block-product-template > .wc-block-product {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	grid-template-rows: auto 16px 44px 38px minmax(48px, 1fr) 44px;
	row-gap: 6px;
	align-content: start;
	min-width: 0;
	height: 100%;
	box-sizing: border-box;
}
.hv-rail .wc-block-product-template > .wc-block-product > * { margin-block: 0 !important; min-width: 0; }
.hv-rail .wc-block-product > .wc-block-components-product-image {
	grid-row: 1;
	display: block;
	position: relative;
	width: 100%;
	height: auto !important;
	min-height: 0 !important;
	aspect-ratio: 1 / 1 !important;
	overflow: hidden;
	align-self: start;
}
/* Remove intrinsic/broken-image height from the frame's sizing calculation. */
.hv-rail .wc-block-product > .wc-block-components-product-image > a {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
}
.hv-rail .wc-block-components-product-image img {
	position: absolute;
	inset: 0;
	width: 100% !important;
	height: 100% !important;
	min-height: 0 !important;
	max-width: 100%;
	object-fit: cover;
}
.hv-rail .wc-block-product > .hv-card-brand { grid-row: 2; line-height: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hv-rail .wc-block-product > .wp-block-post-title {
	grid-row: 3;
	min-height: 0;
	line-height: 1.45;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.hv-rail .wc-block-product > .hv-card-facts { grid-row: 4; align-self: start; min-height: 0; line-height: 1.5; }
.hv-rail .wc-block-product > .wp-block-woocommerce-product-price { grid-row: 5; align-self: start; }
.hv-rail .wc-block-product .wc-block-components-product-price { line-height: 1.45; }
.hv-rail .wc-block-product > .hv-dots { grid-row: 6; align-self: start; display: flex; flex-wrap: nowrap; gap: 0; margin-left: -4px; max-width: calc(100% + 4px); }
.hv-rail .wc-block-product > .hv-dots > a { flex: 0 1 44px; width: 44px; min-width: 24px; height: 44px; white-space: nowrap; }
.hv-media-fallback { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; text-align: center; color: var(--hv-muted); background: var(--hv-sand); font-size: 13px; line-height: 1.5; pointer-events: none; }
.hv-media-fallback[hidden] { display: none; }
.hv-media-unavailable img { visibility: hidden; }
.hv-media-unavailable .hv-heart { z-index: 2; }

.hv-shop__main { min-width: 0; }
.hv-shop__bar { gap: 12px; align-items: center; }
.hv-shop__bar .wc-block-product-results-count { flex: 1 1 auto; min-width: 0; }
.hv-shop__bar .woocommerce-result-count { margin: 0; line-height: 1.5; }
.hv-shop__bar .wc-block-catalog-sorting { flex: 0 0 auto; min-width: 0; }
.hv-shop__bar .woocommerce-ordering { margin: 0; }
.hv-catalogue-sort { position: relative; color: var(--hv-ink); }
.hv-catalogue-sort__trigger {
	display: inline-flex; align-items: center; justify-content: space-between; gap: 10px;
	min-height: 44px; max-width: min(220px, 57vw); padding: 10px 12px;
	border: 1px solid var(--hv-line); border-radius: 8px; background: #fff;
	color: var(--hv-ink); font: inherit; font-size: 14px; line-height: 1.35; text-align: left; cursor: pointer;
}
.hv-catalogue-sort__trigger svg { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; }
.hv-catalogue-sort__trigger[aria-expanded=true] { border-color: var(--hv-olive); background: var(--hv-sand); }
.hv-catalogue-sort__menu {
	position: absolute; top: calc(100% + 8px); right: 0; z-index: 120;
	width: 260px; max-width: calc(100vw - 32px); max-height: min(360px, 60dvh); overflow-y: auto;
	margin: 0; padding: 6px; list-style: none; border: 1px solid var(--hv-line); border-radius: 12px;
	background: #fff; box-shadow: 0 12px 32px rgba(30, 33, 28, .16); box-sizing: border-box;
	overscroll-behavior: contain;
}
.hv-catalogue-sort__menu[hidden] { display: none; }
.hv-catalogue-sort.is-above .hv-catalogue-sort__menu { top: auto; bottom: calc(100% + 8px); }
.hv-catalogue-sort__option { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 44px; padding: 11px 12px; border: 0; border-radius: 6px; background: #fff; color: var(--hv-ink); font: inherit; font-size: 14px; line-height: 1.4; text-align: left; cursor: pointer; }
.hv-catalogue-sort__option:hover, .hv-catalogue-sort__option:focus-visible { background: var(--hv-sand); }
.hv-catalogue-sort__option[aria-checked=true] { background: var(--hv-sage); font-weight: 600; }
.hv-catalogue-sort__option[aria-checked=true]::after { content: "✓"; color: var(--hv-olive); }
.hv-catalogue-sort__trigger:focus-visible, .hv-catalogue-sort__option:focus-visible { outline: 2px solid var(--hv-olive); outline-offset: 2px; }
.hv-sort-apply { min-height: 44px; margin-left: 8px; }

/* Anchor the saved-item badge to the heart's corner, inside its touch target. */
.hv-main-header .hv-wl-link .hv-wl-count { top: 2px; right: -2px; min-width: 18px; height: 18px; padding: 0 4px; box-sizing: border-box; border-radius: 999px; font-size: 11px; line-height: 18px; background: var(--hv-ink); }
.hv-main-header .hv-wl-count[hidden] { display: none !important; }

@media (max-width: 781px) {
	html.hv-catalogue-ready .hv-archive .wp-block-columns.hv-shop { gap: 0 !important; margin-top: 16px !important; }
	html.hv-catalogue-ready .hv-archive .hv-shop > .wp-block-column.hv-shop__side { flex: 0 0 0 !important; height: 0 !important; min-height: 0 !important; margin: 0 !important; padding: 0; }
	html.hv-catalogue-ready .hv-archive .hv-shop__side > p { margin: 0 !important; line-height: 0; }
	.hv-archive .hv-shop__main { margin-top: 0 !important; }
	.hv-shop__bar .woocommerce-result-count { font-size: 13px; }
	.hv-catalogue-sort__trigger { font-size: 13px; }
	.hv-rail .wc-block-product-template > .wc-block-product { grid-template-rows: auto 16px 41px 38px minmax(48px, 1fr) 44px; }
}
