.case-search {
	position: relative;
}

.case-search__input {
	appearance: none;
	outline: none;
	box-shadow: none;
	border-radius: 0;
}

.case-search__input::-webkit-search-decoration,
.case-search__input::-webkit-search-cancel-button {
	appearance: none;
}

.case-search__input::placeholder {
	color: var(--color-blueberry, #1e263e);
	opacity: 1;
}

.case-search__input:focus-visible {
	outline: 2px solid var(--color-blue, #5dbde9);
	outline-offset: 4px;
}

.case-search__icon {
	position: absolute;
	right: 0;
	bottom: 10px;
	width: 13px;
	height: 16px;
}

.case-card__video {
	position: absolute;
	top: 16px;
	right: 16px;
	z-index: 2;
	width: 26px;
	height: 26px;
}

.case-stack {
	--case-stack-top: 70px;
	--case-stack-step: 10px;
	/* Space above the section title. It is not part of the card when deciding where the stack locks. */
	--case-stack-lead: clamp(40px, 5.5vw, 80px);
	--case-inline: clamp(24px, 7.65vw, 110px);
	display: flex;
	flex-direction: column;
	gap: 20px;
	padding-top: clamp(40px, 5.5vw, 80px);
	padding-bottom: clamp(40px, 8.3vw, 120px);
}

/* Figma 3020:1494 — stack starts 192px before the 1440px media ends. */
.case-media + .case-stack,
.fullvideo + .case-stack {
	position: relative;
	z-index: 2;
	margin-top: min(-13.333vw, -96px);
}

/* The stack overlaps the video. Keep the play control above that card, and let
   the overlap padding pass pointer events through so the control can be used. */
@media (width >= 1024px) {
	.fullvideo:not(.case-media--portrait):has(+ .case-stack) {
		--fullvideo-pad-y: max(
			calc(var(--fullvideo-pad) + var(--stripe-space)),
			calc(max(13.333vw, 96px) - clamp(40px, 5.5vw, 80px) + var(--fullvideo-pad))
		);
	}

	.fullvideo + .case-stack {
		pointer-events: none;
	}

	.fullvideo + .case-stack > * {
		pointer-events: auto;
	}
}

@media (width < 1024px) {
	.case-media + .case-stack,
	.fullvideo + .case-stack {
		margin-top: 0;
	}

	.case-stack.container {
		width: 100%;
		max-width: none;
		padding-inline: 0;
	}
}

.case-stack::after {
	content: "";
	height: clamp(120px, 30vh, 320px);
}

.case-stack__card {
	--stack-line: calc(var(--case-stack-top) + var(--stack-index, 0) * var(--case-stack-step));
	position: sticky;
	top: var(--stack-top, var(--stack-line));
}

@media (width < 1024px) {
	.case-stack {
		--case-stack-top: 30px;
	}
}

.case-section__inner {
	padding: var(--case-stack-lead, clamp(40px, 5.5vw, 80px)) var(--case-inline, clamp(24px, 7.65vw, 110px));
}

.case-section__bar {
	position: sticky;
	top: var(--stack-bar-top, var(--stack-line));
	z-index: 1;
	height: 10px;
	width: 100%;
}

.case-section__line {
	display: block;
	width: 1px;
	flex: 1;
	min-height: 180px;
	margin-top: 16px;
	background: currentColor;
	opacity: 0.2;
}

.case-section__index {
	min-height: 220px;
}

.case-media--portrait {
	padding-bottom: 40px;
}

.case-media__frame--portrait {
	aspect-ratio: 9 / 16;
	width: min(100%, 420px);
	max-height: 80vh;
}

/* Top shutter on the hero media is half height on phones. */
@media (width < 768px) {
	.case-media .fullvideo__frame.stripe-before,
	.case-media .case-media__frame.stripe-before {
		--stripe-space: 50px;
	}
}

.case-quotes {
	--case-quote-end: 30px;
	width: 100%;
	max-width: 100%;
	min-width: 0;
}

.case-quotes__swiper {
	position: relative;
	width: 100%;
	max-width: 100%;
	min-width: 0;
	height: 100%;
	max-height: 100%;
}

.case-quotes__slide {
	display: grid;
	gap: 24px;
	min-height: 440px;
}

@media (width >= 1024px) {
	.case-quotes__slide {
		grid-template-columns: minmax(0, 1fr) 410px;
		grid-template-rows: minmax(min-content, 1fr);
		align-items: stretch;
		height: auto;
		min-height: 100%;
		max-height: none;
	}

	.case-quotes__slide--text {
		grid-template-columns: minmax(0, 1fr);
		overflow: visible;
	}

	.case-quotes__slide--text .case-quotes__copy {
		padding-right: var(--case-inline, clamp(24px, 7.65vw, 110px));
	}
}

/* Lg (992px card, 410px image) is the reference. Xl cards grow, so keep that same split
   and let the quote fill its column instead of stopping at 600px. */
@media (width >= 1280px) {
	.case-quotes__slide:not(.case-quotes__slide--text) {
		grid-template-columns: minmax(0, 1fr) 41.33%;
	}

	.case-quotes__slide:not(.case-quotes__slide--text) .case-quotes__quote {
		max-width: none;
	}
}

.case-quotes__copy {
	min-width: 0;
	max-width: 100%;
	padding: 80px 40px 190px var(--case-inline, clamp(24px, 7.65vw, 110px));
}

/* One quote has no dots, so it uses the same end gap as the photo. */
@media (width >= 1024px) {
	.case-quotes__swiper.is-static .case-quotes__copy {
		padding-bottom: var(--case-quote-end);
	}

	/* End gap matches the photo. The card grows so the quote is never clipped to keep the name. */
	.case-quotes__slide:not(.case-quotes__slide--text) .case-quotes__copy {
		display: flex;
		flex-direction: column;
		box-sizing: border-box;
		padding-bottom: var(--case-quote-end);
	}

	.case-quotes__slide:not(.case-quotes__slide--text) .case-quotes__copy > svg,
	.case-quotes__slide:not(.case-quotes__slide--text) .case-quotes__attribution {
		flex-shrink: 0;
	}
}

/* Dots need a taller band. The photo ends on the same line as the name. */
@media (width >= 1024px) {
	.case-quotes__swiper:not(.is-static) {
		--case-quote-end: 150px;
	}
}

@media (width < 1024px) {
	.case-quotes__copy {
		padding: 40px var(--case-inline, clamp(24px, 7.65vw, 110px)) 12px;
	}

	/* Stacked: the 24px row gap under the name matches the space under the photo. */
	.case-quotes__slide:not(.case-quotes__slide--text) .case-quotes__copy {
		padding-bottom: 0;
	}
}

.case-quotes__quote,
.case-quotes__attribution {
	color: inherit;
	font-family: var(--font-serif);
	font-weight: 350;
	line-height: 1.1;
	letter-spacing: -0.06em;
	text-wrap: pretty;
}

.case-quotes__quote {
	max-width: 600px;
	--tx-min: 28;
	--tx-max: 40;
	--tx-calc: max(calc(var(--tx-min) * 1px), calc(clamp(
		calc(var(--tx-min) * 1px),
		calc(
			1px * (
				var(--tx-min) + (var(--tx-max) - var(--tx-min)) *
				((var(--fluid-vw) - var(--fluid-min-viewport)) / (var(--fluid-design-width) - var(--fluid-min-viewport)))
			)
		),
		calc(var(--tx-max) * 1px)
	) * var(--fluid-height-scale)));
	--tx-calc-vw: max(calc(var(--tx-min) * 1px), calc(var(--tx-max) * 1px * (1 + var(--fluid-overscale) * (var(--fluid-vw) - var(--fluid-design-width)) / var(--fluid-design-width)) * var(--fluid-height-scale)));
	font-size: var(--tx-calc);
}

.case-quotes__slide--text .case-quotes__quote {
	max-width: 100%;
	overflow-wrap: break-word;
}

.case-quotes__attribution {
	margin-top: 20px;
	font-size: max(20px, calc(clamp(20px, calc(20px + 4 * (var(--fluid-vw) - 375px) / 1065), 24px) * var(--fluid-height-scale)));
}

@media (width >= 1440px) {
	.case-quotes__quote {
		font-size: var(--tx-calc-vw);
	}

	.case-quotes__attribution {
		font-size: max(20px, calc(24 / 1440 * var(--fluid-vw) * var(--fluid-height-scale)));
	}
}

.case-quotes__image {
	margin: 0 var(--case-inline, clamp(24px, 7.65vw, 110px)) 24px;
	aspect-ratio: 306 / 354;
}

/* Md cards are locked to the window. A portrait frame under the quote is taller than
   that window, so the photo is clipped. Use the leftover height and a landscape frame. */
@media (width >= 768px) and (width < 1024px) {
	.case-quotes__slide:not(.case-quotes__slide--text) {
		grid-template-rows: auto minmax(0, 1fr);
		min-height: 0;
	}

	.case-quotes__slide:not(.case-quotes__slide--text) .case-quotes__image {
		aspect-ratio: 16 / 9;
		width: auto;
		max-width: 100%;
		height: auto;
		max-height: 100%;
		min-height: 0;
		align-self: start;
		justify-self: stretch;
	}
}

@media (width >= 1024px) {
	.case-quotes__image {
		margin: 30px 30px var(--case-quote-end, 30px) 0;
		height: auto;
		max-height: none;
		min-height: 0;
		aspect-ratio: auto;
		align-self: stretch;
		overflow: hidden;
	}
}

.case-quotes .case-quotes__swiper > .case-quotes__pagination {
	position: absolute;
	top: auto;
	left: var(--case-inline, clamp(24px, 7.65vw, 110px));
	bottom: 110px;
	width: auto;
	z-index: 2;
	display: flex;
	align-items: center;
	gap: 10px;
}

.case-quotes__swiper .swiper-wrapper,
.case-quotes__swiper .swiper-slide,
.case-quotes__swiper .case-quotes__slide {
	height: auto;
	min-height: 100%;
	max-height: none;
	min-width: 0;
}

.case-quotes__swiper .swiper-slide {
	display: flex;
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	min-height: 0;
}

.case-quotes__swiper .case-quotes__slide {
	flex: 1 1 auto;
	width: 100%;
	max-width: 100%;
	min-height: 100%;
}

/* Single quote: no Swiper, so the slide follows the copy instead of a fixed frame. */
.case-quotes__swiper.is-static {
	height: auto;
	min-height: 100%;
	max-height: none;
	overflow: visible;
}

.case-quotes__swiper.is-static .swiper-wrapper {
	width: 100%;
	transform: none;
}

.case-quotes__swiper.is-static .swiper-slide {
	width: 100%;
	max-width: 100%;
}

.case-quotes__image img,
.case-quotes__image picture {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

@media (width < 1024px) {
	.case-quotes .case-quotes__swiper > .case-quotes__pagination {
		position: relative;
		left: auto;
		bottom: auto;
		margin: 0 var(--case-inline, clamp(24px, 7.65vw, 110px)) 24px;
	}
}

/* Xs and S: stack in normal flow so titles stay on screen and height follows the content. */
@media (width < 768px) {
	.case-stack {
		gap: 0;
	}

	.case-stack::after {
		content: none;
	}

	.case-stack__card,
	.case-section__bar {
		position: static;
	}

	.case-quotes__slide {
		min-height: 0;
	}

	.case-quotes__swiper,
	.case-quotes__swiper .swiper-wrapper,
	.case-quotes__swiper .swiper-slide,
	.case-quotes__swiper .case-quotes__slide {
		height: auto;
		max-height: none;
	}

	.case-quotes__swiper .swiper-wrapper {
		align-items: flex-start;
	}
}

.case-quotes__pagination .swiper-pagination-bullet,
.case-quotes__bullet {
	display: block;
	width: 90px;
	height: 2px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: var(--color-blueberry, #1e263e);
	opacity: 0.2;
	cursor: pointer;
}

.case-quotes__pagination .swiper-pagination-bullet-active,
.case-quotes__bullet.is-active {
	opacity: 1;
}

@media (max-height: 750px) and (min-width: 900px) {
	[data-name="banner-case-studies"] .container {
		padding-top: 180px;
	}
}

@media (max-width: 1023px) {
	[data-name="banner-case-study"] h1 {
		font-size: 58px;
		line-height: 1;
		letter-spacing: -0.04em;
	}

	[data-name="banner-case-study"] > .container > p {
		font-size: 20px;
		line-height: 1.2;
	}

	.case-section h2 {
		font-size: 42px;
		line-height: 1;
		letter-spacing: -0.06em;
	}

	.case-related h2,
	.article-related h2 {
		font-size: 54px;
		line-height: 0.9;
		letter-spacing: -0.06em;
	}
}

/* Gallery is the block above related case studies, so the section gap is dropped. */
.main > .block--carousel:has(+ .case-related) {
	margin-bottom: 0;
}

body.single-case-study .main > .case-related:last-child {
	padding-bottom: 0;
}

/* Full screen has no overlapping card, so the inset matches the side padding. */
.case-media.fullvideo.is-fullscreen :is(.fullvideo__frame, .case-media__frame),
.case-media :is(.fullvideo__frame, .case-media__frame):fullscreen,
.case-media :is(.fullvideo__frame, .case-media__frame):-webkit-full-screen {
	--fullvideo-pad-y: var(--fullvideo-pad);
}

