/*
 * Burning Tree single resources: "Print This Page" button + print stylesheet.
 * D20 Digital, 2026-09-22. Enqueued on single resources only (hello-elementor-child/functions.php).
 *
 * Template 9187 (Resource Single) renders the Print This Page button (class print-button) directly after the
 * Download as PDF button (class download-button). The download button only renders when the resource has a
 * PDF (display condition: pdf_download is not empty), so the print button hides itself whenever the download
 * button is on the page. Pure CSS on purpose: 94 older resources have no pdf_download meta at all, and an
 * Elementor "is empty" condition treats a missing field as false, so a condition would hide the button there.
 */

/* ---------- Print This Page button (screen). Colors, type, radius and spacing live in the Elementor widget. ---------- */

body:not(.elementor-editor-active) #single-resource-sidebar .download-button ~ .print-button {
	display: none;
}

#single-resource-sidebar .print-button .elementor-button-icon svg {
	width: 20px;
}

@media (max-width: 1200px) {
	/* Existing layout bug, fixed while here: the desktop sidebar min-width (400px, style.css) survived the stacked
	   layout and made phones under about 440px lay the page out wider than the screen. */
	#single-resource-sidebar {
		min-width: 0;
	}

	/* The sidebar stacks above the article here. Match the compact dark download card, minus the thumbnail. */
	#single-resource-sidebar .print-button .elementor-button-wrapper,
	#single-resource-sidebar .print-button .elementor-button {
		width: 248px;
		max-width: 100%;
	}

	#single-resource-sidebar .print-button .elementor-button {
		display: flex;
		align-items: center;
		justify-content: space-between;
		border: none;
		padding: 14px 12px 14px 16px;
		background-image: linear-gradient(90deg, #51070F 0%, #8C000B 100%);
	}

	#single-resource-sidebar .print-button .elementor-button::after {
		content: '';
		display: block;
		flex: 0 0 28px;
		width: 28px;
		height: 28px;
		background: url(/wp-content/uploads/2026/04/circle-arrow-thin-light.svg) center center no-repeat;
		background-size: cover;
	}

	/* On resources without a PDF the table of contents used to be the first sidebar child. style.css sizes
	   "#single-resource-sidebar > div > div:nth-child(2)" as the download card, so keep the TOC full width. */
	#single-resource-sidebar > div > .print-button + .elementor-widget-table-of-contents {
		display: block;
		width: 100%;
		flex-basis: 100%;
		margin-top: 8px;
	}
}

@media (max-width: 500px) {
	/* Phones: full width, like the thumbnail + download card it replaces. */
	#single-resource-sidebar .print-button .elementor-button-wrapper,
	#single-resource-sidebar .print-button .elementor-button {
		width: 100%;
	}
}

/* ---------- Print ---------- */

@page {
	margin: 0.5in;
}

@media print {

	/* Site chrome: header and mobile nav, hero extras, sidebar, CTA band, chat, footer menus. */
	.elementor-location-header,
	.elementor-sticky__spacer,
	.skip-link,
	#hubspot-messages-iframe-container,
	.page-hero-2026 .hero-breadcrumbs,
	.page-hero-2026 .hero-read-more,
	#single-resource-sidebar,
	#resource-footer,
	#assessment,
	.elementor-location-footer #bt-footer-bottom,
	.elementor-location-footer .elementor-element-5b920bf,
	.elementor-location-footer .elementor-element-60087080,
	.elementor-location-footer .elementor-element-608f2270,
	.elementor-location-footer .elementor-widget-social-icons {
		display: none !important;
	}

	/* Entrance animations never fire for content that was not scrolled into view before printing. */
	body.single-resources .elementor-invisible {
		visibility: visible !important;
	}

	body.single-resources .animated {
		animation: none !important;
	}

	/* Everything reads left to right on paper. */
	body.single-resources,
	body.single-resources * {
		text-align: left !important;
	}

	body.single-resources .elementor-widget-post-info ul,
	body.single-resources .elementor-icon-list-items,
	body.single-resources .elementor-nav-menu {
		justify-content: flex-start !important;
	}

	body.single-resources .elementor-widget-post-info li {
		display: inline-block !important;
	}

	/* Links: keep the text, drop the printed URL (reset.css in the parent theme appends every href). */
	body.single-resources a[href]::after {
		content: none !important;
	}

	/* Hero: no full-height band, title block starts at the top of page one. */
	.page-hero-2026,
	.page-hero-2026 > .elementor-container,
	.page-hero-2026 .page-hero-inner-col,
	.page-hero-2026 .elementor-widget-wrap {
		height: auto !important;
		min-height: 0 !important;
	}

	.page-hero-2026 .page-hero-inner-col {
		margin: 0 !important;
	}

	.page-hero-2026 .elementor-widget-wrap,
	.page-hero-2026 .page-hero-inner-col-content {
		padding: 0 !important;
	}

	.page-hero-2026 {
		margin-bottom: 20px !important;
	}

	/* Article runs the full page width. */
	.single-resource-content-wrap {
		padding: 0 !important;
	}

	.single-resource-content-wrap > .elementor-container,
	#single-resource-content {
		width: 100% !important;
		max-width: 100% !important;
		gap: 0 !important;
	}

	/* Images: left aligned and sized for paper rather than the full column. */
	#single-resource-content .elementor-widget-image {
		text-align: left !important;
	}

	#single-resource-content .elementor-widget-image img {
		display: block !important;
		width: auto !important;
		max-width: 60% !important;
		height: auto !important;
		margin: 0 !important;
	}

	/* Boxes and quotes lose their fill in print, so give them a light rule instead. */
	#single-resource-content .info-box {
		border: 1px solid #bbb !important;
		border-radius: 8px !important;
	}

	#single-resource-content .elementor-widget-blockquote .elementor-widget-container {
		border-left: 3px solid #bbb !important;
		padding-left: 20px !important;
	}

	/* Page breaks */
	h1, h2, h3, h4 {
		break-after: avoid;
		page-break-after: avoid;
	}

	#single-resource-content .elementor-widget-image,
	#single-resource-content .info-box,
	#single-resource-content .elementor-widget-blockquote,
	#single-resource-content .elementor-icon-list-item {
		break-inside: avoid;
		page-break-inside: avoid;
	}

	/* Footer: only the Contact Burning Tree block stays. */
	.elementor-location-footer {
		margin-top: 32px !important;
		padding-top: 16px !important;
		border-top: 1px solid #bbb !important;
		break-inside: avoid;
		page-break-inside: avoid;
	}

	.elementor-location-footer .elementor-section,
	.elementor-location-footer .elementor-column,
	.elementor-location-footer .elementor-widget-wrap {
		padding: 0 !important;
		margin: 0 !important;
		min-height: 0 !important;
	}

	.elementor-location-footer .elementor-element-2d40fb82 {
		width: 100% !important;
	}

	.elementor-location-footer a {
		text-decoration: none !important;
	}
}
