/**
 * Homepage bento banner v2: 4×2 grid, five tiles (1×1 / 1×2 / 2×1 only), no v1 wipes or entrance motion.
 */

.gather-home-bento-v2 {
	margin-top: clamp(1.25rem, 3.5vw, 2rem);
}

.gather-bento-v2 {
	display: grid;
	/* Equal-width columns (archive v1 uses 1 / 1.2 / 1.2 / 1 — that skews vertical seams in v2 layouts). */
	grid-template-columns: repeat(4, minmax(0, 1fr));
	/* Equal row heights: fractional rows only split evenly when the grid has a definite block size —
	   min/max alone often leave height indefinite, so each row sizes from its own content (mis-matched rows). */
	grid-template-rows: repeat(2, minmax(0, 1fr));
	gap: clamp(3px, 0.45vw, 6px);
	min-height: clamp(240px, 36vw, 400px);
	max-height: clamp(260px, 42vw, 500px);
	height: clamp(240px, 38vw, 500px);
	border-radius: 0.5rem;
	overflow: hidden;
	box-shadow: 0 1px 0 rgb(58 53 53 / 0.06);
}

.gather-bento-v2__tile {
	position: relative;
	display: block;
	overflow: hidden;
	border-radius: 0.5rem;
	min-width: 0;
	min-height: 0;
	color: var(--gather-chalk) !important;
	text-decoration: none !important;
	background: rgb(20 17 16 / 0.06);
	/* Foot scrim (readability under title/meta) — tune without replacing full gradient. */
	--gather-bento-scrim-strong: 0.5;
	--gather-bento-scrim-mid: 0.12;
	--gather-bento-scrim-mid-pos: 42%;
	--gather-bento-scrim-clear-pos: 85%;
	/* FLIP repack sets transform / transition inline (Isotope-style pack). */
	transition: none;
}

@media (prefers-reduced-motion: no-preference) {
	.gather-bento-v2--is-pack-animating .gather-bento-v2__tile {
		will-change: transform;
	}
}

.gather-bento-v2__tile::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
	pointer-events: none;
	background: linear-gradient(
		to top,
		rgb(12 10 9 / var(--gather-bento-scrim-strong)) 0%,
		rgb(12 10 9 / var(--gather-bento-scrim-mid)) var(--gather-bento-scrim-mid-pos),
		transparent var(--gather-bento-scrim-clear-pos)
	);
}

.gather-bento-v2__media {
	position: absolute;
	inset: 0;
	z-index: 0;
	overflow: hidden;
}

/* Ken Burns target; tile `<a>` carries FLIP transforms only. */
.gather-bento-v2__ken {
	position: absolute;
	inset: 0;
	transform-origin: 50% 50%;
}

.gather-bento-v2__img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
}

.gather-bento-v2__overlay {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 2;
	padding: clamp(0.65rem, 2vw, 1.1rem) clamp(0.55rem, 1.5vw, 0.85rem);
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
	min-height: 2.35em;
	justify-content: flex-end;
	pointer-events: none;
}

/* Title / meta sizing aligned with archive rail CTA typography scale. */
.gather-bento-v2__tile-title {
	font-family: var(--gather-font-headline);
	font-size: clamp(0.9375rem, 2.1vw, 1.125rem);
	font-weight: 400;
	line-height: 1.2;
	color: var(--gather-chalk);
	text-shadow:
		0 1px 3px rgb(0 0 0 / 0.45),
		0 0 1px rgb(0 0 0 / 0.35);
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	overflow: hidden;
}

.gather-bento-v2__tile-meta {
	font-family: var(--gather-font-body);
	font-size: 0.65625rem;
	font-weight: 400;
	line-height: 1.35;
	letter-spacing: 0.04em;
	color: rgb(255 255 255 / 0.88);
	text-shadow: 0 1px 2px rgb(0 0 0 / 0.4);
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	overflow: hidden;
	word-break: break-word;
}

.gather-bento-v2__tile-meta--empty {
	color: rgb(255 255 255 / 0.42);
	letter-spacing: 0.12em;
	text-shadow: none;
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
	.gather-bento-v2__tile:hover .gather-bento-v2__ken,
	.gather-bento-v2__tile:focus-visible .gather-bento-v2__ken {
		animation-play-state: paused;
	}
}

/* Slightly stronger foot on smallest cells — still lighter than legacy full-tile crush. */
.gather-bento-v2__tile--1x1 {
	--gather-bento-scrim-strong: 0.58;
	--gather-bento-scrim-mid: 0.2;
	--gather-bento-scrim-mid-pos: 46%;
	--gather-bento-scrim-clear-pos: 88%;
}

