/* Case Studies -------------------------------------------------------------- */
.case-studies {
	padding: 64px 0;
}
@media (min-width: 768px) {
	.case-studies {
		padding: 96px 0;
	}
}

/* Header — same rhythm as the Inspiration Gallery it usually sits under. */
.case-studies-header {
	max-width: 820px;
	margin: 0 auto 40px;
	text-align: center;
}
@media (min-width: 400px) {
	.case-studies-header {
		margin-bottom: 60px;
	}
}
.case-studies-heading {
	font-family: var(--font-serif);
	font-size: clamp(2rem, 4vw, 3rem);
	font-weight: 300;
	margin: 0 0 1rem;
}
.case-studies-intro {
	font-size: 1.05rem;
	font-weight: 300;
	color: var(--color-muted);
	margin: 0;
}

/* Grid — 3 / 2 / 1 up, matching the gallery grid's breakpoints. */
.case-studies-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 30px;
}
@media (max-width: 991px) {
	.case-studies-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 16px;
	}
}
@media (max-width: 575px) {
	.case-studies-grid {
		grid-template-columns: 1fr;
	}
}

/* Card — a square photo with the overlay and the link stacked on top of it. */
.case-study-card {
	position: relative;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	background: rgba(0, 0, 0, 0.05);
	color: #fff;
}

.case-study-image,
.case-study-img {
	display: block;
	width: 100%;
	height: 100%;
}
.case-study-img {
	object-fit: cover;
}

/* Overlay — hidden until hover/focus, exactly as on the current site. */
.case-study-overlay {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 10px;
	padding: 20px;
	text-align: center;
	background: rgba(17, 17, 17, 0.85);
	opacity: 0;
	transition: opacity 0.25s ease;
	overflow: auto;
}
.case-study-card:hover .case-study-overlay,
.case-study-card:focus-within .case-study-overlay {
	opacity: 1;
}

.case-study-logo {
	display: block;
	width: 40%;
	max-width: 140px;
	height: auto;
	margin: 0 auto;
}

.case-study-label {
	font-family: var(--font-sans);
	font-size: clamp(1.1rem, 2vw, 1.5rem);
	font-weight: 400;
	line-height: 1.2;
	color: #fff;
	margin: 0;
}

/* Whole-card link, above the overlay so the entire tile is clickable. */
.case-study-link {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: block;
}
.case-study-link:focus-visible {
	outline: 2px solid #fff;
	outline-offset: -6px;
}

/* Without hover the overlay would never appear, so pin it open on touch. */
@media (hover: none) {
	.case-study-overlay {
		opacity: 1;
		background: rgba(17, 17, 17, 0.65);
		justify-content: flex-end;
	}
	.case-study-logo {
		display: none;
	}
}
