/*
 * Showroom Galerie ALB element - kl_showroom_gallery.php
 *
 * >= 768px: free-form collage. Each item carries its position/size in design px
 * (--x, --y, --w, --h on a 1210px-wide frame; --h follows the photo's aspect ratio); --u converts one design px to the real
 * container width via container query units, so the whole collage scales as one piece.
 * <  768px: single column, items alternate left/right at their own width (--mw).
 */

@font-face {
	font-family: 'Host Grotesk';
	src: url('../../assets/fonts/host-grotesk-latin.woff2') format('woff2');
	font-weight: 300 800;
	font-style: normal;
	font-display: swap;
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

.kl-showroom {
	--kl-font-display: 'Host Grotesk', 'Helvetica Neue', Helvetica, Arial, sans-serif;
	--kl-font-text: Helvetica, Arial, sans-serif;
	--kl-color-heading: #222;
	--kl-color-text: #444;
	--kl-color-caption: #171717;
	--kl-radius: 8px;
}

.kl-showroom__inner {
	container-type: inline-size;
	max-width: 1210px;
	margin: 0 auto;
}

/* Header */

.kl-showroom__header {
	margin-bottom: 94px;
}

#top #wrap_all .kl-showroom h2.kl-showroom__title {
	margin: 0 0 8px;
	font-family: var(--kl-font-display);
	font-size: clamp(28px, 1.25rem + 2.8vw, 48px);
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: 1px;
	text-transform: none;
	color: var(--kl-color-heading);
}

#top #wrap_all .kl-showroom p.kl-showroom__lead {
	margin: 0;
	padding: 0;
	font-family: var(--kl-font-text);
	font-size: 16px;
	line-height: 26.4px;
	color: var(--kl-color-text);
}

/* Items */

#top .kl-showroom__gallery {
	margin: 0;
	padding: 0;
	list-style: none;
}

#top .kl-showroom__item {
	margin: 0;
	padding: 0;
	list-style: none;
}

.kl-showroom__figure {
	margin: 0;
}

.kl-showroom__media {
	position: relative;
	overflow: hidden;
	aspect-ratio: var(--w) / var(--h);
	border-radius: var(--kl-radius);
	background: #f2f2f2;
}

#top .kl-showroom__media img {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
}

.kl-showroom__caption {
	margin-top: 16px;
	padding: 0 7px;
	font-family: var(--kl-font-display);
	font-size: 19px;
	font-weight: 500;
	line-height: 1.3;
	color: var(--kl-color-caption);
}

/* Scroll animation (kl_showroom_gallery.js): photos fly in from beyond the column's
   edges, so clip horizontally at the full-width section around the element. */

.avia-section:has(.kl-showroom[data-kl-animate]),
.container_wrap:has(.kl-showroom[data-kl-animate]) {
	overflow-x: clip;
}

.kl-showroom[data-kl-animate] .kl-showroom__figure {
	will-change: transform, opacity;
}

/* Desktop / tablet: collage */

@media (min-width: 768px) {
	.kl-showroom__gallery {
		--u: calc(100cqw / 1210);
		position: relative;
		height: calc(var(--kl-h) * var(--u));
	}

	/* Below 1330px the 40px overhang would reach the viewport edge, so fit the
	   whole 1250px-wide collage inside the column instead. */
	@media (max-width: 1329px) {
		.kl-showroom__gallery {
			--u: calc(100cqw / 1250);
		}
	}

	.kl-showroom__item {
		position: absolute;
		left: calc(var(--x) * var(--u));
		top: calc(var(--y) * var(--u));
		width: calc(var(--w) * var(--u));
	}
}

/* Mobile: staggered single column */

@media (max-width: 767px) {
	.kl-showroom__header {
		margin-bottom: 40px;
	}

	.kl-showroom__gallery {
		display: flex;
		flex-direction: column;
		gap: 40px;
	}

	.kl-showroom__item {
		width: var(--mw);
	}

	.kl-showroom__item:nth-child(even) {
		align-self: flex-end;
	}

	.kl-showroom__caption {
		margin-top: 12px;
		font-size: 17px;
	}
}

/* "reveal" scroll animation: GSAP zooms the picture inside its frame. */

.kl-showroom[data-kl-animate="reveal"] .kl-showroom__img {
	will-change: transform;
}
