/* core/group, style "image-cards": a full-bleed Grid group of Cover cards (photo, navy text panel, heading, text,
   arrow link). The group's background colour shows through the 1px gaps as the lines between the cards.
   Columns: 4, and 2 / 1 on tablet / mobile via the block's own per-viewport layout settings.
   Figma: Event & Commercial Home › 4 Sections 7265:28473 */

/* Every photo is --fews-card-photo tall and the grid stretches the cards in a row to the tallest one, so the headings
   line up whatever the copy length. Figma: 650px card = 436px photo area + the 214px text panel. */
.wp-block-group.is-style-image-cards {
	--fews-card-photo: 27.25rem;
	gap: 1px;
}

.wp-block-group.is-style-image-cards > .wp-block-cover {
	--fews-card-inset: clamp(1.25rem, 2vw, 2.375rem); /* Figma: 38px at 1920 */
	display: block;
	min-height: 0;
	margin: 0;
	padding: 0;
	background-color: var(--wp--preset--color--contrast);
}

/* The photo is in the flow (not absolute like a normal cover), so photo and text simply stack. */
.wp-block-group.is-style-image-cards > .wp-block-cover > .wp-block-cover__image-background {
	position: relative;
	display: block;
	block-size: var(--fews-card-photo);
	transition: transform 0.6s ease;
}

.wp-block-group.is-style-image-cards > .wp-block-cover:is(:hover, :focus-within) > .wp-block-cover__image-background {
	transform: scale(1.05);
}

.wp-block-group.is-style-image-cards > .wp-block-cover .is-style-arrow-link > .wp-block-button__link {
	transition: background-size 0.3s, color 0.3s;
}

/* The link's colour comes from `.has-base-color` (!important), so re-point the variable instead. */
.wp-block-group.is-style-image-cards > .wp-block-cover:is(:hover, :focus-within) .is-style-arrow-link > .wp-block-button__link {
	--wp--preset--color--base: var(--wp--preset--color--primary);
	background-size: 100% 4px;
}

@media (prefers-reduced-motion: reduce) {
	.wp-block-group.is-style-image-cards > .wp-block-cover > .wp-block-cover__image-background,
	.wp-block-group.is-style-image-cards > .wp-block-cover .is-style-arrow-link > .wp-block-button__link {
		transition: none;
	}
}

/* Text panel: solid navy behind the text, fading into the photo over the 6rem above it (Figma overlay: navy from the
   text top, transparent ~96px higher). It grows with the text, so longer copy always sits on navy. */
.wp-block-group.is-style-image-cards > .wp-block-cover > .wp-block-cover__inner-container {
	box-sizing: border-box;
	inline-size: 100%;
	padding: 0 var(--fews-card-inset) calc(var(--fews-card-inset) + 0.5rem); /* Figma 46px at 1920, 28px on mobile */
	background-color: var(--wp--preset--color--contrast);
}

.wp-block-group.is-style-image-cards > .wp-block-cover > .wp-block-cover__inner-container::before {
	content: "";
	position: absolute;
	inset-inline: 0;
	bottom: 100%;
	block-size: 6rem;
	background: linear-gradient(to top, var(--wp--preset--color--contrast), transparent);
	pointer-events: none;
}

/* Body text: white at 50% (Figma). Not the "Line" palette colour: its class `has-border-color` is also core's border
   support class, which draws a solid border. A colour picked in the editor still wins. */
.wp-block-group.is-style-image-cards p:where(:not(.has-text-color)) {
	color: color-mix(in srgb, var(--wp--preset--color--base) 50%, transparent);
}

@media (width < 782px) {
	.wp-block-group.is-style-image-cards {
		--fews-card-photo: 19.125rem; /* ~500px cards */
	}
}
