.tm-shop-filter-panel {
	padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
}

.tm-shop-filter-panel__header button,
.tm-shop-filter-panel__actions .tm-button,
.tm-active-filters a {
	min-height: 44px;
}

html:not(.tm-shop-filters-enhanced) .tm-shop-page .tm-shop-filter-panel {
	display: none;
}

html:not(.tm-shop-filters-enhanced) .tm-shop-page .tm-shop-filter-panel__header button,
html:not(.tm-shop-filters-enhanced) .tm-shop-page .tm-filter-toggle,
html:not(.tm-shop-filters-enhanced) .tm-shop-page .tm-filter-backdrop {
	display: none !important;
}

/* Archive-only grid contract. Keep every card in its grid track and away from
 * WooCommerce's legacy float/percentage widths without affecting other loops. */
.woocommerce-shop .tm-shop-container,
.post-type-archive-product .tm-shop-container,
.tax-product_cat .tm-shop-container,
.tax-product_tag .tm-shop-container {
	width: min(calc(100% - (2 * var(--tm-page-gutter))), var(--tm-container-main));
	margin-inline: auto;
}

.tm-shop-page .tm-shop-toolbar {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto auto;
	align-items: center;
	gap: var(--tm-space-lg);
	padding: var(--tm-space-md) 0;
	border: 0;
	border-bottom: 1px solid var(--tm-border);
	border-radius: 0;
	background: transparent;
}

.tm-shop-page .tm-shop-toolbar__native {
	display: contents;
}

.tm-shop-page .tm-shop-toolbar__native .woocommerce-notices-wrapper {
	grid-column: 1 / -1;
}

.tm-shop-page .tm-shop-toolbar__native .woocommerce-result-count {
	grid-column: 1;
	grid-row: 2;
	font-family: var(--tm-font-body);
	font-weight: 650;
}

.tm-shop-page .tm-filter-toggle {
	grid-column: 2;
	grid-row: 2;
	display: inline-flex !important;
	min-height: 3rem;
	justify-self: end;
	border-color: var(--tm-border-strong);
}

.tm-shop-page .tm-shop-toolbar__native .woocommerce-ordering {
	grid-column: 3;
	grid-row: 2;
	display: flex;
	align-items: center;
	gap: var(--tm-space-sm);
}

.tm-shop-page .tm-shop-toolbar__native .woocommerce-ordering select {
	min-height: 3rem;
	border-color: var(--tm-border-strong);
	background: var(--tm-surface-raised);
}

.tm-shop-page .tm-orderby-submit {
	min-height: 3rem;
	padding-inline: var(--tm-space-md);
	border-color: var(--tm-border);
	background: transparent;
	color: var(--tm-text-secondary);
}

html.tm-shop-filters-enhanced .tm-shop-page .tm-shop-filter-panel {
	position: fixed;
	z-index: 1001;
	inset: 0 0 0 auto;
	width: min(92vw, 27rem);
	max-height: none;
	padding: clamp(1rem, 3vw, 1.5rem);
	margin: 0;
	overflow-y: auto;
	border: 0;
	border-left: 1px solid var(--tm-border);
	border-radius: 0;
	background: var(--tm-bg);
	box-shadow: var(--tm-shadow-drawer);
	transform: translateX(105%);
}

html.tm-shop-filters-enhanced.tm-filters-open .tm-shop-page .tm-shop-filter-panel {
	transform: none;
}

html.tm-shop-filters-enhanced .tm-shop-page .tm-shop-filter-panel__header button {
	display: inline-flex !important;
}

html.tm-shop-filters-enhanced .tm-shop-page .tm-filter-backdrop {
	display: none !important;
}

html.tm-shop-filters-enhanced.tm-filters-open .tm-shop-page .tm-filter-backdrop {
	display: block !important;
}

.tm-shop-page .tm-shop-results,
.tm-shop-page .tm-shop-results > ul.products {
	width: 100%;
	min-width: 0;
	max-width: none;
}

.tm-shop-page .tm-shop-results > ul.products {
	display: grid !important;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
	gap: clamp(1.25rem, 2.4vw, 2rem) !important;
	align-items: stretch;
}

.tm-shop-page .tm-shop-results > ul.products::before,
.tm-shop-page .tm-shop-results > ul.products::after {
	content: none !important;
	display: none !important;
}

