/* ==========================================================================
   Case Studies Grid
   Override any token below on .csg (or a parent) to re-skin.
   ========================================================================== */

.csg {
	--csg-accent: #F3660C;
	--csg-accent-ink: #f8f6f0;
	--csg-ink: #121212;
	--csg-card-ink: #f8f6f0;
	--csg-hairline: rgba(23, 22, 26, 0.35);
	--csg-columns-desktop: 2;
	--csg-columns-tablet: 2;
	--csg-columns-mobile: 1;
	--csg-columns: var(--csg-columns-desktop);
	--csg-ratio: 41 / 50;
	--csg-gap: clamp(1rem, 2.2vw, 2.1rem);
	--csg-pad: clamp(1.1rem, 2.1vw, 1.85rem);
	--csg-radius: 0;
	--csg-ease: cubic-bezier(0.22, 0.72, 0.16, 1);
	--csg-display: inherit; /* set this to your condensed display face */

	position: relative;
}

.csg *,
.csg *::before,
.csg *::after {
	box-sizing: border-box;
}

.csg-sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* --------------------------------------------------------------------------
   Filters
   -------------------------------------------------------------------------- */

.csg-filters {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.5rem;
	margin: 0 0 clamp(1.75rem, 5.5vw, 4.25rem);
}

.csg-filter {
	appearance: none;
	margin: 0;
	padding: 0.55rem 0.95rem;
	border: 1px solid #121212;
	border-radius: var(--csg-radius);
	background: transparent;
	color: var(--csg-ink);
	font: inherit;
	font-size: clamp(0.78rem, 0.9vw, 0.875rem);
	line-height: 1;
	cursor: pointer;
	transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.csg-filter:hover {
	border-color: var(--csg-ink);
	background:var(--csg-accent);
	border-radius:var(--csg-radius);
	color:#121212;
}

.csg-filter.is-active {
	border-color: var(--csg-ink);
	background:var(--csg-accent);
	border-radius:var(--csg-radius);
	color:#121212;
}

.csg-filter:focus-visible, .csg-filter:focus {
	border-color: var(--csg-ink);
	background:var(--csg-accent);
	border-radius:var(--csg-radius);
	color:#121212;
}

/* --------------------------------------------------------------------------
   Grid
   -------------------------------------------------------------------------- */

.csg-grid {
	display: grid;
	grid-template-columns: repeat(var(--csg-columns), minmax(0, 1fr));
	gap: var(--csg-gap);
	transition: opacity 0.25s ease;
}

.csg.is-swapping .csg-grid {
	opacity: 0.25;
}

.csg-empty {
	grid-column: 1 / -1;
	margin: 0;
	padding: clamp(2rem, 6vw, 4rem) 0;
	text-align: center;
	color: var(--csg-ink);
	opacity: 0.7;
}

.csg-sentinel {
	height: 1px;
}

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

.csg-card {
	position: relative;
	aspect-ratio: var(--csg-ratio);
	overflow: hidden;
	isolation: isolate;
	border-radius: var(--csg-radius);
	background: #111;
	color: #fff;
	animation: csg-in 0.5s var(--csg-ease) both;
}

@keyframes csg-in {
	from { opacity: 0; transform: translateY(12px); }
	to   { opacity: 1; transform: none; }
}

.csg-card__media,
.csg-card__scrim {
	position: absolute;
	inset: 0;
}

.csg-card__media { z-index: 0; }
.csg-card__scrim { z-index: 1; }
.csg-card__body  { z-index: 2; }

.csg-card__video,
.csg-card__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transform: scale(1.001);
	transition: transform 0.9s var(--csg-ease);
}

.csg-card__scrim {
	background: linear-gradient(
		to top,
		rgba(0, 0, 0, 0.74) 0%,
		rgba(0, 0, 0, 0.34) 34%,
		rgba(0, 0, 0, 0) 64%
	);
	transition: background 0.5s ease;
}

/* Body — bottom-anchored, two columns, both bottom-aligned */

.csg-card__body {
	position: absolute;
	inset: auto 0 0 0;
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	align-items: end;
	gap: clamp(0.9rem, 2.2vw, 2rem);
	padding: var(--csg-pad);
	pointer-events: none;
}

.csg-card__col {
	min-width: 0;
}

.csg-card__title {
	margin: 0;
	color: var(--csg-card-ink);
	font-size: clamp(0.72rem, 0.85vw, 0.82rem);
	font-weight: 700;
	letter-spacing: 0.075em;
	line-height: 1.35;
	text-transform: uppercase;
}

/* The reveal: rows animate 0fr → 1fr, so the title is pushed up by the
   content growing underneath it. */

.csg-card__reveal {
	display: grid;
	grid-template-rows: 0fr;
	transition: grid-template-rows 0.55s var(--csg-ease);
}

.csg-card__clip {
	
	min-height: 0;
}

.csg-card__inner {
	opacity: 0;
	transform: translateY(16px);
	transition: opacity 0.3s ease, transform 0.5s var(--csg-ease);
}

.csg-card__excerpt {
	margin: 0.8rem 0 0;
	color: var(--csg-card-ink);
	font-family: var(--global-heading-font-family);
	font-size: clamp(2rem, 4.4vw, 4rem);
	font-weight: 800;
	line-height: 0.84;
	letter-spacing: -0.02em;
	translate: -1px 0;
	text-transform: uppercase;
}

/* An editor who put a <br> in the excerpt meant it, so stop balancing
   around them and let the manual break decide the line. */
