/**
 * RSW SM5 Case Studies.
 * Values from the approved mockup (HTML/case-studies.html) and the brief, section 5.
 * Never sets a literal font-family: headings use the theme's; small labels use
 * --sm5cs-font-head (the theme heading font, printed by the plugin) or inherit.
 * Breakpoints follow Beaver Builder: 1024 / 992 / 768 / 480.
 */

.sm5cs,
.sm5cs-latest {
	--sm5cs-orange: #f98439;
	--sm5cs-rich: #1d1d1b;
	--sm5cs-black: #000;
	--sm5cs-grey: #b4b4b2;
	--sm5cs-lede: #f1f1f1;
	--sm5cs-line: #595959;
	--sm5cs-gutter: clamp(20px, 5vw, 48px);
	--sm5cs-ease: cubic-bezier(.4, 0, .2, 1);
}

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

.sm5cs {
	color: #fff;
}

.sm5cs-wrap {
	max-width: 1240px;
	margin: 0 auto;
}

/* Theme resets for the elements the plugin prints.
   Vertical gaps below include the 20px Beaver Builder module margins the mockup renders with
   (e.g. sector top to heading 90 + 20 = 110). */
.sm5cs h2,
.sm5cs h3,
.sm5cs p,
.sm5cs ul,
.sm5cs dl,
.sm5cs dd,
.sm5cs-latest h2,
.sm5cs-latest p,
.sm5cs-latest ul {
	margin: 0;
	padding: 0;
}

.sm5cs h2,
.sm5cs h3,
.sm5cs-latest h2 {
	color: #fff;
	line-height: 1;
	text-transform: lowercase;
}

/* Eyebrow: "Case study 01" and the tile sector name. */
.sm5cs-eyebrow {
	font-family: var(--sm5cs-font-head, inherit);
	font-size: 12px;
	font-weight: 800;
	line-height: 1.6;
	letter-spacing: 1.5px;
	text-transform: uppercase;
	color: var(--sm5cs-orange);
}

.sm5cs .sm5cs-eyebrow,
.sm5cs-latest .sm5cs-eyebrow {
	margin-bottom: 2px;
}

/* ==========================================================================
   Index: black, skyline along the bottom
   ========================================================================== */

.sm5cs-index {
	background: #000 url("../img/skyline-tile-60.png") repeat-x left bottom;
	background-size: auto;
	padding: 90px var(--sm5cs-gutter) 140px;
}

/* Filter */
.sm5cs-filter {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin: 0 0 40px;
}

.sm5cs-filter__btn {
	-webkit-appearance: none;
	appearance: none;
	margin: 0;
	font-family: var(--sm5cs-font-head, inherit);
	font-size: 12px;
	font-weight: 800;
	line-height: 1;
	letter-spacing: 1.5px;
	text-transform: uppercase;
	color: #fff;
	background: transparent;
	border: 1px solid var(--sm5cs-line);
	border-radius: 0;
	padding: 12px 20px;
	cursor: pointer;
	box-shadow: none;
	text-shadow: none;
	transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}

.sm5cs-filter__btn:hover,
.sm5cs-filter__btn:focus-visible {
	color: #fff;
	background: transparent;
	border-color: var(--sm5cs-orange);
}

.sm5cs-filter__btn:focus-visible {
	outline: 2px solid var(--sm5cs-orange);
	outline-offset: 2px;
}

.sm5cs-filter__btn[aria-pressed="true"],
.sm5cs-filter__btn[aria-pressed="true"]:hover {
	color: #000;
	background: var(--sm5cs-orange);
	border-color: var(--sm5cs-orange);
}

/* Tiles */
.sm5cs-tiles {
	list-style: none;
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 20px 18px;
	/* Rows keep their size while the filter animates the grid's height. */
	align-content: start;
}

.sm5cs-tiles__item {
	margin: 0;
	padding: 0;
	list-style: none;
}

.sm5cs-tiles__item[hidden] {
	display: none !important;
}

.sm5cs-tile {
	position: relative;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	overflow: hidden;
	height: 100%;
	padding: 220px 26px 26px;
	background-color: var(--sm5cs-rich);
	color: #fff;
	text-decoration: none;
	transition: transform .35s ease;
}

