/**
 * Cases grid.
 *
 * The design is fixed here; the Elementor widget only feeds the custom
 * properties declared on .cases-grid-wrapper.
 */

/*
 * Defaults live in the var() fallbacks below, never as declarations on
 * .cases-grid-wrapper. Elementor writes the style controls onto the widget
 * element, which is an ANCESTOR of the wrapper -- a declaration on the wrapper
 * itself would override those inherited values and the controls would do
 * nothing.
 */

/* -------------------------------------------------------------------------
 * Grid: three equal tracks, items alternating 2 / 1 / 1 / 2 spans so rows read
 * 66-33 then 33-66. nth-child is deliberate -- AJAX appends into this same
 * container, so the alternation continues across loads with no JS bookkeeping.
 * ---------------------------------------------------------------------- */

.cases-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	/* Fixed rather than auto: every row is the same height, so all cards match
	   regardless of how much text each one holds. */
	grid-auto-rows: var(--cases-card-height, 560px);
	gap: var(--cases-gap, 24px);
	align-items: stretch;
	margin: 0;
	padding: 0;
	list-style: none;
}

.cases-grid__item {
	container-type: inline-size;
	display: flex;
	height: 100%;
	margin: 0;
	min-width: 0;
}

.cases-grid__item:nth-child(4n + 1) {
	grid-column: span 2;
}

.cases-grid__item:nth-child(4n + 2) {
	grid-column: span 1;
}

.cases-grid__item:nth-child(4n + 3) {
	grid-column: span 1;
}

.cases-grid__item:nth-child(4n + 4) {
	grid-column: span 2;
}

/* -------------------------------------------------------------------------
 * Card
 * ---------------------------------------------------------------------- */

.cases-card {
	position: relative;
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	justify-content: space-between;
	gap: 24px;
	height: 100%;
	padding: 20px;
	overflow: hidden;
	border-radius: var(--cases-card-radius, 16px);
	background-color: #14110f;
	color: var(--cases-text-color, rgba(255, 255, 255, 0.82));
	text-decoration: none;
}

.cases-card--linked {
	cursor: pointer;
}

.cases-card--linked:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 3px;
}

/* The card root is an <a>, so a theme or Elementor-kit `a:hover { color }`
   rule outranks the colour set on .cases-card and repaints every inheriting
   bit of panel text mid-hover. Pin the colour across all link states. */
.cases-card--linked,
.cases-card--linked:hover,
.cases-card--linked:focus,
.cases-card--linked:focus-visible,
.cases-card--linked:active,
.cases-card--linked:visited {
	color: var(--cases-text-color, rgba(255, 255, 255, 0.82));
}

.cases-card__media {
	position: absolute;
	inset: 0;
	pointer-events: none;
}

/* Scoped through the media wrapper so the rule outranks Elementor's
   `.elementor img { height: auto }`, which would otherwise letterbox the
   image against the top of the card. */
