/**
 * Style images — [bb_stijl_images], see includes/stijl-images.php.
 *
 * A staggered strip of images pulled from the product's Stijl terms: three
 * descending heights on desktop, two on tablet, a single one on mobile.
 *
 *            desktop (>=850)   tablet (550-849)   mobile (<=549)
 *   columns        3                  2                 1
 *   image 1      700px              600px            hidden
 *   image 2      600px              500px             350px
 *   image 3      500px             hidden            hidden
 *
 * The heights are custom properties redeclared per breakpoint, so a single
 * override changes one image everywhere:
 *
 *   .my-block .bb-stijl-images { --bb-stijl-images-h1: 640px }
 *
 * Note that such an override wins at every breakpoint — it is more specific
 * than the media queries below, which sit on `.bb-stijl-images` alone. Wrap the
 * override in its own media query when only one breakpoint should change.
 *
 * The column count comes from the shortcode as `--bb-stijl-images-cols` (the
 * number of images it rendered); the media queries set `grid-template-columns`
 * outright, which beats that inline custom property.
 *
 * Images hidden per breakpoint are still in the markup. They carry
 * `loading="lazy"` and never enter the viewport, so browsers skip fetching
 * them — hiding costs markup, not bandwidth.
 */

.bb-stijl-images {
	--bb-stijl-images-h1: 700px;
	--bb-stijl-images-h2: 600px;
	--bb-stijl-images-h3: 500px;

	display: grid;
	grid-template-columns: repeat(var(--bb-stijl-images-cols, 3), minmax(0, 1fr));
	/* Tops aligned, bottoms stepping down. `end` hangs them off a common
	   baseline instead, `center` balances them around one. */
	align-items: var(--bb-stijl-images-align, start);
	gap: var(--bb-stijl-images-gap, 16px);
}

/*
 * The item owns the height and the rounding; the image fills it. `figure` needs
 * its margin reset — flatsome.css leaves the browser default in place.
 */
.bb-stijl-images__item {
	display: block;
	margin: 0;
	overflow: hidden;
	border-radius: var(--bb-stijl-images-radius, 12px);
}

.bb-stijl-images__item:nth-child(1) {
	height: var(--bb-stijl-images-h1);
	margin-bottom: -60px;
}

.bb-stijl-images__item:nth-child(2) {
	height: var(--bb-stijl-images-h2);
}

.bb-stijl-images__item:nth-child(3) {
	height: var(--bb-stijl-images-h3);
}

.bb-stijl-images__img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.35s ease;
}

/* Linked images (link="filter"|"term") get the same lift as the product cards. */
a.bb-stijl-images__item:hover .bb-stijl-images__img,
a.bb-stijl-images__item:focus-visible .bb-stijl-images__img {
	transform: scale(1.04);
}

a.bb-stijl-images__item:focus-visible {
	outline: 2px solid var(--fs-color-primary, #b01e22);
	outline-offset: 2px;
}

/* Flatsome's breakpoints: tablet 550-849, mobile <=549. */
@media (max-width: 849px) {
	.bb-stijl-images {
		--bb-stijl-images-h1: 600px;
		--bb-stijl-images-h2: 500px;

		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: var(--bb-stijl-images-gap, 12px);
	}

	.bb-stijl-images__item:nth-child(n + 3) {
		display: none;
	}
}

@media (max-width: 549px) {
	.bb-stijl-images {
		--bb-stijl-images-h2: 350px;

		grid-template-columns: minmax(0, 1fr);
		gap: var(--bb-stijl-images-gap, 8px);
	}

	.bb-stijl-images__item {
		border-radius: var(--bb-stijl-images-radius, 8px);
	}

	/* Only the middle image survives; it is the one sized for this width. */
	.bb-stijl-images__item:nth-child(1) {
		display: none;
	}

	/*
	 * Unless there is no middle image to fall back on: a style with a single
	 * image would otherwise leave the block empty on phones.
	 */
	.bb-stijl-images__item:only-child {
		display: block;
		height: var(--bb-stijl-images-h2);
	}
}
