/**
 * Our work and program pages (WORK): the "Mosaic" hero, the statement, "Where your gift goes",
 * the overseas feature card, the "Program carousel split" hero, the program body and the program
 * page sections. Enqueued on page-templates/our-work.php and single programs only.
 * Selectors are scoped to .hero--mosaic, .hero--program and .work-* (F1); CORE classes inside
 * these blocks are composed, never restyled.
 *
 * Flat surfaces (A4): no fills, borders or shadows; photos carry the radius. Text placed on a
 * photo sits on --grad-scrim and stays white on hover (client item 5): mosaic titles never change
 * colour, their arrow buttons invert to white with navy. Nothing lifts on hover: photos zoom inside
 * their frames, arrows nudge, colours change.
 */

/* 1. Hero "Mosaic" (Our work) --------------------------------------------- */
.hero--mosaic .work-mosaic {
	--work-row: clamp(11rem, 6rem + 9vw, 14.5rem); /* 226px at 1440: the mosaic fits above the fold at 1440×900 */
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 12px;
}

.work-mosaic__text {
	display: grid;
	grid-column: 1 / -1;
	align-content: center;
	justify-items: start;
	min-width: 0;
	margin-bottom: 12px;
}

/* Full-width actions row, so its buttons can fill the row below 30em (CORE .actions rule). */
.work-mosaic__text > .actions {
	justify-self: stretch;
}

.work-mosaic__credit {
	max-width: 52rem;
	margin-top: 10px;
	font-size: var(--fs-xs);
	line-height: 1.45;
	color: var(--c-ink-3);
}

/* Tiles: one link each; photo, scrim, title and arrow button. Square below 48em. */
.work-tile {
	position: relative;
	display: block;
	min-width: 0;
	overflow: hidden;
	aspect-ratio: 1 / 1;
	border-radius: var(--radius-l);
	color: var(--c-white);
	text-decoration: none;
	isolation: isolate;
}

.work-tile:hover {
	color: var(--c-white);
}

.work-tile:focus-visible {
	outline-offset: 3px;
}

.work-tile--wide {
	grid-column: span 2;
	aspect-ratio: 16 / 10;
}

.work-tile__media {
	position: absolute;
	inset: 0;
	z-index: 0;
}

.work-tile::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
	background: var(--grad-scrim);
	pointer-events: none;
}

.work-tile__body {
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 2;
	display: grid;
	gap: 6px;
	padding: 14px 60px 14px 16px;
}

.work-tile__title {
	max-width: none;
	color: inherit;
	font-size: 1.125rem;
	font-weight: 600;
	line-height: 1.25;
	letter-spacing: -.01em;
}

.work-tile--lg .work-tile__title {
	font-size: clamp(1.375rem, 1rem + 1.2vw, 1.75rem);
	line-height: 1.15;
	letter-spacing: -.02em;
}

.work-tile__text {
	display: -webkit-box;
	max-width: 34em;
	overflow: hidden;
	color: rgb(255 255 255 / .85);
	font-size: .9375rem;
	line-height: 1.45;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	line-clamp: 2;
}

/* The arrow: a 40px light icon button, inverted to white with navy while the tile is hovered or focused. */
.work-tile__arrow {
	position: absolute;
	right: 12px;
	bottom: 12px;
	z-index: 2;
}

.work-tile:is(:hover, :focus-visible) .work-tile__arrow {
	border-color: var(--c-white);
	background: var(--c-white);
	color: var(--c-blue-950);
}

/* Hover-capable devices show the arrow on hover or focus; touch screens always show it. */
@media (hover: hover) and (pointer: fine) {
	.work-tile__arrow {
		opacity: 0;
	}

	.work-tile:is(:hover, :focus-visible) .work-tile__arrow {
		opacity: 1;
	}
}

@media (prefers-reduced-motion: no-preference) {
	.work-tile__media > img {
		transition: scale 600ms var(--ease-out);
	}

	.work-tile:is(:hover, :focus-visible) .work-tile__media > img {
		scale: 1.03;
	}

	.work-tile__arrow .icon {
		transition: translate 200ms var(--ease-out);
	}

	.work-tile:hover .work-tile__arrow .icon {
		translate: 2px 0;
	}
}

