/**
 * Print stylesheet for receipts, statements and reports.
 *
 * Black on white, no chrome, no colour. What comes out of the printer is filed
 * in a folder and read years later by an audit committee.
 */

/*
 * The paper is A4, and saying so is what makes the rest of this file mean
 * anything. Without it the page box is whatever the printer dialog last had,
 * so a sheet laid out to fit could still be laid out against the wrong width.
 * The margin is here rather than on the sheet: a margin belongs to the page,
 * and one set as padding on the element is not applied to the second page of a
 * report that runs over.
 */
/* Shared appearance on screen and on paper. */

.sot-print-sheet {
	background: #fff;
	/*
	 * Border-box, or the 14mm of margin the paper needs is added on top of a
	 * full-width sheet and the page is pushed sideways by exactly that much.
	 * The sheet also takes its own sideways scroll: the tables inside it are
	 * the shape of the paper, not the shape of a telephone, and nothing in a
	 * sheet is positioned outside it.
	 */
	box-sizing: border-box;
	color: #000;
	font-family: "DejaVu Serif", Georgia, "Times New Roman", serif;
	margin: 0 auto 20px;
	overflow-x: auto;
	padding: 14mm;
}

/*
 * On screen the sheet shows the shape of the paper, but a fixed 210mm is
 * 794px and a telephone is not, so the page was pushed sideways and the
 * navigation went with it. The width is a ceiling now; the print block above
 * sets width:auto, so what comes out of the printer is unchanged.
 */
.sot-print-sheet--a5 {
	border: 1px solid #c3c4c7;
	max-width: 148mm;
	min-height: 210mm;
	width: 100%;
}

.sot-print-sheet--a4 {
	border: 1px solid #c3c4c7;
	max-width: 210mm;
	width: 100%;
}

@media screen and ( max-width: 782px ) {
	.sot-print-sheet {
		padding: var( --wizspSpace4, 16px );
	}

	.sot-print-sheet--a5 {
		min-height: 0;
	}

	/* The header puts the lodge and the document side by side; not here. */
	.sot-print-head {
		display: block;
	}
}

.sot-print-head {
	align-items: center;
	border-bottom: 1.5pt solid #000;
	display: flex;
	gap: 12px;
	padding-bottom: 8px;
}

.sot-print-head h1 {
	font-size: 13pt;
	margin: 0 0 2px;
}

.sot-print-head p {
	font-size: 8.5pt;
	margin: 0;
}

/* The lodge's own name, under it and read with it, not with the address. */
.sot-print-head .sot-print-sub {
	font-size: 10pt;
	margin-bottom: 2px;
}

.sot-print-identity {
	min-width: 0;
}

/*
 * A ceiling, not a size. The emblem is drawn at whatever proportions it was
 * given and merely refused more than 60 pixels in either direction, so a wide
 * one is capped by its width and a tall one by its height, and neither is
 * stretched to fill a box. A small emblem stays small: enlarging a 48-pixel
 * image to 60 does not add detail to it, it only blurs what is there.
 *
 * Sixteen millimetres of paper. A crest at the head of a letter is read as a
 * mark of whose paper it is, not as an illustration, and on an A5 receipt
 * anything larger takes a fifth of the width from the figures.
 */
.sot-print-logo {
	flex: 0 0 auto;
}

.sot-print-logo img {
	display: block;
	height: auto;
	max-height: 60px;
	max-width: 60px;
	width: auto;
}

.sot-print-title {
	font-size: 12pt;
	font-weight: bold;
	letter-spacing: .04em;
	margin: 14px 0 4px;
	text-align: center;
}

.sot-print-meta {
	font-size: 9.5pt;
	margin-bottom: 12px;
	text-align: center;
}

/*
 * Laid out to the width of the paper rather than to the width of its contents.
 *
 * A table left to size itself asks each column for the narrowest it can bear
 * and, when those come to more than the page, simply exceeds it. On screen
 * that produces a scroll bar; on paper it produces a report with columns
 * missing. Fixed layout reverses the question: the table is the width of the
 * page, and the columns divide it. Long names wrap, which is what a printed
 * ledger has always done.
 *
 * The amounts are given a width of their own so they are not handed the same
 * share as a name, and they are the one thing that must never wrap: a figure
 * broken across two lines is a figure a reader has to reassemble.
 */
