:root {
	--winery-catalog-background: var(--winery-shop-color-surface-subtle);
	--winery-catalog-max-width: var(--winery-shop-max-width);
	--winery-catalog-inline-gutter: var(--winery-shop-inline-gutter);
	--winery-catalog-block-padding: var(--winery-shop-space-7);
	--winery-catalog-headerless-block-start-padding: 0;
	--winery-catalog-sidebar-width: 15rem;
	--winery-catalog-grid-gap: var(--winery-shop-space-5);
	--winery-catalog-card-min-width: 12rem;
	--winery-catalog-card-min-width-compact: 15rem;
	--winery-catalog-single-card-width: 22rem;
	--winery-catalog-columns-max: 5;
	--winery-catalog-featured-slot-inline-padding: var(--winery-shop-space-5);
	--winery-catalog-toolbar-gap: var(--winery-shop-space-3);
	--winery-catalog-facet-gap: var(--winery-shop-space-3);
}

.winery-product-catalog {
	position: relative;
	padding-block: var(--winery-catalog-block-padding);
	color: var(--winery-shop-color-text);
	font-family: var(--winery-shop-font-family-body);
	font-size: var(--winery-shop-font-size-base);
	line-height: var(--winery-shop-line-height-base);
	background: var(--winery-catalog-background);
}

.winery-product-catalog--header-hidden {
	padding-block-start: var(--winery-catalog-headerless-block-start-padding);
}

.winery-product-catalog__header,
.winery-product-catalog__shop-by,
.winery-product-catalog__layout {
	width: min(calc(100% - (2 * var(--winery-catalog-inline-gutter))), var(--winery-catalog-max-width));
	margin-inline: auto;
}

.winery-product-catalog__header,
.winery-product-catalog__shop-by {
	margin-block-end: var(--winery-shop-space-5);
}

.winery-product-catalog__eyebrow,
.winery-product-catalog__description,
.winery-product-catalog__title,
.winery-product-catalog__result-count,
.winery-product-catalog__empty-message {
	margin: 0;
}

.winery-product-catalog__eyebrow {
	color: var(--winery-shop-color-muted);
	font-size: var(--winery-shop-font-size-sm);
	font-weight: var(--winery-shop-font-weight-medium);
	letter-spacing: var(--winery-shop-letter-spacing-eyebrow);
	text-transform: var(--winery-shop-text-transform-eyebrow);
}

.winery-product-catalog__title {
	margin-block-start: var(--winery-shop-space-2);
	font-family: var(--winery-shop-font-family-heading);
	font-size: var(--winery-shop-font-size-2xl);
	font-weight: var(--winery-shop-font-weight-semibold);
	line-height: var(--winery-shop-line-height-tight);
}

.winery-product-catalog__description {
	margin-block-start: var(--winery-shop-space-3);
	color: var(--winery-shop-color-muted);
}

.winery-product-catalog__shop-by {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--winery-shop-space-3);
}

.winery-product-catalog__shop-by-label {
	font-weight: var(--winery-shop-font-weight-semibold);
}

.winery-product-catalog__shop-by-list,
.winery-product-catalog__facet-chips,
.winery-product-catalog__active-filters,
.winery-product-catalog__pagination {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--winery-shop-space-2);
	padding: 0;
	margin: 0;
	list-style: none;
}

.winery-product-catalog__shop-by-item[data-winery-catalog-shop-by-group="collection"] +
.winery-product-catalog__shop-by-item[data-winery-catalog-shop-by-group="region"] {
	padding-inline-start: var(--winery-shop-space-3);
	border-inline-start: var(--winery-shop-border-width) solid var(--winery-shop-color-border);
}

.winery-product-catalog__shop-by-item,
.winery-product-catalog__facet-option-row {
	position: relative;
}

