/*
 * Logo row (cis/logo-row + cis/logo-row-item). Loaded with the blocks, front end and editor canvas.
 *
 * Moved here from the Etch styles of the BMDA "Industry partners" grid: the Etch Block component's layout
 * (flex, row, centred, gap --space-xl) plus the extra rules of .bw-partners__grid-block, and the logo
 * rules .bw-partners__logo and .bw-partners__logo-image. Etch still prints the logo styles for any page that
 * has those class names in its markup, so every rule here is written with two classes (.bw-logo-row first)
 * to win on its own and to match the old look exactly. Plain stylesheet, not compiled by Etch, so:
 *   - lengths are ACSS variables as they were;
 *   - the Etch @custom-media tokens do not exist here, so their conditions are written out:
 *       --block-query-large / --container-query-large = inline-size >= 800px  (50rem)
 *   - the row does not carry the old "block" class (the Etch Block rules are not needed: this block states
 *     its own layout), and it does not carry .bw-partners__grid-block (its rules are folded in below).
 *
 * The container queries need an ancestor with container-type: inline-size. On the page that is the Etch
 * container (or, later, the section block); in the editor it is the block wrapper, set below.
 *
 * Mobile first: centred logos, two per row (each takes half the row less half the gap); from 50rem of
 * container width the logos take their own width and the rows are closer together (--space-l).
 */

.bw-logo-row {
	position: relative;
	display: flex;
	flex-direction: row;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	text-align: center;
	gap: var(--space-xl);
	inline-size: 100%;

	@container (inline-size >= 50rem) {
		row-gap: var(--space-l);
	}
}

.bw-logo-row .bw-partners__logo {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 calc((100% - var(--space-xl)) / 2);

	@container (inline-size >= 50rem) {
		flex: 0 1 auto;
	}
}

.bw-logo-row .bw-partners__logo-image {
	max-inline-size: 100%;
	max-block-size: 100%;
	inline-size: auto;
	block-size: auto;
	object-fit: contain;
	border-radius: 0;
}

/* ---- Editor canvas only ---------------------------------------------------------------------------
 * The wrapper is the container for the queries above. The logo block's own wrapper is the logo box, so it
 * is laid out like the front end; the editor adds its own margins and a content width, removed here. */
/* A size container has no width of its own, so inside a shrink-to-fit parent (the Etch containers on the BMDA page
 * centre their children) the box would collapse to nothing: give it the full width. */
.bw-logo-row-editor {
	container-type: inline-size;
	inline-size: 100%;
}

.bw-logo-row > .wp-block {
	margin: 0;
	max-inline-size: none;
}

.bw-logo-row .bw-logo-row-item__placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	inline-size: 100%;
	min-block-size: 4rem;
	padding: var(--space-xs);
	border: 0.0625rem dashed currentColor;
	border-radius: var(--radius-m);
	color: var(--neutral);
	font-size: var(--text-s);
}
