/* =========================================================
   DANH MỤC GIA CÔNG - MODULAR LABORATORY
   Bố cục: danh mục trái - ảnh giữa - danh mục phải
   Chiều rộng nội dung tối đa: 1320px
========================================================= */

.sp-section1 {
	--sp-primary: #087f72;
	--sp-accent: #28cbbb;
	--sp-dark: #193530;
	--sp-line: #d8e8e4;
	--sp-soft: #eff7f5;
	--sp-white: #ffffff;

	position: relative;
	overflow: hidden;
	padding: 0;
	background:
		linear-gradient(
			180deg,
			#ffffff 0%,
			#f2f8f6 100%
		);
}

/* Tạo lưới kỹ thuật nhẹ cho nền section */
.sp-section1::before {
	content: "";
	position: absolute;
	inset: 0;
	background-image:
		linear-gradient(
			rgba(8, 127, 114, 0.035) 1px,
			transparent 1px
		),
		linear-gradient(
			90deg,
			rgba(8, 127, 114, 0.035) 1px,
			transparent 1px
		);
	background-size: 44px 44px;
	pointer-events: none;
}

/* Tạo vùng sáng nhẹ phía sau ảnh trung tâm */
.sp-section1::after {
	content: "";
	position: absolute;
	top: 120px;
	left: 50%;
	width: 590px;
	height: 450px;
	border-radius: 50%;
	background: rgba(40, 203, 187, 0.09);
	filter: blur(90px);
	transform: translateX(-50%);
	pointer-events: none;
}

/* Đưa nội dung lên trên lớp nền trang trí */
.sp-section1 .section-content {
	position: relative;
	z-index: 2;
}

/* =========================================================
   TIÊU ĐỀ
========================================================= */

.sp-section1 .sp-tieude {
	width: calc(100% - 30px);
	max-width: 1320px;
	margin: 0 auto;
	padding: 34px 0 22px;
}

/* Xóa khoảng đệm mặc định của UX Builder */
.sp-section1 .sp-tieude > .col,
.sp-section1 .sp-tieude .col-inner {
	padding: 0;
}

/* Định dạng tiêu đề section */
.sp-section1 .sp-tieude p {
	position: relative;
	margin: 0;
	color: var(--sp-dark);
	font-size: clamp(1.8rem, 2.5vw, 2.4rem);
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: 0.045em;
	text-align: center;
	text-transform: uppercase;
}

/* Tạo thanh trang trí dưới tiêu đề */
.sp-section1 .sp-tieude p::after {
	content: "";
	display: block;
	width: 82px;
	height: 7px;
	margin: 12px auto 0;
	border-right: 24px solid var(--sp-primary);
	border-left: 24px solid var(--sp-primary);
	background: var(--sp-accent);
}

/* =========================================================
   KHUNG NỘI DUNG 1320PX
========================================================= */

.sp-section1 .sp {
	display: grid;
	grid-template-columns:
		minmax(320px, 1fr)
		minmax(360px, 1.04fr)
		minmax(320px, 1fr);
	align-items: stretch;
	gap: 22px;
	width: calc(100% - 30px);
	max-width: 1320px;
	min-height: 560px;
	margin: 0 auto;
	padding: 0 0 42px;
}

/* Loại bỏ chiều rộng cột mặc định của Flatsome */
.sp-section1 .sp > .col {
	width: 100%;
	max-width: none;
	flex-basis: auto;
	padding: 0;
}

/* Cho nội dung mỗi cột chiếm đủ chiều cao */
.sp-section1 .sp > .col > .col-inner {
	height: 100%;
	padding: 0;
}

/* =========================================================
   HAI CỘT DANH MỤC
========================================================= */

/* Chia đều ba card theo chiều cao */
.sp-section1 .sp-trai > .col-inner,
.sp-section1 .sp-phai > .col-inner {
	display: grid;
	grid-template-rows: repeat(3, minmax(0, 1fr));
	gap: 14px;
	position: relative;
	padding: 0;
}