.winery-product-catalog__shop-by-description,
.winery-product-catalog__facet-description {
	position: absolute;
	z-index: 6;
	top: calc(100% + var(--winery-shop-space-1));
	width: max-content;
	max-width: min(20rem, calc(100vw - (2 * var(--winery-shop-inline-gutter))));
	padding: var(--winery-shop-space-3);
	color: var(--winery-shop-color-text);
	pointer-events: none;
	visibility: hidden;
	background: var(--winery-shop-color-surface);
	border: var(--winery-shop-border-width) solid var(--winery-shop-color-border);
	border-radius: var(--winery-shop-radius-md);
	box-shadow: var(--winery-shop-shadow-popover);
	opacity: 0;
	transform: translateY(calc(-1 * var(--winery-shop-space-1)));
	transition: opacity var(--winery-shop-transition), transform var(--winery-shop-transition), visibility var(--winery-shop-transition);
}

.winery-product-catalog__shop-by-description {
	left: 0;
}

.winery-product-catalog__facet-description {
	right: 0;
}

.winery-product-catalog__shop-by-item:hover .winery-product-catalog__shop-by-description,
.winery-product-catalog__shop-by-item:focus-within .winery-product-catalog__shop-by-description,
.winery-product-catalog__facet-option-row:hover .winery-product-catalog__facet-description,
.winery-product-catalog__facet-option-row:focus-within .winery-product-catalog__facet-description {
	visibility: visible;
	opacity: 1;
	transform: translateY(0);
}

.winery-product-catalog__layout {
	display: grid;
	grid-template-columns: var(--winery-catalog-sidebar-width) minmax(0, 1fr);
	gap: var(--winery-shop-space-6);
}

.winery-product-catalog--facets-hidden .winery-product-catalog__layout {
	grid-template-columns: minmax(0, 1fr);
}

.winery-product-catalog--2-up .winery-product-catalog__layout,
.winery-product-catalog--3-up .winery-product-catalog__layout,
.winery-product-catalog--4-up .winery-product-catalog__layout,
.winery-product-catalog--5-up .winery-product-catalog__layout {
	grid-template-columns: minmax(0, 1fr);
}

.winery-product-catalog__facets {
	display: flex;
	min-width: 0;
	flex-direction: column;
	gap: var(--winery-catalog-facet-gap);
}

.winery-product-catalog__facets-header,
.winery-product-catalog__facets-actions,
.winery-product-catalog__toolbar,
.winery-product-catalog__facet-option,
.winery-product-catalog__facet-option-row,
.winery-product-catalog__facet-range-values {
	display: flex;
	align-items: center;
	gap: var(--winery-shop-space-2);
}

.winery-product-catalog__facets-header,
.winery-product-catalog__toolbar,
.winery-product-catalog__facet-range-values {
	justify-content: space-between;
}

.winery-product-catalog__facet {
	padding-block: var(--winery-shop-space-3);
	border-block-start: var(--winery-shop-border-width) solid var(--winery-shop-color-border);
}

.winery-product-catalog__facet-toggle {
	display: flex;
	width: 100%;
	align-items: center;
	justify-content: space-between;
	min-height: var(--winery-shop-control-min-height);
	padding: 0;
	color: inherit;
	font: inherit;
	font-weight: var(--winery-shop-font-weight-semibold);
	background: var(--winery-shop-color-surface);
	border: 0;
	cursor: pointer;
}

.winery-product-catalog__facet-toggle::after {
	content: "+";
}

.winery-product-catalog__facet--open > .winery-product-catalog__facet-toggle::after {
	content: "−";
}

.winery-product-catalog__facet-options {
	display: grid;
	gap: var(--winery-shop-space-2);
	margin-block-start: var(--winery-shop-space-3);
}

.winery-product-catalog__facet-option-row {
	justify-content: space-between;
}

.winery-product-catalog__facet-option {
	min-width: 0;
	flex: 1;
	cursor: pointer;
}

