/*
 * NX Elements (prototype): layout rules for item counts the original sections never had.
 * Every selector is scoped to an NX element root (.brxe-nx-*), so current pages are not affected.
 */

/* Key figures (cards): beyond 4 cards, wrap into balanced rows on desktop (5 = 3+2, 6 = 3+3, 7 = 4+3...).
   --nxp-per is set by the element. Tablet and mobile keep the site's own 2-column / 1-column grid. */
@media (min-width: 992px) {
	.brxe-nx-key-figures.nx-statcards[data-nxp-per] {
		flex-wrap: wrap;
	}
	.brxe-nx-key-figures.nx-statcards[data-nxp-per][data-nxp-stretch] > .nx-statcard {
		flex: 1 1 calc((100% - var(--nxp-per) * 2rem) / var(--nxp-per)); /* basis kept under the real share; grow fills the row */
	}
	/* Default: every card keeps the same width, the short last row is centred (5 = 3 + 2 centred). */
	.brxe-nx-key-figures.nx-statcards[data-nxp-per]:not([data-nxp-stretch]) {
		--nxp-gap: var(--nx-statcards-gap, var(--nx-space-xs));
		column-gap: var(--nxp-gap);
		justify-content: center;
	}
	.nx-home .brxe-nx-key-figures.nx-statcards[data-nxp-per]:not([data-nxp-stretch]) { --nxp-gap: var(--nx-space-xs); }
	.brxe-nx-key-figures.nx-statcards[data-nxp-per]:not([data-nxp-stretch]) > .nx-statcard {
		flex: 0 0 calc((100% - (var(--nxp-per) - 1) * var(--nxp-gap)) / var(--nxp-per));
	}
}

/* Two-column lists: a lone last item spans the whole row (rule validated by Benjamin on 02/11 for 2-column grids). */
.brxe-nx-icon-list.nx-benefits-grid__cards:not([data-nx-cols="3"]):not(.nx-reco-benefits--joined *):not(.nx-benefits-grid--cols-4 *) > .nx-c-benefit-item:nth-last-child(1 of .nx-c-benefit-item):nth-child(odd of .nx-c-benefit-item),
.brxe-nx-icon-list.nx-impact__grid > .nx-impact__cell:nth-last-child(1 of .nx-impact__cell):nth-child(odd of .nx-impact__cell) {
	grid-column: 1 / -1;
}

/* Awards mosaic with a count other than 4 (cells placed by the element): every cell fills its row,
   otherwise rows of slightly different aspect ratios leave a grey strip of the separator background. */
.brxe-nx-awards.nx-awards__mosaic > .nx-awards__cell[style*="grid-row"] {
	align-self: stretch;
}

/* Awards mosaic: a lone last award spans both columns. The home cells keep a fixed aspect ratio,
   which would make a full-width cell twice as tall (and stretch every row): drop it for that cell. */
.brxe-nx-awards.nx-awards__mosaic > .nx-awards__cell[data-nxp-span] {
	aspect-ratio: auto;
	align-self: stretch; /* the mosaic sets align-items: flex-start; without this the cell stops short of its row */
	min-block-size: 12rem;
}

/* Key figures, dark card: the chevron art (stat-dark.png) has a 1px light-grey column on its right edge.
   On the site the cards are never wide enough to show it; with 1 or 2 cards (or a wider last row) it shows as a vertical line. Clip it. */
.brxe-nx-key-figures .nx-statcard--dark::before {
	clip-path: inset(0 0.25rem 0 0);
}

/* Key figures on tablet and mobile (2-column grids for both variants): a lone last figure spans the row,
   so it does not sit at half width with a half-length bottom border (same 02/11 rule as above). */
@media (max-width: 991px) {
	.brxe-nx-key-figures.nx-statcards > .nx-statcard:nth-last-child(1 of .nx-statcard):nth-child(odd of .nx-statcard),
	.brxe-nx-key-figures.nx-company-intro__grid > .nx-company-intro__stat:nth-last-child(1 of .nx-company-intro__stat):nth-child(odd of .nx-company-intro__stat) {
		grid-column: 1 / -1;
	}
}

