/*
 * Reusable Cards block.
 * Supports standard, icon-over-text and full-image-overlay layouts.
 */

/* Keep the long layout choices inside Gutenberg's narrow block inspector. */
.acf-block-fields [data-key="field_duraproducts_cards_layout"] .acf-button-group {
	display: flex;
	flex-wrap: wrap;
	width: 100%;
}

.acf-block-fields [data-key="field_duraproducts_cards_layout"] .acf-button-group label {
	flex: 1 1 130px;
	box-sizing: border-box;
	white-space: normal;
	text-align: center;
}

/* Compact the Cards block inspector without affecting front-end output. */
.acf-block-fields:has([data-key="field_duraproducts_cards_layout"]) > .acf-field,
.acf-block-fields:has([data-key="field_duraproducts_cards_layout"]) .acf-repeater .acf-row:not(.acf-clone) .acf-field {
	padding: 8px 10px;
}

.acf-block-fields:has([data-key="field_duraproducts_cards_layout"]) .acf-label {
	margin-bottom: 3px;
}

.acf-block-fields:has([data-key="field_duraproducts_cards_layout"]) .acf-label label {
	font-size: 13px;
	line-height: 1.25;
}

.acf-block-fields:has([data-key="field_duraproducts_cards_layout"]) .description {
	margin-top: 3px;
	font-size: 12px;
	line-height: 1.35;
}

.acf-block-fields:has([data-key="field_duraproducts_cards_layout"]) .acf-button-group label {
	padding: 5px 9px;
	font-size: 13px;
	line-height: 1.25;
}

.acf-block-fields:has([data-key="field_duraproducts_cards_layout"]) textarea {
	min-height: 72px;
	height: 72px;
}

.acf-block-fields:has([data-key="field_duraproducts_cards_layout"]) .acf-image-uploader .image-wrap {
	max-width: 150px !important;
}

.acf-block-fields:has([data-key="field_duraproducts_cards_layout"]) .acf-image-uploader .image-wrap img {
	width: auto;
	max-width: 150px;
	max-height: 150px;
	object-fit: contain;
}

.acf-block-fields:has([data-key="field_duraproducts_cards_layout"]) .acf-repeater .acf-row {
	margin-bottom: 6px;
}

.acf-block-fields:has([data-key="field_duraproducts_cards_layout"]) .acf-repeater .acf-row-handle {
	width: 28px;
}

.content-cards {
	--content-cards-accent: #284972;
	--content-cards-text: #555;
	--content-cards-title: #222;
	--content-cards-border: #d7dde5;
	--content-cards-surface: #fff;
	--content-cards-muted: #f4f6f8;
	padding: 30px 0;
}

/* Position the complete Cards composition inside an explicitly tall block. */
@media (min-width: 768px) {
	.content-cards[data-dp-height-desktop] {
		display: flex;
		flex-direction: column;
	}

	.content-cards[data-dp-height-desktop] > .wrap {
		width: 100%;
	}

	.content-cards--valign-center[data-dp-height-desktop] {
		justify-content: center;
	}

	.content-cards--valign-bottom[data-dp-height-desktop] {
		justify-content: flex-end;
	}
}

@media (max-width: 767px) {
	.content-cards[data-dp-height-mobile] {
		display: flex;
		flex-direction: column;
	}

	.content-cards[data-dp-height-mobile] > .wrap {
		width: 100%;
	}

	.content-cards--valign-center[data-dp-height-mobile] {
		justify-content: center;
	}

	.content-cards--valign-bottom[data-dp-height-mobile] {
		justify-content: flex-end;
	}
}

.content-cards__heading {
	margin: 0 0 36px;
	color: var(--content-cards-title);
	font-size: clamp(28px, 2.35vw, 34px);
	font-weight: 400;
	line-height: 1.15;
}

.content-cards__grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
	gap: var(--content-cards-gap, 20px);
	align-items: stretch;
}

@media (min-width: 1024px) {
	.content-cards[style*="--content-cards-items-per-row"] .content-cards__grid {
		grid-template-columns: repeat(var(--content-cards-items-per-row), minmax(0, 1fr));
	}
}