.winery-product-catalog__facet-option input[type="checkbox"] {
	position: absolute;
	opacity: 0;
}

.winery-product-catalog__facet-check {
	display: inline-grid;
	width: var(--winery-shop-space-4);
	height: var(--winery-shop-space-4);
	flex: 0 0 auto;
	border: var(--winery-shop-border-width) solid var(--winery-shop-color-control-border);
	border-radius: var(--winery-shop-radius-sm);
	place-items: center;
}

.winery-product-catalog__facet-option input:checked + .winery-product-catalog__facet-check {
	background: var(--winery-shop-color-accent);
}

.winery-product-catalog__facet-option input:focus-visible + .winery-product-catalog__facet-check {
	outline: var(--winery-shop-focus-ring);
	outline-offset: var(--winery-shop-space-1);
}

.winery-product-catalog__facet-count {
	margin-inline-start: auto;
	color: var(--winery-shop-color-muted);
	font-size: var(--winery-shop-font-size-sm);
}

.winery-product-catalog__facet-info {
	width: var(--winery-shop-control-min-height);
	height: var(--winery-shop-control-min-height);
	padding: 0;
	color: var(--winery-shop-color-muted);
	background: var(--winery-shop-color-surface);
	border: var(--winery-shop-border-width) solid var(--winery-shop-color-control-border);
	border-radius: var(--winery-shop-radius-pill);
	cursor: pointer;
}

.winery-product-catalog__facet-select,
.winery-product-catalog__per-page select,
.winery-product-catalog__sort select {
	min-height: var(--winery-shop-control-min-height);
	padding-inline: var(--winery-shop-space-3);
	color: inherit;
	font: inherit;
	background: var(--winery-shop-color-surface);
	border: var(--winery-shop-border-width) solid var(--winery-shop-color-control-border);
	border-radius: var(--winery-shop-radius-md);
}

.winery-product-catalog__facet-range {
	position: relative;
	padding-block-end: var(--winery-shop-space-4);
}

.winery-product-catalog__facet-range-track {
	position: relative;
	height: var(--winery-shop-space-1);
	margin-block: var(--winery-shop-space-4);
	background: var(--winery-shop-color-border);
	border-radius: var(--winery-shop-radius-pill);
}

.winery-product-catalog__facet-range-fill {
	position: absolute;
	inset-block: 0;
	background: var(--winery-shop-color-accent);
	border-radius: var(--winery-shop-radius-pill);
}

.winery-product-catalog__facet-range-handle {
	position: absolute;
	inset-inline: 0;
	bottom: 0;
	width: 100%;
	margin: 0;
	pointer-events: none;
}

.winery-product-catalog__facet-range-handle::-webkit-slider-thumb {
	pointer-events: auto;
}

.winery-product-catalog__facet-range-handle::-moz-range-thumb {
	pointer-events: auto;
}

.winery-product-catalog__products {
	min-width: 0;
}

/* Structural only: the slot is a theme-targetable region, not a styled band. */
.winery-product-catalog__featured-slot {
	min-width: 0;
	margin-block-end: var(--winery-shop-space-5);
}

/* A nested featured row already sits inside the catalog's centred content
   column, so its own gutter and content cap would inset it a second time. The
   band takes inline padding of its own instead, which is what makes it read as
   a deliberate panel above the results rather than a first grid row. */
.winery-product-catalog__featured-slot .winery-featured-row {
	padding-inline: var(--winery-catalog-featured-slot-inline-padding);
	border-radius: var(--winery-shop-radius-lg);
}

.winery-product-catalog__featured-slot .winery-featured-row__header,
.winery-product-catalog__featured-slot .winery-featured-row__grid {
	width: 100%;
	margin-inline: 0;
}

.winery-product-catalog__featured-slot .winery-featured-row__toggle {
	margin-inline-start: 0;
}

.winery-product-catalog__toolbar {
	flex-wrap: wrap;
	margin-block-end: var(--winery-catalog-toolbar-gap);
}