/* Feature cards, fixed columns (2, 3 or 4): desktop N columns, tablet and landscape 2 (the site's own rule then spans
   a lone odd last card), portrait 1. "Automatic" keeps the site's auto-fit grid, "5 columns" the site's 5-up grid. */
.brxe-nx-feature-cards.nx-feature-cards__grid[data-nxp-cols] {
	grid-template-columns: repeat(var(--nxp-cols), minmax(0, 1fr));
}
.brxe-nx-feature-cards.nx-feature-cards__grid[data-nxp-cols="2"] { --nxp-cols: 2; }
.brxe-nx-feature-cards.nx-feature-cards__grid[data-nxp-cols="3"] { --nxp-cols: 3; }
.brxe-nx-feature-cards.nx-feature-cards__grid[data-nxp-cols="4"] { --nxp-cols: 4; }
@media (max-width: 991px) {
	.brxe-nx-feature-cards.nx-feature-cards__grid[data-nxp-cols] { --nxp-cols: 2; }
}
@media (max-width: 478px) {
	.brxe-nx-feature-cards.nx-feature-cards__grid[data-nxp-cols] { --nxp-cols: 1; }
}

/* Feature cards "Table": one block with shared 1px strokes (like the icon lists), no gaps, no rounded corners.
   Flex rows let a short last row stretch, so strokes always run edge to edge. */
.brxe-nx-feature-cards.nx-feature-cards__grid[data-nxp-table] {
	display: flex;
	flex-direction: row; /* .brxe-block is a column flexbox */
	flex-wrap: wrap;
	gap: var(--nx-border-width);
	overflow: hidden;
	border-block: var(--nx-border-width) solid var(--nx-border);
}
.brxe-nx-feature-cards.nx-feature-cards__grid[data-nxp-table] > .nx-c-card,
.brxe-nx-feature-cards.nx-feature-cards__grid[data-nxp-table] > .nx-c-card:is(:hover, :focus-within) {
	flex: 1 1 28rem;
	height: auto; /* the site's height:100% blocks flex stretch: unequal heights in a row */
	border: 0;
	border-radius: 0;
	background: transparent;
	box-shadow: var(--nx-border-width) 0 0 var(--nx-border), 0 var(--nx-border-width) 0 var(--nx-border);
}
.brxe-nx-feature-cards.nx-feature-cards__grid[data-nxp-table][data-nx-cols="5"] { --nxp-cols: 5; }
@media (max-width: 991px) { .brxe-nx-feature-cards.nx-feature-cards__grid[data-nxp-table][data-nx-cols="5"] { --nxp-cols: 3; } }
@media (max-width: 767px) { .brxe-nx-feature-cards.nx-feature-cards__grid[data-nxp-table][data-nx-cols="5"] { --nxp-cols: 2; } }
@media (max-width: 478px) { .brxe-nx-feature-cards.nx-feature-cards__grid[data-nxp-table][data-nx-cols="5"] { --nxp-cols: 1; } }
.brxe-nx-feature-cards.nx-feature-cards__grid[data-nxp-table]:is([data-nxp-cols], [data-nx-cols="5"]) > .nx-c-card {
	flex-basis: calc((100% - (var(--nxp-cols) - 1) * var(--nx-border-width)) / var(--nxp-cols) - 1px);
}

/* Benefit cards, stat card: the chevron art keeps the card's full height when the row is taller than the original 231px. */
.brxe-nx-benefit-cards .nx-benefit-stats__stat-art {
	height: 100%;
	min-height: 23.1rem;
	object-fit: cover;
	object-position: right top;
}

/* Stat card chevron art, under 768 px (Benjamin 13/11): the whole artwork scaled to the card height instead of a 23rem crop that only shows half the chevron. */
@media (max-width: 767px) {
	.brxe-nx-benefit-cards .nx-benefit-stats__stat-art { min-height: 0; height: 100%; width: auto; aspect-ratio: 258 / 231; object-fit: contain; object-position: right top; }
}