.sot-print-table {
	border-collapse: collapse;
	font-size: 9pt;
	table-layout: fixed;
	width: 100%;
}

.sot-print-table th,
.sot-print-table td {
	border-bottom: .5pt solid #666;
	overflow-wrap: anywhere;
	padding: 3px 4px;
	text-align: left;
}

/*
 * A share of the table rather than a measurement of it. Given in millimetres,
 * six columns of figures came to more than the page and a fixed-layout table
 * grows to hold the widths it is given — so the very rule meant to make the
 * report fit was what pushed it off the paper. A percentage cannot do that:
 * whatever is left over goes to the columns that carry words, which are the
 * ones that can wrap.
 */
.sot-print-table th.sot-amount,
.sot-print-table td.sot-amount {
	width: 13%;
}

/*
 * Headings in sentence case on paper, and not letter-spaced.
 *
 * The screen shouts them — small, spaced, uppercase — which reads as a label
 * there. Greek in capitals is a great deal wider than Greek in lower case, and
 * on a column of figures thirteen per cent of the page wide it was the width
 * that broke: ΕΙΣΠΡΑΧΘΗΚΑΝ came out as ΕΙΣΠΡΑΧΘΗ over ΚΑΝ, split inside the
 * word. A report a committee files for years should not be shouting at them
 * either.
 */
.sot-print-table thead th {
	border-bottom: 1pt solid #000;
	font-size: 8pt;
	font-weight: bold;
	letter-spacing: normal;
	overflow-wrap: break-word;
	text-transform: none;
}

.sot-print-table .sot-amount {
	font-variant-numeric: tabular-nums;
	text-align: right;
	white-space: nowrap;
}

/*
 * The heading of a column of figures wraps; the figures themselves never do.
 * A Greek label runs long — «Μήνες καθυστέρησης», «Υπόλοιπο αρχής» — and held
 * on one line it was the whole of what pushed these reports off the paper:
 * not one amount anywhere was too wide, only the words above them. A heading
 * on two lines is what a printed ledger has always looked like. A figure
 * broken across two lines is one the reader has to reassemble.
 */
.sot-print-table thead th.sot-amount {
	white-space: normal;
}

.sot-print-total td {
	border-top: 1pt solid #000;
	border-bottom: 0;
	font-weight: bold;
}

/*
 * A per-recipient subtotal above the grand total. Set in italic rather than
 * bold so the eye still lands on the total below it, and given a hairline
 * above so the group it closes is visible.
 */
.sot-print-subtotal td {
	border-bottom: 0;
	border-top: 0.5pt solid #000;
	font-style: italic;
}

.sot-print-amount-box {
	border: 1pt solid #000;
	font-size: 12pt;
	font-weight: bold;
	margin: 14px 0;
	padding: 8px 10px;
	text-align: right;
}

/*
 * The cancellation stamp. It used to borrow the amount box and centre itself
 * with an inline style, so the two read as one component while meaning
 * opposite things: one carries a figure, the other says the paper is void.
 */
.sot-print-void {
	border: 1pt solid #000;
	font-size: 12pt;
	font-weight: bold;
	letter-spacing: 0.08em;
	margin: 14px 0;
	padding: 8px 10px;
	text-align: center;
}

.sot-print-note {
	font-size: 9pt;
	margin-top: 10px;
}

.sot-signatures {
	display: flex;
	gap: 10mm;
	justify-content: space-between;
	margin-top: 22mm;
}

.sot-signatures div {
	border-top: .5pt solid #000;
	flex: 1;
	font-size: 9pt;
	padding-top: 4px;
	text-align: center;
}

.sot-print-footer {
	font-size: 8.5pt;
	margin-top: 10mm;
	text-align: center;
}

/*
 * Statement lines are inline text on paper. The screen stacks them, but a
 * printed table with a column of stacked lines throws every row's height out,
 * and the sheet has to be readable across the page rather than down one cell.
 */
