/*
 * Service and case study pages. Measurements from the Framer build at 1440 / 810 / 390.
 *
 * Service: breadcrumb, title and intro (72 / 54 / 36 above and below, 28 between); a split with
 * the hero image (720 square on desktop; full width 520 / 390 below 1200) and the description;
 * the editorial gallery; View selected works cards (140/160 padding); the enquiry section.
 *
 * Case study: cover image in the left half at window height (at least 720) with the text in the
 * right half; full width 520 / 390 below 1200. The same editorial gallery as the services,
 * previous / next, then the enquiry prompt.
 */

.single-service main.wp-block-group > *,
.single-case_study main.wp-block-group > * {
	margin-block: 0;
}

/* ---------- Service head ---------- */

.fh-service-head {
	padding-block: clamp(36px, min(19.2857px + 4.2857vw, 30.8571px + 2.8571vw), 72px);
}

.fh-service-head > * {
	margin-block: 0;
}

.fh-service-head > * + * {
	margin-block-start: 28px;
}

/* ---------- Split: image half + text half ---------- */

.fh-split {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
}

.fh-split > * {
	margin: 0 !important;
}

.fh-split__media {
	position: relative;
	height: 390px;
	overflow: hidden;
	background: var(--wp--preset--color--stone);
}

.fh-split__media .wp-block-post-featured-image {
	position: absolute;
	inset: 0;
	margin: 0;
}

.fh-split__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.fh-split__text {
	display: flex;
	align-items: center;
	box-sizing: border-box;
	padding: 56px calc(var(--wp--custom--outer) - var(--wp--custom--frame));
}

.fh-split__content {
	width: 100%;
	max-width: var(--fh-content-w);
	margin-inline: auto;
}

.fh-split__content > * {
	margin-block: 0;
}

.fh-split__content > * + * {
	margin-block-start: 28px;
}

/* Service description and its button. */
.single-service .fh-split__content .wp-block-post-content {
	font-size: var(--wp--preset--font-size--body-large);
	line-height: 1.55;
	letter-spacing: -0.005em;
}

.single-service .fh-split__content .wp-block-post-content > * {
	margin-block: 0;
}

.single-service .fh-split__content .wp-block-post-content > * + * {
	margin-block-start: 20px;
}

.single-service .fh-split__content > .wp-block-buttons {
	margin-block-start: 40px;
}

@media (min-width: 810px) {
	.fh-split__media {
		height: 520px;
	}
}

@media (min-width: 1200px) {
	/* A 20px gutter down the middle, like the gallery's halves below, so the photo's edge
	   lines up with the gallery's columns instead of running to the centre line. */
	.fh-split {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		column-gap: var(--wp--custom--frame);
	}

	.single-service .fh-split__media {
		height: auto;
		aspect-ratio: 1;
	}

	.single-case_study .fh-split {
		min-height: max(720px, 100svh);
	}

	.single-case_study .fh-split__media {
		height: auto;
		min-height: 100%;
	}

	.fh-split__text {
		padding: 64px 0;
	}

	.fh-split__content {
		width: 70%;
		max-width: none;
	}
}

/* Case study text. */
.single-case_study .fh-split__text {
	padding-block: 40px 48px;
}

@media (min-width: 810px) {
	.single-case_study .fh-split__text {
		padding-block: 48px 56px;
	}
}

@media (min-width: 1200px) {
	.single-case_study .fh-split__text {
		padding-block: 64px;
	}
}

.fh-scope,
.fh-year {
	color: var(--wp--preset--color--muted);
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.4;
}

.fh-summary {
	font-size: var(--wp--preset--font-size--body-large);
	line-height: 1.55;
	letter-spacing: -0.005em;
}

.fh-split__content > p:empty {
	display: none;
}

.single-case_study .fh-split__content .wp-block-post-content > * {
	margin-block: 0;
}

.single-case_study .fh-split__content .wp-block-post-content > * + * {
	margin-block-start: 20px;
}

/* ---------- Editorial gallery (services) ----------
 * Phone: two columns inside the content; edge-to-edge tiles run to the frame at 4:5,
 * large squares fill the content width, small squares sit two-up.
 * Tablet and desktop: a grid with an edge column each side and four content columns, so tiles
 * line up with the frame (20px in from the window), the centre line and the content edges.
 */

.fh-gallery--editorial {
	--fh-m: calc((100vw - 2 * var(--wp--custom--frame) - var(--fh-content-w)) / 2);
	display: grid;
	gap: 20px;
}

/* The same 20px gutter between the top photo and the gallery as between the gallery's photos. */
.single-service main.wp-block-group > .fh-gallery--editorial,
.single-case_study main.wp-block-group > .fh-gallery--editorial {
	margin-top: var(--wp--custom--frame);
}

/* Case studies: room before previous / next. */
.single-case_study main.wp-block-group > .fh-gallery--editorial {
	margin-bottom: var(--wp--preset--spacing--section-96);
}

