/* =========================================================================
 * X3SALES DV Gallery — element vhm_thm_gallery
 * Khối "Hình ảnh thi công": cụm tiêu đề + LƯỚI ảnh (mỗi ô là ảnh phủ kín).
 * Bản gốc dùng absolute px cố định; ở đây dựng bằng CSS Grid responsive,
 * số cột / tỉ lệ ô / khoảng cách / màu đổ qua --thm-gal-* trên thẻ gốc.
 * Scope dưới .thm-gallery → không ảnh hưởng phần còn lại của site.
 * ========================================================================= */

@font-face {
	font-family: "THM Megante";
	src: url("https://w.ladicdn.com/5dadc2a03bf9ab4ea2cc8ccb/svn-megante-20231018093528-hgdbo.otf");
	font-display: swap;
}

.thm-gallery,
.thm-gallery * {
	box-sizing: border-box;
}

.thm-gallery {
	position: relative;
	width: 100%;
	padding: 44px 15px 56px;
	background-color: var(--thm-gal-bg, #f1f3f4);
	overflow: hidden;
}

.thm-gallery__inner {
	width: 100%;
	max-width: 1200px;
	margin: 0 auto;
}

/* -------- Tiêu đề -------- */
.thm-gallery__head {
	position: relative;
	margin-bottom: 36px;
	text-align: center;
}

.thm-gallery__title {
	margin: 0;
	font-family: "THM Megante", Arial, sans-serif;
	font-weight: bold;
	font-size: 30px;
	line-height: 1.6;
	color: var(--thm-gal-accent, #264b9c);
	text-transform: uppercase;
	animation: thmFadeInDown 1s ease 0s 1;
}

.thm-gallery__bracket {
	display: block;
	width: 121px;
	height: 2px;
	margin: 6px auto 0;
	background-color: var(--thm-gal-accent, #264b9c);
}

/* -------- Lưới ảnh -------- */
.thm-gallery__grid {
	display: grid;
	grid-template-columns: repeat(var(--thm-gal-cols, 5), 1fr);
	gap: var(--thm-gal-gap, 9px);
}

.thm-gallery__item {
	position: relative;
	width: 100%;
	aspect-ratio: var(--thm-gal-ratio, 0.735);
	overflow: hidden;
}

.thm-gallery__bg {
	position: absolute;
	inset: 0;
	background-repeat: no-repeat;
	background-position: center center;
	background-size: cover;
	transition: transform 300ms ease;
}

.thm-gallery__item:hover .thm-gallery__bg {
	transform: scale(1.06);
}

@keyframes thmFadeInDown {
	0% { opacity: 0; transform: translateY(-20px); }
	100% { opacity: 1; transform: translateY(0); }
}

/* -------- Mobile (< 768px): co số cột -------- */
@media (max-width: 767px) {
	.thm-gallery {
		padding: 28px 12px 36px;
	}

	.thm-gallery__head {
		margin-bottom: 24px;
	}

	.thm-gallery__title {
		font-size: 25px;
	}

	.thm-gallery__bracket {
		width: 64px;
	}

	.thm-gallery__grid {
		grid-template-columns: repeat(var(--thm-gal-cols-mobile, 2), 1fr);
	}
}

/* -------------------------------------------------------------------------
 * Chế độ UX Builder ("chip viền builder"): các ảnh hiện thành chip CÓ VIỀN
 * (thumbnail) để người dùng dễ nhìn/kéo-thả/sửa. Frontend giữ lưới ảnh thật.
 * ---------------------------------------------------------------------- */
.thm-gallery__builder-items {
	width: 100%;
}

.thm-gallery__builder-note {
	margin: 0 0 12px;
	color: #555;
	font-size: 13px;
	font-style: italic;
	text-align: center;
}

.thm-gallery__builder-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	justify-content: center;
}

.thm-gallery__b-item {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	width: 140px;
	padding: 8px;
	border: 1px dashed rgba(0, 0, 0, 0.35);
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.6);
}

.thm-gallery__b-tag {
	padding: 2px 8px;
	border-radius: 999px;
	background: var(--fs-color-primary, #264b9c);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
}

.thm-gallery__b-thumb {
	width: 100%;
	height: 90px;
	border-radius: 4px;
	background-repeat: no-repeat;
	background-position: center center;
	background-size: cover;
}

.thm-gallery__b-empty {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 90px;
	border-radius: 4px;
	background: rgba(0, 0, 0, 0.06);
	color: #888;
	font-size: 12px;
	text-align: center;
}