.sm5cs-tile:hover,
.sm5cs-tile:focus {
	color: #fff;
	text-decoration: none;
}

.sm5cs-tile:hover {
	transform: translateY(-6px) scale(1.02);
}

.sm5cs-tile:focus-visible {
	outline: 2px solid var(--sm5cs-orange);
	outline-offset: 2px;
}

.sm5cs-tile__img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	object-position: center;
}

.sm5cs-tile::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
	background: linear-gradient(0deg, rgba(0, 0, 0, .59) 11%, rgba(0, 0, 0, .07) 80%);
}

.sm5cs-tile > p,
.sm5cs-tile > h2 {
	position: relative;
	z-index: 2;
}

.sm5cs .sm5cs-tile__title,
.sm5cs-latest .sm5cs-tile__title {
	margin-top: 2px;
	font-size: 24px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	/* Room for descenders that the 1.0 line-height would clip. */
	padding-bottom: .12em;
	margin-bottom: -.12em;
}

/* [sm5_case_studies_latest] */
.sm5cs-latest {
	background: transparent;
}

.sm5cs-latest--cols-2 .sm5cs-tiles {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.sm5cs-latest--cols-3 .sm5cs-tiles {
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* layout="feature": two large tiles, then three small, repeating (staging homepage). */
.sm5cs-latest--feature .sm5cs-tiles {
	grid-template-columns: repeat(6, minmax(0, 1fr));
}

.sm5cs-latest--feature .sm5cs-tiles__item {
	grid-column: span 2;
}

.sm5cs-latest--feature .sm5cs-tiles__item:nth-child(5n + 1),
.sm5cs-latest--feature .sm5cs-tiles__item:nth-child(5n + 2) {
	grid-column: span 3;
}

/* Homepage tile recipe: text 46px in, eyebrow 240px down, title straight under it; bigger lift. */
.sm5cs-latest--feature .sm5cs-tile {
	padding: 240px 46px 46px;
	transition: transform .3s ease, filter .3s ease;
}

.sm5cs-latest--feature .sm5cs-tile:hover {
	transform: translateY(-8px) scale(1.04);
	filter: drop-shadow(0 8px 8px rgba(0, 0, 0, .2));
}

.sm5cs-latest--feature .sm5cs-tile__title {
	margin-top: 0;
}

/* ==========================================================================
   Sectors and projects
   ========================================================================== */

.sm5cs-sector {
	padding: 110px var(--sm5cs-gutter);
}

.sm5cs-sector--rich {
	background-color: var(--sm5cs-rich);
}

.sm5cs-sector--black {
	background-color: var(--sm5cs-black);
}

.sm5cs-sector__head {
	padding-bottom: 30px;
	border-bottom: 1px solid var(--sm5cs-line);
}

.sm5cs .sm5cs-sector__title {
	font-size: clamp(36px, 4.6vw, 52px);
}

.sm5cs-project {
	margin-top: 76px;
	scroll-margin-top: 110px;
}

.sm5cs-project:focus {
	outline: none;
}

.sm5cs-divider {
	height: 1px;
	margin: 110px 0;
	padding: 0;
	border: 0;
	background: var(--sm5cs-line);
	color: var(--sm5cs-line);
	opacity: 1;
}

.sm5cs-divider + .sm5cs-project {
	margin-top: 0;
}

.sm5cs .sm5cs-project__title {
	margin-top: 12px;
	max-width: 900px;
	font-size: clamp(28px, 3.2vw, 38px);
}

/* Client / sector strip */
.sm5cs .sm5cs-strip {
	display: grid;
	grid-template-columns: 9% minmax(0, 1fr) 12% minmax(0, 1fr);
	align-items: stretch;
	margin-top: 44px;
	border-top: 1px solid var(--sm5cs-line);
	border-bottom: 1px solid var(--sm5cs-line);
}

.sm5cs .sm5cs-strip__label,
.sm5cs .sm5cs-strip__value {
	display: flex;
	align-items: center;
	margin: 0;
	padding: 14px 0;
}

.sm5cs-strip__label {
	font-family: var(--sm5cs-font-head, inherit);
	font-size: 12px;
	font-weight: 800;
	line-height: 1.6;
	letter-spacing: 1.5px;
	text-transform: uppercase;
	color: var(--sm5cs-grey);
}

.sm5cs .sm5cs-strip__label--split {
	padding-left: 40px;
	border-left: 1px solid var(--sm5cs-line);
}

.sm5cs-strip__value {
	font-size: 18px;
	line-height: 1.4;
	color: #fff;
}

/* Gallery: lead + three */
.sm5cs-gallery {
	--sm5cs-gallery-h: 380px;
	display: grid;
	gap: 18px;
	margin-top: 40px;
	height: var(--sm5cs-gallery-h);
}

.sm5cs-gallery--n1 { grid-template-columns: 1fr; }
.sm5cs-gallery--n2 { grid-template-columns: 3fr 2fr; }
.sm5cs-gallery--n3 { grid-template-columns: 2fr 1fr 1fr; }
.sm5cs-gallery--n4 { grid-template-columns: 2fr 1fr 1fr 1fr; }

.sm5cs-gallery--lead-right.sm5cs-gallery--n2 { grid-template-columns: 2fr 3fr; }
.sm5cs-gallery--lead-right.sm5cs-gallery--n3 { grid-template-columns: 1fr 1fr 2fr; }
.sm5cs-gallery--lead-right.sm5cs-gallery--n4 { grid-template-columns: 1fr 1fr 1fr 2fr; }
.sm5cs-gallery--lead-right .sm5cs-gallery__item--lead { order: 9; }

.sm5cs-gallery__item {
	position: relative;
	display: block;
	min-width: 0;
	height: 100%;
	overflow: hidden;
	background: var(--sm5cs-black);
	cursor: zoom-in;
}

.sm5cs-gallery__img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
}

.sm5cs-gallery__item::after {
	content: "";
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0);
	transition: background-color .3s ease;
	pointer-events: none;
}