/* From 48em: four columns. Text cell row 1, columns 1–2; large tile rows 1–2, columns 3–4. */
@media (min-width: 48em) {
	.hero--mosaic .work-mosaic {
		grid-template-columns: repeat(4, minmax(0, 1fr));
		grid-template-rows: minmax(var(--work-row), auto);
		grid-auto-rows: var(--work-row);
	}

	.work-mosaic__text {
		grid-column: 1 / 3;
		grid-row: 1;
		margin-bottom: 0;
		padding: 8px clamp(.5rem, -1rem + 3vw, 2.5rem) 8px 0;
	}

	.work-tile {
		aspect-ratio: auto;
	}

	.work-tile--wide {
		grid-column: auto;
	}

	.work-tile--lg {
		grid-column: 3 / 5;
		grid-row: 1 / 3;
	}

	.work-mosaic--solo .work-tile--lg {
		grid-row: 1;
	}

	.work-tile--span2 {
		grid-column: span 2;
	}

	.work-tile--span4 {
		grid-column: 1 / -1;
	}

	.work-tile--lg .work-tile__body {
		gap: 8px;
		padding: 24px 76px 24px 24px;
	}

	.work-tile--lg .work-tile__arrow {
		right: 20px;
		bottom: 20px;
	}
}

/* 2. Statement (Our work) ------------------------------------------------- */
.work-statement__grid {
	display: grid;
	gap: var(--space-m);
}

.work-statement__lead {
	max-width: none;
}

.work-statement__text {
	max-width: 40rem;
	color: var(--c-ink-2);
}

.work-statement__text > * + * {
	margin-top: 1em;
}

@media (min-width: 60em) {
	.work-statement__grid {
		grid-template-columns: repeat(12, minmax(0, 1fr));
		column-gap: var(--grid-gap);
	}

	.work-statement__grid > * {
		grid-column: 1 / 10;
	}
}

/* 3. "Where your gift goes" (Our work) ------------------------------------ */
.work-gift__cols {
	display: grid;
}

.work-gift__col {
	display: grid;
	align-content: start;
	row-gap: 12px;
	min-width: 0;
}

.work-gift__col + .work-gift__col {
	margin-top: var(--space-xl);
	padding-top: var(--space-xl);
	border-top: 1px solid var(--c-line);
}

.work-gift__text {
	max-width: 34em;
	color: var(--c-ink-2);
}

.work-gift__progress {
	max-width: 30rem;
	padding-top: 6px;
}

.work-gift__actions {
	align-self: start;
	padding-top: 8px;
}

/* Two columns from 48em; title, text, progress and actions line up across them (subgrid),
   split by a vertical hairline. */
@media (min-width: 48em) {
	.work-gift__cols {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		grid-template-rows: repeat(4, auto);
		column-gap: 0;
	}

	.work-gift__col {
		grid-row: span 4;
		grid-template-rows: subgrid;
		padding-right: clamp(1.5rem, .5rem + 3vw, 4rem);
	}

	.work-gift__title {
		grid-row: 1;
	}

	.work-gift__text {
		grid-row: 2;
	}

	.work-gift__progress {
		grid-row: 3;
	}

	.work-gift__actions {
		grid-row: 4;
	}

	.work-gift__col + .work-gift__col {
		margin-top: 0;
		padding-top: 0;
		padding-right: 0;
		padding-left: clamp(1.5rem, .5rem + 3vw, 4rem);
		border-top: 0;
		border-left: 1px solid var(--c-line);
	}
}

/* 4. Overseas feature card (Our work, REF6 language) ---------------------- */
.work-feature {
	position: relative;
	overflow: hidden;
	border-radius: var(--radius-l);
	color: var(--c-white);
	isolation: isolate;
}

.work-feature__media {
	--ratio: 4 / 5;
}

/* --grad-scrim, anchored to the bottom edge and stretched on the taller crops so it always
   reaches the title (white on the scrim keeps at least 3:1 at title size, 4.5:1 for the line). */
.work-feature::after {
	content: "";
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 1;
	height: 170%;
	background: var(--grad-scrim);
	pointer-events: none;
}

.work-feature__body {
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 2;
	display: grid;
	justify-items: start;
	gap: 12px;
	max-width: 44rem;
	padding: clamp(1.25rem, .75rem + 2vw, 2.5rem);
}

.work-feature__title {
	max-width: 20ch;
	font-size: clamp(1.5rem, 1.25rem + .8vw, 1.75rem);
	line-height: 1.2;
	letter-spacing: -.02em;
}

.work-feature__text {
	max-width: 36em;
	color: var(--c-white);
}

.work-feature__body .actions {
	justify-self: stretch;
	margin-top: 8px;
}