/* Thiết kế chung cho card danh mục */
.sp-section1 .sp-trai .box,
.sp-section1 .sp-phai .box {
	position: relative;
	display: grid;
	align-items: center;
	gap: 13px;
	min-height: 0;
	margin: 0;
	padding: 10px 15px;
	overflow: hidden;
	border: 1px solid var(--sp-line);
	background: rgba(255, 255, 255, 0.96);
	box-shadow: 0 8px 24px rgba(25, 53, 48, 0.07);
	transition:
		transform 0.3s ease,
		border-color 0.3s ease,
		box-shadow 0.3s ease,
		background 0.3s ease;
}

/* Card bên trái: ảnh bên trái, tên bên phải */
.sp-section1 .sp-trai .box {
	grid-template-columns: 132px minmax(0, 1fr);
	border-radius: 20px 4px 4px 20px;
	clip-path: polygon(
		0 0,
		calc(100% - 15px) 0,
		100% 15px,
		100% calc(100% - 15px),
		calc(100% - 15px) 100%,
		0 100%
	);
}

/* Card bên phải: tên bên trái, ảnh bên phải */
.sp-section1 .sp-phai .box {
	grid-template-columns: minmax(0, 1fr) 132px;
	border-radius: 4px 20px 20px 4px;
	clip-path: polygon(
		15px 0,
		100% 0,
		100% 100%,
		15px 100%,
		0 calc(100% - 15px),
		0 15px
	);
}

/* Đưa ảnh card bên phải ra ngoài cùng */
.sp-section1 .sp-phai .box-image {
	order: 2;
}

/* Đưa tên card bên phải vào phía ảnh trung tâm */
.sp-section1 .sp-phai .box-text {
	order: 1;
}

/* =========================================================
   ẢNH DANH MỤC
========================================================= */

/* Tăng ảnh danh mục lên 132px */
.sp-section1 .sp-trai .box-image,
.sp-section1 .sp-phai .box-image {
	position: relative;
	width: 132px;
	height: 132px;
	overflow: hidden;
	border: 5px solid var(--sp-soft);
	border-radius: 50%;
	background: #dfece8;
	box-shadow: 0 8px 22px rgba(8, 127, 114, 0.16);
}

/* Tạo vòng viền nhỏ phía trong ảnh */
.sp-section1 .sp-trai .box-image::after,
.sp-section1 .sp-phai .box-image::after {
	content: "";
	position: absolute;
	inset: 7px;
	z-index: 2;
	border: 1px solid rgba(255, 255, 255, 0.72);
	border-radius: 50%;
	pointer-events: none;
}

/* Cho lớp bao ảnh chiếm toàn bộ khung tròn */
.sp-section1 .sp-trai .box-image > div,
.sp-section1 .sp-phai .box-image > div {
	width: 100%;
	height: 100%;
}

/* Cắt ảnh đúng theo khung tròn */
.sp-section1 .sp-trai .box-image img,
.sp-section1 .sp-phai .box-image img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition:
		transform 0.45s ease,
		filter 0.3s ease;
}

/* =========================================================
   TÊN DANH MỤC
========================================================= */

/* Xóa giao diện mặc định của vùng chữ */
.sp-section1 .sp-trai .box-text,
.sp-section1 .sp-phai .box-text {
	position: relative;
	display: flex;
	align-items: center;
	width: 100%;
	padding: 0;
	background: transparent;
}

/* Căn tên cột trái về phía ảnh trung tâm */
.sp-section1 .sp-trai .box-text {
	justify-content: flex-end;
	text-align: right;
}

/* Căn tên cột phải về phía ảnh trung tâm */
.sp-section1 .sp-phai .box-text {
	justify-content: flex-start;
	text-align: left;
}

