/*
 * Services index and Case Studies archive. Measured from the Framer build at 1440 / 810 / 390.
 *
 * Services, cards: one full-window card per service (Charcoal behind the photo, 28% shade,
 * 20px top corners), stacking as you scroll with 480px (360 on phone) of dwell before the next
 * slides over. The first card starts under the header, as on Framer. Title (Hero size) starts at
 * the card's midline, then "View work →", 20px below. No description: the photos carry it.
 * Services, list: rows of titles, 1px Ink lines between them.
 * "Toggle view" sits at the top of the services, 21px below the header (16 on phone), at the
 * content's right edge, in the same place in both views. It scrolls away with the page rather
 * than sticking under the header. White over the cards, Ink over the list.
 */

.fh-page--services main.wp-block-group > *,
.fh-page--services .wp-block-post-content > *,
.post-type-archive-case_study main.wp-block-group > * {
	margin-block: 0;
}

/* ---------- Toggle ---------- */

/* flow-root keeps the cards' pull-up under the header from moving the services box itself,
   so the toggle is measured from the same top in both views. */
.fh-services {
	position: relative;
	display: flow-root;
}

.fh-services__bar {
	position: absolute;
	z-index: 5;
	top: 0;
	left: 0;
	right: 0;
	height: 0;
}

.fh-services__toggle {
	position: absolute;
	top: 16px;
	right: max(20px, (100% - var(--fh-content-w)) / 2);
	padding: 6px 0;
	border: 0;
	background: none;
	color: var(--wp--preset--color--white);
	font-family: var(--wp--preset--font-family--helvetica-neue);
	font-size: var(--wp--preset--font-size--body);
	line-height: 1.3;
	cursor: pointer;
	background-image: linear-gradient(currentColor, currentColor);
	background-repeat: no-repeat;
	background-size: 0% 1px;
	background-position: 100% calc(100% - 3px);
	transition: background-size 0.45s var(--fh-ease);
}

@media (min-width: 810px) {
	.fh-services__toggle {
		top: 21px;
	}
}

@media (hover: hover) {
	.fh-services__toggle:hover {
		background-size: 100% 1px;
		background-position: 0 calc(100% - 3px);
	}
}

.fh-services[data-view="rows"] .fh-services__toggle {
	color: var(--wp--preset--color--ink);
}

.fh-services__toggle:focus-visible {
	outline-color: currentColor;
}

/* ---------- Cards ---------- */

.fh-svc-cards,
.fh-svc-rows {
	margin: 0;
	padding: 0;
	list-style: none;
}

.fh-svc-cards[hidden],
.fh-svc-rows[hidden] {
	display: none;
}

.fh-svc-cards {
	display: grid;
	gap: 360px;
	margin-top: calc(-1 * var(--wp--custom--header-height));
}

@media (min-width: 810px) {
	.fh-svc-cards {
		gap: 480px;
	}
}

.fh-svc-card {
	position: sticky;
	top: 0;
	height: 100svh;
	overflow: hidden;
	border-radius: 20px 20px 0 0;
	background: var(--wp--preset--color--charcoal);
}

.fh-svc-card__link {
	position: relative;
	display: block;
	height: 100%;
	color: var(--wp--preset--color--white);
	text-decoration: none;
}

.fh-svc-card__media,
.fh-svc-card__link::after {
	position: absolute;
	inset: 0;
}

.fh-svc-card__link::after {
	content: "";
	background: var(--wp--preset--color--overlay-light);
}

/* "Darker shade" ticked on the service (pale or busy photos): about half-dark, so the white
   title still reads over a white shutter or wall. */
.fh-svc-card.is-dark .fh-svc-card__link::after {
	background: rgba(0, 0, 0, 0.5);
}

.fh-svc-card__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.9s var(--fh-ease);
}

@media (hover: hover) {
	.fh-svc-card__link:hover .fh-svc-card__media img {
		transform: scale(1.04);
	}
}

