/**
 * Variant CSS: before-after--scalable-gallery-wall
 * Layer 2 — Path B before-after role (2026-06-10).
 * A SCALABLE dense gallery-wall mosaic of before/after pairs, framed as a board: the
 * whole section sits inside a bordered pinboard panel, and pairs are small matte-framed
 * tiles in a tight auto-fill mosaic. Each tile = a small ordinal, a horizontal
 * before|after split inside a passe-partout frame (inner padding + border + card bg),
 * corner tags, and a name plate beneath. Tile count flows to the client's project count
 * (clone/trim case-N-* tiles; 6 demo baked) — the mosaic just fills more of the board.
 * Distinct from dense-duo-grid (border-less large 2-up tiles, no board) and
 * thumb-pair-grid (tiny border-less pairs, inline footer): here everything lives inside
 * a framed board and each tile wears a matte frame, packed dense like a gallery wall.
 */

body.aibt-universal .universal-before-after--scalable-gallery-wall {
	background: var(--background-alt);
	color: var(--text-primary);
}

/* Board — the framed pinboard panel that wraps intro + mosaic. */
body.aibt-universal .universal-before-after--scalable-gallery-wall .universal-before-after__board {
	background: var(--background-card);
	border: 1px solid var(--divider-primary);
	/* Board radius tracks the active theme; +6px lifts the panel above its inner tiles. */
	border-radius: calc(var(--decor-radius) + 6px);
	padding: clamp(var(--space-lg), 4vw, var(--space-2xl));
	box-shadow: 0 18px 48px rgba(0, 0, 0, 0.08);
}

/* Intro — centred block inside the board, A8-safe. */
body.aibt-universal .universal-before-after--scalable-gallery-wall .universal-before-after__intro {
	margin-bottom: var(--space-xl);
	text-align: center;
}

body.aibt-universal .universal-before-after--scalable-gallery-wall .universal-before-after__intro > * {
	margin-inline: auto !important;
}

body.aibt-universal .universal-before-after--scalable-gallery-wall .universal-before-after__kicker {
	font-family: var(--font-body) !important;
	font-size: var(--text-xs) !important;
	font-weight: 600 !important;
	letter-spacing: var(--tracking-widest) !important;
	text-transform: uppercase !important;
	color: var(--accent) !important;
	margin: 0 0 var(--space-sm) 0 !important;
}

body.aibt-universal .universal-before-after--scalable-gallery-wall h2.universal-before-after__headline,
body.aibt-universal .universal-before-after--scalable-gallery-wall .universal-before-after__headline {
	font-family: var(--font-display) !important;
	color: var(--text-primary) !important;
	margin: 0 !important;
}

/* Mosaic — dense auto-fill so many small framed tiles pack in; flows for any N. */
body.aibt-universal .universal-before-after--scalable-gallery-wall .universal-before-after__mosaic {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: var(--space-md) !important;
}

/* Tile — ordinal + framed pair + plate. */
body.aibt-universal .universal-before-after--scalable-gallery-wall .universal-before-after__tile {
	display: flex;
	flex-direction: column;
	gap: var(--space-xs) !important;
}

body.aibt-universal .universal-before-after--scalable-gallery-wall .universal-before-after__num {
	font-family: var(--font-display) !important;
	font-size: var(--text-sm) !important;
	font-weight: 700 !important;
	line-height: 1 !important;
	letter-spacing: var(--tracking-wide) !important;
	color: var(--accent) !important;
	margin: 0 !important;
	/* Numeric — keep intact, never break. */
	overflow-wrap: normal;
}

/* Frame — passe-partout matte around the split (card bg + inner pad + border). */
body.aibt-universal .universal-before-after--scalable-gallery-wall .universal-before-after__frame {
	background: var(--background);
	border: 1px solid var(--divider-primary);
	border-radius: var(--decor-radius);
	padding: 6px;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.07);
}

/* Split — before | after halves meeting on a centre seam. */
body.aibt-universal .universal-before-after--scalable-gallery-wall .universal-before-after__split {
	position: relative;
	gap: 0 !important;
	/* Inner image radius sits a touch tighter than the matte frame. */
	border-radius: max(0px, calc(var(--decor-radius) - 4px));
	overflow: hidden;
}

/* Centre seam between the two halves. */
body.aibt-universal .universal-before-after--scalable-gallery-wall .universal-before-after__split::before {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	left: 50%;
	width: 2px;
	transform: translateX(-50%);
	background: var(--background-card);
	z-index: 2;
}

body.aibt-universal .universal-before-after--scalable-gallery-wall .universal-before-after__half {
	position: relative;
	flex: 1 1 50%;
	min-width: 0;
	overflow: hidden;
}

