/**
 * Young Achievers School Calendar — print styles.
 *
 * Loaded with media="print". Two modes:
 *
 * 1. The visitor uses the calendar's own Print button, which adds
 *    `.yaesc-printing` to <body> and `.yaesc-print-target` to that calendar.
 *    Everything except that calendar is hidden.
 * 2. The visitor uses the browser's own print command, in which case the
 *    calendar simply prints cleanly in place.
 */

@page {
	margin: 12mm;
	size: landscape;
}

/* -------------------------------------------------------------------------
 * Isolate the calendar when printing from the plugin's own button
 * ---------------------------------------------------------------------- */

body.yaesc-printing > * {
	display: none !important;
}

/* Walk the ancestor chain of the printing calendar back into view. */
body.yaesc-printing .yaesc-print-target,
body.yaesc-printing .yaesc-print-target * {
	visibility: visible;
}

body.yaesc-printing {
	background: #fff !important;
}

/* Re-show only the branch that contains the target calendar. */
body.yaesc-printing .yaesc-print-target {
	display: block !important;
	left: 0;
	position: absolute;
	top: 0;
	width: 100%;
}

/* Common theme chrome, including Enfold's, is removed from the printed page. */
@media print {
	#header,
	#main > .title_container,
	#footer,
	#socket,
	.av-frame,
	.avia-menu,
	#advanced_menu_toggle,
	#advanced_menu_hide,
	#scroll-top-link,
	.av-burger-menu-main,
	header.av_header_transparency,
	nav,
	aside,
	.sidebar,
	.widget,
	.comments-area,
	.site-header,
	.site-footer,
	.wp-block-navigation,
	#wpadminbar {
		display: none !important;
	}

	/* Plugin controls are interactive only; they are never printed. */
	.yaesc-cal__nav,
	.yaesc-cal__actions,
	.yaesc-modal,
	.yaesc-day__more,
	.yaesc-agenda {
		display: none !important;
	}

	body {
		background: #fff !important;
	}

	.yaesc-calendar {
		margin: 0 !important;
		max-width: 100% !important;
		width: 100% !important;
	}

	.yaesc-cal {
		background: #fff !important;
		border: 0 !important;
		border-radius: 0 !important;
		box-shadow: none !important;
		padding: 0 !important;
	}

	.yaesc-cal__header {
		border-bottom: 2px solid #31364e;
		margin-bottom: 10pt;
		padding-bottom: 6pt;
	}

	.yaesc-cal__month {
		font-size: 22pt !important;
	}

	.yaesc-cal__logo {
		max-height: 48pt !important;
	}

	/* The agenda is a screen-only affordance; the grid is what gets printed. */
	.yaesc-grid-wrap {
		display: block !important;
		overflow: visible !important;
	}

	.yaesc-grid {
		border-spacing: 2pt !important;
		page-break-inside: auto;
		table-layout: fixed !important;
		width: 100% !important;
	}

	/* Keep a whole week together rather than splitting a row across pages. */
	.yaesc-grid__week,
	.yaesc-grid__focus-row {
		break-inside: avoid;
		page-break-inside: avoid;
	}

	.yaesc-grid__weekday {
		font-size: 8pt !important;
		padding: 2pt !important;
	}

	.yaesc-day {
		border: 0.75pt solid #c9cdd8 !important;
		height: auto !important;
		min-height: 64pt;
		padding: 3pt !important;
	}

	.yaesc-day__number {
		font-size: 10pt !important;
	}

	.yaesc-event {
		font-size: 7pt !important;
		padding: 1.5pt 2.5pt !important;
	}

	.yaesc-event__type {
		font-size: 6pt !important;
	}

	/* Closed dates must stay red on paper. */
	.yaesc-day.is-closed {
		background: #fdeceb !important;
		border-color: #d92d20 !important;
	}

	.yaesc-day__closed,
	.yaesc-agenda__closed {
		background: #d92d20 !important;
		color: #fff !important;
	}

	.yaesc-day.is-closed .yaesc-day__number {
		color: #d92d20 !important;
	}

	.yaesc-week-focus {
		font-size: 8pt !important;
		padding: 2pt 8pt !important;
	}

	.yaesc-focus {
		break-inside: avoid;
		page-break-inside: avoid;
	}

	/* Force browsers to print background colours so the colour coding survives. */
	.yaesc-calendar,
	.yaesc-calendar * {
		-webkit-print-color-adjust: exact !important;
		print-color-adjust: exact !important;
	}

	/* "Today" highlighting is meaningless on paper. */
	.yaesc-day.is-today {
		box-shadow: none !important;
	}
}