.fh-svc-card__content {
	position: absolute;
	z-index: 1;
	top: 50%;
	left: max(20px, (100% - var(--fh-content-w)) / 2);
	width: min(var(--fh-content-w), 100% - 40px);
	display: grid;
	gap: 20px;
	justify-items: start;
}

.fh-svc-card .fh-svc-card__title {
	margin: 0;
	color: inherit;
	font-size: var(--wp--preset--font-size--hero);
	line-height: 1;
	letter-spacing: -0.035em;
}

.fh-svc-card__more {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	line-height: 1.55;
}

@media (hover: hover) {
	.fh-svc-card__link:hover .fh-arrow--right {
		transform: translateX(4px);
	}
}

/* ---------- List ---------- */

.fh-svc-rows {
	box-sizing: border-box;
	width: var(--fh-content-w);
	margin-inline: auto;
	padding-top: 75px;
	padding-bottom: var(--wp--preset--spacing--section-160);
}

/* First row at 168 / 176 / 140 from the top of the page, as on Framer. */
@media (min-width: 810px) {
	.fh-svc-rows {
		padding-top: 87px;
	}
}

@media (min-width: 1200px) {
	.fh-svc-rows {
		padding-top: 79px;
	}
}

.fh-svc-rows li:first-child {
	border-top: 1px solid var(--wp--preset--color--ink);
}

.fh-svc-row {
	display: block;
	padding: 5.5px 0;
	border-bottom: 1px solid var(--wp--preset--color--ink);
	color: inherit;
	text-decoration: none;
}

.fh-svc-row .fh-svc-row__title {
	margin: 0;
	font-family: var(--wp--preset--font-family--helvetica-neue);
	font-size: var(--wp--preset--font-size--subheading);
	font-weight: 400;
	line-height: 1.15;
	letter-spacing: -0.01em;
	transition: opacity 0.3s ease, transform 0.45s var(--fh-ease);
}

@media (hover: hover) {
	.fh-svc-row:hover .fh-svc-row__title {
		opacity: 0.4;
		transform: translateX(14px);
	}
}

/* ---------- Closing prompt (Services) ---------- */

/* Just a label and the button, so it takes little room. */
.fh-page--services .fh-cta {
	padding-block: var(--wp--preset--spacing--section-120);
}

.fh-page--services .fh-cta > p {
	max-width: 460px !important;
	margin-left: calc((100% - var(--fh-content-w)) / 2) !important;
	color: var(--wp--preset--color--muted);
	font-size: var(--wp--preset--font-size--body-large);
	line-height: 1.55;
	letter-spacing: -0.005em;
}

.fh-page--services .fh-cta > p + * {
	margin-block-start: 16px;
}

/* ---------- Case Studies archive ---------- */

/* The title is for screen readers and search engines only; the intro and cards sit centred in
   the first screen (more rows simply carry on below). */
.post-type-archive-case_study main.wp-block-group {
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	justify-content: center;
	min-height: calc(100svh - var(--wp--custom--header-height));
	padding-block: clamp(36px, min(19.2857px + 4.2857vw, 30.8571px + 2.8571vw), 72px);
}

/* Full width: in a centred column, the layout's auto margins would otherwise shrink them. */
.post-type-archive-case_study main.wp-block-group > * {
	width: 100%;
}

/* Desktop: the cards run edge to edge, with the same 20px gap at the sides as between them. */
@media (min-width: 1200px) {
	.post-type-archive-case_study main.wp-block-group > .fh-project-list {
		box-sizing: border-box;
		width: 100vw;
		max-width: 100vw !important;
		margin-left: calc(50% - 50vw) !important;
		margin-right: calc(50% - 50vw) !important;
		padding-inline: 20px;
	}
}

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

.fh-archive-head h1 {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
	.fh-svc-card__media img,
	.fh-svc-row__title,
	.fh-services__toggle {
		transition: none;
	}
}