.fh-g {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 20px;
	padding-inline: var(--fh-m);
}

.fh-g__tile {
	position: relative;
	margin: 0;
	overflow: hidden;
	background: var(--wp--preset--color--image-placeholder);
}

/* The photo never sizes its tile: tiles take their size from the layout. */
.fh-g__tile img {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.fh-g__tile.is-bleed,
.fh-g__tile[class*="is-half"],
.fh-g__tile[class*="is-tall"] {
	grid-column: 1 / -1;
	margin-inline: calc(-1 * var(--fh-m));
	height: min((100vw - 2 * var(--wp--custom--frame)) * 1.25, 100svh); /* 4:5, never taller than the window */
}

/* An upright photo in a full-width slot: shown whole, at its own shape. */
.fh-g__tile.is-bleed.is-upright {
	height: auto;
	aspect-ratio: var(--fh-ratio);
}

.fh-g__tile[class*="is-big"],
.fh-g__tile.is-third.is-first {
	grid-column: 1 / -1;
	aspect-ratio: 1;
}

.fh-g__tile.is-small,
.fh-g__tile.is-third {
	aspect-ratio: 1;
}

@media (min-width: 810px) {
	.fh-g {
		grid-template-columns: [full-start] calc(var(--fh-m) - 20px) [content-start] repeat(4, minmax(0, 1fr)) [content-end] calc(var(--fh-m) - 20px) [full-end];
		padding-inline: 0;
	}

	.fh-g .fh-g__tile {
		margin-inline: 0 !important;
	}

	.fh-g__tile.is-bleed {
		grid-column: full-start / full-end;
	}

	/* …centred, and as tall as fits on screen below the header. */
	.fh-g__tile.is-bleed.is-upright {
		justify-self: center;
		width: auto;
		height: calc(100svh - var(--wp--custom--header-height) - 40px);
	}

	.fh-g__tile[class*="is-half"] {
		height: auto;
		aspect-ratio: 4 / 5;
	}

	.fh-g__tile.is-half-left,
	.fh-g__tile.is-tall-left {
		grid-column: 1 / 4;
	}

	.fh-g__tile.is-half-right,
	.fh-g__tile.is-tall-right {
		grid-column: 4 / 7;
	}

	.fh-g__tile.is-big-left {
		grid-column: 2 / 4;
	}

	.fh-g__tile.is-big-right {
		grid-column: 4 / 6;
	}

	.fh-g__tile[class*="is-tall"] {
		grid-row: span 2;
		height: auto;
		min-height: calc((50vw - var(--wp--custom--frame) - 10px) * 1.25);
	}

	.fh-g__tile.is-small {
		grid-column: span 1;
	}

	/* Small squares fill the content columns on the side away from the tall tile. */
	.fh-g--stack-l .is-small:nth-child(3),
	.fh-g--quad-l .is-small:nth-child(2),
	.fh-g--quad-l .is-small:nth-child(4) {
		grid-column: 4 / 5;
	}

	.fh-g--stack-l .is-small:nth-child(4),
	.fh-g--quad-l .is-small:nth-child(3),
	.fh-g--quad-l .is-small:nth-child(5) {
		grid-column: 5 / 6;
	}

	.fh-g--stack-r .is-small:nth-child(3),
	.fh-g--quad-r .is-small:nth-child(1),
	.fh-g--quad-r .is-small:nth-child(3) {
		grid-column: 2 / 3;
	}

	.fh-g--stack-r .is-small:nth-child(4),
	.fh-g--quad-r .is-small:nth-child(2),
	.fh-g--quad-r .is-small:nth-child(4) {
		grid-column: 3 / 4;
	}

	.fh-g--stack-r .is-tall-right,
	.fh-g--quad-r .is-tall-right {
		grid-row: 1 / span 2;
	}

	/* Three equal squares across the content. */
	.fh-g--trio {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		padding-inline: var(--fh-m);
	}

	.fh-g__tile.is-third,
	.fh-g__tile.is-third.is-first {
		grid-column: auto;
	}
}

@media (min-width: 1200px) {
	.fh-g__tile[class*="is-tall"] {
		min-height: 0;
	}
}

/* ---------- View selected works (service) ---------- */

.fh-works {
	padding-top: var(--wp--preset--spacing--section-140);
	padding-bottom: var(--wp--preset--spacing--section-160);
}

.fh-works .fh-project-list__heading {
	margin: 0 0 40px;
}

/* ---------- Case study: previous / next, enquiry prompt ---------- */

.fh-case-nav {
	display: flex;
	line-height: 1.3;
	justify-content: space-between;
	box-sizing: border-box;
	width: var(--fh-content-w);
	max-width: none !important;
	margin-inline: auto !important;
	padding-block: clamp(20px, min(10.7143px + 2.381vw, 17.1429px + 1.5873vw), 40px);
}