/* 3-column bordered grids (benefit list 3 columns, key figures with icons), desktop: a short last row stretches to the full
   width so the strokes run edge to edge (option C validated by Benjamin 11/11). Benefit list: only with the
   "Stretch the last row" checkbox (data-nxp-stretch, 12/11). 6-track grid: items span 2,
   a lone last item spans 6, a last pair spans 3 + 3. */
@media (min-width: 992px) {
	.brxe-nx-icon-list.brxe-nx-icon-list.nx-benefits-grid__cards[data-nx-cols="3"][data-nxp-stretch] { grid-template-columns: repeat(6, minmax(0, 1fr)); }
	.brxe-nx-icon-list.brxe-nx-icon-list.nx-benefits-grid__cards[data-nx-cols="3"][data-nxp-stretch] > .nx-c-benefit-item { grid-column: span 2; }
	.brxe-nx-icon-list.brxe-nx-icon-list.nx-benefits-grid__cards[data-nx-cols="3"][data-nxp-stretch] > .nx-c-benefit-item:nth-last-child(1 of .nx-c-benefit-item):nth-child(3n+1 of .nx-c-benefit-item) { grid-column: 1 / -1; border-inline-end-width: 0 !important; }
	.brxe-nx-icon-list.brxe-nx-icon-list.nx-benefits-grid__cards[data-nx-cols="3"][data-nxp-stretch] > .nx-c-benefit-item:nth-last-child(2 of .nx-c-benefit-item):nth-child(3n+1 of .nx-c-benefit-item),
	.brxe-nx-icon-list.brxe-nx-icon-list.nx-benefits-grid__cards[data-nx-cols="3"][data-nxp-stretch] > .nx-c-benefit-item:nth-last-child(1 of .nx-c-benefit-item):nth-child(3n+2 of .nx-c-benefit-item) { grid-column: span 3; }
	.brxe-nx-icon-list.brxe-nx-icon-list.nx-benefits-grid__cards[data-nx-cols="3"][data-nxp-stretch] > .nx-c-benefit-item:nth-last-child(1 of .nx-c-benefit-item):nth-child(3n+2 of .nx-c-benefit-item) { border-inline-end-width: 0 !important; }
	/* Benefit list 3 columns, stretch option off (default, as in Figma 25596:39289): the site CSS keeps an empty last cell;
	   the closing right stroke is put back here because the element's decoration div is the grid's last child. */
	.brxe-nx-icon-list.brxe-nx-icon-list.nx-benefits-grid__cards[data-nx-cols="3"]:not([data-nxp-stretch]) > .nx-c-benefit-item:nth-last-child(1 of .nx-c-benefit-item):not(:nth-child(3n of .nx-c-benefit-item)) { border-inline-end: var(--nx-border-width) solid var(--nx-border); }
	.brxe-nx-key-figures.brxe-nx-key-figures.nx-company-intro__grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
	.brxe-nx-key-figures.brxe-nx-key-figures.nx-company-intro__grid > .nx-company-intro__stat { grid-column: span 2; }
	.brxe-nx-key-figures.brxe-nx-key-figures.nx-company-intro__grid > .nx-company-intro__stat:nth-last-child(1 of .nx-company-intro__stat):nth-child(3n+1 of .nx-company-intro__stat) { grid-column: 1 / -1; border-inline-end-width: 0 !important; }
	.brxe-nx-key-figures.brxe-nx-key-figures.nx-company-intro__grid > .nx-company-intro__stat:nth-last-child(2 of .nx-company-intro__stat):nth-child(3n+1 of .nx-company-intro__stat),
	.brxe-nx-key-figures.brxe-nx-key-figures.nx-company-intro__grid > .nx-company-intro__stat:nth-last-child(1 of .nx-company-intro__stat):nth-child(3n+2 of .nx-company-intro__stat) { grid-column: span 3; }
	.brxe-nx-key-figures.brxe-nx-key-figures.nx-company-intro__grid > .nx-company-intro__stat:nth-last-child(1 of .nx-company-intro__stat):nth-child(3n+2 of .nx-company-intro__stat) { border-inline-end-width: 0 !important; }
}

