/**
 * MEMOT theme styles — social.
 *
 * The Social page (patterns/social-page.php). The page widens like growth rings
 * in a rubber tree's trunk: the tapper, their welfare, their family in hard
 * times, their village, the region. The hero states that idea once, with a
 * tapper at the centre of amber rings and the village on the outermost ring.
 * The sections after it follow the same order but stay quiet. Photos live in
 * wp-content/uploads/memot/social/ (see inc/media.php).
 */

/* -------------------------------------------------------------------------- *
 * Shared photo frame
 *
 * Every photo is a core Image block, so editors can swap it. The frames set
 * the shape and the photo covers it, so a replacement image of any size or
 * ratio still fits. `.wp-block-image` in each selector outranks core's own
 * image-block margins and `height: auto`.
 * -------------------------------------------------------------------------- */

.wp-block-image:is(.memot-social-photo, .memot-social-rings__core, .memot-social-rings__satellite, .memot-social-teams__inset, .memot-social-programme__photo, .memot-social-band__img) {
	margin: 0;
}

.wp-block-image:is(.memot-social-photo, .memot-social-rings__core, .memot-social-rings__satellite, .memot-social-teams__inset, .memot-social-programme__photo, .memot-social-band__img) img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.memot-social-photo {
	overflow: hidden;
	border-radius: var(--memot-radius-lg);
	background: var(--wp--preset--color--brand); /* holds the frame while the photo loads */
}

/* The flow layout's block gap would show as a strip between two tinted
   bands; every band on this page sets its own padding. */
.memot-social-hero ~ .alignfull {
	margin-block-start: 0;
}

/* -------------------------------------------------------------------------- *
 * Hero: growth rings
 * -------------------------------------------------------------------------- */

.memot-social-hero {
	overflow-x: clip; /* the satellite photo can overhang on narrow screens */
	padding-bottom: var(--wp--preset--spacing--70) !important; /* one step under .memot-page-hero's */
}

.memot-social-hero__grid {
	margin-top: 0;
	margin-bottom: 0;
}

.memot-social-hero h1 {
	max-width: 18ch;
}

/* Three figures on one row, closer under the actions than the shared strip. */
.memot-social-hero .memot-hero-stats {
	flex-wrap: nowrap;
	column-gap: var(--wp--preset--spacing--60);
	margin-top: var(--wp--preset--spacing--60);
	padding-top: var(--wp--preset--spacing--50);
}

/* Headings here sit in narrow columns; keep a lone word off the last line. */
.memot-social-hero h1,
:is(.memot-social-teams, .memot-social-welfare, .memot-social-care, .memot-social-band, .memot-social-relief) h2 {
	text-wrap: balance;
}

.memot-social-hero .memot-lead {
	max-width: 56ch;
	text-wrap: pretty;
}

.memot-social-rings {
	position: relative;
	width: min(100%, 25rem);
	margin-left: auto;
	aspect-ratio: 1;
}

/* Three rings at 68%, 84% and 100% of the stage, fading as they widen. The
   fade is on the border color so opacity stays free for the entrance. */
.memot-social-rings__ring {
	position: absolute;
	inset: 0;
	margin: 0; /* the group's flow layout would add a block gap */
	border: 1.5px solid color-mix(in srgb, var(--wp--preset--color--harvest) 35%, transparent);
	border-radius: 50%;
	pointer-events: none;
}

.memot-social-rings__ring:nth-child(1) {
	inset: 16%;
	border-color: color-mix(in srgb, var(--wp--preset--color--harvest) 90%, transparent);
}

.memot-social-rings__ring:nth-child(2) {
	inset: 8%;
	border-color: color-mix(in srgb, var(--wp--preset--color--harvest) 60%, transparent);
}

.memot-social-rings__core,
.memot-social-rings__satellite {
	position: absolute;
	overflow: hidden;
	border-radius: 50%;
}

.memot-social-rings__core {
	inset: 20%;
	background: var(--wp--preset--color--brand);
	box-shadow: var(--memot-shadow-lg);
}

/* Centred on the outer ring at the 4:30 position: 50% + 50% x cos 45deg. */
.memot-social-rings__satellite {
	top: calc(85.36% - 14%);
	left: calc(85.36% - 14%);
	width: 28%;
	aspect-ratio: 1;
	border: 6px solid var(--wp--preset--color--paper);
	background: var(--wp--preset--color--brand);
	box-shadow: var(--memot-shadow-md);
}

