/* RRJ Page Template (rrj-helper). Basic layout only, the styling team may restyle. */

/* Gap above the footer, whatever the last item is (the theme's 88px only applies to a last <p>). */
.rrj-page-template {
	padding-bottom: clamp(3rem, 6vw, 5.5rem);
}

.rrj-page-template__intro {
	font-size: 1.125em;
}

.rrj-page-template__video,
.rrj-page-template-image {
	margin: 2rem 0;
}

.rrj-page-template__video iframe {
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
}

.rrj-page-template-image img {
	display: block;
	max-width: 100%;
	height: auto;
}

/* Placement: Left (default) keeps the image at its own size; Wide stretches it (width set below, like .rrj-split). */
.rrj-page-template-image--center img {
	margin-inline: auto;
}

.rrj-page-template-image--right img {
	margin-left: auto;
}

.rrj-page-template-image--wide img {
	width: 100%;
}

.rrj-page-template-image--center figcaption {
	text-align: center;
}

.rrj-page-template-image--right figcaption {
	text-align: right;
}

.rrj-page-template-image figcaption {
	margin-top: 0.5rem;
	font-size: 0.875em;
}

.rrj-page-template-image__credit {
	opacity: 0.7;
}

/* Attachment card: tighter than the theme module spacing (up to 7rem), it sits right under its heading. */
.rrj-attachment.rrj-module {
	margin-block: 1rem 2rem;
	padding: clamp(1.25rem, 3vw, 2rem);
	align-items: flex-start;
}

