/**
 * iBreathe 3x2 Grid
 *
 * Structural rules are fixed and live here.
 * Per-instance values arrive as custom properties on .ibr-3x2-grid-wrapper,
 * set inline by ibr-3x2-grid.php. Fallbacks below match the Shopify defaults.
 */

/* ---------------------------------------------------------------
   Outer strip — breaks out of the theme container to full viewport width
   --------------------------------------------------------------- */

.ibr-3x2-grid-wrapper {
	width: 100vw;
	max-width: 100vw;
	margin-left: calc(50% - 50vw);
	margin-right: calc(50% - 50vw);
	box-sizing: border-box;
	padding-top: 20px;
	padding-bottom: 20px;
	margin-top: var(--ibr3x2-mt-desktop, 40px);
	margin-bottom: var(--ibr3x2-mb-desktop, 40px);
	background-color: var(--ibr3x2-bg-color, transparent);
	background-image: var(--ibr3x2-bg-image, none);
	background-size: var(--ibr3x2-bg-size, cover);
	background-repeat: var(--ibr3x2-bg-repeat, no-repeat);
	background-position: center;
	color: var(--ibr3x2-text-color, #000000);
}

/* WordPress's block layout system sets margin-block-start/end on children of
   .is-layout-constrained and .is-layout-flow, including a 24px block gap and a
   first-child reset to zero. Those are logical properties and resolve to the
   same computed value as margin-top/bottom, so they compete with the rule
   above. Restating them here as logical properties at a higher specificity
   settles it, on any template. Do not remove. */
.ibr-3x2-grid-wrapper.alignfull {
	margin-block-start: var(--ibr3x2-mt-desktop, 40px);
	margin-block-end: var(--ibr3x2-mb-desktop, 40px);
}

/* ---------------------------------------------------------------
   Inner container — width constrained by Blocksy's .ct-container
   --------------------------------------------------------------- */

.ibr-3x2-grid {
	width: 100%;
	box-sizing: border-box;
	text-align: left;
}

/* Blocksy applies its own vertical padding to .ct-container; the strip
   already supplies that, so remove it here to avoid doubling up. */
.ibr-3x2-grid-wrapper .ibr-3x2-grid.ct-container {
	padding-top: 0;
	padding-bottom: 0;
}

/* Heading inherits the section colour rather than the theme's heading colour. */
.ibr-3x2-grid .matrix-grid-title {
	color: inherit;
	font-size: 24px;
	font-weight: 700;
	line-height: 1.2;
	margin-top: 0;
	margin-bottom: 15px;
	padding: 0;
}

/* ---------------------------------------------------------------
   Grid
   --------------------------------------------------------------- */

.ibr-3x2-grid .matrix-grid-core {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 14px;
	margin: 0;
	padding: 6px 0;
	width: 100%;
}

/* ---------------------------------------------------------------
   Banners

   Height is set by the artwork: images render at their natural aspect
   ratio, as the Shopify section does. Banners are not cropped, so a
   banner supplied at a different ratio to the others in its row will
   show white beneath it inside the card.
   --------------------------------------------------------------- */

.ibr-3x2-grid .matrix-grid-link {
	display: block;
	overflow: hidden;
	background: #ffffff;
	border-radius: 6px;
	box-shadow: 0 0 4px rgba(0, 0, 0, 0.15);
	text-decoration: none;
	color: inherit;
}

.ibr-3x2-grid .matrix-grid-link img,
.ibr-3x2-grid .matrix-grid-link video {
	width: 100%;
	height: auto;
	display: block;
}

.ibr-3x2-grid .matrix-grid-placeholder {
	background: #ffffff;
	aspect-ratio: 2.4;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #777777;
	font-size: 14px;
}

/* ---------------------------------------------------------------
   Mobile — 749px breakpoint, as per the Shopify section
   --------------------------------------------------------------- */

@media screen and (max-width: 749px) {

	.ibr-3x2-grid-wrapper {
		margin-top: var(--ibr3x2-mt-mobile, 20px);
		margin-bottom: var(--ibr3x2-mb-mobile, 20px);
		padding-top: 25px;
		padding-bottom: 25px;
	}

	.ibr-3x2-grid-wrapper.alignfull {
		margin-block-start: var(--ibr3x2-mt-mobile, 20px);
		margin-block-end: var(--ibr3x2-mb-mobile, 20px);
	}

	.ibr-3x2-grid .matrix-grid-core {
		grid-template-columns: 1fr;
		gap: 12px;
	}
}