@media (max-width: 781px) {

	.memot-social-hero h1 {
		max-width: 100%;
	}

	.memot-social-hero .memot-hero-stats {
		flex-wrap: wrap;
	}

	.memot-social-rings {
		width: min(88%, 24rem);
		margin-right: auto;
	}
}

/* -------------------------------------------------------------------------- *
 * Tappers and teams
 * -------------------------------------------------------------------------- */

.memot-social-teams__stage {
	position: relative;
	width: min(100%, 30rem);
}

.memot-social-teams__photo {
	aspect-ratio: 4 / 5;
	box-shadow: var(--memot-shadow-lg);
}

/* A round detail over the frame's corner, echoing the hero rings. */
.memot-social-teams__inset {
	position: absolute;
	right: -10%;
	bottom: 8%;
	width: 38%;
	aspect-ratio: 1;
	overflow: hidden;
	border: 6px solid var(--wp--preset--color--paper);
	border-radius: 50%;
	background: var(--wp--preset--color--brand);
	box-shadow: var(--memot-shadow-md);
}

.memot-social-teams h2 {
	max-width: 18ch;
}

@media (max-width: 781px) {

	.memot-social-teams__stage {
		width: min(88%, 26rem);
	}
}

/* -------------------------------------------------------------------------- *
 * Worker welfare
 * -------------------------------------------------------------------------- */

.memot-social-welfare__photo {
	position: sticky;
	top: calc(var(--memot-header-space) + var(--wp--preset--spacing--40));
	aspect-ratio: 4 / 5;
}

.memot-social-benefits {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--wp--preset--spacing--60) var(--wp--preset--spacing--70);
	margin-top: var(--wp--preset--spacing--70);
}

.memot-social-benefits > .memot-social-benefit {
	margin: 0;
	padding-top: var(--wp--preset--spacing--50);
	border-top: 1px solid var(--wp--preset--color--line);
}

.memot-social-benefit h3 {
	margin: var(--wp--preset--spacing--40) 0 var(--wp--preset--spacing--30);
	font-size: var(--wp--preset--font-size--large);
}

.memot-social-benefit p {
	margin: 0;
	color: var(--wp--preset--color--slate);
}

/* Chips sit on sand here, which is also their default fill. */
.memot-social-benefit .memot-icon-chip {
	background: var(--wp--preset--color--paper);
}

@media (max-width: 781px) {

	.memot-social-welfare__photo {
		position: static;
		aspect-ratio: 3 / 2;
	}
}

@media (max-width: 600px) {

	.memot-social-benefits {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* -------------------------------------------------------------------------- *
 * Illness and injury support
 * -------------------------------------------------------------------------- */

.memot-social-care__photo {
	aspect-ratio: 3 / 2;
	margin-top: var(--wp--preset--spacing--60);
}

/* Line the first step up with the heading rather than the eyebrow. */
.memot-social-care__steps {
	margin-top: var(--wp--preset--spacing--60);
}

@media (max-width: 781px) {

	.memot-social-care__steps {
		margin-top: 0;
	}
}

/* -------------------------------------------------------------------------- *
 * Local villages: photo band, then programme cards lifted over its edge
 * -------------------------------------------------------------------------- */

.memot-social-band {
	position: relative;
	display: grid;
	align-content: end;
	min-height: clamp(34rem, 82vh, 48rem);
	margin-block: 0;
	padding-top: var(--wp--preset--spacing--100);
	padding-bottom: calc(var(--wp--preset--spacing--80) * 2);
	overflow: hidden;
	color: var(--wp--preset--color--paper);
}

.wp-block-image.memot-social-band__img {
	position: absolute;
	inset: 0;
	max-width: none !important; /* the constrained layout caps every child's width */
	margin: 0 !important; /* ...and centres it with !important auto margins */
}

.wp-block-image.memot-social-band__img img {
	object-position: 50% 60%;
}

/* Scrim from the lower-left, where the copy sits. Mixed from ink. */
.memot-social-band::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
	background:
		linear-gradient(0deg, color-mix(in srgb, var(--wp--preset--color--ink) 82%, transparent) 0%, color-mix(in srgb, var(--wp--preset--color--ink) 35%, transparent) 55%, transparent 80%),
		linear-gradient(90deg, color-mix(in srgb, var(--wp--preset--color--ink) 45%, transparent) 0%, transparent 60%);
}

.memot-social-band__copy {
	position: relative;
	width: 100%; /* a grid item with auto margins would otherwise shrink to fit */
	z-index: 2;
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	column-gap: var(--wp--preset--spacing--70);
	align-items: end;
}

.memot-social-band__copy > * {
	grid-column: 1;
}

.memot-social-band__copy h2 {
	max-width: 18ch;
	color: var(--wp--preset--color--paper);
}

.memot-social-band__copy .memot-lead {
	max-width: 52ch;
	color: color-mix(in srgb, var(--wp--preset--color--paper) 86%, transparent);
}

.memot-social-band__copy > .memot-social-band__figure {
	grid-column: 2;
	grid-row: 1 / span 3;
	align-self: end;
	margin: 0;
	padding-left: var(--wp--preset--spacing--50);
	border-left: 2px solid var(--wp--preset--color--harvest);
}

.memot-social-band__figure dt {
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--xx-large);
	font-weight: 800;
	line-height: 1;
}

