/*
 * The Total Office Shop – product listing pages
 * (Shop, categories, Quickship, Pre-Loved, Top Picks, product search).
 * Loaded only on those pages, after tto-home.css (header, footer, buttons).
 * Every rule is scoped to .tto-catalog.
 */

.tto-catalog-body .tto-home {
	/* Listing pages may grow wider than the homepage, so wide screens
	   (or zooming out) show more products per row. */
	--tto-max: 2600px;
}

.tto-home .tto-catalog {
	--tto-card-bg: #f3f2f0;
	--tto-heading: #333;
	--tto-soft: #9a9a9a;
	padding-bottom: 8px;
}

/* ---------- Title, results count, filter button ---------- */

.tto-home .tto-catalog__title {
	margin: 8px 0 0;
	text-align: center;
	font-size: clamp(28px, 2.5vw, 36px);
	font-weight: 600;
	line-height: 1.2;
	color: var(--tto-heading);
}

.tto-home .tto-catalog__bar {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin-top: 28px;
}

.tto-home .tto-catalog__count {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 4px 16px;
	font-size: 15px;
	color: #777;
}

.tto-home .tto-catalog__clear {
	font-size: 14px;
	color: var(--tto-black);
	text-decoration: underline;
	text-underline-offset: 3px;
}

.tto-home .tto-filter {
	position: relative;
	z-index: 20;
}

.tto-home .tto-filter__toggle {
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	margin: 0 -8px 0 0;
	padding: 0;
	border: 0;
	border-radius: 9999px;
	background: transparent;
	color: var(--tto-black);
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.tto-home .tto-filter__toggle:hover,
.tto-home .tto-filter__toggle[aria-expanded="true"] {
	background: var(--tto-field);
}

.tto-home .tto-filter__toggle svg {
	width: 22px;
	height: 22px;
	stroke-width: 1.6;
}

/* ---------- Filter panel ---------- */

.tto-home .tto-filter__panel {
	position: absolute;
	top: calc(100% + 14px);
	right: -6px;
	width: min(400px, calc(100vw - 40px));
	padding: 12px 24px;
	background: #fff;
	border: 1px solid var(--tto-line);
	border-radius: 20px;
	box-shadow: 0 18px 40px rgba(0, 0, 0, 0.12);
}

.tto-home .tto-filter__panel[hidden] {
	display: none;
}

.tto-home .tto-filter__group + .tto-filter__group {
	border-top: 1px solid var(--tto-line);
}

.tto-home .tto-filter__group summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px 0;
	list-style: none;
	font-size: 16px;
	font-weight: 500;
	color: var(--tto-black);
	cursor: pointer;
}

.tto-home .tto-filter__group summary::-webkit-details-marker {
	display: none;
}

.tto-home .tto-filter__group summary svg {
	width: 18px;
	height: 18px;
	stroke-width: 1.8;
	transition: transform 0.2s ease;
}

.tto-home .tto-filter__group[open] summary svg {
	transform: rotate(180deg);
}

.tto-home .tto-filter__group ul {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 12px 20px;
	padding: 0 0 20px;
}

.tto-home .tto-filter__group li {
	margin: 0;
	padding: 0;
	font-size: 14px;
	line-height: 1.35;
}

.tto-home .tto-filter__group a {
	color: var(--tto-text);
}

.tto-home .tto-filter__group a:hover {
	color: var(--tto-black);
	text-decoration: underline;
	text-underline-offset: 3px;
}

.tto-home .tto-filter__group a.is-current {
	font-weight: 600;
	color: var(--tto-black);
}

/* Fade the products while the filter panel is open, as in the design. */
.tto-home .tto-catalog .tto-grid,
.tto-home .tto-catalog .tto-pager {
	transition: opacity 0.25s ease;
}

.tto-home .tto-catalog.is-filtering .tto-grid,
.tto-home .tto-catalog.is-filtering .tto-pager {
	opacity: 0.35;
}

/* ---------- Product grid ---------- */

.tto-home .tto-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 56px 24px;
	margin-top: 64px;
}

.tto-home .tto-pcard {
	min-width: 0;
}

.tto-home .tto-pcard__media {
	position: relative;
	overflow: hidden;
	border-radius: 14px;
	background: var(--tto-card-bg);
	aspect-ratio: 6 / 5;
}

.tto-home .tto-pcard__image {
	display: block;
	width: 100%;
	height: 100%;
}

.tto-home .tto-pcard__image img {
	width: 100%;
	height: 100%;
	padding: 7%;
	object-fit: contain;
	mix-blend-mode: multiply; /* lets white product backgrounds blend into the card */
	transition: transform 0.5s ease;
}

.tto-home .tto-pcard__media:hover .tto-pcard__image img {
	transform: scale(1.03);
}

.tto-home .tto-pcard.is-sold-out .tto-pcard__image img {
	opacity: 0.6;
}

.tto-home .tto-pcard__tags {
	position: absolute;
	top: 18px;
	right: 18px;
	z-index: 1;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 6px;
	pointer-events: none;
}

