/*
 * Home page. Measurements from the Framer build at 1440 / 810 / 390:
 * hero = window height minus the header (812 / 992 / 780 at 900 / 1080 / 844 high), title centred
 * with 88px kept clear below, 20% overlay; caption 40 / 30 / 20 below, right half from 810;
 * latest projects 120/160 → 90/120 → 60/80 padding, heading row → strip 48;
 * commissions two squares on desktop, the same size as the enquiry section, photo behind
 * with 58% overlay below 1200; a 20px gap before the enquiry section.
 */

/* Sections sit flush; each sets its own spacing. */
.home main.wp-block-group > *,
.home .wp-block-post-content > * {
	margin-block: 0;
}

/* ---------- Hero ---------- */

/* The first screen holds the hero and the 20px frame below it, so it reads as framed all round. */
.home-hero__media.wp-block-cover {
	min-height: calc(100svh - var(--wp--custom--header-height) - var(--wp--custom--frame));
	padding: 0 7.5vw 88px;
	background: var(--wp--preset--color--stone);
}

.home-hero__media .wp-block-cover__inner-container {
	width: 100%;
}

.home-hero__media h1 {
	margin: 0;
	color: var(--wp--preset--color--white);
	font-size: var(--wp--preset--font-size--hero-title);
	line-height: 1.05;
	letter-spacing: -0.03em;
	text-align: center;
	text-wrap: balance;
	animation: fh-hero-in 0.9s var(--fh-ease) 0.1s both;
}

/* "Light photo" style (pale photos): no shade, Ink title. */
.home-hero__media.is-style-light-photo .wp-block-cover__background {
	opacity: 0 !important;
}

.home-hero__media.is-style-light-photo h1 {
	color: var(--wp--preset--color--ink);
}

/* Upright screens use the portrait photo; keep its lower half (where the work usually is) in view. */
.home-hero__media picture img {
	object-position: 50% 80%;
}

/* Title painted in letter by letter (assets/js/hero-title.js), first Home visit of a session
   only: each letter wipes in from the left, 14ms after the one before, about 0.8s for the whole
   line. Until the script has run the title waits hidden, and shows anyway after 2s. */
.fh-js .home-hero__media h1:not(.is-split) {
	opacity: 0;
	animation: fh-show 0s 2s forwards;
}

@keyframes fh-show {
	to {
		opacity: 1;
	}
}

.home-hero__media h1.is-split {
	animation: none;
}

.home-hero__media .fh-word {
	display: inline-block;
	white-space: nowrap;
}

.home-hero__media .fh-char {
	display: inline-block;
	clip-path: inset(-0.2em calc(100% + 0.1em) -0.3em -0.1em); /* nothing showing, serifs included */
	animation: fh-paint-in 0.25s var(--fh-wipe) forwards;
	animation-delay: calc(var(--i) * 14ms + 60ms);
}

@keyframes fh-paint-in {
	to {
		clip-path: inset(-0.2em -0.1em -0.3em -0.1em);
	}
}

@keyframes fh-hero-in {
	from {
		opacity: 0;
		transform: translateY(12px);
	}
}

/* Wide screens (the landscape photo): the title sits in the left part of the photo, lined up
   with the page content and wrapping over a few lines, so it stays clear of the work on the right. */
@media (min-width: 810px) and (orientation: landscape) {
	.home-hero__media.wp-block-cover {
		padding-inline: calc(var(--wp--custom--outer) - var(--wp--custom--frame));
	}

	.home-hero__media h1 {
		max-width: 44% !important;
		margin-left: 0 !important;
		text-align: left;
	}
}

.is-layout-constrained > .home-hero__caption {
	margin: 0 !important;
	padding-top: clamp(20px, min(10.7143px + 2.381vw, 17.1429px + 1.5873vw), 40px);
}

@media (min-width: 810px) {
	.is-layout-constrained > .home-hero__caption {
		box-sizing: border-box;
		max-width: calc(var(--fh-content-w) / 2);
		margin-left: auto !important;
		margin-right: calc((100% - var(--fh-content-w)) / 2) !important;
	}
}

/* ---------- Latest projects ---------- */

.home-projects {
	padding-top: var(--wp--preset--spacing--section-120);
	padding-bottom: var(--wp--preset--spacing--section-160);
}