/* Images rendered by the NX elements in PHP: Bricks prints a global class's image settings (object-fit, filter)
   only when a native element on the page holds the class, so pages without the original section got stretched
   tab screens (seen 11/11 on front and builder). Same values as the global classes. */
:where([class*="brxe-nx-"]) img.nx-product-tabs__image { object-fit: cover; }
:where([class*="brxe-nx-"]) img.nx-benefit-stats__stat-art { object-fit: cover; }
:where([class*="brxe-nx-"]) img.nx-award-strip__image { object-fit: contain; }
:where([class*="brxe-nx-"]) img:is(.nx-benefit-stats__icon-glyph, .nx-company-intro__glyph) { object-fit: contain; filter: brightness(0%) invert(100%); }

/* NX Steps "Columns on desktop" (Benjamin 11/11): fixed count from 992px; tablet and mobile keep the site rules. */
@media (min-width: 992px) {
	.brxe-nx-steps[data-nxp-cols] > .nx-benefit-stats__steps { grid-template-columns: repeat(var(--nxp-cols), minmax(0, 1fr)); }
}

/* Feature cards, separate cards, "Stretch the last row" ticked: flex rows so a short last row widens to fill the width.
   Full rows keep N equal cards (basis a bit under 1/N, grow 1); "Automatic" keeps the site's 280px minimum. */
.brxe-nx-feature-cards.nx-feature-cards__grid[data-nxp-stretch] {
	display: flex;
	flex-direction: row; /* .brxe-block is a column flexbox */
	flex-wrap: wrap;
	align-items: stretch;
}
.brxe-nx-feature-cards.nx-feature-cards__grid[data-nxp-stretch] > .nx-c-card {
	flex: 1 1 calc(100% / var(--nxp-cols) - 2rem);
	min-width: 0;
	align-self: stretch; /* equal heights in a row, like the grid */
	height: auto;
}
.brxe-nx-feature-cards.nx-feature-cards__grid[data-nxp-stretch]:not([data-nxp-cols], [data-nx-cols]) > .nx-c-card {
	flex: 1 1 min(100%, 28rem);
}
.brxe-nx-feature-cards.nx-feature-cards__grid[data-nxp-stretch][data-nx-cols="5"] { --nxp-cols: 5; }
@media (max-width: 991px) { .brxe-nx-feature-cards.nx-feature-cards__grid[data-nxp-stretch][data-nx-cols="5"] { --nxp-cols: 3; } }
@media (max-width: 767px) { .brxe-nx-feature-cards.nx-feature-cards__grid[data-nxp-stretch][data-nx-cols="5"] { --nxp-cols: 2; } }
@media (max-width: 478px) { .brxe-nx-feature-cards.nx-feature-cards__grid[data-nxp-stretch][data-nx-cols="5"] { --nxp-cols: 1; } }

/* Feature cards, grey style, "Standard" text (as on Pitchbook, Performance): title + text column with a right margin, body-size text. */
.brxe-nx-feature-cards .nx-feature-cards__copy { display: flex; flex-direction: column; align-items: flex-start; gap: var(--nx-space-xs); min-width: 0; width: 100%; padding-inline-end: var(--nx-space-m); }
.brxe-nx-feature-cards .nx-feature-cards__copy > .nx-text { margin: 0; font-size: var(--nx-text-m); line-height: var(--nx-leading-normal); }

/* Check list "In a row": items side by side, wrapping. :where() keeps it weaker than a block's own class (IDP hero band). */
:where(.brxe-nx-checklist.nx-checklist--row) { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; column-gap: var(--nx-space-l); row-gap: var(--nx-space-xs); }
