/**
 * Gallery cantiere — masonry layout (CSS multi-column).
 *
 * The masonry effect is done with CSS columns (no JS): items flow into N
 * balanced columns and never break across a column. Each <img> carries
 * width/height so its box (and the column balance) is reserved before load —
 * that keeps the layout stable even for the lazy images (loading="lazy" from
 * the 21st on).
 */

/* The gallery lives inside a normal WP page, which Breakdance wraps in a
   width-constrained `.section-container` (rule `.bde-section .section-container`,
   specificity 0,2,0, loaded AFTER this file). Release that constraint just for
   the page(s) that contain this gallery so the section can go full-bleed —
   matching Breakdance's descendant selector (0,3,0) so we win regardless of
   stylesheet load order. */
.bde-section .section-container:has(.am-gallery-sec) {
	max-width: none;
	padding: 0;
}

/* Breakdance's `.section-container` and `.bde-code-block` are both flex columns
   with `align-items:flex-start`, so their children are shrink-to-fit. A
   multi-column container that is shrink-to-fit computes its width from the
   content (3 columns at the images' natural width) and overflows to the right
   instead of dividing the available width into 3. Force the wrapper chain to
   fill its parent so `column-count` splits the real available width. */
.bde-code-block:has(.am-gallery-sec) {
	width: 100%;
	align-self: stretch;
}

.am-gallery-sec {
	width: 100%;
	box-sizing: border-box;
	background: #fff;
	/* padding-top clears the transparent/overlay site header */
	padding: 184px 30px 96px;
}

.am-gallery-sec__inner {
	max-width: 1440px;
	margin: 0 auto;
}

.am-gallery-sec__title {
	margin: 0 0 44px;
	color: var(--am-green, #193f2f);
	font-family: var(--am-font-display, "Season Mix"), sans-serif;
	font-weight: 500;
	font-size: 64px;
	letter-spacing: -0.02em;
	line-height: 1.05;
}

/* Masonry via CSS columns. NB: the grid class is intentionally NOT `.am-gallery`
   — that name is already a registered Breakdance global class (the home page's
   horizontal drag-slider: display:flex; overflow-x:auto; cursor:grab), whose
   `display:flex` would suppress the multi-column layout. */
.am-gallery-sec__grid {
	column-count: 3;
	column-gap: 12px;
}

.am-gallery-sec__item {
	break-inside: avoid;
	-webkit-column-break-inside: avoid;
	margin: 0 0 12px;
	display: block;
	width: 100%;
}

.am-gallery-sec__item img {
	display: block;
	width: 100%;
	height: auto;
}

@media (max-width: 1023px) {
	.am-gallery-sec {
		padding-top: 150px;
	}
	.am-gallery-sec__title {
		font-size: 48px;
	}
	.am-gallery-sec__grid {
		column-count: 2;
	}
}

@media (max-width: 767px) {
	.am-gallery-sec {
		padding: 120px 20px 64px;
	}
	.am-gallery-sec__title {
		font-size: 34px;
	}
	.am-gallery-sec__grid {
		column-count: 1;
	}
}