.sm5cs-gallery__item:hover::after,
.sm5cs-gallery__item:focus-visible::after {
	background: rgba(0, 0, 0, .28);
}

.sm5cs-gallery__item:focus-visible {
	outline: 2px solid var(--sm5cs-orange);
	outline-offset: 3px;
}

.sm5cs-gallery__count {
	position: absolute;
	left: 0;
	bottom: 0;
	z-index: 1;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 9px 12px 9px 10px;
	font-family: var(--sm5cs-font-head, inherit);
	font-size: 12px;
	font-weight: 800;
	line-height: 1;
	letter-spacing: 1.5px;
	text-transform: uppercase;
	color: #fff;
	background: rgba(0, 0, 0, .72);
	transition: background-color .2s ease, color .2s ease;
}

.sm5cs-gallery__count svg {
	width: 14px;
	height: 14px;
	fill: currentColor;
	flex: none;
}

.sm5cs-gallery__item--lead:hover .sm5cs-gallery__count,
.sm5cs-gallery__item--lead:focus-visible .sm5cs-gallery__count {
	color: #000;
	background: var(--sm5cs-orange);
}

/* Copy */
/* BB columns: 32.9 / 67.1 of the row plus its -10px gutters, 40px extra right of the intro. */
.sm5cs-copy {
	display: grid;
	grid-template-columns: 32.9% minmax(0, 67.1%);
	margin: 76px -10px 0;
}

.sm5cs-copy__intro,
.sm5cs-copy__body {
	padding: 0 10px;
}

.sm5cs-copy__intro {
	padding-right: 50px;
}

.sm5cs-copy__intro p {
	font-size: 21px;
	line-height: 1.65;
	color: var(--sm5cs-lede);
}

.sm5cs-copy__body {
	font-size: 18px;
	line-height: 1.65;
	color: var(--sm5cs-grey);
}

.sm5cs-copy__body p {
	margin: 0 0 1.1em;
	font-size: inherit;
	line-height: inherit;
	color: inherit;
}

.sm5cs-copy__body > :last-child {
	margin-bottom: 0;
}

.sm5cs-copy__body a {
	color: var(--sm5cs-orange);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1200px) {
	.sm5cs .sm5cs-tile__title,
	.sm5cs-latest .sm5cs-tile__title {
		font-size: 20px;
	}

	.sm5cs-latest--feature .sm5cs-tile__title {
		font-size: 24px;
	}
}