body.aibt-universal .universal-before-after--scalable-gallery-wall .universal-before-after__img {
	margin: 0 !important;
	display: block;
	height: 100%;
}

body.aibt-universal .universal-before-after--scalable-gallery-wall .universal-before-after__img img {
	display: block;
	width: 100%;
	height: 100%;
	aspect-ratio: 1 / 1;
	object-fit: cover;
	filter: var(--photo-filter, none);
	transition: transform var(--duration-slow, 900ms) var(--ease-elegant, ease);
}

/* Gentle paired zoom on hover — tactile result cue. */
body.aibt-universal .universal-before-after--scalable-gallery-wall .universal-before-after__tile:hover .universal-before-after__img img {
	transform: scale(1.05);
}

/* Corner tags — small chips on each half.
   Fixed rgba drop-shadow lifts the chip off any photo (theme-independent,
   correct text-on-photo pattern) so light chips stay crisp on bright shots. */
body.aibt-universal .universal-before-after--scalable-gallery-wall .universal-before-after__tag {
	position: absolute;
	top: 6px;
	z-index: 3;
	font-family: var(--font-body) !important;
	font-size: 0.625rem !important;
	font-weight: 700 !important;
	letter-spacing: var(--tracking-wide) !important;
	text-transform: uppercase !important;
	margin: 0 !important;
	padding: 0.25em 0.6em !important;
	border-radius: var(--decor-radius-pill);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28), 0 1px 2px rgba(0, 0, 0, 0.22);
}

/* "Przed" — neutral dark chip (text-on-dark), pinned to the left half. */
body.aibt-universal .universal-before-after--scalable-gallery-wall .universal-before-after__tag--before {
	left: 6px;
	background: var(--background-dark, #141414);
	color: var(--text-on-dark, #fff) !important;
}

/* "Po" — accent CTA chip to signal the win, pinned to the right half. */
body.aibt-universal .universal-before-after--scalable-gallery-wall .universal-before-after__tag--after {
	right: 6px;
	background: var(--cta-bg-primary);
	color: var(--cta-text-primary) !important;
}

/* Plate — small project name beneath the frame, like a gallery label. */
body.aibt-universal .universal-before-after--scalable-gallery-wall .universal-before-after__plate {
	font-family: var(--font-body) !important;
	font-size: var(--text-sm) !important;
	font-weight: 600 !important;
	line-height: 1.3 !important;
	color: var(--text-primary) !important;
	margin: 2px 0 0 0 !important;
	min-width: 0;
	/* Narrow cell — wrap on spaces, do not break PL mid-word. */
	overflow-wrap: normal;
}

/* Phone — single column; trim board padding; cap wide tracking (A5). */
@media (max-width: 600px) {
	body.aibt-universal .universal-before-after--scalable-gallery-wall .universal-before-after__board {
		padding: var(--space-lg) var(--space-md);
	}
	body.aibt-universal .universal-before-after--scalable-gallery-wall .universal-before-after__mosaic {
		grid-template-columns: minmax(0, 1fr);
	}
	body.aibt-universal .universal-before-after--scalable-gallery-wall .universal-before-after__kicker,
	body.aibt-universal .universal-before-after--scalable-gallery-wall .universal-before-after__tag {
		letter-spacing: 0 !important;
	}
}

/* Keyboard affordance — tile focus-within outline + image focus-visible. */
body.aibt-universal .universal-before-after--scalable-gallery-wall .universal-before-after__tile:focus-within {
	outline: 2px solid var(--accent);
	outline-offset: 3px;
}

body.aibt-universal .universal-before-after--scalable-gallery-wall .universal-before-after__img img:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

/* Respect reduced-motion — drop the hover zoom transition. */
@media (prefers-reduced-motion: reduce) {
	body.aibt-universal .universal-before-after--scalable-gallery-wall .universal-before-after__img img {
		transition: none !important;
	}
	body.aibt-universal .universal-before-after--scalable-gallery-wall .universal-before-after__tile:hover .universal-before-after__img img {
		transform: none;
	}
}

/* A8/A9 left-shift fix (2026-06-10): centered intro children (kicker/headline) were
   max-width-capped by WP constrained layout but had horizontal margin 0, pinning them
   to the left. Force margin-inline:auto. Section class doubled -> specificity (0,4,1)
   beats element-tag-qualified rules like h2.__headline; harmless on already-centered
   elements (auto margins compute to 0). Only left/right are overridden. */
body.aibt-universal .universal-before-after--scalable-gallery-wall.universal-before-after--scalable-gallery-wall .universal-before-after__kicker,
body.aibt-universal .universal-before-after--scalable-gallery-wall.universal-before-after--scalable-gallery-wall .universal-before-after__headline { margin-inline: auto !important; }