.home-projects__head {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.home-projects__head > * {
	margin: 0 !important;
}

.home-projects__all {
	align-self: flex-end;
}

@media (min-width: 810px) {
	.home-projects__head {
		flex-direction: row;
		align-items: flex-end;
		justify-content: space-between;
	}
}

.home-projects .fh-project-list.is-strip {
	margin-top: 48px;
}

/* ---------- How commissions work ---------- */

.home-commissions.wp-block-cover {
	min-height: 0;
	padding: var(--wp--preset--spacing--section-96) var(--wp--custom--outer);
	background: var(--wp--preset--color--stone);
	color: var(--wp--preset--color--white);
}

.home-commissions__steps > * {
	margin: 0;
}

.home-commissions__steps h2 {
	color: inherit;
}

.home-commissions__steps h2 + .home-step,
.home-commissions__steps .home-step + .wp-block-buttons {
	margin-top: 36px;
}

.home-commissions__steps .home-step + .home-step {
	margin-top: 32px;
}

.home-step > * {
	margin: 0;
}

.home-step h3 {
	color: inherit;
}

.home-step p {
	margin-top: 6px;
	color: var(--wp--preset--color--white-soft);
}

/* On the photo (phone, tablet) the button is the light version. */
@media (max-width: 1199.98px) {
	.home-commissions .wp-block-button__link {
		--fh-btn-bg: var(--wp--preset--color--paper);
		--fh-btn-fg: var(--wp--preset--color--ink);
		--fh-btn-line: var(--wp--preset--color--paper);
	}
}

@media (min-width: 810px) {
	.home-commissions.wp-block-cover {
		padding: var(--wp--preset--spacing--section-96) 0;
	}

	.home-commissions .wp-block-cover__inner-container {
		width: 80%;
	}
}

/* Desktop: photo in the left half, steps on Paper in the right half. */
@media (min-width: 1200px) {
	/* Two squares, the same size as the enquiry section below (690 x 690 at 1440). The photo stops
	   10px short of the centre line; the enquiry photo starts 10px past it, so the gap between
	   them is 20px, the same as the frame round the outside. */
	.home-commissions.wp-block-cover {
		justify-content: flex-end;
		min-height: calc(50vw - 1.5 * var(--wp--custom--frame));
		margin-bottom: var(--wp--custom--frame);
		padding: 40px 0;
		background: linear-gradient(90deg, var(--wp--preset--color--stone) calc(50% - var(--wp--custom--frame) / 2), var(--wp--preset--color--paper) calc(50% - var(--wp--custom--frame) / 2));
		color: var(--wp--preset--color--ink);
	}

	.wp-block-cover.home-commissions .wp-block-cover__image-background {
		right: auto;
		width: calc(50% - var(--wp--custom--frame) / 2);
	}

	.home-commissions .wp-block-cover__background {
		display: none;
	}

	.home-commissions .wp-block-cover__inner-container {
		display: flex;
		justify-content: center;
		width: 50%;
	}

	.home-commissions__steps {
		width: 70%;
	}

	.home-step p {
		color: var(--wp--preset--color--muted);
	}
}

@media (prefers-reduced-motion: reduce) {
	.home-hero__media h1,
	.fh-js .home-hero__media h1:not(.is-split) {
		opacity: 1;
		animation: none;
	}

	.home-hero__media .fh-char {
		clip-path: none;
		animation: none;
	}
}

/* ---------- Phones: one section per screen ----------
 * The hero, latest projects, commissions, the enquiry form and its photo each take a full
 * screen below the header (photos less the 20px frame below them), content centred, so the
 * page breathes instead of stacking tightly. Tablet and desktop are unchanged.
 */
@media (max-width: 809.98px) {
	.home-hero__media h1 {
		letter-spacing: -0.015em;
	}

	.is-layout-constrained > .home-hero__caption {
		padding-top: 40px;
	}

	.home-projects {
		box-sizing: border-box;
		display: flex;
		flex-direction: column;
		justify-content: center;
		min-height: calc(100svh - var(--wp--custom--header-height));
	}

	.home-projects > * {
		width: 100%;
	}

	.home-commissions.wp-block-cover {
		min-height: calc(100svh - var(--wp--custom--header-height) - var(--wp--custom--frame));
		margin-bottom: var(--wp--custom--frame);
	}

	.home .fh-enquiry > .wp-block-cover__inner-container {
		display: flex;
		flex-direction: column;
		justify-content: center;
		min-height: calc(100svh - var(--wp--custom--header-height));
	}

	.home .fh-enquiry > .wp-block-cover__inner-container > * {
		width: 100%;
	}

	.wp-block-cover.home .fh-enquiry .wp-block-cover__image-background,
	.home .wp-block-cover.fh-enquiry .wp-block-cover__image-background,
	.home .fh-enquiry::after {
		height: calc(100svh - var(--wp--custom--header-height) - var(--wp--custom--frame));
	}
}