.content-cards__item {
	position: relative;
	min-width: 0;
	height: 100%;
	scroll-margin-top: 100px;
	background: var(--content-cards-surface);
	border: 1px solid var(--content-cards-border);
	border-top: 4px solid var(--content-cards-accent);
	transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.content-cards[style*="--content-cards-max-height"] .content-cards__item {
	width: 100%;
	height: var(--content-cards-max-height);
	max-height: none;
	overflow: visible;
}

.content-cards[style*="--content-cards-max-height"] .content-cards__card {
	height: 100%;
	min-height: 0;
}

.content-cards[style*="--content-cards-max-height"] .content-cards__media {
	flex: 1 1 auto;
	min-height: 0;
	aspect-ratio: auto;
}

.content-cards[style*="--content-cards-max-height"] .content-cards__content {
	flex: 0 0 auto;
}

.content-cards[style*="--content-cards-max-height"] .content-cards__image {
	max-height: 100%;
}

.content-cards[style*="--content-cards-max-height"][style*="--content-cards-keep-ratio:1"] .content-cards__image {
	object-fit: contain;
}

/*
 * A set card height replaces the square tile, but the overlay layout must keep
 * clipping to its rounded corners: the generic height rule above relaxes
 * overflow, and the full bleed image is absolutely positioned, so without this
 * it paints over the radius and the tile reads as a hard edged rectangle.
 */
.content-cards--layout-overlay[style*="--content-cards-max-height"] .content-cards__item {
	aspect-ratio: auto;
	height: var(--content-cards-max-height);
	overflow: hidden;
	border-radius: 18px;
}

.content-cards__card {
	display: flex;
	flex-direction: column;
	min-height: 100%;
	color: var(--content-cards-text);
	text-decoration: none;
	box-shadow: none;
}

.content-cards__item--linked:hover,
.content-cards__item--linked:focus-within {
	border-color: var(--content-cards-accent);
	box-shadow: 0 12px 30px rgba(25, 48, 77, 0.14);
	transform: translateY(-3px);
}

.content-cards__card:focus-visible,
.content-cards__button:focus-visible {
	outline: 3px solid var(--content-cards-accent);
	outline-offset: 4px;
}

.content-cards__media {
	display: flex;
	align-items: center;
	justify-content: center;
	aspect-ratio: 4 / 3;
	margin: 0;
	padding: 24px;
	overflow: hidden;
	background: var(--content-cards-muted);
	border-bottom: 1px solid var(--content-cards-border);
}

.content-cards__image {
	display: block;
	width: 100%;
	height: 100%;
	max-height: 220px;
	object-fit: contain;
}

.content-cards__content {
	display: flex;
	flex: 1;
	flex-direction: column;
	align-items: flex-start;
	padding: 24px;
}

.content-cards--align-center .content-cards__content {
	align-items: center;
	text-align: center;
}

.content-cards--align-right .content-cards__content {
	align-items: flex-end;
	text-align: right;
}

.content-cards__item--no-image .content-cards__content {
	padding-top: 30px;
}

.content-cards__title {
	margin: 0;
	padding: 0 0 12px;
	color: var(--content-cards-title);
	font-size: 19px;
	line-height: 1.35;
}

.content-cards__description {
	line-height: 1.6;
}

.content-cards__description > :first-child {
	margin-top: 0;
}

.content-cards__description > :last-child {
	margin-bottom: 0;
}

.content-cards__button {
	margin-top: auto;
}

.content-cards__description + .content-cards__button,
.content-cards__title + .content-cards__button {
	margin-top: 22px;
}

.content-cards__link-indicator {
	position: absolute;
	right: 14px;
	bottom: 14px;
	z-index: 3;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	color: #fff;
	background: #222;
	border-radius: 50%;
	font-size: 26px;
	font-weight: 400;
	line-height: 1;
	transition: background-color 180ms ease, transform 180ms ease;
}

.content-cards--link-card .content-cards__item--linked .content-cards__content {
	padding-bottom: 62px;
}

.content-cards__item--linked:hover .content-cards__link-indicator,
.content-cards__item--linked:focus-within .content-cards__link-indicator {
	background: var(--content-cards-accent);
	transform: rotate(90deg);
}

.content-cards__item--no-title .content-cards__description {
	color: var(--content-cards-title);
	font-size: 17px;
}

.content-cards__item--no-image.content-cards__item--no-title.content-cards__item--no-description .content-cards__content {
	justify-content: center;
	min-height: 140px;
}

.content-cards__item--has-image.content-cards__item--no-title.content-cards__item--no-description .content-cards__content {
	padding-top: 18px;
	padding-bottom: 18px;
}

/* Image or icon above centred content. */
.content-cards--layout-icon .content-cards__item {
	background: transparent;
	border: 0;
}

.content-cards--layout-icon .content-cards__item--linked:hover,
.content-cards--layout-icon .content-cards__item--linked:focus-within {
	box-shadow: none;
}

.content-cards--layout-icon .content-cards__media {
	aspect-ratio: auto;
	min-height: 0;
	padding: 18px 18px 0;
	background: transparent;
	border: 0;
}

.content-cards--layout-icon .content-cards__image {
	width: auto;
	max-width: 100%;
	height: auto;
	max-height: 210px;
}

.content-cards--layout-icon .content-cards__item--has-image.content-cards__item--no-title.content-cards__item--no-description .content-cards__card {
	height: 100%;
	justify-content: flex-start;
}

.content-cards--layout-icon .content-cards__content {
	padding: 10px 16px 4px;
}

.content-cards--layout-icon.content-cards--link-card .content-cards__item--linked .content-cards__content {
	padding-bottom: 4px;
}

.content-cards--link-card .content-cards__link-indicator {
	display: none;
}

.content-cards--layout-icon .content-cards__item--no-image .content-cards__content {
	min-height: 210px;
	justify-content: center;
	padding-top: 30px;
}

.content-cards--layout-icon .content-cards__title {
	font-size: 22px;
	font-weight: 400;
	line-height: 1.25;
}

.content-cards--layout-icon.content-cards--align-center .content-cards__description {
	max-width: 28rem;
}

/* Match the legacy Why Duraproducts icon treatment using true square crops. */
.content-cards--why-duraproducts.content-cards--layout-icon .content-cards__media {
	width: min(100%, 320px);
	aspect-ratio: 1 / 1;
	margin: 0 auto;
	padding: 0;
	border-radius: 50%;
}

.content-cards--why-duraproducts.content-cards--layout-icon .content-cards__image {
	width: 100%;
	height: 100%;
	max-height: none;
	object-fit: cover;
}

.content-cards--why-duraproducts.content-cards--layout-icon .content-cards__title {
	font-size: clamp(25px, 2vw, 34px);
	line-height: 1.2;
}

/* Full-bleed image tiles with individually selected colour overlays. */
.content-cards--layout-overlay .content-cards__item {
	aspect-ratio: 1 / 1;
	overflow: hidden;
	background: var(--content-card-overlay, #284972);
	border: 0;
	border-radius: 18px;
}

.content-cards--layout-overlay .content-cards__item--linked:hover,
.content-cards--layout-overlay .content-cards__item--linked:focus-within {
	border-color: transparent;
	box-shadow: 0 14px 34px rgba(25, 48, 77, 0.2);
}

.content-cards--layout-overlay .content-cards__card {
	position: relative;
	z-index: 1;
	min-height: 100%;
	overflow: hidden;
}

.content-cards--layout-overlay .content-cards__media {
	position: absolute;
	inset: 0;
	z-index: 0;
	aspect-ratio: auto;
	padding: 0;
	background: transparent;
	border: 0;
}

.content-cards--layout-overlay .content-cards__media::after {
	position: absolute;
	inset: 0;
	content: "";
	background: var(--content-card-overlay, #284972);
	opacity: var(--content-card-overlay-opacity, .65);
}

.content-cards--layout-overlay .content-cards__image {
	width: 100%;
	height: 100%;
	max-height: none;
	object-fit: cover;
}

/*
 * When the editor keeps the full image ratio, let the page background show
 * around narrower artwork instead of filling the unused space with overlay blue.
 */
.content-cards--layout-overlay[style*="--content-cards-keep-ratio:1"] .content-cards__item {
	background: transparent;
}

.content-cards--layout-overlay .content-cards__content {
	position: relative;
	z-index: 2;
	justify-content: center;
	min-height: 100%;
	padding: 32px;
}

.content-cards--layout-overlay.content-cards--link-card .content-cards__item--linked .content-cards__content {
	padding-bottom: 64px;
}

.content-cards--layout-overlay .content-cards__title {
	padding-bottom: 8px;
	font-size: clamp(24px, 2.4vw, 40px);
	line-height: 1.12;
}

.content-cards--layout-overlay .content-cards__description {
	font-size: clamp(17px, 1.5vw, 24px);
	line-height: 1.3;
}

.content-cards--layout-overlay .content-cards__item--dark-text,
.content-cards--layout-overlay .content-cards__item--dark-text .content-cards__card,
.content-cards--layout-overlay .content-cards__item--dark-text .content-cards__title {
	color: #12232b;
}

.content-cards--layout-overlay .content-cards__item--light-text,
.content-cards--layout-overlay .content-cards__item--light-text .content-cards__card,
.content-cards--layout-overlay .content-cards__item--light-text .content-cards__title {
	color: #fff;
}

.content-cards--layout-overlay .content-cards__button {
	position: relative;
	z-index: 3;
	margin-top: 22px;
}

.content-cards--layout-overlay .content-cards__item--light-text .content-cards__button {
	color: var(--content-cards-accent);
	background: #fff;
}

.content-cards--layout-overlay .content-cards__item--dark-text .content-cards__button {
	color: #fff;
	background: #12232b;
}

.content-cards--layout-overlay .content-cards__link-indicator {
	right: 16px;
	bottom: 16px;
}

/* An explicitly selected font colour overrides automatic layout contrast. */
.content-cards[style*="--content-cards-font-colour"] .content-cards__card,
.content-cards[style*="--content-cards-font-colour"] .content-cards__title,
.content-cards[style*="--content-cards-font-colour"] .content-cards__description,
.content-cards[style*="--content-cards-font-colour"] .content-cards__description * {
	color: var(--content-cards-font-colour);
}

.content-cards__empty {
	padding: 30px;
	color: #555;
	text-align: center;
	background: #f4f6f8;
	border: 1px dashed #9faab8;
}

/* Keep enabled Businesses calls to action in the card flow and visible below the description. */
.businesses .businesses__background {
	display: flex;
	flex-direction: column;
	height: 100%;
	overflow: visible;
}

.businesses .businesses__text-container {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	overflow: visible;
}

.businesses .businesses__button {
	flex: 0 0 auto;
	align-self: flex-start;
}

.businesses .businesses__button,
.businesses .businesses__description > p > a:only-child {
	display: inline-flex;
	align-items: center;
	justify-content: space-between;
	gap: 18px;
	margin-top: 24px;
}

@media all and (min-width: 767px) {
	.content-cards {
		padding: 60px 0;
	}

	.content-cards__grid {
		column-gap: 30px;
		row-gap: var(--content-cards-gap, 30px);
	}
}

/* Compact Case Study labels: sector and content type share one line. */
.case-study-sector-pill {
	display: inline-flex;
	align-items: center;
	width: fit-content;
	max-width: 100%;
	margin: 0 0 10px;
	padding: 4px 8px 3px;
	vertical-align: top;
	color: #12232b;
	background: #d3e59b;
	border: 1px solid rgba(18, 35, 43, 0.12);
	border-radius: 999px;
	font-size: 9px;
	font-weight: 700;
	line-height: 1.1;
	letter-spacing: 0.03em;
	text-transform: uppercase;
}

.archive-cpt__tag,
.featured-cpt__tag {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: auto;
	min-width: 0;
	height: auto;
	margin: 0 6px 10px 0;
	padding: 4px 9px;
	vertical-align: top;
	font-size: 9px;
	line-height: 1.1;
}

@media (prefers-reduced-motion: reduce) {
	.content-cards__item,
	.content-cards__link-indicator {
		transition: none;
	}
}

/*
 * Statistic titles. Highlighting part of a card title in the editor marks that
 * run as the headline figure: it becomes large, heavy and sits on its own line,
 * while the unhighlighted words stay small. The selectors carry enough
 * specificity to beat the per-layout title sizes above.
 */
.content-cards .content-cards__title.content-cards__title--stat {
	padding-bottom: 0;
	font-size: clamp(15px, 1.3vw, 20px);
	font-weight: 400;
	line-height: 1.3;
}

.content-cards .content-cards__title.content-cards__title--stat strong,
.content-cards .content-cards__title.content-cards__title--stat b {
	display: block;
	margin: 2px 0 4px;
	font-size: clamp(28px, 3vw, 48px);
	font-weight: 800;
	line-height: 1.02;
	letter-spacing: -0.02em;
}

.content-cards .content-cards__title.content-cards__title--stat > strong:first-child,
.content-cards .content-cards__title.content-cards__title--stat > b:first-child {
	margin-top: 0;
}

.content-cards .content-cards__title.content-cards__title--stat > strong:last-child,
.content-cards .content-cards__title.content-cards__title--stat > b:last-child {
	margin-bottom: 0;
}

/* Overlay tiles carry the figure at poster size. */
.content-cards--layout-overlay .content-cards__title.content-cards__title--stat strong,
.content-cards--layout-overlay .content-cards__title.content-cards__title--stat b {
	font-size: clamp(30px, 3.4vw, 56px);
}

.content-cards .content-cards__title--stat + .content-cards__description {
	margin-top: 6px;
}