/* Cho vùng chữ sử dụng toàn bộ chiều rộng còn lại */
.sp-section1 .sp-trai .box-text-inner,
.sp-section1 .sp-phai .box-text-inner {
	width: 100%;
	padding: 0;
}

/* Định dạng tên danh mục */
.sp-section1 .sp-trai .box-text p,
.sp-section1 .sp-phai .box-text p {
	margin: 0;
	color: var(--sp-dark);
	font-size: 1rem;
	font-weight: 700;
	line-height: 1.35;
	letter-spacing: 0.012em;
	text-transform: uppercase;
	transition: color 0.3s ease;
}

/* Căn tên danh mục bên trái */
.sp-section1 .sp-trai .box-text p {
	text-align: right;
}

/* Căn tên danh mục bên phải */
.sp-section1 .sp-phai .box-text p {
	text-align: left;
}

/* =========================================================
   HIỆU ỨNG CARD
========================================================= */

/* Nâng nhẹ card khi hover */
.sp-section1 .sp-trai .box:hover,
.sp-section1 .sp-phai .box:hover {
	border-color: rgba(40, 203, 187, 0.7);
	background: var(--sp-white);
	box-shadow: 0 16px 36px rgba(25, 53, 48, 0.13);
	transform: translateY(-4px);
}

/* Phóng nhẹ ảnh danh mục khi hover */
.sp-section1 .sp-trai .box:hover .box-image img,
.sp-section1 .sp-phai .box:hover .box-image img {
	filter: saturate(1.06);
	transform: scale(1.08);
}

/* Đổi màu tên danh mục khi hover */
.sp-section1 .sp-trai .box:hover .box-text p,
.sp-section1 .sp-phai .box:hover .box-text p {
	color: var(--sp-primary);
}

/* =========================================================
   ẢNH TRUNG TÂM
========================================================= */

/* Cho ảnh giữa chiếm toàn bộ chiều cao cột */
.sp-section1 .sp-giua .img,
.sp-section1 .sp-giua .img-inner {
	width: 100%;
	height: 100%;
	margin: 0;
}

/* Khung ngoài ảnh trung tâm */
.sp-section1 .sp-giua > .col-inner {
	position: relative;
	padding: 10px;
	border: 1px solid rgba(8, 127, 114, 0.28);
	background: rgba(255, 255, 255, 0.66);
	box-shadow: 0 22px 48px rgba(25, 53, 48, 0.15);
	clip-path: polygon(
		28px 0,
		100% 0,
		100% calc(100% - 28px),
		calc(100% - 28px) 100%,
		0 100%,
		0 28px
	);
}

/* Tạo hai góc nhận diện bên ngoài ảnh */
.sp-section1 .sp-giua > .col-inner::before,
.sp-section1 .sp-giua > .col-inner::after {
	content: "";
	position: absolute;
	z-index: 3;
	width: 38px;
	height: 38px;
	pointer-events: none;
}

/* Góc trên bên trái */
.sp-section1 .sp-giua > .col-inner::before {
	top: 0;
	left: 0;
	border-top: 4px solid var(--sp-accent);
	border-left: 4px solid var(--sp-accent);
}

/* Góc dưới bên phải */
.sp-section1 .sp-giua > .col-inner::after {
	right: 0;
	bottom: 0;
	border-right: 4px solid var(--sp-primary);
	border-bottom: 4px solid var(--sp-primary);
}

/* Khung chứa ảnh chính */
.sp-section1 .sp-giua .img-inner {
	position: relative;
	overflow: hidden;
	background: #dce9e5;
	clip-path: polygon(
		20px 0,
		100% 0,
		100% calc(100% - 20px),
		calc(100% - 20px) 100%,
		0 100%,
		0 20px
	);
}

/* Tạo đường viền mảnh bên trong ảnh */
.sp-section1 .sp-giua .img-inner::before {
	content: "";
	position: absolute;
	inset: 14px;
	z-index: 2;
	border: 1px solid rgba(255, 255, 255, 0.58);
	pointer-events: none;
}