.cases-card__media .cases-card__image,
.cases-card__media .cases-card__placeholder {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	border-radius: 0;
	transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.cases-card__media .cases-card__placeholder {
	background: linear-gradient(140deg, #3a3330, #14110f);
}

.cases-card--linked:hover .cases-card__image,
.cases-card:hover .cases-card__image {
	transform: scale(1.04);
}

.cases-card__head,
.cases-card__panel {
	position: relative;
	z-index: 1;
}

/* Head: tags left, logo right ------------------------------------------- */

.cases-card__head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
}

.cases-card__tags {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.cases-card__tag {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 7px 15px;
	border-radius: var(--cases-tag-radius, 999px);
	background: var(--cases-tag-background, rgba(20, 17, 15, 0.42));
	-webkit-backdrop-filter: blur(14px);
	backdrop-filter: blur(14px);
	color: var(--cases-tag-color, #fff);
	font-size: 13px;
	line-height: 1.2;
	white-space: nowrap;
}

.cases-card__logo {
	flex: none;
	margin-inline-start: auto;
}

.cases-card__logo .cases-card__logo-image {
	display: block;
	width: auto;
	max-width: 140px;
	max-height: 28px;
	height: auto;
	object-fit: contain;
	/* The logo sits directly on the photo with no scrim behind it, so a light
	   sky would otherwise swallow a white wordmark. Invisible on dark images. */
	filter: drop-shadow(0 1px 6px rgba(0, 0, 0, 0.55));
}

/* Frosted panel: insights left, content right ---------------------------- */

.cases-card__panel {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 6cqi;
	margin-top: auto;
	padding: 24px 28px;
	border: 1px solid rgba(255, 255, 255, 0.16);
	border-radius: 22px;
	background: color-mix(
		in srgb,
		var(--cases-panel-color, #171412) calc(var(--cases-panel-opacity, 0.34) * 100%),
		transparent
	);
	-webkit-backdrop-filter: blur(5px);
	backdrop-filter: blur(5px);
}

/* The tint above is deliberately light -- the panel leans mostly on the blur.
   Where blur is unsupported the tint alone cannot separate white text from the
   photo, so fall back to a heavier flat one purely for legibility. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
	.cases-card__panel {
		background: rgba(23, 20, 18, 0.55);
	}
}

.cases-card__insights {
	display: flex;
	flex: 0 1 auto;
	flex-direction: column;
	gap: 20px;
	min-width: 0;
}

.cases-card__insight {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.cases-card__insight-number {
	color: var(--cases-insight-color, #fff);
	font-size: clamp(30px, 5cqi, 46px);
	font-weight: 400;
	line-height: 1.05;
	letter-spacing: -0.02em;
}

.cases-card__insight-label {
	color: var(--cases-insight-label-color, inherit);
	font-size: 13px;
	line-height: 1.35;
	opacity: var(--cases-insight-label-opacity, 0.85);
}

.cases-card__content {
	display: flex;
	flex: 1 1 52%;
	flex-direction: column;
	gap: 8px;
	min-width: 0;
	max-width: 46ch;
}

.cases-card__title {
	margin: 0;
	color: var(--cases-title-color, #fff);
	font-size: clamp(20px, 3.4cqi, 30px);
	font-weight: 600;
	line-height: 1.15;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.cases-card__excerpt {
	margin: 0;
	color: var(--cases-excerpt-color, inherit);
	font-size: 15px;
	line-height: 1.45;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.cases-card__button {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	align-self: flex-start;
	margin-top: 8px;
	color: var(--cases-title-color, #fff);
	font-size: 15px;
	text-decoration: none;
	border-bottom: 1px solid currentColor;
	padding-bottom: 2px;
}

/* Same story as the card root: keep the read-more link off the theme's
   link-hover colour. */
.cases-card__button:hover,
.cases-card__button:focus,
.cases-card__button:focus-visible,
.cases-card__button:active,
.cases-card__button:visited {
	color: var(--cases-title-color, #fff);
}

.cases-card__button:hover .cases-card__arrow {
	transform: translateX(4px);
}

.cases-card__arrow {
	transition: transform 0.25s ease;
}

/* -------------------------------------------------------------------------
 * Narrow cards (the 33% column) keep the insights-left / text-right split and
 * simply tighten up. Only phone-width cards fall back to a single column.
 * ---------------------------------------------------------------------- */

@container (max-width: 620px) {
	.cases-card {
		gap: 16px;
		padding: 16px;
	}

	.cases-card__panel {
		gap: 18px;
		padding: 18px 20px;
		border-radius: 18px;
	}

	.cases-card__insights {
		gap: 12px;
	}

	.cases-card__insight-number {
		font-size: 27px;
	}

	.cases-card__insight-label {
		font-size: 12px;
	}

	.cases-card__title {
		font-size: 19px;
	}

	.cases-card__excerpt {
		font-size: 13px;
	}

	.cases-card__button {
		margin-top: 4px;
		font-size: 13px;
	}

	.cases-card__content {
		flex-basis: 56%;
		max-width: none;
	}
}

@container (max-width: 360px) {
	.cases-card__panel {
		flex-direction: column;
		align-items: stretch;
		gap: 16px;
	}
}

/* -------------------------------------------------------------------------
 * Load more
 * ---------------------------------------------------------------------- */

.cases-grid__foot {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	margin-top: var(--cases-gap, 24px);
}

.cases-grid__sentinel {
	width: 100%;
	height: 1px;
}

.cases-grid__load-more {
	padding: 12px 28px;
	border: 1px solid currentColor;
	border-radius: 999px;
	background: transparent;
	color: inherit;
	font: inherit;
	cursor: pointer;
	transition: opacity 0.2s ease;
}

.cases-grid__load-more[hidden] {
	display: none;
}

.cases-grid__load-more[disabled] {
	opacity: 0.55;
	cursor: default;
}

.cases-grid__status {
	margin: 0;
	font-size: 14px;
	min-height: 1em;
}

.cases-grid__status:empty {
	display: none;
}

.cases-grid-wrapper.is-loading .cases-grid__load-more {
	opacity: 0.55;
}

.cases-grid__empty {
	margin: 0;
	padding: 24px;
	border: 1px dashed currentColor;
	border-radius: var(--cases-card-radius, 16px);
	text-align: center;
	opacity: 0.7;
}

/* -------------------------------------------------------------------------
 * Responsive
 * ---------------------------------------------------------------------- */

@media (max-width: 1024px) {
	.cases-grid {
		grid-template-columns: 1fr;
		grid-auto-rows: min(var(--cases-card-height, 560px), 78vh);
	}

	.cases-grid__item:nth-child(n) {
		grid-column: span 1;
	}
}

@media (prefers-reduced-motion: reduce) {
	.cases-card__image,
	.cases-card__arrow {
		transition: none;
	}

	.cases-card--linked:hover .cases-card__image,
	.cases-card:hover .cases-card__image {
		transform: none;
	}
}