.tm-shop-page .tm-shop-results > ul.products > li.product.tm-product-card {
	float: none !important;
	width: 100% !important;
	min-width: 0;
	max-width: none;
	height: 100%;
	margin: 0 !important;
	padding: 0;
	overflow: hidden;
	border-color: var(--tm-border);
	background: linear-gradient(145deg, var(--tm-surface), var(--tm-surface-raised));
}

.tm-shop-page .tm-shop-results .tm-product-card > .tm-card__media {
	display: block;
	width: 100%;
	aspect-ratio: 1;
	overflow: hidden;
	background: var(--tm-surface-raised);
}

.tm-shop-page .tm-shop-results .tm-product-card > .tm-card__media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.tm-shop-page .tm-shop-results .tm-product-card > .tm-card__content {
	gap: var(--tm-space-sm);
	padding: clamp(1rem, 2vw, 1.25rem);
}

.tm-shop-page .tm-shop-results .woocommerce-loop-product__title {
	min-height: 2.2em;
	margin: 0;
	font-size: clamp(1.35rem, 2vw, 1.6rem);
	line-height: 1.1;
	-webkit-line-clamp: 2;
}

.tm-shop-page .tm-shop-results .tm-product-card__tagline {
	margin: 0;
	overflow: hidden;
	color: var(--tm-text-muted);
	font-size: var(--tm-type-body-sm);
	text-overflow: ellipsis;
	white-space: nowrap;
}

.tm-shop-page .tm-shop-results .tm-product-card .price {
	min-height: auto;
	margin: 0;
	color: var(--tm-accent-hover);
	font-family: var(--tm-font-body);
	font-size: clamp(1.2rem, 1.8vw, 1.45rem);
	font-weight: 750;
}

.tm-shop-page .tm-shop-results .tm-product-card__badge {
	max-width: calc(100% - (2 * var(--tm-space-1)));
}

.tm-shop-page .tm-shop-results .tm-product-card__footer {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	width: 100%;
	margin-top: auto;
	gap: var(--tm-space-sm);
}

.tm-shop-page .tm-shop-results .tm-product-card__footer > .button,
.tm-shop-page .tm-shop-results .tm-product-card__footer > .added_to_cart {
	grid-column: 1 / -1;
	width: 100%;
	min-height: 3.25rem;
	justify-content: center;
	background: var(--tm-accent);
	color: #fff;
	font-size: .9rem;
}

.tm-shop-page .tm-shop-results .tm-product-card__footer > .tm-compare-control,
.tm-shop-page .tm-shop-results .tm-product-card__footer > .tm-wishlist-control {
	min-width: 0;
	min-height: 2.5rem;
	padding: .5rem .65rem;
	border: 1px solid var(--tm-border);
	background: transparent;
	color: var(--tm-text-secondary);
	font-size: .78rem;
	line-height: 1.15;
}

.tm-shop-page .tm-shop-hero {
	padding-block: clamp(2rem, 4vw, 3.5rem);
}

@media (max-width: 39.99rem) {
	.tm-shop-page .tm-shop-results > ul.products {
		grid-template-columns: minmax(0, 1fr);
	}

	.tm-shop-page .tm-shop-toolbar,
	.tm-shop-page .tm-shop-toolbar__native {
		display: grid;
		grid-template-columns: 1fr;
		align-items: stretch;
		width: 100%;
		margin-left: 0;
	}

	.tm-shop-page .tm-shop-toolbar__native .woocommerce-notices-wrapper,
	.tm-shop-page .tm-shop-toolbar__native .woocommerce-result-count,
	.tm-shop-page .tm-filter-toggle,
	.tm-shop-page .tm-shop-toolbar__native .woocommerce-ordering {
		grid-column: 1;
		grid-row: auto;
		justify-self: stretch;
	}

	.tm-shop-page .tm-shop-toolbar__native .woocommerce-ordering {
		display: grid;
		grid-template-columns: minmax(0, 1fr) auto;
	}

	.tm-shop-page .tm-filter-toggle {
		justify-content: center;
	}

	.tm-shop-page .tm-shop-results .tm-product-card__footer > .tm-compare-control,
	.tm-shop-page .tm-shop-results .tm-product-card__footer > .tm-wishlist-control {
		font-size: .84rem;
	}
}

@media (min-width: 40rem) and (max-width: 74.99rem) {
	.tm-shop-page .tm-shop-results > ul.products {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}
