/* ================= UF Background ================= */
.ufl-bg {
	--ufl-bg-c1: #0f172a;
	--ufl-bg-c2: #1e293b;
	--ufl-bg-dot: #93c5fd;
	--ufl-bg-overlay: 0;
	--ufl-bg-radius: 0px;
	--ufl-bg-pad: 48px 32px;
	position: relative;
	overflow: hidden;
	isolation: isolate;
	padding: var(--ufl-bg-pad, 48px 32px);
	border-radius: var(--ufl-bg-radius, 0);
	background: linear-gradient(135deg, var(--ufl-bg-c1), var(--ufl-bg-c2));
	color: #fff;
	min-height: 320px;
}

.ufl-bg__canvas {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	z-index: 0;
	display: block;
	pointer-events: none;
}

.ufl-bg__overlay {
	position: absolute;
	inset: 0;
	z-index: 1;
	background: rgba(2, 6, 23, var(--ufl-bg-overlay, 0));
	pointer-events: none;
}

.ufl-bg__inner {
	position: relative;
	z-index: 2;
}

/* Blob: 2 quầng sáng trôi mềm */
.ufl-bg--blob::before,
.ufl-bg--blob::after {
	content: "";
	position: absolute;
	width: 60%;
	aspect-ratio: 1;
	border-radius: 50%;
	filter: blur(64px);
	opacity: 0.55;
	z-index: 0;
	pointer-events: none;
}

.ufl-bg--blob::before {
	background: var(--ufl-bg-dot);
	top: -14%;
	left: -10%;
	animation: ufl-blob-a calc(18s / var(--ufl-bg-speed, 3)) ease-in-out infinite alternate;
}

.ufl-bg--blob::after {
	background: color-mix(in srgb, var(--ufl-bg-dot) 60%, #f472b6);
	bottom: -18%;
	right: -12%;
	animation: ufl-blob-b calc(22s / var(--ufl-bg-speed, 3)) ease-in-out infinite alternate;
}

/* Mesh gradient */
.ufl-bg--mesh {
	background:
		radial-gradient(60% 60% at 20% 20%, color-mix(in srgb, var(--ufl-bg-dot) 55%, transparent), transparent 70%),
		radial-gradient(50% 50% at 80% 30%, color-mix(in srgb, #a78bfa 50%, transparent), transparent 70%),
		radial-gradient(60% 60% at 60% 90%, color-mix(in srgb, #22d3ee 45%, transparent), transparent 70%),
		linear-gradient(135deg, var(--ufl-bg-c1), var(--ufl-bg-c2));
	background-size: 200% 200%;
	animation: ufl-mesh calc(24s / var(--ufl-bg-speed, 3)) ease-in-out infinite;
}

/* Waves: 2 lớp sóng SVG chạy ngang liền mạch (translate3d -50%, không nhảy seam) */
.ufl-bg--waves::before,
.ufl-bg--waves::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: 0;
	width: 200%;
	height: 46%;
	z-index: 0;
	pointer-events: none;
	background-repeat: repeat-x;
	background-position: left bottom;
	background-size: 50% 100%;
	will-change: transform;
}

.ufl-bg--waves::before {
	opacity: 0.24;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 180' preserveAspectRatio='none'%3E%3Cpath d='M0,90 C200,150 400,30 600,90 C800,150 1000,30 1200,90 L1200,180 L0,180 Z' fill='%23ffffff'/%3E%3C/svg%3E");
	animation: ufl-waves-slide calc(22s / var(--ufl-bg-speed, 3)) linear infinite;
}

.ufl-bg--waves::after {
	height: 36%;
	opacity: 0.16;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 180' preserveAspectRatio='none'%3E%3Cpath d='M0,100 C250,30 350,150 600,100 C850,50 950,150 1200,100 L1200,180 L0,180 Z' fill='%2393c5fd'/%3E%3C/svg%3E");
	animation: ufl-waves-slide-rev calc(30s / var(--ufl-bg-speed, 3)) linear infinite;
}

@keyframes ufl-blob-a {
	from { transform: translate3d(0, 0, 0) scale(1); }
	to { transform: translate3d(18%, 12%, 0) scale(1.15); }
}

@keyframes ufl-blob-b {
	from { transform: translate3d(0, 0, 0) scale(1.1); }
	to { transform: translate3d(-16%, -10%, 0) scale(0.95); }
}

@keyframes ufl-mesh {
	0%, 100% { background-position: 0% 50%; }
	50% { background-position: 100% 50%; }
}

@keyframes ufl-waves-slide {
	from { transform: translate3d(0, 0, 0); }
	to { transform: translate3d(-50%, 0, 0); }
}

@keyframes ufl-waves-slide-rev {
	from { transform: translate3d(-50%, 0, 0); }
	to { transform: translate3d(0, 0, 0); }
}

/* ================= Parallax ================= */
.ufl-px {
	--ufl-px-img: none;
	--ufl-px-speed: 0.2;
	--ufl-px-overlay: 0.35;
	--ufl-px-radius: 0px;
	position: relative;
	height: 520px;
	overflow: hidden;
	border-radius: var(--ufl-px-radius, 0);
	background: #0f172a;
	isolation: isolate;
}

/* Buffer -22% trên/dưới đảm bảo không bao giờ lộ viền tối khi scroll */
.ufl-px__layer {
	position: absolute;
	inset: -22% 0;
	background-image: var(--ufl-px-img);
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	will-change: transform;
	z-index: 0;
}

.ufl-px__overlay {
	position: absolute;
	inset: 0;
	background: rgba(2, 6, 23, var(--ufl-px-overlay, 0.35));
	z-index: 1;
	pointer-events: none;
}

.ufl-px__content {
	position: relative;
	z-index: 2;
	display: grid;
	place-items: center;
	height: 100%;
	padding: 24px;
	text-align: center;
}

.ufl-px__title {
	margin: 0;
	color: #fff;
	font-size: clamp(1.6rem, 4vw, 3rem);
	font-weight: 800;
	line-height: 1.15;
	text-shadow: 0 2px 24px rgba(0, 0, 0, 0.38);
}

@media (prefers-reduced-motion: reduce) {
	.ufl-bg--blob::before,
	.ufl-bg--blob::after,
	.ufl-bg--mesh,
	.ufl-bg--waves::before,
	.ufl-bg--waves::after {
		animation: none;
	}

	.ufl-px__layer {
		inset: 0;
		transform: none !important;
	}
}