/* Tạo lớp phủ nhẹ phía dưới ảnh */
.sp-section1 .sp-giua .img-inner::after {
	content: "";
	position: absolute;
	inset: 0;
	background:
		linear-gradient(
			180deg,
			rgba(14, 60, 52, 0) 58%,
			rgba(14, 60, 52, 0.25) 100%
		);
	pointer-events: none;
}

/* Ảnh trung tâm phủ kín khung trên desktop */
.sp-section1 .sp-giua img {
	display: block;
	width: 100%;
	height: 100%;
	min-height: 540px;
	object-fit: cover;
	transition:
		transform 0.65s ease,
		filter 0.4s ease;
}

/* Phóng nhẹ ảnh giữa khi hover */
.sp-section1 .sp-giua .img-inner:hover img {
	filter: contrast(1.02) saturate(1.03);
	transform: scale(1.035);
}

/* =========================================================
   LAPTOP NHỎ
========================================================= */

@media screen and (max-width: 1120px) {
	/* Điều chỉnh tỷ lệ ba cột */
	.sp-section1 .sp {
		grid-template-columns:
			minmax(260px, 1fr)
			minmax(320px, 1.02fr)
			minmax(260px, 1fr);
		gap: 16px;
		min-height: 510px;
		padding-bottom: 36px;
	}

	/* Thu padding card trên laptop nhỏ */
	.sp-section1 .sp-trai .box,
	.sp-section1 .sp-phai .box {
		gap: 10px;
		padding: 9px 11px;
	}

	/* Giữ ảnh danh mục lớn trên laptop */
	.sp-section1 .sp-trai .box {
		grid-template-columns: 112px minmax(0, 1fr);
	}

	.sp-section1 .sp-phai .box {
		grid-template-columns: minmax(0, 1fr) 112px;
	}

	.sp-section1 .sp-trai .box-image,
	.sp-section1 .sp-phai .box-image {
		width: 112px;
		height: 112px;
		border-width: 4px;
	}

	/* Điều chỉnh chữ danh mục */
	.sp-section1 .sp-trai .box-text p,
	.sp-section1 .sp-phai .box-text p {
		font-size: 0.86rem;
	}

	/* Đồng bộ chiều cao ảnh giữa */
	.sp-section1 .sp-giua img {
		min-height: 490px;
	}
}

/* =========================================================
   TABLET VÀ MOBILE
========================================================= */

