/* TeamCNF Our Work: case stories (photo with an inset and badge, three facts or a monthly
   cycle; the mirrored story swaps sides on wide screens), the dark story slider (stories share
   one cell and cross-fade once the script runs; without it they simply stack), the filterable
   photo gallery and the client logo wall. Classes come from the "TeamCNF Our Work (PHP)" blocks;
   shared pieces (glass, chips, filter buttons, slider arrows and dots) from the design system
   and the testimonials styles. */

/* ---- Case stories -------------------------------------------------------- */
.tcnf-work-cases {
	overflow-x: clip;
}

.tcnf-case {
	display: grid;
	gap: var(--wp--preset--spacing--80);
	align-items: center;
	scroll-margin-top: calc(var(--wp--custom--size--header) + var(--wp--preset--spacing--60));
}

.tcnf-case + .tcnf-case {
	margin-top: var(--wp--preset--spacing--100);
}

.tcnf-case__visual {
	position: relative;
	padding-bottom: var(--wp--preset--spacing--70);
}

.tcnf-case__main {
	aspect-ratio: 4 / 3;
}

.tcnf-case__inset {
	position: absolute;
	right: 0;
	bottom: 0;
	z-index: var(--wp--custom--z--raised);
	width: 38%;
	aspect-ratio: 4 / 5;
	border: var(--wp--custom--border-thick) solid var(--wp--preset--color--base);
}

.tcnf-case__badge {
	position: absolute;
	left: var(--wp--preset--spacing--50);
	top: var(--wp--preset--spacing--50);
	z-index: var(--wp--custom--z--raised);
	display: inline-flex;
	align-items: center;
	gap: var(--wp--preset--spacing--20);
	padding: var(--wp--preset--spacing--10) var(--wp--preset--spacing--40);
	border-radius: var(--wp--custom--radius--pill);
	background: var(--wp--preset--gradient--accent);
	color: var(--wp--custom--text--on-accent);
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 600;
	letter-spacing: var(--wp--custom--tracking--wide);
	text-transform: uppercase;
	box-shadow: var(--wp--preset--shadow--glow);
}

.tcnf-case__badge .tcnf-glyph {
	--tcnf-glyph-size: var(--wp--custom--size--icon--xs);
}

.tcnf-case__body {
	display: grid;
	gap: var(--wp--preset--spacing--50);
	justify-items: start;
}

.tcnf-case__body h2 {
	font-size: var(--wp--preset--font-size--xxx-large);
}

.tcnf-case__facts {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: var(--wp--preset--spacing--50);
	width: 100%;
	padding-top: var(--wp--preset--spacing--50);
	border-top: 1px solid var(--wp--custom--glass--border-subtle);
}

.tcnf-case__facts div {
	display: flex;
	flex-direction: column-reverse;
	justify-content: flex-end;
	gap: var(--wp--preset--spacing--10);
}

.tcnf-case__facts dd {
	font-size: var(--wp--preset--font-size--stat-small);
	font-weight: 600;
	line-height: var(--wp--custom--leading--tight);
	letter-spacing: var(--wp--custom--tracking--tight);
	color: var(--wp--custom--text--primary);
}

.tcnf-case__facts dt {
	color: var(--wp--custom--text--tertiary);
	font-size: var(--wp--preset--font-size--x-small);
	line-height: var(--wp--custom--leading--snug);
}

/* Monthly cycle for the podcast retainer */
.tcnf-cycle {
	display: grid;
	gap: var(--wp--preset--spacing--30);
	width: 100%;
}

.tcnf-cycle__steps {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: var(--wp--preset--spacing--20);
}

.tcnf-cycle__step {
	display: grid;
	gap: var(--wp--preset--spacing--10);
	padding: var(--wp--preset--spacing--40);
	border-radius: var(--wp--custom--radius--md);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 500;
	color: var(--wp--custom--text--primary);
}

.tcnf-cycle__step span {
	color: var(--wp--custom--text--tertiary);
	font-size: var(--wp--preset--font-size--tiny);
	font-weight: 600;
	letter-spacing: var(--wp--custom--tracking--wide);
}

