/* Block Danh mục sản phẩm (Figma "Detail page → Product" → Frame 2147231135: rộng 1920, padding 40 / 56, gap 40) */

.block-catalog {
	display: grid;
	gap: clamp(24px, 2.08vw, 40px);
	margin-top: clamp(8px, 0.83vw, 16px); /* Frame bắt đầu ở top 120, header cao 104. */
	padding: clamp(24px, 2.08vw, 40px) var(--gutter);
}

/* Bộ lọc --------------------------------------------------------------- */

.block-catalog__filters {
	display: grid;
	align-content: start;
	gap: clamp(24px, 2.5vw, 48px);
}

.catalog-filter__title {
	font-family: var(--font-body);
	font-size: clamp(22px, 1.67vw, 32px);
	font-weight: 600;
	line-height: 1.2;
	text-transform: none;
	color: var(--color-text-muted);
}

ul.catalog-filter__list { /* "ul." thắng ul[class] { padding: 0 } của base.css */
	display: grid;
	gap: clamp(6px, 0.68vw, 13px);
	margin-top: clamp(12px, 1.25vw, 24px);
	padding-left: clamp(24px, 1.82vw, 35px); /* chấm đầu dòng cách lề 16, chữ cách lề 35 */
}

.catalog-filter__list li {
	list-style: disc;
	color: var(--color-ink);
}

.catalog-filter__button {
	display: block;
	padding: 0;
	border: 0;
	background: none;
	font: inherit;
	font-size: clamp(16px, 1.04vw, 20px);
	font-weight: 500;
	line-height: 1.3;
	letter-spacing: 0.01em;
	color: var(--color-ink);
	text-align: left;
	cursor: default;
}

/* Chỉ bấm được khi filter.js đã gắn (không có JS: danh sách chỉ để đọc, mọi ảnh vẫn hiện). */
.is-enhanced .catalog-filter__button {
	cursor: pointer;
}

.is-enhanced .catalog-filter__button:hover,
.catalog-filter__button[aria-pressed="true"] {
	color: var(--color-text-strong);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.2em;
}

.catalog-filter__button[aria-pressed="true"] {
	font-weight: 700;
}

.catalog-filter__list li:has([aria-pressed="true"]) {
	color: var(--color-text-strong);
}

/* Nhóm link trang sản phẩm: cùng kiểu chữ với mục lọc, thêm mũi tên ↗ để phân biệt là link sang trang khác. */
.catalog-filter__link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: clamp(16px, 1.04vw, 20px);
	font-weight: 500;
	line-height: 1.3;
	letter-spacing: 0.01em;
	color: var(--color-ink);
	text-decoration: none;
}

.catalog-filter__link .icon {
	width: 0.9em;
	height: 0.9em;
	transition: transform 0.2s;
}

.catalog-filter__link:hover {
	color: var(--color-primary);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.2em;
}

.catalog-filter__link:hover .icon {
	transform: translate(2px, -2px);
}

/* Lưới ảnh -------------------------------------------------------------- */

.block-catalog__grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: clamp(12px, 2.08vw, 40px);
}

.catalog-item {
	position: relative;
	overflow: hidden;
	border-radius: var(--radius-sm);
	aspect-ratio: 438 / 549;
	background: var(--color-beige);
	isolation: isolate;
}

.catalog-item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* Rê chuột / focus: ảnh phóng nhẹ, phủ bóng tối (đậm dần về đáy) và hiện SKU ở góc dưới trái
   (slide UX "Products"; kiểu phủ tối tham khảo gallery trang dugarco.com/vi/quan-ao-dan/). */
.catalog-item::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, rgba(0, 0, 0, 0.15) 0%, rgba(0, 0, 0, 0.35) 55%, rgba(0, 0, 0, 0.75) 100%);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.4s ease;
}

