/*
 * Ahago Content Protect — frontend.
 *
 * KHÔNG bọc các rule bảo vệ trong @layer: theo cascade layers, style KHÔNG
 * nằm trong layer luôn thắng style nằm trong layer, bất kể specificity.
 * Bản cũ đặt tất cả trong `@layer ahago-cp` nên chỉ cần theme có một dòng
 * `user-select: text` bình thường là toàn bộ phần chặn bôi đen mất tác dụng.
 */

.ahago-cp-protected.ahago-cp-no-select {
	-webkit-user-select: none;
	-moz-user-select: none;
	user-select: none;
}

/*
 * Ô nhập liệu phải chọn/sửa được, nếu không khách không gõ nổi ô tìm kiếm,
 * form liên hệ hay trang thanh toán. Bản cũ để user-select: none kế thừa
 * xuống input/textarea.
 */
.ahago-cp-protected.ahago-cp-no-select :is(input, textarea, select, [contenteditable="true"], .ahago-cp-allow-select, .ahago-cp-allow-select *) {
	-webkit-user-select: text;
	-moz-user-select: text;
	user-select: text;
}

.ahago-cp-protected.ahago-cp-no-select ::selection {
	background: transparent;
}

.ahago-cp-protected.ahago-cp-no-select :is(input, textarea, [contenteditable="true"])::selection {
	background: Highlight;
	color: HighlightText;
}

/*
 * Chỉ chặn kéo-thả ảnh.
 *
 * Bản cũ dùng `pointer-events: none` cho mọi <img> — cái này chặn luôn CLICK,
 * nên logo, ảnh sản phẩm trong link, slider, lightbox đều bấm không được.
 * Trên site bán hàng đây là lỗi nghiêm trọng hơn cả việc bị copy ảnh.
 */
.ahago-cp-protected.ahago-cp-no-drag :is(img, picture) {
	-webkit-user-drag: none;
	-webkit-touch-callout: none;
}

.ahago-cp__toast {
	position: fixed;
	left: 50%;
	bottom: 1.5rem;
	z-index: 999999;
	transform: translateX(-50%);
	background: rgba(23, 23, 23, 0.92);
	color: #fff;
	padding: 0.6rem 1rem;
	border-radius: 0.5rem;
	font-size: 0.875rem;
	line-height: 1.45;
	max-width: min(90vw, 28rem);
	text-align: center;
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.2s ease;
}

.ahago-cp__toast.is-visible {
	opacity: 1;
}

@supports (background: color-mix(in srgb, black 50%, transparent)) {
	.ahago-cp__toast {
		background: color-mix(in srgb, CanvasText 88%, transparent);
		color: Canvas;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ahago-cp__toast {
		transition: none;
	}
}

@media print {
	.ahago-cp-protected.ahago-cp-print-protected :is(.entry-content, article) {
		filter: blur(6px);
	}

	.ahago-cp__toast {
		display: none;
	}
}