.tcnf-cycle__repeat {
	display: inline-flex;
	align-items: center;
	gap: var(--wp--preset--spacing--20);
	color: var(--wp--custom--text--tertiary);
	font-size: var(--wp--preset--font-size--x-small);
}

.tcnf-cycle__repeat .tcnf-glyph {
	--tcnf-glyph-size: var(--wp--custom--size--icon--xs);
}

@media (min-width: 640px) {
	.tcnf-case__inset {
		right: calc(var(--wp--preset--spacing--50) * -1);
	}
}

@media (min-width: 1100px) {
	.tcnf-case {
		grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
		gap: var(--wp--preset--spacing--90);
	}

	.tcnf-case--mirror .tcnf-case__visual {
		order: 2;
	}

	.tcnf-case--mirror .tcnf-case__inset {
		right: auto;
		left: calc(var(--wp--preset--spacing--50) * -1);
	}
}

/* ---- Story slider: full-bleed story player ----------------------------- */
.tcnf-briefs {
	isolation: isolate;
	overflow: hidden;
	border-block: 1px solid var(--wp--custom--glass--border-subtle);
	background: var(--wp--preset--color--base);
}

/* Red glow, flipped to sit in the bottom-right corner */
.tcnf-briefs::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background: var(--wp--custom--overlay--tint-red);
	opacity: var(--wp--custom--opacity--muted);
	transform: scale(-1);
}

.tcnf-briefs__head {
	display: grid;
	gap: var(--wp--preset--spacing--50);
	margin-bottom: var(--wp--preset--spacing--80);
}

.tcnf-briefs__aside {
	display: grid;
	gap: var(--wp--preset--spacing--40);
	justify-items: start;
	max-width: var(--wp--custom--size--measure-lead);
}

.tcnf-briefs__deck {
	display: grid;
	gap: var(--wp--preset--spacing--80);
	touch-action: pan-y;
}

.tcnf-brief {
	display: grid;
}

.tcnf-brief__media {
	aspect-ratio: 16 / 10;
}

.tcnf-brief__body {
	position: relative;
	z-index: var(--wp--custom--z--raised);
	display: grid;
	gap: var(--wp--preset--spacing--40);
	align-content: start;
	justify-items: start;
	margin: calc(var(--wp--preset--spacing--70) * -1) var(--wp--preset--spacing--30) 0;
	padding: var(--wp--preset--spacing--60) var(--wp--preset--spacing--50);
	border-radius: var(--wp--custom--radius--xl);
}

.tcnf-brief__top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--wp--preset--spacing--40);
	width: 100%;
	margin-bottom: var(--wp--preset--spacing--20);
}

.tcnf-brief__count {
	color: var(--wp--custom--text--primary);
	font-size: var(--wp--preset--font-size--stat-small);
	font-weight: 600;
	line-height: var(--wp--custom--leading--tight);
	letter-spacing: var(--wp--custom--tracking--tight);
}

.tcnf-brief__count span {
	color: var(--wp--custom--text--tertiary);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 500;
	letter-spacing: normal;
}

.tcnf-brief__title {
	font-size: var(--wp--preset--font-size--xx-large);
}

.tcnf-brief__label {
	margin-top: var(--wp--preset--spacing--20);
	color: var(--wp--custom--text--tertiary);
	font-size: var(--wp--preset--font-size--tiny);
	font-weight: 600;
	letter-spacing: var(--wp--custom--tracking--wider);
	text-transform: uppercase;
}

.tcnf-briefs__bar {
	display: flex;
	align-items: center;
	margin-top: var(--wp--preset--spacing--70);
	padding-top: var(--wp--preset--spacing--50);
	border-top: 1px solid var(--wp--custom--glass--border-subtle);
}

/* With JavaScript, the stories share one cell and cross-fade */
.tcnf-js .tcnf-briefs__deck {
	gap: 0;
}

.tcnf-js .tcnf-brief {
	grid-area: 1 / 1;
	transition:
		opacity var(--wp--custom--duration--slow) var(--wp--custom--ease--out),
		visibility var(--wp--custom--duration--slow);
}