@media screen and (max-width: 849px) {
	/* Giảm khoảng cách trên dưới tiêu đề */
	.sp-section1 .sp-tieude {
		padding: 26px 0 18px;
	}

	/* Thu nhỏ tiêu đề mobile */
	.sp-section1 .sp-tieude p {
		font-size: 1.55rem;
	}

	/* Giảm khoảng cách dưới thanh tiêu đề */
	.sp-section1 .sp-tieude p::after {
		margin-top: 9px;
	}

	/* Chuyển nội dung thành lưới hai cột */
	.sp-section1 .sp {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 12px;
		width: calc(100% - 24px);
		min-height: 0;
		padding-bottom: 28px;
	}

	/* Đưa ảnh trung tâm lên đầu */
	.sp-section1 .sp-giua {
		order: -1;
		grid-column: 1 / -1;
		margin-bottom: 5px;
	}

	/* Đưa sáu card vào chung một lưới */
	.sp-section1 .sp-trai,
	.sp-section1 .sp-phai,
	.sp-section1 .sp-trai > .col-inner,
	.sp-section1 .sp-phai > .col-inner {
		display: contents;
	}

	/* Chuyển card mobile thành dạng dọc */
	.sp-section1 .sp-trai .box,
	.sp-section1 .sp-phai .box {
		display: flex;
		flex-direction: column;
		justify-content: center;
		gap: 7px;
		min-height: 170px;
		padding: 10px 7px;
		border-radius: 15px;
		clip-path: none;
	}

	/* Tăng ảnh danh mục trên mobile */
	.sp-section1 .sp-trai .box-image,
	.sp-section1 .sp-phai .box-image {
		order: 1;
		width: 100px;
		height: 100px;
		flex: 0 0 100px;
	}

	/* Đồng nhất vị trí phần chữ */
	.sp-section1 .sp-trai .box-text,
	.sp-section1 .sp-phai .box-text {
		order: 2;
		justify-content: center;
		text-align: center;
	}

	/* Căn giữa tên danh mục */
	.sp-section1 .sp-trai .box-text p,
	.sp-section1 .sp-phai .box-text p {
		font-size: 0.8rem;
		text-align: center;
	}

	/* Cho khung ảnh giữa tự co theo đúng tỷ lệ ảnh gốc */
	.sp-section1 .sp-giua > .col-inner {
		height: auto;
		padding: 8px;
		clip-path: polygon(
			18px 0,
			100% 0,
			100% calc(100% - 18px),
			calc(100% - 18px) 100%,
			0 100%,
			0 18px
		);
	}

	/* Xóa chiều cao cố định của các lớp bao ảnh */
	.sp-section1 .sp-giua .img,
	.sp-section1 .sp-giua .img-inner {
		width: 100%;
		height: auto;
	}

	/* Bỏ tỷ lệ ngang cố định để không cắt ảnh */
	.sp-section1 .sp-giua .img-inner {
		aspect-ratio: auto;
		background: #f2f8f6;
		clip-path: polygon(
			13px 0,
			100% 0,
			100% calc(100% - 13px),
			calc(100% - 13px) 100%,
			0 100%,
			0 13px
		);
	}

	/* Hiển thị toàn bộ ảnh theo đúng tỷ lệ gốc trên mobile */
	.sp-section1 .sp-giua img {
		display: block;
		width: 100%;
		height: auto;
		min-height: 0;
		object-fit: contain;
		object-position: center;
	}

	/* Không phóng ảnh trung tâm trên thiết bị cảm ứng */
	.sp-section1 .sp-giua .img-inner:hover img {
		filter: none;
		transform: none;
	}
}

/* =========================================================
   MOBILE NHỎ
========================================================= */

@media screen and (max-width: 420px) {
	/* Thu nhỏ khoảng cách tiêu đề */
	.sp-section1 .sp-tieude {
		padding-top: 22px;
		padding-bottom: 15px;
	}

	/* Thu nhỏ tiêu đề */
	.sp-section1 .sp-tieude p {
		font-size: 1.3rem;
	}

	/* Thu nhỏ khoảng cách lưới */
	.sp-section1 .sp {
		gap: 10px;
		width: calc(100% - 20px);
		padding-bottom: 24px;
	}

	/* Điều chỉnh card theo ảnh lớn hơn */
	.sp-section1 .sp-trai .box,
	.sp-section1 .sp-phai .box {
		min-height: 158px;
		padding: 8px 5px;
	}

	/* Giữ ảnh danh mục lớn trên mobile nhỏ */
	.sp-section1 .sp-trai .box-image,
	.sp-section1 .sp-phai .box-image {
		width: 90px;
		height: 90px;
		flex-basis: 90px;
	}

	/* Thu nhỏ tên danh mục */
	.sp-section1 .sp-trai .box-text p,
	.sp-section1 .sp-phai .box-text p {
		font-size: 0.72rem;
	}
}

/* =========================================================
   ACCESSIBILITY
========================================================= */

/* Tắt hiệu ứng khi thiết bị yêu cầu giảm chuyển động */
@media (prefers-reduced-motion: reduce) {
	.sp-section1 .box,
	.sp-section1 .box img,
	.sp-section1 .sp-giua img {
		transition: none;
	}
}