.memot-social-band__figure dd {
	max-width: 20ch;
	margin: var(--wp--preset--spacing--30) 0 0;
	font-size: var(--wp--preset--font-size--small);
	color: color-mix(in srgb, var(--wp--preset--color--paper) 86%, transparent);
}

/* On the band and the green relief section the eyebrow text goes light;
   the amber tick stays, since it reads on both. */
.memot-social-band .is-style-memot-eyebrow,
.memot-social-relief .is-style-memot-eyebrow {
	color: var(--wp--preset--color--paper);
}

.memot-social-programmes {
	position: relative;
	z-index: 2;
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: var(--wp--preset--spacing--50);
	margin-top: calc(var(--wp--preset--spacing--80) * -1) !important; /* beats the flow layout's block gap */
}

.memot-social-programmes > .memot-social-programme {
	margin: 0;
	padding-bottom: var(--wp--preset--spacing--50);
	overflow: hidden;
	border-radius: var(--memot-radius);
	background: var(--wp--preset--color--paper);
	box-shadow: var(--memot-shadow-md);
}

.memot-social-programme__photo {
	aspect-ratio: 4 / 3;
	background: var(--wp--preset--color--brand);
}

.memot-social-programme h3,
.memot-social-programme p {
	margin-inline: var(--wp--preset--spacing--50);
}

.memot-social-programme h3 {
	margin-top: var(--wp--preset--spacing--50);
	margin-bottom: var(--wp--preset--spacing--30);
	font-size: var(--wp--preset--font-size--large);
}

.memot-social-programme p {
	margin-top: 0;
	margin-bottom: 0;
	font-size: 0.9375rem;
	color: var(--wp--preset--color--slate);
}

@media (max-width: 1080px) {

	.memot-social-programmes {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 781px) {

	.memot-social-band__copy {
		grid-template-columns: minmax(0, 1fr);
	}

	.memot-social-band__copy > .memot-social-band__figure {
		grid-column: 1;
		grid-row: auto;
		margin-top: var(--wp--preset--spacing--60);
	}
}

@media (max-width: 600px) {

	.memot-social-programmes {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* -------------------------------------------------------------------------- *
 * Humanitarian actions (brand-green band)
 * -------------------------------------------------------------------------- */

.memot-social-relief h2 {
	max-width: 16ch;
	color: var(--wp--preset--color--paper);
}

.memot-social-relief .memot-lead {
	color: color-mix(in srgb, var(--wp--preset--color--paper) 86%, transparent);
}

.memot-social-relief__photo {
	aspect-ratio: 5 / 4;
	box-shadow: var(--memot-shadow-lg);
}

.memot-social-relief .is-style-outline .wp-block-button__link {
	border-color: var(--wp--preset--color--paper);
	color: var(--wp--preset--color--paper);
}

.memot-social-relief .is-style-outline .wp-block-button__link:hover,
.memot-social-relief .is-style-outline .wp-block-button__link:focus-visible {
	background: var(--wp--preset--color--paper);
	color: var(--wp--preset--color--brand);
}

/* -------------------------------------------------------------------------- *
 * Hero entrance (memot-motion.js). Pre-hidden only under .memot-anim; the
 * reduced-motion override lives here with the rule it undoes.
 * -------------------------------------------------------------------------- */

.memot-anim .memot-social-rings :where(.memot-social-rings__ring, .memot-social-rings__core, .memot-social-rings__satellite) {
	opacity: 0;
}

@media (prefers-reduced-motion: reduce) {

	.memot-anim .memot-social-rings :where(.memot-social-rings__ring, .memot-social-rings__core, .memot-social-rings__satellite) {
		opacity: 1;
	}
}