.work-feature__credit {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 2;
	max-width: calc(100% - 24px);
	margin: 0;
	padding: 4px 8px;
	border-radius: var(--radius-s);
	background: rgb(0 8 61 / .62);
	color: var(--c-white);
	font-size: var(--fs-xs);
	line-height: 1.4;
}

@media (min-width: 40em) {
	.work-feature__media {
		--ratio: 16 / 9;
	}

	.work-feature::after {
		height: 150%;
	}
}

@media (min-width: 64em) {
	.work-feature__media {
		--ratio: 21 / 9;
	}

	.work-feature::after {
		height: 100%;
	}

	.work-feature__credit {
		top: auto;
		bottom: 12px;
		max-width: min(24rem, 34%);
	}
}

/* 5. Program hero "Program carousel split" -------------------------------- */
.hero--program .work-phero {
	display: grid;
	gap: var(--space-l) var(--grid-gap);
}

.work-phero__copy {
	display: grid;
	justify-items: start;
	min-width: 0;
}

.work-phero__place {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-top: 12px;
	font-size: .9375rem;
	line-height: 1.4;
	color: var(--c-ink-2);
}

.work-phero__place .icon {
	width: 18px;
	height: 18px;
	color: var(--c-blue);
}

.work-phero__give {
	display: grid;
	gap: 20px;
	width: 100%;
	margin-top: 24px;
}

.work-phero__progress {
	max-width: 28rem;
}

.work-phero__for {
	margin-top: 8px;
	font-size: var(--fs-small);
	line-height: 1.45;
	color: var(--c-ink-2);
}

/* The photo: 5:4, never wider than 600px; first below 64em. */
.work-phero__visual {
	order: -1;
	width: 100%;
	max-width: 600px;
	min-width: 0;
}

.work-phero__frame {
	position: relative;
}

/* Bottom scrim with "Next: …" and the previous/next program links (text stays white). */
.work-phero__nav {
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 2;
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 12px;
	padding: 56px 16px 16px 20px;
	border-radius: 0 0 var(--radius-l) var(--radius-l);
	background: var(--grad-scrim);
	pointer-events: none;
}

.work-phero__nav a {
	pointer-events: auto;
}

.work-phero__next {
	min-width: 0;
	margin-bottom: 12px;
	color: var(--c-white);
	font-size: var(--fs-xs);
	font-weight: 500;
	line-height: 1.4;
}

.work-phero__arrows {
	display: flex;
	flex: none;
	gap: 8px;
}

.work-phero__credit {
	margin-top: 8px;
	font-size: var(--fs-xs);
	line-height: 1.45;
	color: var(--c-ink-3);
}

@media (min-width: 64em) {
	.hero--program .work-phero {
		grid-template-columns: repeat(12, minmax(0, 1fr));
		align-items: center;
	}

	.work-phero__copy {
		grid-column: 1 / 7;
		grid-row: 1;
	}

	.work-phero__visual {
		grid-column: 7 / 13;
		grid-row: 1;
		justify-self: end;
		order: 0;
	}
}

/* 6. Program body: content beside "What your support provides" ------------ */
.work-body__grid {
	display: grid;
	gap: var(--space-xl) var(--grid-gap);
}

/* The content runs the width of its columns: the first paragraph at statement size, the rest at
   body size and measure. */
.work-body__prose {
	max-width: none;
}

.work-body__prose > :not(:first-child) {
	max-width: 65ch;
}

.work-body__prose > p:first-child {
	max-width: 30em;
	color: var(--c-blue-950);
	font-family: var(--ff-display);
	font-size: var(--fs-statement);
	font-weight: 500;
	line-height: 1.3;
	letter-spacing: -.015em;
}

.work-body__prose > p:first-child + * {
	margin-top: 1.5em;
}

.work-provides__title {
	max-width: none;
	font-size: var(--fs-h3);
	font-weight: 600;
	line-height: 1.25;
	letter-spacing: -.015em;
}

.work-provides {
	margin: 12px 0 0;
	padding: 0;
	list-style: none;
}

.work-provides li {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding-block: 12px;
}

.work-provides li + li {
	border-top: 1px solid var(--c-line);
}

.work-provides .icon {
	width: 20px;
	height: 20px;
	margin-top: .15em;
	color: var(--c-blue-950);
}

@media (min-width: 60em) {
	.work-body__grid {
		grid-template-columns: repeat(12, minmax(0, 1fr));
	}

	.work-body__prose {
		grid-column: 1 / 8;
	}

	.work-body__aside {
		grid-column: 9 / 13;
	}
}