.tcnf-js .tcnf-brief:not([data-pos="0"]) {
	opacity: 0;
	visibility: hidden;
}

.tcnf-js .tcnf-brief__media img,
.tcnf-js .tcnf-brief__body {
	transition: transform var(--wp--custom--duration--slow) var(--wp--custom--ease--out);
}

.tcnf-js .tcnf-brief:not([data-pos="0"]) .tcnf-brief__media img {
	transform: scale(1.06);
}

.tcnf-js .tcnf-brief:not([data-pos="0"]) .tcnf-brief__body {
	transform: translateY(var(--wp--preset--spacing--50));
}

/* Without it, the stories simply stack and need no controls */
html:not(.tcnf-js) .tcnf-briefs__bar {
	display: none;
}

@media (prefers-reduced-motion: reduce) {
	.tcnf-js .tcnf-brief:not([data-pos="0"]) .tcnf-brief__media img,
	.tcnf-js .tcnf-brief:not([data-pos="0"]) .tcnf-brief__body {
		transform: none;
	}
}

@media (min-width: 640px) {
	.tcnf-brief__body {
		margin-inline: var(--wp--preset--spacing--60);
		padding: var(--wp--preset--spacing--70) var(--wp--preset--spacing--60);
	}
}

@media (min-width: 900px) {
	.tcnf-briefs__head {
		grid-template-columns: minmax(0, 1fr) minmax(0, 0.85fr);
		align-items: end;
		gap: var(--wp--preset--spacing--80);
	}

	/* Photo on the left, story card overlapping it from the right */
	.tcnf-brief {
		grid-template-columns: repeat(12, minmax(0, 1fr));
		align-items: center;
	}

	.tcnf-brief__media {
		grid-column: 1 / span 8;
		grid-row: 1;
	}

	.tcnf-brief__body {
		grid-column: 7 / -1;
		grid-row: 1;
		margin: 0;
	}
}

@media (min-width: 1100px) {
	.tcnf-brief__media {
		aspect-ratio: 3 / 2;
	}

	.tcnf-brief__body {
		padding: var(--wp--preset--spacing--80) var(--wp--preset--spacing--70);
	}
}

/* ---- Filterable gallery -------------------------------------------------- */
.tcnf-gallery__bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--wp--preset--spacing--40);
	margin-bottom: var(--wp--preset--spacing--50);
}

.tcnf-gallery__bar .tcnf-filter {
	margin: 0;
}

.tcnf-gallery__bar .tcnf-filter__btn {
	margin: 0;
}

.tcnf-gallery__count {
	color: var(--wp--custom--text--tertiary);
	font-size: var(--wp--preset--font-size--x-small);
}

.tcnf-gallery__grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	grid-auto-rows: var(--wp--custom--size--gallery-row);
	grid-auto-flow: dense;
	gap: var(--wp--custom--grid);
}

.tcnf-gallery__item {
	position: relative;
	overflow: hidden;
	margin: 0;
	border: 1px solid var(--wp--custom--glass--border);
	border-radius: var(--wp--custom--radius--lg);
	background: var(--wp--preset--color--surface);
}

.tcnf-gallery__item[hidden] {
	display: none;
}

.tcnf-gallery__item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: scale var(--wp--custom--duration--slow) var(--wp--custom--ease--out);
}

.tcnf-gallery__item:hover img {
	scale: 1.05;
}

.tcnf-gallery__item figcaption {
	position: absolute;
	inset: auto 0 0;
	padding: var(--wp--preset--spacing--70) var(--wp--preset--spacing--40) var(--wp--preset--spacing--40);
	background: var(--wp--custom--overlay--fade-bottom);
	color: var(--wp--custom--text--secondary);
	font-size: var(--wp--preset--font-size--tiny);
	font-weight: 600;
	letter-spacing: var(--wp--custom--tracking--wide);
	text-transform: uppercase;
}

.tcnf-gallery__item--tall {
	grid-row: span 2;
}