@media (max-width: 1024px) {
	.sm5cs-tiles,
	.sm5cs-latest .sm5cs-tiles {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.sm5cs-latest--feature .sm5cs-tiles {
		grid-template-columns: repeat(6, minmax(0, 1fr));
	}
}

@media (max-width: 992px) {
	.sm5cs-gallery {
		--sm5cs-gallery-h: 300px;
	}
}

@media (max-width: 768px) {
	.sm5cs-index {
		padding-top: 64px;
		padding-bottom: 80px;
	}

	.sm5cs-tile {
		padding-top: 140px;
	}

	/* Feature layout on phones: one column, tiles at most 360px wide, centred. */
	.sm5cs-latest--feature .sm5cs-tiles {
		grid-template-columns: minmax(0, 360px);
		justify-content: center;
		gap: 40px;
	}

	.sm5cs-latest--feature .sm5cs-tiles__item,
	.sm5cs-latest--feature .sm5cs-tiles__item:nth-child(n) {
		grid-column: auto;
	}

	.sm5cs-latest--feature .sm5cs-tile {
		padding: 240px 20px 50px;
	}

	.sm5cs-latest--feature .sm5cs-tile__title {
		font-size: 20px;
	}

	.sm5cs-sector {
		padding-top: 84px;
		padding-bottom: 84px;
	}

	.sm5cs-project {
		margin-top: 60px;
	}

	/* Mockup: 84 above, 110 below (the second project's BB margin is not responsive). */
	.sm5cs-divider {
		margin: 84px 0 110px;
	}

	/* Two rows: Client, then Sector. */
	.sm5cs .sm5cs-strip {
		grid-template-columns: 30% minmax(0, 70%);
	}

	.sm5cs .sm5cs-strip__label,
	.sm5cs .sm5cs-strip__value {
		padding: 12px 0;
	}

	.sm5cs-strip__label:first-child,
	.sm5cs-strip__label:first-child + .sm5cs-strip__value {
		border-bottom: 1px solid var(--sm5cs-line);
	}

	.sm5cs .sm5cs-strip__label--split {
		padding-left: 0;
		border-left: 0;
	}

	/* Lead full width, the rest in a row below; lead always first. */
	.sm5cs-gallery,
	.sm5cs-gallery[class*="lead-right"] {
		height: auto;
		gap: 12px;
		grid-template-columns: repeat(6, minmax(0, 1fr));
	}

	.sm5cs-gallery__item {
		grid-column: span 2;
		height: 120px;
	}

	.sm5cs-gallery--n3 .sm5cs-gallery__item {
		grid-column: span 3;
	}

	.sm5cs-gallery--n2 .sm5cs-gallery__item,
	.sm5cs-gallery .sm5cs-gallery__item--lead {
		grid-column: 1 / -1;
	}

	.sm5cs-gallery .sm5cs-gallery__item--lead {
		order: 0;
		height: 260px;
	}

	.sm5cs-copy {
		grid-template-columns: minmax(0, 1fr);
		gap: 44px;
	}

	.sm5cs-copy__intro {
		padding-right: 10px;
	}
}

@media (max-width: 480px) {
	.sm5cs-filter {
		gap: 8px;
		margin-bottom: 28px;
	}

	.sm5cs-filter__btn {
		padding: 10px 14px;
	}

	.sm5cs-tiles {
		gap: 12px;
	}

	.sm5cs-tile {
		padding: 120px 14px 14px;
	}

	.sm5cs .sm5cs-tile__title,
	.sm5cs-latest .sm5cs-tile__title {
		font-size: 19px;
		white-space: normal;
	}

	/* Feature tiles stay full size on phones (one per row). */
	.sm5cs-latest--feature .sm5cs-tiles {
		gap: 40px;
	}

	.sm5cs-latest--feature .sm5cs-tile {
		padding: 240px 20px 50px;
	}

	.sm5cs-latest--feature .sm5cs-tile__title {
		font-size: 20px;
		white-space: nowrap;
	}
}

@media (prefers-reduced-motion: reduce) {
	.sm5cs-tile,
	.sm5cs-filter__btn,
	.sm5cs-gallery__item::after,
	.sm5cs-gallery__count {
		transition: none;
	}

	.sm5cs-tile:hover,
	.sm5cs-latest--feature .sm5cs-tile:hover {
		transform: none;
	}
}

/* ==========================================================================
   Lightbox (built by sm5-cs-lightbox.js)
   ========================================================================== */

.sm5cs-lb {
	--sm5cs-orange: #f98439;
	--sm5cs-gutter: clamp(20px, 5vw, 48px);
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	flex-direction: column;
	background: rgba(0, 0, 0, .95);
	color: #fff;
	opacity: 1;
	transition: opacity .2s ease;
}

.sm5cs-lb[hidden],
.sm5cs-lb [hidden] {
	display: none !important;
}

.sm5cs-lb.is-entering {
	opacity: 0;
}

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

.sm5cs-lb__top {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 20px;
	padding: 18px var(--sm5cs-gutter);
}

.sm5cs-lb__count {
	margin: 0 0 4px;
	font-family: var(--sm5cs-font-head, inherit);
	font-size: 12px;
	font-weight: 800;
	line-height: 1.2;
	letter-spacing: 1.5px;
	text-transform: uppercase;
	color: var(--sm5cs-orange);
}

.sm5cs-lb__title {
	margin: 0;
	font-family: var(--sm5cs-font-head, inherit);
	font-size: 20px;
	font-weight: 800;
	line-height: 1.2;
	letter-spacing: -.02em;
	text-transform: lowercase;
	color: #fff;
}

.sm5cs-lb__stage {
	position: relative;
	flex: 1;
	min-height: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 88px 32px;
}

.sm5cs-lb__img {
	display: block;
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	user-select: none;
	-webkit-user-drag: none;
}

.sm5cs-lb__btn {
	-webkit-appearance: none;
	appearance: none;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 52px;
	height: 52px;
	margin: 0;
	padding: 0;
	color: #fff;
	background: transparent;
	border: 2px solid var(--sm5cs-orange);
	border-radius: 0;
	box-shadow: none;
	cursor: pointer;
	transition: background-color .25s ease, color .25s ease, border-color .25s ease;
}

.sm5cs-lb__btn:hover {
	color: #000;
	background: #fff;
	border-color: #fff;
}

.sm5cs-lb__btn:focus-visible,
.sm5cs-lb__thumb:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

.sm5cs-lb__btn svg {
	width: 20px;
	height: 20px;
	fill: currentColor;
}

/* Scoped under .sm5cs-lb to outrank the BB theme's button:active, button:focus { position: relative },
   which made a pressed arrow jump away so the click landed on the backdrop. */
.sm5cs-lb .sm5cs-lb__prev,
.sm5cs-lb .sm5cs-lb__next {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
}

.sm5cs-lb .sm5cs-lb__prev {
	left: var(--sm5cs-gutter);
}

.sm5cs-lb .sm5cs-lb__next {
	right: var(--sm5cs-gutter);
}

.sm5cs-lb__strip {
	display: flex;
	gap: 8px;
	justify-content: safe center;
	padding: 0 var(--sm5cs-gutter) 22px;
	overflow-x: auto;
}

.sm5cs-lb__thumb {
	-webkit-appearance: none;
	appearance: none;
	flex: 0 0 auto;
	width: 72px;
	height: 50px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: #111 center / cover no-repeat;
	opacity: .45;
	cursor: pointer;
	transition: opacity .2s ease;
}

.sm5cs-lb__thumb:hover,
.sm5cs-lb__thumb[aria-current="true"] {
	opacity: 1;
}

.sm5cs-lb__thumb[aria-current="true"] {
	outline: 2px solid var(--sm5cs-orange);
	outline-offset: 0;
}

html.sm5cs-lb-lock,
html.sm5cs-lb-lock body {
	overflow: hidden;
}

html.sm5cs-lb-lock {
	scrollbar-gutter: stable;
}

@media (max-width: 768px) {
	.sm5cs-lb__stage {
		padding: 0 12px 84px;
	}

	.sm5cs-lb .sm5cs-lb__prev,
	.sm5cs-lb .sm5cs-lb__next {
		top: auto;
		bottom: 16px;
		transform: none;
	}

	.sm5cs-lb .sm5cs-lb__prev {
		left: 12px;
	}

	.sm5cs-lb .sm5cs-lb__next {
		right: 12px;
	}

	.sm5cs-lb__strip {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.sm5cs-lb,
	.sm5cs-lb__btn,
	.sm5cs-lb__thumb {
		transition: none;
	}
}