.tto-home .tto-pcard__tag {
	position: static;
	padding: 5px 11px;
	font-size: 11px;
	font-weight: 500;
}

/* Wishlist heart (WoodMart's own button, restyled) */

.tto-home .tto-pcard__wish {
	position: absolute;
	top: 10px;
	left: 10px;
	z-index: 2;
}

.tto-home .tto-pcard__wish .wd-wishlist-btn,
.tto-home .tto-pcard__wish .wd-action-btn {
	margin: 0;
	padding: 0;
}

.tto-home .tto-pcard__wish a {
	position: relative;
	display: block;
	width: 36px;
	height: 36px;
	padding: 0;
	border-radius: 9999px;
	font-size: 0;
	line-height: 0;
	color: #333;
	background: transparent;
}

.tto-home .tto-pcard__wish a span {
	display: none;
}

.tto-home .tto-pcard__wish a::before {
	content: none !important;
}

.tto-home .tto-pcard__wish a::after {
	content: "";
	position: absolute;
	inset: 8px;
	background-color: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round'%3E%3Cpath d='M12 20.5s-7.5-4.6-7.5-10.2A4.3 4.3 0 0 1 12 7.6a4.3 4.3 0 0 1 7.5 2.7c0 5.6-7.5 10.2-7.5 10.2Z'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round'%3E%3Cpath d='M12 20.5s-7.5-4.6-7.5-10.2A4.3 4.3 0 0 1 12 7.6a4.3 4.3 0 0 1 7.5 2.7c0 5.6-7.5 10.2-7.5 10.2Z'/%3E%3C/svg%3E") center / contain no-repeat;
	transition: transform 0.2s ease;
}

.tto-home .tto-pcard__wish a:hover::after {
	transform: scale(1.12);
}

.tto-home .tto-pcard__wish a.added::after,
.tto-home .tto-pcard__wish .wd-added a::after {
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 20.5s-7.5-4.6-7.5-10.2A4.3 4.3 0 0 1 12 7.6a4.3 4.3 0 0 1 7.5 2.7c0 5.6-7.5 10.2-7.5 10.2Z'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 20.5s-7.5-4.6-7.5-10.2A4.3 4.3 0 0 1 12 7.6a4.3 4.3 0 0 1 7.5 2.7c0 5.6-7.5 10.2-7.5 10.2Z'/%3E%3C/svg%3E");
	color: #c2410c;
}

.tto-home .tto-pcard__wish a.loading::after {
	opacity: 0.5;
}

/* Card text */

.tto-home .tto-pcard__title {
	margin: 16px 0 0;
	padding: 0;
	font-size: clamp(16px, 1.45vw, 21px);
	font-weight: 500;
	line-height: 1.25;
	letter-spacing: 0;
	text-transform: none;
	color: var(--tto-heading);
}

.tto-home .tto-pcard__title a:hover {
	text-decoration: underline;
	text-underline-offset: 4px;
	text-decoration-thickness: 1px;
}

.tto-home .tto-pcard__cats {
	margin-top: 4px;
	font-size: 14px;
	font-weight: 300;
	line-height: 1.35;
	color: var(--tto-soft);
}

.tto-home .tto-pcard__foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-top: 14px;
}

.tto-home .tto-pcard__price {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 4px 10px;
	min-width: 0;
	margin-top: 0;
	font-size: 15px;
	font-weight: 500;
	line-height: 1.3;
	color: var(--tto-text);
}

.tto-home .tto-pcard__price .price,
.tto-home .tto-pcard__price ins,
.tto-home .tto-pcard__price bdi,
.tto-home .tto-pcard__price .amount {
	font: inherit;
	color: inherit;
	background: none;
	text-decoration: none;
}

/* "AED1,200.00" -> "AED 1,200.00" (works for the text and for the Dirham symbol) */
.tto-home .tto-pcard__price .woocommerce-Price-currencySymbol {
	margin-right: 0.25em;
}

.tto-home .tto-pcard__price del {
	margin-right: 8px;
	font-weight: 400;
	color: var(--tto-soft);
	text-decoration: line-through;
	opacity: 1;
}

.tto-home .tto-pcard__price del .amount,
.tto-home .tto-pcard__price del bdi {
	color: var(--tto-soft);
	text-decoration: line-through;
}

.tto-home .tto-pcard__price .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
}

.tto-home .tto-pcard__stock {
	font-size: 13px;
	font-weight: 400;
	color: #b42318;
}

/* Add-to-cart button (right of the price) */

