/*
 * Leaflet page template (page-leaflet.php)
 *
 * Lays a page out like a folded A4 leaflet: an A5 cover, the A4 inside
 * spread, and an A5 back page, all at the same scale. Positions are
 * percentages measured from the print PDF, so the layout scales with the
 * screen. Narrow screens stack the spread's two panels.
 *
 * Text uses Helvetica Neue, as in print. Visitors without it get Inter
 * (SIL Open Font License, see fonts/Inter-LICENSE.txt).
 */

@font-face {
	font-family: 'Inter Leaflet';
	src: url('fonts/inter-latin-300-normal.woff2') format('woff2');
	font-weight: 300;
	font-style: normal;
	font-display: swap;
}
@font-face {
	font-family: 'Inter Leaflet';
	src: url('fonts/inter-latin-700-normal.woff2') format('woff2');
	font-weight: 700;
	font-style: normal;
	font-display: swap;
}

/* Wider page area than the standard 650px text column. */
#page.leaflet-page {
	max-width: 1160px;
}

.leaflet {
	--lf-ink: #191a21;
	--lf-dark: #3c454d;
	container: leaflet / inline-size;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 48px;
	margin-bottom: 40px;
	font-family: 'Helvetica Neue', 'Inter Leaflet', Helvetica, Arial, sans-serif;
	font-weight: 300;
	letter-spacing: -0.012em;
	line-height: 1.45;
	color: var(--lf-ink);
}

.leaflet img {
	display: block;
	max-width: none;
}

.leaflet h2 {
	font: inherit;
	font-weight: 700;
	font-style: normal;
	line-height: 1.3;
	color: inherit;
	margin: 0 0 0.8em;
}

.leaflet p {
	text-align: justify;
	-webkit-hyphens: manual;
	hyphens: manual;
	margin: 0 0 0.5em;
}

.leaflet a {
	color: inherit;
	text-decoration: none;
}
.leaflet a:hover {
	text-decoration: underline;
}

.lf-visually-hidden {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

/* ---- Sheets: cover and back page (A5 portrait) ---- */

.lf-sheet,
.lf-spread {
	background: #fff;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), 0 4px 18px rgba(0, 0, 0, 0.08);
}

.lf-sheet {
	position: relative;
	width: 100%;
	max-width: 480px;
}

.lf-cover {
	aspect-ratio: 419.528 / 595.276;
	overflow: hidden;
}
.lf-cover-type {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
}
#content .lf-heavens,
.lf-heavens {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 23.385%;
	width: 53.06%;
	list-style: none;
	margin: 0;
	padding: 0;
}
.lf-heavens li {
	position: absolute;
	left: 0;
	width: 100%;
	margin: 0;
	overflow: hidden;
}
.lf-heavens img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.lf-back {
	display: flex;
	flex-direction: column;
}
.lf-score {
	width: 100%;
	height: auto;
}
.lf-back-footer {
	background: var(--lf-dark);
	color: #fff;
	padding: 1.1em 8.6% 1.3em;
	font-size: clamp(13px, 2.5cqi, 16px);
	line-height: 1.6;
}
.lf-back-footer p {
	text-align: left;
	margin: 0;
}
.lf-links {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 0 1em;
}

/* ---- Inside spread (A4 landscape: two A5 panels) ---- */

.lf-spread {
	width: 100%;
	display: grid;
	grid-template-columns: 1fr;
}

/* min-height keeps each panel at least A5 in shape (595.3 / 419.5);
   a panel grows taller if its text needs more room. */
.lf-panel {
	min-height: 141.9cqi;
	font-size: clamp(15px, 2.5cqi, 17px);
	overflow: hidden;
}
.lf-panel::after {
	content: "";
	display: table;
	clear: both;
}

/* Left panel: text wraps around the cut-out of Jonathan Harvey.
   Measurements from the PDF (in points, panel 419.5 wide): text column
   x 91 to 383, top 34; photo 237 wide from x 0, top 47. */
.lf-panel--light {
	background: #fff;
	padding: 8.1% 8.7% 0 21.7%;
}
.lf-harvey {
	float: left;
	width: 81.2%;
	height: auto;
	margin: 4.45% 0 0 -31.2%;
	shape-image-threshold: 0.3;
	shape-margin: 0.7em;
}

/* Right panel: white text on slate, studio photo bleeding off the left
   edge. Text x 36.5 to 383; photo 185 wide from x 0, top 38. */
.lf-panel--dark {
	background: var(--lf-dark);
	color: #fff;
	padding: 8.1% 8.7% 6%;
}
.lf-photo {
	float: left;
	width: 53.3%;
	height: auto;
	margin: 1.15% 2.8% 0.6em -10.5%;
}
.lf-panel--dark h2 {
	margin-top: 2.2em;
}

/* Wide enough for the spread side by side: show it at the same scale
   as the cover and back page. */
@container leaflet (min-width: 860px) {
	.lf-spread {
		grid-template-columns: 1fr 1fr;
	}
	.lf-sheet {
		width: 50%;
		max-width: none;
	}
	.lf-panel {
		min-height: 70.95cqi;
		font-size: clamp(13px, 1.23cqi, 16px);
	}
	.lf-back-footer {
		font-size: clamp(13px, 1.25cqi, 16px);
	}
}

/* Phones: not enough width to wrap text around the figures. The text
   runs full width; Jonathan Harvey moves to the foot of his panel and
   the studio photo goes full width above the text. */
@container leaflet (max-width: 519px) {
	.leaflet {
		gap: 32px;
	}
	.lf-panel {
		min-height: 0;
	}
	.lf-panel--light {
		display: flex;
		flex-direction: column;
		padding: 8% 7% 0;
	}
	.lf-harvey {
		order: 2;
		float: none;
		width: 62%;
		margin: 1em 0 0 -8.14%;
		shape-outside: none !important;
	}
	.lf-panel--dark {
		padding: 0 7% 8%;
	}
	.lf-photo {
		float: none;
		width: calc(100% / 0.86);
		margin: 0 0 1.4em -8.14%;
	}
	.lf-panel--dark h2 {
		margin-top: 1.6em;
	}
	.leaflet p {
		text-align: left;
	}
	.lf-back-footer br {
		display: none;
	}
}

@media print {
	.lf-sheet,
	.lf-spread {
		box-shadow: none;
		break-inside: avoid;
	}
}