.rrj-attachment__files {
	margin: 0;
	padding: 0;
	list-style: none;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.rrj-attachment__size {
	font-size: 0.875em;
}

.rrj-card-grid {
	display: grid;
	gap: 1.5rem;
	margin: 2rem 0;
}

@media (min-width: 640px) {
	.rrj-card-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

.rrj-card img {
	display: block;
	width: 100%;
	height: auto;
	/* Same box for every card image, whatever the upload size; the image is cropped to fit. */
	aspect-ratio: 16 / 9;
	object-fit: cover;
}

/* Text shows on hover or keyboard focus; always visible on touch screens. */
.rrj-card__text {
	max-height: 0;
	overflow: hidden;
	opacity: 0;
	transition: opacity 0.2s, max-height 0.2s;
}

.rrj-card:hover .rrj-card__text,
.rrj-card:focus-within .rrj-card__text {
	max-height: 40em;
	opacity: 1;
}

@media (hover: none) {
	.rrj-card__text {
		max-height: none;
		opacity: 1;
	}
}

/* Side-by-side section ([rrj_section]): image or video and text, half each.
 * The image fills the height of the text next to it (cropped), like Media & Text "Crop image to fill". */
.rrj-split {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: clamp(1.5rem, 4vw, 3rem);
	margin: 2rem 0;
}

.rrj-split--media-right .rrj-split__media {
	order: 2;
}

.rrj-split__media {
	position: relative;
	min-height: 300px;
}

.rrj-split__media img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.rrj-split__text {
	align-self: center;
}

.rrj-split__text > :first-child {
	margin-top: 0;
}

.rrj-split__text > :last-child {
	margin-bottom: 0;
}

/* Video: 16:9 at the column width, centred against the text. */
.rrj-split--video .rrj-split__media {
	min-height: 0;
	align-self: center;
}

.rrj-split__media iframe {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
}

/* Image height 75%: the image box at 75% of the text height, centred (e.g. a wide GIF next to long text). */
.rrj-split--image-75 .rrj-split__media img {
	top: 12.5%;
	height: 75%;
}

/* Only media or only text: that part alone, the image at its own proportions. */
.rrj-split--single {
	grid-template-columns: 1fr;
}

.rrj-split--single .rrj-split__media {
	min-height: 0;
}

.rrj-split--single .rrj-split__media img {
	position: static;
	height: auto;
}

@media (max-width: 700px) {
	.rrj-split {
		grid-template-columns: 1fr;
	}

	/* Stacked: media first, the image at a fixed shape instead of the text height. */
	.rrj-split--media-right .rrj-split__media {
		order: 0;
	}

	.rrj-split:not(.rrj-split--video):not(.rrj-split--single) .rrj-split__media {
		min-height: 0;
		aspect-ratio: 4 / 3;
	}

	.rrj-split--image-75 .rrj-split__media img {
		top: 0;
		height: 100%;
	}
}

/* Contact cards ([rrj_contact]): up to 3 in a row. */
.rrj-contact-cards {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: 1.5rem;
	margin: 2.5rem 0;
}

.rrj-contact-cards--one-per-row {
	grid-template-columns: 1fr;
}

.rrj-contact-card {
	padding: 1.5rem;
	border: 1px solid rgba(43, 33, 29, 0.22);
	border-radius: 8px;
}

.rrj-contact-card > :last-child {
	margin-bottom: 0;
}

.rrj-contact-card__title {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin: 0 0 0.5rem;
	color: var(--burgundy, #8e191c);
}

.rrj-contact-card__icon {
	flex: 0 0 auto;
}

.rrj-contact-card__subcontent {
	margin: 0.5rem 0 0;
	font-size: 0.875em;
	opacity: 0.8;
}

.rrj-contact-card__content {
	margin: 0;
}

.rrj-contact-card__content a {
	overflow-wrap: anywhere;
}

/* Full-width layout (alignfull): pages with Full-width hero or colour band.
 * Hero and band go edge to edge, sections use the wide column, the rest the text column. */
.rrj-full-layout {
	width: 100%;
}

.rrj-full-layout > :not(.rrj-cover):not(.rrj-band):not(.rrj-split):not(.rrj-page-template-image--wide) {
	max-width: 820px;
	width: calc(100% - (var(--site-gutter, 24px) * 2));
	margin-inline: auto;
}

.rrj-full-layout > :last-child {
	margin-bottom: 0;
}

.rrj-full-layout > :is(.rrj-split, .rrj-page-template-image--wide) {
	max-width: var(--site-container, 1200px);
	width: calc(100% - (var(--site-gutter, 24px) * 2));
	margin: 2.5rem auto;
}

/* Side-by-side and Wide images use the wide column in a page without full width hero. */
.rrj-page-template:not(.rrj-full-layout) > :is(.rrj-split, .rrj-page-template-image--wide) {
	--rrj-wide: min(var(--site-container, 1200px), 100vw - (var(--site-gutter, 24px) * 2));
	width: var(--rrj-wide);
	margin: 2.5rem calc((100% - var(--rrj-wide)) / 2);
}

/* Hero, band and the section right after the band touch, like the old cover blocks. */
.rrj-full-layout > :is(.rrj-cover, .rrj-band),
.rrj-full-layout > .rrj-band + .rrj-split {
	margin-top: 0;
	margin-bottom: 0;
}

/* Text of hero and band starts at the same left edge as the sections (wide column), hero lines kept to 820px. */
.rrj-cover__text,
.rrj-band > * {
	box-sizing: border-box;
	max-width: var(--site-container, 1200px);
	width: calc(100% - (var(--site-gutter, 24px) * 2));
	margin-inline: auto;
}

.rrj-cover__text > * {
	max-width: 820px;
}

/* Hero: the Featured image fills the block, text on top under a light overlay (the old cover's #a7a5a6 at 50%). */
.rrj-cover {
	position: relative;
	display: flex;
	align-items: center;
	min-height: 430px;
	padding-block: clamp(3rem, 8vw, 6rem);
	overflow: hidden;
	color: var(--ink, #3b3a3a);
	font-size: 1.125em;
}

.rrj-cover > img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.rrj-cover::before {
	content: "";
	position: absolute;
	inset: 0;
	background: rgba(167, 165, 166, 0.5);
}

.rrj-cover--text-only {
	min-height: 0;
}

.rrj-cover--text-only::before {
	content: none;
}

.rrj-cover__text {
	position: relative; /* Above the image and overlay. */
	color: var(--rrj-hero-fg, inherit); /* "Hero text colour", set per page. */
}

.rrj-cover__text a {
	color: inherit;
}

/* "Dark box behind hero text": white text unless a colour is picked. */
.rrj-cover--box::before {
	content: none;
}

.rrj-cover--box .rrj-cover__text {
	padding: clamp(1rem, 3vw, 1.5rem) clamp(1.25rem, 4vw, 2.5rem);
	background: rgba(40, 38, 38, 0.42);
	color: var(--rrj-hero-fg, #fff);
}

.rrj-cover__text > :first-child,
.rrj-band__text > :first-child {
	margin-top: 0;
}

.rrj-cover__text > :last-child,
.rrj-band__text > :last-child {
	margin-bottom: 0;
}

/* Colour band: colour set per page (--rrj-band-bg / --rrj-band-fg). */
.rrj-band {
	padding-block: clamp(1rem, 2.5vw, 1.5rem);
	background: var(--rrj-band-bg, var(--burgundy, #8e191c));
	color: var(--rrj-band-fg, #fff);
	font-size: 1.125em;
}

.rrj-band > p {
	margin-top: 0;
	margin-bottom: 0;
}

/* Links in the band use the band text colour, so they stay readable on any band colour. */
.rrj-band a {
	color: inherit;
}

@media (max-width: 700px) {
	.rrj-cover {
		min-height: 320px;
	}
}
