/*
 * Etz Hahaim Notice Generator — print styles (loaded with media="print").
 *
 * Printing works by cloning the active notice into a temporary container
 * appended directly to <body> (.ehng-print-root). Everything else on the
 * page is removed from the layout with display:none — never
 * visibility:hidden, which reserves space and produces blank pages.
 *
 * The clone is wrapped in .ehng-generator so the plugin's scoped rules and
 * CSS custom properties still resolve.
 *
 * Frame classes: the classic frame is the base .ehng-obituary with no
 * modifier; modern, soft (inner gold) and no-frame add a modifier class.
 * Font family is never overridden here — the chosen font class travels
 * with the clone; only weight and size change for paper.
 */

@media print {

	@page {
		size: A4 landscape;
		margin: 10mm;
	}

	html,
	body {
		width: 100% !important;
		height: auto !important;
		min-height: 0 !important;
		margin: 0 !important;
		padding: 0 !important;
		background: #fff !important;
		overflow: visible !important;
	}

	/* Remove every direct child of body from the layout. */
	body > * {
		display: none !important;
	}

	/* Show only the temporary print container. */
	body.ehng-print-mode .ehng-print-root {
		display: block !important;
		position: static !important;
		width: 100% !important;
		height: auto !important;
		min-height: 0 !important;
		margin: 0 !important;
		padding: 0 !important;
		background: #fff !important;
		overflow: visible !important;
	}

	body.ehng-print-mode .ehng-print-root .ehng-generator {
		display: block !important;
		position: static !important;
		width: 100% !important;
		max-width: none !important;
		min-height: 0 !important;
		height: auto !important;
		margin: 0 !important;
		padding: 0 !important;
		background: transparent !important;
		overflow: visible !important;
		box-shadow: none !important;
		transform: none !important;
	}

	/* A4 landscape with 10mm margins leaves 277mm x 190mm printable. */
	body.ehng-print-mode .ehng-print-area {
		display: block !important;
		width: 100% !important;
		max-width: 277mm !important;
		margin: 0 auto !important;
		padding: 0 !important;
		page-break-inside: avoid !important;
		break-inside: avoid-page !important;
	}

	/* The notice itself. */
	body.ehng-print-mode .ehng-print-area .ehng-obituary {
		display: flex !important;
		position: static !important;
		width: 100% !important;
		max-width: 277mm !important;
		height: auto !important;
		min-height: 170mm !important;
		max-height: none !important;
		aspect-ratio: auto !important;
		margin: 0 auto !important;
		padding: 12mm !important;
		box-shadow: none !important;
		transform: none !important;
		overflow: visible !important;
		background: #fff !important;
		color: #000 !important;
		direction: rtl !important;
		page-break-inside: avoid !important;
		break-inside: avoid-page !important;
		page-break-before: auto !important;
		page-break-after: auto !important;
		break-before: auto !important;
		break-after: auto !important;
		-webkit-print-color-adjust: exact !important;
		print-color-adjust: exact !important;
	}

	/* ---- Frames: thicker on paper, each style kept distinct ---- */

	/* Classic (default, no modifier class): heavy double rule. */
	body.ehng-print-mode .ehng-print-area .ehng-obituary {
		border: 6px double #222 !important;
	}

	/* Modern: single heavier olive rule. */
	body.ehng-print-mode .ehng-print-area .ehng-obituary.ehng-frame-modern {
		border: 4px solid #495030 !important;
	}

	/* Inner: clear double gold frame (inset shadows print unreliably). */
	body.ehng-print-mode .ehng-print-area .ehng-obituary.ehng-frame-soft {
		border: 3px solid #a99463 !important;
		outline: 2px solid #a99463 !important;
		outline-offset: -10px !important;
		box-shadow: none !important;
	}

	/* No frame: stays without a frame. */
	body.ehng-print-mode .ehng-print-area .ehng-obituary.ehng-frame-no-frame {
		border: 0 !important;
		outline: 0 !important;
	}

	/* Nothing inside the notice may clip, float or break across pages. */
	body.ehng-print-mode .ehng-print-area .ehng-obituary * {
		box-sizing: border-box !important;
		position: static !important;
		max-height: none !important;
		overflow: visible !important;
		transform: none !important;
		page-break-inside: avoid !important;
		break-inside: avoid-page !important;
		-webkit-print-color-adjust: exact !important;
		print-color-adjust: exact !important;
	}

	/* ---- Text: bolder and larger for paper ---- */

	/* Name. The size class is assigned by the script from the name length,
	   so a long name steps down instead of overflowing the frame. */
	body.ehng-print-mode .ehng-print-area .ehng-obituary-name {
		font-size: 42pt !important;
		line-height: 1.1 !important;
		font-weight: 700 !important;
	}

	body.ehng-print-mode .ehng-print-area .ehng-obituary-name.ehng-print-name-lg {
		font-size: 34pt !important;
	}

	body.ehng-print-mode .ehng-print-area .ehng-obituary-name.ehng-print-name-md {
		font-size: 27pt !important;
	}

	body.ehng-print-mode .ehng-print-area .ehng-obituary-name.ehng-print-name-sm {
		font-size: 21pt !important;
	}

	/* Opening line. */
	body.ehng-print-mode .ehng-print-area .ehng-obituary-kicker {
		font-size: 16pt !important;
		font-weight: 600 !important;
	}

	/* Name suffix and personal line share one element in this plugin. */
	body.ehng-print-mode .ehng-print-area .ehng-obituary-title {
		font-size: 16pt !important;
		font-weight: 600 !important;
	}

	/* Funeral / memorial details. */
	body.ehng-print-mode .ehng-print-area .ehng-obituary-text {
		font-size: 14pt !important;
		line-height: 1.8 !important;
		font-weight: 600 !important;
	}

	/* Family signature. */
	body.ehng-print-mode .ehng-print-area .ehng-family-list {
		font-size: 12pt !important;
		font-weight: 600 !important;
	}

	/* Family signature. */
	body.ehng-print-mode .ehng-print-area .ehng-obituary-bottom {
		font-size: 10pt !important;
		font-weight: 600 !important;
	}

	/* Anything explicitly marked as non-printable. */
	body.ehng-print-mode .ehng-no-print {
		display: none !important;
	}

	/* Plugin floating UI controls must never appear on paper. The clone-based
	   print already hides the original page, but these are called out
	   explicitly so the mobile preview FAB / panel can never leak into a
	   printout. display:none (not visibility:hidden) leaves no empty space. */
	.ehng-mobile-preview-toggle,
	.ehng-preview-panel,
	.ehng-close-preview {
		display: none !important;
	}
}