.csg-card__excerpt {
	text-wrap: balance;
}

.csg-card__excerpt:has(br) {
	text-wrap: normal;
}

.csg-card__terms {
	list-style: none;
	margin: clamp(1rem, 2.4vw, 2rem) 0 0;
	padding: 0!important;
	font-size: clamp(0.85rem, 1.05vw, 1.05rem);
	font-weight: 700;
	line-height: 1.3;
	text-transform: capitalize;
}

.csg-card__desc {
	font-size: clamp(0.7rem, 0.8vw, 0.8rem);
	line-height: 1.45;
	max-width: 28ch;
}

.csg-card__desc p {
	margin: 0 0 0.65em;
}

.csg-card__desc p:last-child {
	margin-bottom: 0;
}

.csg-card__plus {
	display: block;
	margin-bottom: 0.35rem;
	font-size: 0.85rem;
	line-height: 1;
}

.csg-card__cta {
	display: inline-flex;
	align-items: center;
	gap: 0.55rem;
	margin-top: clamp(1.1rem, 2.8vw, 2.5rem);
	padding: 0.6rem 1rem;
	border: 1px solid rgba(255, 255, 255, 0.8);
	border-radius: var(--csg-radius);
	color: #fff;
	font-size: clamp(0.7rem, 0.8vw, 0.8rem);
	line-height: 1;
	white-space: nowrap;
	text-decoration: none;
	pointer-events: auto; /* the only clickable thing on the card */
	transition: background-color 0.25s ease, color 0.25s ease;
}

.csg-card__cta:hover,
.csg-card__cta:focus-visible,
.csg-card__cta:active {
	background: #F3660C;
	color: #121212;
	border-color:#121212;
}

.csg-card__cta:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 3px;
}

.csg-card__cta svg {
	flex: none;
}

button[data-csg-filter="uncategorized"] {
	display:none;
}

/* Open state ------------------------------------------------------------- */

@media (hover: hover) and (pointer: fine) {
	.csg-card:hover .csg-card__reveal,
	.csg-card:focus-within .csg-card__reveal {
		grid-template-rows: 1fr;
	}

	.csg-card:hover .csg-card__inner,
	.csg-card:focus-within .csg-card__inner {
		opacity: 1;
		transform: none;
		transition-delay: 0.06s;
	}

	.csg-card:hover .csg-card__scrim,
	.csg-card:focus-within .csg-card__scrim {
		background: linear-gradient(
			to top,
			rgba(0, 0, 0, 0.9) 0%,
			rgba(0, 0, 0, 0.7) 54%,
			rgba(0, 0, 0, 0) 100%
		);
	}

	.csg-card:hover .csg-card__video,
	.csg-card:hover .csg-card__img {
		transform: scale(1.04);
	}
}

/* Touch / no-hover: nothing to hover, so show it all. */
@media (hover: none), (pointer: coarse) {
	.csg-card__reveal { grid-template-rows: 1fr; }
	.csg-card__inner  { opacity: 1; transform: none; }
	.csg-card__scrim {
		background: linear-gradient(
			to top,
			rgba(0, 0, 0, 0.85) 0%,
			rgba(0, 0, 0, 0.55) 58%,
			rgba(0, 0, 0, 0.15) 100%
		);
	}
}

/* --------------------------------------------------------------------------
   Loading status
   -------------------------------------------------------------------------- */

.csg-status {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.6rem;
	min-height: 3rem;
	margin: clamp(1.25rem, 3vw, 2.5rem) 0 0;
	font-size: 0.8rem;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--csg-ink);
	opacity: 0;
	transition: opacity 0.2s ease;
}

.csg.is-loading .csg-status {
	opacity: 0.65;
}

.csg-status:has(.csg-status__text:not(:empty)) {
	opacity: 0.65;
}

.csg-spinner {
	width: 14px;
	height: 14px;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	opacity: 0;
	animation: csg-spin 0.7s linear infinite;
}

.csg.is-loading .csg-spinner {
	opacity: 1;
}

@keyframes csg-spin {
	to { transform: rotate(360deg); }
}

/* --------------------------------------------------------------------------
   Responsive — Kadence breakpoints (tablet <= 1024px, mobile <= 767px)
   -------------------------------------------------------------------------- */

@media (max-width: 1024px) {
	.csg {
		--csg-columns: var(--csg-columns-tablet);
	}
}

@media (max-width: 767px) {
	.csg {
		--csg-columns: var(--csg-columns-mobile);
	}

	.csg-card__body {
		.csg-card__desc {display:none;}
		gap: 0;
		grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr);
	}
	.csg-card__inner:has( .csg-card__cta ) {
		display:flex;
		justify-content: flex-end;
	}
	.csg-card__cta span, .csg-card__title {
		font-size:15px;
		white-space:nowrap;
	}
	.csg-card__excerpt {
		    font-size: 50px;
   			white-space: nowrap;
	}
	.csg-card__terms {
		    font-size: 15px;
			white-space: nowrap;
	}
	.csg-filters button {
		font-size:16px;
	}
	.csg-filters {
		max-width: 450px;
    	margin: 0 auto clamp(1.75rem, 5.5vw, 4.25rem);
	}
}

/* --------------------------------------------------------------------------
   Reduced motion
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	.csg-card,
	.csg-card__reveal,
	.csg-card__inner,
	.csg-card__video,
	.csg-card__img,
	.csg-card__scrim,
	.csg-grid {
		animation: none !important;
		transition: none !important;
	}
	.csg-spinner { animation-duration: 2s; }
}