.winery-product-catalog__per-page,
.winery-product-catalog__sort {
	display: inline-flex;
	align-items: center;
	gap: var(--winery-shop-space-2);
}

.winery-product-catalog__filter-toggle,
.winery-product-catalog__facets-close,
.winery-product-catalog__facets-apply {
	display: none;
}

.winery-product-catalog__active-filters {
	margin-block-end: var(--winery-shop-space-3);
}

.winery-product-catalog__shop-by-chip,
.winery-product-catalog__facet-chip,
.winery-product-catalog__active-filter,
.winery-product-catalog__page-link,
.winery-product-catalog__load-more,
.winery-product-catalog__filter-toggle,
.winery-product-catalog__facets-close,
.winery-product-catalog__facets-apply,
.winery-product-catalog__empty-clear {
	min-height: var(--winery-shop-control-min-height);
	padding: var(--winery-shop-button-padding);
	color: inherit;
	font: inherit;
	font-weight: var(--winery-shop-font-weight-medium);
	line-height: var(--winery-shop-line-height-tight);
	background: var(--winery-shop-color-surface);
	border: var(--winery-shop-border-width) solid var(--winery-shop-color-control-border);
	border-radius: var(--winery-shop-radius-pill);
	cursor: pointer;
	transition: color var(--winery-shop-transition), background var(--winery-shop-transition), border-color var(--winery-shop-transition);
}

.winery-product-catalog__shop-by-chip[aria-pressed="true"],
.winery-product-catalog__facet-chip--active,
.winery-product-catalog__page-link--current {
	color: var(--winery-shop-color-accent-contrast);
	background: var(--winery-shop-color-accent);
	border-color: var(--winery-shop-color-accent);
}

.winery-product-catalog__shop-by-chip:hover,
.winery-product-catalog__facet-chip:hover,
.winery-product-catalog__active-filter:hover,
.winery-product-catalog__page-link:hover,
.winery-product-catalog__load-more:hover,
.winery-product-catalog__filter-toggle:hover,
.winery-product-catalog__facets-close:hover,
.winery-product-catalog__facets-apply:hover,
.winery-product-catalog__empty-clear:hover {
	color: var(--winery-shop-color-accent-contrast);
	background: var(--winery-shop-color-accent-hover);
	border-color: var(--winery-shop-color-accent-hover);
}

.winery-product-catalog__facets-clear {
	min-height: var(--winery-shop-control-min-height);
	padding-inline: var(--winery-shop-space-2);
	color: var(--winery-shop-color-accent);
	font: inherit;
	font-weight: var(--winery-shop-font-weight-medium);
	background: var(--winery-shop-color-surface);
	border: 0;
	cursor: pointer;
}

.winery-product-catalog__facets-clear:hover {
	color: var(--winery-shop-color-accent-hover);
}

/* The track floor is the larger of the card floor and the exact width that
   would produce `--winery-catalog-columns-max` tracks, so auto-fill scales up
   with the viewport but never past the documented column cap. The outer `min()`
   keeps a single full-width track once the container is narrower than a card. */
.winery-product-catalog__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, max(var(--winery-catalog-card-min-width), (100% - ((var(--winery-catalog-columns-max) - 1) * var(--winery-catalog-grid-gap))) / var(--winery-catalog-columns-max))), 1fr));
	grid-auto-flow: dense;
	gap: var(--winery-catalog-grid-gap);
}

/* One centred card reads as a deliberate product feature, so it takes its own
   width rather than the grid floor that sizes a dense multi-column row. */
.winery-product-catalog--single .winery-product-catalog__grid {
	grid-template-columns: minmax(0, var(--winery-catalog-single-card-width));
	justify-content: center;
}

