/*
 * LUCKBAG Print Fix
 * Goal: keep the printed result as close as possible to the rendered page.
 *
 * Important:
 * - This does NOT create a separate print template.
 * - It intentionally keeps most screen layout/content.
 * - The browser's own "print backgrounds" setting can still override this.
 */

@media print {

	/* Tell the browser that colors/images are intentional. */
	html,
	body,
	body * {
		-webkit-print-color-adjust: exact !important;
		print-color-adjust: exact !important;
	}

	/* Do not let common builders/theme rules collapse the main page. */
	html,
	body {
		width: 100% !important;
		min-width: 0 !important;
		margin: 0 !important;
		padding: 0 !important;
	}

	body {
		background: transparent !important;
	}

	/* Preserve common layout primitives. */
	.elementor,
	.elementor-page,
	.elementor-section,
	.elementor-container,
	.elementor-widget-wrap,
	.elementor-element,
	.e-con,
	.e-con-inner,
	.brxe-container,
	.brxe-section,
	.brxe-block {
		-webkit-print-color-adjust: exact !important;
		print-color-adjust: exact !important;
	}

	/* Prevent print-specific overflow from clipping wide content. */
	.elementor,
	.elementor-page,
	.brxe-section,
	.brxe-container {
		overflow: visible !important;
	}

	/* Keep images at their rendered proportions. */
	img,
	svg,
	video,
	canvas {
		max-width: 100% !important;
		height: auto !important;
		-webkit-print-color-adjust: exact !important;
		print-color-adjust: exact !important;
	}

	/* Stop interactive/animated behavior from changing the captured state. */
	*,
	*::before,
	*::after {
		animation: none !important;
		transition: none !important;
		caret-color: transparent !important;
	}

	/* Sticky/fixed elements are a frequent source of duplicated/overlapping print output. */
	.elementor-sticky,
	.elementor-motion-effects-container,
	.elementor-motion-effects-layer {
		position: static !important;
		transform: none !important;
	}

	/* Keep flex/grid layouts rather than forcing block layout. */
	.elementor-container,
	.elementor-widget-wrap,
	.e-con,
	.e-con-inner {
		display: flex !important;
	}

	/* Don't force every child to break. This lets the browser paginate naturally. */
	.elementor-widget,
	.elementor-element,
	.brxe-element {
		break-inside: auto;
		page-break-inside: auto;
	}

	/* Useful natural break behavior for text-heavy blocks. */
	h1, h2, h3, h4, h5, h6,
	p, li,
	.elementor-heading-title {
		orphans: 3;
		widows: 3;
	}

	/* Avoid cutting common cards/boxes when possible. */
	.elementor-widget-image,
	.elementor-widget-text-editor,
	.elementor-widget-heading,
	.elementor-widget-button,
	.brxe-image,
	.brxe-text,
	.brxe-heading,
	.brxe-button {
		break-inside: avoid;
		page-break-inside: avoid;
	}

	/* Do not append URLs after links. */
	a[href]::after,
	a[href]::before {
		content: none !important;
	}

	/* Explicit opt-out hooks for site owners. */
	.no-print,
	.print-hide {
		display: none !important;
	}

	/* Explicit break hook. */
	.print-break-before {
		break-before: page !important;
		page-break-before: always !important;
	}

	.print-break-after {
		break-after: page !important;
		page-break-after: always !important;
	}

	/* A4-ish default page box. Users can still choose their own paper size in the dialog. */
	@page {
		margin: 10mm;
	}
}