.tto-home .tto-pcard__add {
	position: relative;
	display: grid;
	flex: 0 0 auto;
	place-items: center;
	width: 40px;
	height: 40px;
	margin: 0;
	padding: 0;
	border: 1.5px solid var(--tto-black);
	border-radius: 9999px;
	background: #fff;
	color: var(--tto-black);
	transition: background-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.tto-home .tto-pcard__add:hover {
	background: var(--tto-black);
	color: #fff;
}

.tto-home .tto-pcard__add:active {
	transform: scale(0.94);
}

.tto-home .tto-pcard__add svg {
	width: 19px;
	height: 19px;
	stroke-width: 1.7;
}

.tto-home .tto-pcard__add .tto-add__tick,
.tto-home .tto-pcard__add.added .tto-add__cart {
	display: none;
}

.tto-home .tto-pcard__add.added {
	background: var(--tto-black);
	color: #fff;
}

.tto-home .tto-pcard__add.added .tto-add__tick {
	display: block;
}

.tto-home .tto-pcard__add.loading {
	opacity: 0.5;
	pointer-events: none;
}

.tto-home .tto-pcard__add::before,
.tto-home .tto-pcard__add::after {
	content: none !important; /* no theme spinners/icons */
}

/* WooCommerce adds a "View cart" link after adding; the header total shows it instead. */
.tto-home .tto-pcard .added_to_cart {
	display: none !important;
}

/* ---------- Pagination ---------- */

.tto-home .tto-pager {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 28px;
	margin-top: 96px;
	font-size: 13px;
	color: var(--tto-muted);
}

.tto-home .tto-pager__step {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	white-space: nowrap;
}

.tto-home .tto-pager__step svg {
	width: 14px;
	height: 14px;
	stroke-width: 1.8;
}

.tto-home a.tto-pager__step:hover {
	color: var(--tto-black);
}

.tto-home .tto-pager__step.is-disabled {
	opacity: 0.35;
}

.tto-home .tto-pager__numbers {
	display: flex;
	align-items: center;
	gap: 6px;
}

.tto-home .tto-pager__numbers .page-numbers {
	display: grid;
	place-items: center;
	min-width: 30px;
	height: 30px;
	padding: 0 6px;
	border-radius: 9999px;
	font-size: 13px;
	color: var(--tto-muted);
}

.tto-home .tto-pager__numbers a.page-numbers:hover {
	background: var(--tto-field);
	color: var(--tto-black);
}

.tto-home .tto-pager__numbers .page-numbers.current {
	background: #6b6b75;
	color: #fff;
}

.tto-home .tto-pager__numbers .dots {
	min-width: 16px;
}

/* ---------- Nothing found ---------- */

.tto-home .tto-empty {
	margin-top: 64px;
	padding: 64px 24px;
	border-radius: 20px;
	background: var(--tto-card-bg);
	text-align: center;
}

.tto-home .tto-empty p {
	margin-bottom: 20px;
	font-size: 17px;
	color: var(--tto-text);
}

/* WooCommerce notices (e.g. "added to cart") inside the listing */

.tto-home .tto-catalog .woocommerce-notices-wrapper:not(:empty) {
	margin-top: 24px;
}

/* ---------- More columns on wide screens / when zoomed out (max 6) ---------- */

@media (min-width: 1600px) {
	.tto-home .tto-grid {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

@media (min-width: 2100px) {
	.tto-home .tto-grid {
		grid-template-columns: repeat(6, minmax(0, 1fr));
		gap: 48px 20px;
	}
}

/* ---------- Tablet (and zoomed in): stays at 3 columns ---------- */

@media (max-width: 900px) {
	.tto-home .tto-grid {
		gap: 36px 14px;
		margin-top: 40px;
	}

	.tto-home .tto-pager {
		gap: 16px;
		margin-top: 64px;
	}
}

/* ---------- Phones: 2 columns ---------- */

@media (max-width: 640px) {
	.tto-home .tto-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 600px) {
	.tto-home .tto-catalog__title {
		margin-top: 0;
	}

	.tto-home .tto-catalog__bar {
		margin-top: 16px;
	}

	.tto-home .tto-grid {
		gap: 32px 12px;
		margin-top: 28px;
	}

	.tto-home .tto-pcard__media {
		border-radius: 12px;
	}

	.tto-home .tto-pcard__tags {
		top: 10px;
		right: 10px;
		gap: 4px;
	}

	.tto-home .tto-pcard__tag {
		padding: 4px 8px;
		font-size: 9px;
	}

	.tto-home .tto-pcard__wish {
		top: 4px;
		left: 4px;
	}

	.tto-home .tto-pcard__title {
		margin-top: 12px;
		font-size: 15px;
	}

	.tto-home .tto-pcard__cats {
		font-size: 12px;
	}

	.tto-home .tto-pcard__foot {
		margin-top: 8px;
		gap: 6px;
	}

	.tto-home .tto-pcard__price {
		font-size: 14px;
	}

	.tto-home .tto-pcard__add {
		width: 34px;
		height: 34px;
	}

	.tto-home .tto-pcard__add svg {
		width: 16px;
		height: 16px;
	}

	.tto-home .tto-pcard__price del {
		margin-right: 4px;
	}

	.tto-home .tto-pager {
		gap: 10px;
		margin-top: 48px;
	}

	.tto-home .tto-pager__step {
		font-size: 0; /* show only the arrows on phones */
		gap: 0;
	}

	.tto-home .tto-pager__step svg {
		width: 20px;
		height: 20px;
	}

	.tto-home .tto-pager__numbers .page-numbers {
		min-width: 32px;
		height: 32px;
	}

	.tto-home .tto-filter__panel {
		right: -8px;
		padding: 8px 20px;
	}
}