.tcnf-gallery__item--wide {
	grid-column: span 2;
}

@media (min-width: 900px) {
	.tcnf-gallery__grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (min-width: 1100px) {
	.tcnf-gallery__grid {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

/* ---- Client logo wall ---------------------------------------------------- */
.tcnf-logo-wall {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--wp--custom--grid);
}

.tcnf-logo-wall__intro {
	grid-column: 1 / -1;
	display: grid;
	gap: var(--wp--preset--spacing--40);
	align-content: end;
	justify-items: start;
	padding: var(--wp--preset--spacing--60) var(--wp--preset--spacing--50);
	border-radius: var(--wp--custom--radius--xl);
}

.tcnf-logo-wall__intro h2 {
	font-size: var(--wp--preset--font-size--xxx-large);
}

.tcnf-logo-wall__intro p {
	font-size: var(--wp--preset--font-size--small);
}

.tcnf-logo-wall .tcnf-logo-tile {
	width: auto;
	height: auto;
	aspect-ratio: 2 / 1;
	margin: 0;
	transition: border-color var(--wp--custom--duration--base) var(--wp--custom--ease--out);
}

.tcnf-logo-wall .tcnf-logo-tile img {
	width: 100%;
	height: 100%;
	object-fit: contain;
}

/* Closing tile: fills the cells left on the last row of the wall (a row of
	its own when the logos fill theirs). The block counts the logos and sets
	the spans for two, four and five columns. */
.tcnf-logo-wall__cta {
	grid-column: var(--tcnf-wall-cta-2, 1 / -1);
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	gap: var(--wp--preset--spacing--20);
	padding: var(--wp--preset--spacing--50);
	border: 1px solid var(--wp--custom--accent-line);
	border-radius: var(--wp--custom--radius--md);
	background: var(--wp--custom--glass--fill-accent);
	color: var(--wp--custom--text--primary);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	line-height: var(--wp--custom--leading--snug);
	text-decoration: none;
	transition:
		border-color var(--wp--custom--duration--base) var(--wp--custom--ease--out),
		background-color var(--wp--custom--duration--base) var(--wp--custom--ease--out);
}

.tcnf-logo-wall__cta:hover {
	border-color: var(--wp--preset--color--accent);
	background: var(--wp--custom--accent-soft);
}

.tcnf-logo-wall__cta-link {
	display: inline-flex;
	align-items: center;
	gap: var(--wp--preset--spacing--10);
	color: var(--wp--custom--text--secondary);
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 500;
}

.tcnf-logo-wall__cta-link .tcnf-glyph {
	--tcnf-glyph-size: var(--wp--custom--size--icon--xs);
	transition: transform var(--wp--custom--duration--base) var(--wp--custom--ease--out);
}

.tcnf-logo-wall__cta:hover .tcnf-logo-wall__cta-link .tcnf-glyph {
	transform: translateX(var(--wp--preset--spacing--10));
}

@media (min-width: 900px) {
	.tcnf-logo-wall {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}

	.tcnf-logo-wall__intro {
		grid-column: span 2;
		grid-row: span 2;
		padding: var(--wp--preset--spacing--70) var(--wp--preset--spacing--60);
	}

	.tcnf-logo-wall__cta {
		grid-column: var(--tcnf-wall-cta-4, 1 / -1);
		flex-direction: row;
		align-items: center;
		padding: var(--wp--preset--spacing--50) var(--wp--preset--spacing--60);
		font-size: var(--wp--preset--font-size--x-large);
	}

	.tcnf-logo-wall__cta-link {
		font-size: var(--wp--preset--font-size--small);
	}
}

@media (min-width: 1100px) {
	.tcnf-logo-wall {
		grid-template-columns: repeat(5, minmax(0, 1fr));
	}

	.tcnf-logo-wall__cta {
		grid-column: var(--tcnf-wall-cta-5, span 2);
		flex-direction: column;
		align-items: flex-start;
		padding: var(--wp--preset--spacing--40) var(--wp--preset--spacing--50);
		font-size: var(--wp--preset--font-size--large);
	}
}