.sot-print-sheet .sot-lines {
	display: block;
}

.sot-print-sheet .sot-line {
	display: inline;
	max-width: none;
}

.sot-print-sheet .sot-line + .sot-line::before {
	content: "; ";
}

.sot-print-sheet .sot-subnote {
	display: block;
	font-size: 8pt;
	font-style: italic;
}

/* The name of one account inside the journal of movements, above its own table. */
.sot-print-subtitle {
	margin: 18px 0 6px;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.02em;
	border-bottom: 1px solid #111;
	padding-bottom: 3px;
}

/*
 * An IBAN is one word. Wrapped, it puts a lone digit on a second line and the
 * brother who copies it into his banking app drops it: the statement is a
 * payment instruction, and a payment instruction that breaks in the middle is
 * worse than none.
 */
.sot-iban {
	white-space: nowrap;
}

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

@media print {
	body {
		background: #fff;
		color: #000;
		font-family: "DejaVu Serif", Georgia, "Times New Roman", serif;
		font-size: 11pt;
		margin: 0;
	}

	.sot-no-print,
	#adminmenumain,
	#wpadminbar,
	#wpfooter,
	.notice,
	.sot-actions {
		display: none !important;
	}

	/*
	 * The page's own margin is the only margin. The sheet's 14mm padding draws
	 * the shape of paper on screen and has no business on paper, where it is
	 * added to the margin the page box already has: 26mm each side, a fifth of
	 * an A4 thrown away, and every table squeezed into what was left. This
	 * block used to sit above the rule it overrides and lost to it on order
	 * alone, which is why it is at the foot of the file now.
	 */
	.wrap {
		margin: 0;
	}

	.sot-print-sheet {
		box-shadow: none;
		border: 0;
		margin: 0;
		padding: 0;

		/*
		 * Never a scroll bar on paper. The sheet takes its own sideways scroll
		 * on screen, which is right there and wrong here: paper does not
		 * scroll, so anything past the edge of the page is not shown elsewhere
		 * — it is silently cut off. Six of the twelve reports were losing
		 * their right-hand columns this way, the cash statement by a third of
		 * its width, and nothing on the printed page said so.
		 */
		overflow: visible;
	}

	/*
	 * A report takes the whole page; a receipt keeps the shape of an A5 slip
	 * even when it is run off on A4, which is how the lodge issues them. The
	 * width is set per sheet rather than on both, because releasing the cap on
	 * both would print a receipt the full width of the paper.
	 */
	.sot-print-sheet--a4 {
		max-width: none;
		width: auto;
	}

	.sot-print-sheet + .sot-print-sheet {
		page-break-before: always;
	}

	table {
		page-break-inside: auto;
	}

	tr {
		page-break-inside: avoid;
	}

	thead {
		display: table-header-group;
	}

	/*
	 * What must not be orphaned at the foot of a page. A signature block on a
	 * sheet of its own is a page the committee cannot read and cannot sign
	 * against anything; a heading with no rows under it is the same fault at
	 * the other end.
	 */
	.sot-signatures,
	.sot-print-total,
	.sot-print-amount-box,
	.sot-print-void {
		break-inside: avoid;
	}

	.sot-print-head,
	.sot-print-title,
	.sot-print-meta,
	.sot-print-subtitle {
		break-after: avoid;
	}
}

/*
 * A sheet with more than one section. Every other printed sheet is one table
 * under one title; the month's report is three — where the money was, what was
 * issued, what is left open — and without a heading between them a reader has
 * to work out where one ends. Kept small and lettered rather than large and
 * bold: the sheet already has a title, and a second thing shouting is a sheet
 * with two titles.
 */
.sot-print-heading {
	font-size: 10pt;
	font-weight: bold;
	letter-spacing: .04em;
	margin: 14px 0 6px;
	text-transform: uppercase;
}

.sot-print-list {
	font-size: 9.5pt;
	margin: 0;
	padding-left: 16px;
}

.sot-print-list li {
	margin-bottom: 4px;
}