.catalog-item__sku {
	position: absolute;
	right: clamp(12px, 1.25vw, 24px);
	bottom: clamp(12px, 1.25vw, 24px);
	left: clamp(12px, 1.25vw, 24px);
	z-index: 1;
	font-family: var(--font-display);
	font-size: clamp(14px, 1.04vw, 20px);
	font-weight: 600;
	letter-spacing: 0.04em;
	color: #fff;
	opacity: 0;
	pointer-events: none;
	transform: translateY(12px);
	transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.catalog-item:is(:hover, :focus-within) img {
	transform: scale(1.05);
}

.catalog-item:is(:hover, :focus-within)::after,
.catalog-item:is(:hover, :focus-within) .catalog-item__sku {
	opacity: 1;
	transform: none;
}

/* Thiết bị cảm ứng (không rê chuột được): SKU luôn hiện trên nền tối nhẹ ở đáy ảnh. */
@media (hover: none) {
	.catalog-item::after {
		background: linear-gradient(180deg, transparent 60%, rgba(0, 0, 0, 0.6) 100%);
		opacity: 1;
	}

	.catalog-item__sku {
		opacity: 1;
		transform: none;
	}
}

.block-catalog__empty {
	color: var(--color-text-muted);
}

/* "Show more": chữ đậm gạch chân căn phải, hộp cao 48 (Figma: cách lưới 40, chữ cách mép phải lưới ~20). */
.block-catalog__more {
	display: block;
	margin: clamp(16px, 2.08vw, 40px) 0 0 auto;
	padding: 12px clamp(8px, 1.04vw, 20px);
	border: 0;
	background: none;
	font: inherit;
	font-size: clamp(18px, 1.46vw, 28px);
	font-weight: 600;
	line-height: 1;
	color: var(--color-text-strong);
	text-decoration: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 0.25em;
	cursor: pointer;
}

.block-catalog__more:hover {
	color: var(--color-primary);
}

.block-catalog__more[hidden] {
	display: none;
}

/* Thanh "Filter" + nút đóng bảng: chỉ mobile / tablet có JS (catalog-panel.js gắn .has-catalog-bar). */
.catalog-bar,
.block-catalog__close {
	display: none;
}

/* Mobile / tablet không JS: các nhóm lọc nằm ngang phía trên lưới. */
@media (max-width: 1023px) {
	.block-catalog__filters {
		grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	}
}

/* Mobile / tablet có JS (Figma mobile "Product" + "Filter", feedback vòng 4): thanh "Filter" + chip mục đang lọc; bộ lọc là
   bảng nổi 320 rộng bên trái (nút đóng tròn đỏ); lưới 2 cột, SKU nhãn nhỏ góc dưới, "Show more" ở giữa. */
@media (max-width: 1023px) {
	.has-catalog-bar .catalog-bar {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 12px;
	}

	.catalog-bar__toggle {
		display: inline-flex;
		align-items: center;
		gap: 8px;
		padding: 4px 0;
		border: 0;
		background: none;
		font-family: var(--font-display);
		font-size: 18px;
		font-weight: 700;
		text-decoration: underline;
		text-decoration-thickness: 2px;
		text-underline-offset: 0.25em;
		color: var(--color-text-strong);
		cursor: pointer;
	}

	.catalog-bar__toggle .icon {
		width: 24px;
		height: 24px;
	}

	.catalog-bar__chip {
		max-width: 60%;
		overflow: hidden;
		padding: 4px 12px;
		border: 0;
		border-radius: var(--radius-pill);
		background: var(--color-primary);
		font-size: 14px;
		font-weight: 500;
		white-space: nowrap;
		text-overflow: ellipsis;
		color: #fff;
		cursor: pointer;
	}

	.catalog-bar__chip[hidden] {
		display: none;
	}

	.has-catalog-bar .block-catalog__filters {
		position: fixed;
		top: calc(var(--header-height) + 8px);
		left: 0;
		z-index: 60; /* trên header (50) */
		display: grid;
		grid-template-columns: none;
		gap: 20px;
		width: min(320px, 100vw - 32px);
		max-height: calc(100dvh - var(--header-height) - 24px);
		overflow-y: auto;
		padding: 16px 16px 24px;
		border-radius: 0 var(--radius-md) var(--radius-md) 0;
		background: #fff;
		box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
		opacity: 0;
		visibility: hidden;
		transform: translateX(-24px);
		transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s linear 0.25s;
	}

	.has-catalog-bar.is-panel-open .block-catalog__filters {
		opacity: 1;
		visibility: visible;
		transform: none;
		transition: opacity 0.25s ease, transform 0.25s ease;
	}

	.has-catalog-bar .block-catalog__close {
		display: grid;
		place-items: center;
		width: 40px;
		height: 40px;
		padding: 0;
		border: 0;
		border-radius: 50%;
		background: var(--color-primary);
		color: #fff;
		cursor: pointer;
	}

	.block-catalog__close .icon {
		width: 22px;
		height: 22px;
	}

	.has-catalog-bar .catalog-filter__title {
		font-size: 20px;
	}

	.has-catalog-bar .catalog-filter__list {
		margin-top: 12px;
	}

	.block-catalog__grid {
		gap: 8px;
	}

	.catalog-item__sku {
		right: auto;
		bottom: 8px;
		left: 8px;
		padding: 3px 8px;
		border-radius: var(--radius-pill);
		background: rgba(30, 30, 30, 0.55);
		font-size: 10px;
		letter-spacing: 0;
	}

	.block-catalog__more {
		margin-inline: auto;
		font-size: 16px;
	}
}

/* Sidebar dính khi cuộn – chỉ khi màn đủ cao để thấy hết 3 nhóm (cao ~870). */
@media (min-width: 1024px) and (min-height: 1000px) {
	.block-catalog__filters {
		position: sticky;
		top: calc(var(--header-height) + 40px);
	}

	.admin-bar .block-catalog__filters {
		top: calc(var(--header-height) + 40px + var(--wp-admin--admin-bar--height, 32px));
	}
}

/* Desktop: sidebar 370 / 1920, lưới 3 cột 438. */
@media (min-width: 1024px) {
	.block-catalog {
		grid-template-columns: 19.27vw 1fr;
		align-items: start;
	}


	.block-catalog__grid {
		grid-template-columns: repeat(3, 1fr);
	}
}
