/* Print sheet. Standalone — the print view does not load the theme, so
   everything it needs is here. */

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

body.ar-print {
	font-family: Arial, "Segoe UI", sans-serif;
	font-size: 11pt;
	line-height: 1.45;
	color: #1a1a1a;
	background: #fff;
	margin: 0;
	padding: 0;
	direction: rtl;
}

/*
 * ⚠️ The masthead and the footer are FIXED, and the body is padded to clear
 * them. A fixed block is repeated by the browser on every printed page, which is
 * what puts the logo and the banner on page four without measuring anything —
 * the alternative is laying out the pages by hand in script, as the old board
 * had to.
 */
.ar-print-mark {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	text-align: center;
	padding-bottom: 6px;
	border-bottom: 1px solid #eee;
	background: #fff;
}

.ar-print-mark img {
	max-height: 1.5cm;
	max-width: 240px;
	object-fit: contain;
}

.ar-print-name {
	color: #0e7c8c;
	font-weight: 700;
	font-size: 13pt;
	text-decoration: none;
}

/* Room for the two fixed blocks, top and bottom. */
.ar-print-body {
	padding-top: 1.9cm;
	padding-bottom: 1.2cm;
}

.ar-print-meta {
	margin: 0 0 10px;
	padding-bottom: 6px;
	border-bottom: 1px solid #eee;
	font-size: 9pt;
	color: #666;
	text-align: center;
}

/* Said on the sheet itself, because the sheet is what gets carried around and
   the screen that explained it is long gone by then. */
.ar-print-capped {
	font-weight: bold;
}

.ar-print-empty {
	margin-top: 40px;
	font-size: 12pt;
	line-height: 1.8;
	text-align: center;
}

/* Table */

.ar-print-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 10pt;
}

.ar-print-table th,
.ar-print-table td {
	border: 1px solid #999;
	padding: 5px 7px;
	text-align: start;
}

.ar-print-table thead {
	display: table-header-group; /* repeat the header on every printed page */
}

.ar-print-table tr {
	page-break-inside: avoid;
}

/* Cards */

.ar-print-card {
	border: 1px solid #d7dde3;
	border-radius: 10px;
	padding: 10px 14px;
	margin-bottom: 10px;
	/* Never split across a page: half a listing on each side of a fold is a
	   telephone number nobody can dial. */
	page-break-inside: avoid;
	break-inside: avoid;
}

.ar-print-card h2 {
	margin: 0 0 4px;
	padding-bottom: 5px;
	border-bottom: 1px solid #e6eef2;
	font-size: 12.5pt;
	color: #0e7c8c;
}

/* The category heading on a grouped sheet. */
.ar-print-group {
	margin: 4px 0 8px;
	padding-bottom: 4px;
	border-bottom: 2px solid #0e7c8c;
	font-size: 13pt;
	color: #0e7c8c;
}

.ar-print-place {
	margin: 0 0 6px;
	font-size: 9.5pt;
	color: #555;
}

/* Name and telephone, once, at the top — the line someone rings from. */
.ar-print-contact {
	display: flex;
	flex-wrap: wrap;
	gap: 3px 18px;
	margin-bottom: 7px;
	font-size: 10pt;
	font-weight: 700;
}

/* Two columns of short facts; a long one takes the whole width. */
.ar-print-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 4px 18px;
}

.ar-print-f {
	font-size: 9.5pt;
	line-height: 1.4;
}

.ar-print-f.is-wide {
	grid-column: 1 / -1;
}

.ar-print-k { color: #667; font-weight: 600; }
.ar-print-v { color: #1a1a1a; }

.ar-print-images {
	display: flex;
	gap: 8px;
	margin-bottom: 10px;
}

.ar-print-images img {
	width: 30%;
	height: auto;
	border-radius: 4px;
}

.ar-print-phone {
	font-weight: 700;
	margin: 8px 0 0;
}

.ar-print-link {
	font-size: 9pt;
	opacity: .7;
	margin: 4px 0 0;
	word-break: break-all;
}

/* The footer: the administrator's note, the banner, and where it came from —
   repeated at the foot of every printed page (see the note on .ar-print-mark). */

.ar-print-foot {
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	background: #fff;
	text-align: center;
}

.ar-print-note {
	margin: 0 0 3px;
	font-size: 8.5pt;
	color: #666;
}

.ar-print-ad {
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	border-top: 1px solid #e0e0e0;
}

.ar-print-ad img {
	max-width: 100%;
	width: auto;
	object-fit: contain;
	display: block;
}

.ar-print-site {
	margin: 3px 0 0;
	font-size: 8pt;
	color: #aaa;
}

/* ---- Once the script has dealt the cards into pages ----
   Each page is a real A4 box carrying its own masthead, footer and number, so
   "עמוד 3 מתוך 7" can exist at all — no browser numbers pages from CSS. The
   fixed positioning above is dropped here, or it would print over them. */

body.is-paged .ar-print-mark,
body.is-paged .ar-print-foot {
	position: static;
	border: 0;
}

body.is-paged .ar-print-foot {
	border-top: 0;
}

.ar-print-page {
	position: relative;
	display: flex;
	flex-direction: column;
	height: calc(297mm - 24mm);
	overflow: hidden;
	page-break-after: always;
	break-after: page;
}

.ar-print-page:last-child {
	page-break-after: auto;
	break-after: auto;
}

/* The cards take the room left between the masthead and the footer, and the
   footer is pushed to the bottom of the sheet however few cards there are. */
.ar-print-page-body {
	flex: 1 1 auto;
	min-height: 0;
	overflow: hidden;
}

.ar-print-page .ar-print-foot {
	flex: 0 0 auto;
	margin-top: auto;
}

.ar-print-page .ar-print-mark {
	flex: 0 0 auto;
	border-bottom: 1px solid #eee;
}

.ar-print-num {
	margin: 3px 0 0;
	font-size: 8pt;
	color: #aaa;
	text-align: center;
}

@media screen {
	/* On screen the pages are shown as sheets, so what is about to print is
	   what is on the screen. */
	body.is-paged {
		background: #f0f2f5;
		padding: 12px 0;
	}

	.ar-print-page {
		width: 210mm;
		padding: 12mm;
		margin: 0 auto 12px;
		background: #fff;
		box-shadow: 0 1px 6px rgba(0, 0, 0, .15);
	}
}