.gather-bento-v2__tile:focus-visible {
	outline: 2px solid var(--gather-terra);
	outline-offset: 2px;
}

.gather-home-bento-v2__cta {
	margin: clamp(1rem, 2.5vw, 1.5rem) 0 0;
	text-align: center;
}

.gather-home-bento-v2__cta-link {
	font-size: 0.6875rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.14em;
	text-decoration: none !important;
	color: var(--gather-charcoal) !important;
}

.gather-home-bento-v2__cta-link:hover {
	color: var(--gather-terra) !important;
}

@media (max-width: 680px) {
	.gather-bento-v2 {
		grid-template-rows: repeat(2, minmax(0, 1fr));
		min-height: 0;
		max-height: none;
		height: clamp(280px, 72vw, 420px);
	}
}

/*
 * Ken Burns — listing-style keyframes on `.gather-bento-v2__ken` (`data-aspect` from JS).
 */
.gather-bento-v2[data-bento-v2] .gather-bento-v2__ken {
	animation: gather-kb-fallback-a 12s ease-in-out infinite alternate both;
}

.gather-bento-v2[data-bento-v2] .gather-bento-v2__ken[data-aspect='wide'] {
	animation: gather-kb-wide-a 12s ease-in-out infinite alternate both;
}

.gather-bento-v2[data-bento-v2] .gather-bento-v2__ken[data-aspect='tall'] {
	animation: gather-kb-tall-a 12s ease-in-out infinite alternate both;
}

.gather-bento-v2[data-bento-v2] .gather-bento-v2__ken[data-aspect='square'] {
	animation: gather-kb-square-a 12s ease-in-out infinite alternate both;
}

.gather-bento-v2[data-bento-v2] > .gather-bento-v2__tile:nth-child(odd) .gather-bento-v2__ken[data-aspect='wide'] {
	animation: gather-kb-wide-b 12s ease-in-out infinite alternate both;
}

.gather-bento-v2[data-bento-v2] > .gather-bento-v2__tile:nth-child(odd) .gather-bento-v2__ken[data-aspect='tall'] {
	animation: gather-kb-tall-b 12s ease-in-out infinite alternate both;
}

.gather-bento-v2[data-bento-v2] > .gather-bento-v2__tile:nth-child(odd) .gather-bento-v2__ken[data-aspect='square'] {
	animation: gather-kb-square-b 12s ease-in-out infinite alternate both;
}

.gather-bento-v2[data-bento-v2] > .gather-bento-v2__tile:nth-child(odd) .gather-bento-v2__ken:not([data-aspect]) {
	animation: gather-kb-fallback-b 12s ease-in-out infinite alternate both;
}

@keyframes gather-kb-wide-a {
	0% {
		transform: scale(1.12) translate3d(-5%, 0, 0);
	}
	100% {
		transform: scale(1.22) translate3d(5%, 0, 0);
	}
}

@keyframes gather-kb-wide-b {
	0% {
		transform: scale(1.12) translate3d(5%, 0, 0);
	}
	100% {
		transform: scale(1.22) translate3d(-5%, 0, 0);
	}
}

@keyframes gather-kb-tall-a {
	0% {
		transform: scale(1.12) translate3d(0, -5%, 0);
	}
	100% {
		transform: scale(1.22) translate3d(0, 5%, 0);
	}
}

@keyframes gather-kb-tall-b {
	0% {
		transform: scale(1.12) translate3d(0, 5%, 0);
	}
	100% {
		transform: scale(1.22) translate3d(0, -5%, 0);
	}
}

@keyframes gather-kb-square-a {
	0% {
		transform: scale(1.1);
	}
	100% {
		transform: scale(1.22);
	}
}

@keyframes gather-kb-square-b {
	0% {
		transform: scale(1.22);
	}
	100% {
		transform: scale(1.1);
	}
}

@keyframes gather-kb-fallback-a {
	0% {
		transform: scale(1.12) translate3d(-5%, 0, 0);
	}
	100% {
		transform: scale(1.2) translate3d(5%, 0, 0);
	}
}

@keyframes gather-kb-fallback-b {
	0% {
		transform: scale(1.12) translate3d(5%, 0, 0);
	}
	100% {
		transform: scale(1.2) translate3d(-5%, 0, 0);
	}
}

@media (prefers-reduced-motion: reduce) {
	.gather-bento-v2[data-bento-v2] .gather-bento-v2__ken {
		animation: none !important;
		transform: none !important;
	}
}