.winery-product-catalog--2-up .winery-product-catalog__grid {
	width: 100%;
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.winery-product-catalog--3-up .winery-product-catalog__grid {
	width: 100%;
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

.winery-product-catalog--4-up .winery-product-catalog__grid {
	width: 100%;
	grid-template-columns: repeat(4, minmax(0, 1fr));
}

.winery-product-catalog--5-up .winery-product-catalog__grid {
	width: 100%;
	grid-template-columns: repeat(5, minmax(0, 1fr));
}

.winery-product-catalog__pagination {
	justify-content: center;
	margin-block-start: var(--winery-shop-space-5);
}

.winery-product-catalog__sentinel {
	width: 100%;
	height: 1px;
}

.winery-product-catalog__empty {
	display: grid;
	gap: var(--winery-shop-space-3);
	padding: var(--winery-shop-space-6);
	margin-block-start: var(--winery-shop-space-5);
	background: var(--winery-shop-color-surface);
	border: var(--winery-shop-border-width) solid var(--winery-shop-color-border);
	border-radius: var(--winery-shop-radius-lg);
	place-items: center;
	text-align: center;
}

.winery-product-catalog__empty-title {
	margin: 0;
	font-family: var(--winery-shop-font-family-heading);
	font-size: var(--winery-shop-font-size-xl);
	font-weight: var(--winery-shop-font-weight-semibold);
	line-height: var(--winery-shop-line-height-tight);
}

.winery-product-catalog__status {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
}

.winery-product-catalog__facet-scrim[hidden],
.winery-product-catalog__facet-options[hidden],
.winery-product-catalog__load-more[hidden],
.winery-product-catalog__empty[hidden] {
	display: none;
}

.winery-product-catalog button:focus-visible,
.winery-product-catalog select:focus-visible,
.winery-product-catalog input:focus-visible {
	outline: var(--winery-shop-focus-ring);
	outline-offset: var(--winery-shop-space-1);
}

@media (max-width: 64rem) {
	.winery-product-catalog--3-up .winery-product-catalog__grid,
	.winery-product-catalog--4-up .winery-product-catalog__grid,
	.winery-product-catalog--5-up .winery-product-catalog__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 48rem) {
	.winery-product-catalog__layout {
		grid-template-columns: minmax(0, 1fr);
	}

	/* Below the rail breakpoint the grid gains the rail's width back. The
	   compact floor spends it on larger cards instead of more columns. */
	.winery-product-catalog__grid {
		grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--winery-catalog-card-min-width-compact)), 1fr));
	}

	.winery-product-catalog__filter-toggle,
	.winery-product-catalog__facets-close,
	.winery-product-catalog__facets-apply {
		display: inline-flex;
	}

	.winery-product-catalog__facets {
		position: fixed;
		z-index: 1001;
		inset-block: 0;
		inset-inline-start: 0;
		width: min(90vw, var(--winery-catalog-sidebar-width));
		padding: var(--winery-shop-space-5);
		overflow-y: auto;
		background: var(--winery-shop-color-surface);
		box-shadow: var(--winery-shop-shadow-popover);
		transform: translateX(-105%);
		transition: transform var(--winery-shop-transition);
	}

	.winery-product-catalog__facets--open {
		transform: translateX(0);
	}

	.winery-product-catalog__facet-scrim {
		position: fixed;
		z-index: 1000;
		inset: 0;
		background: var(--winery-shop-color-overlay);
	}

	.winery-product-catalog--2-up .winery-product-catalog__grid,
	.winery-product-catalog--3-up .winery-product-catalog__grid,
	.winery-product-catalog--4-up .winery-product-catalog__grid,
	.winery-product-catalog--5-up .winery-product-catalog__grid {
		grid-template-columns: minmax(0, 1fr);
	}
}

@media (prefers-reduced-motion: reduce) {
	.winery-product-catalog,
	.winery-product-catalog *,
	.winery-product-catalog *::before,
	.winery-product-catalog *::after {
		scroll-behavior: auto;
		transition: none;
	}
}
