/**
 * Before / After — Roof Replacement section 7 (1920x1048).
 *
 * Measured off the Figma nodes:
 *   section   padding 120 240, stack gap 40
 *   head      1440x168 — centred eyebrow, 64/700 heading, 20/400 lede
 *   media     1440x600 — two 720x600 panes butted together, no gutter
 *   badges    BEFORE 106x48 #010101 top-left, AFTER 95x48 #01963A top-right,
 *             both padding 10/20, label 18/500 white
 *   stats     1440x102 at y=498, so it overlaps the last 102px of the panes.
 *             Background #010101, padding 30/25, three 463px items,
 *             value 36/700 #01963A, label 18/400 #FFFFFF
 */

.before-after__inner {
	display: flex;
	flex-direction: column;
	gap: var(--space-40);
}

/* --- head ------------------------------------------------------------ */
.before-after__head {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
}

.before-after__head .section-eyebrow-center {
	margin-bottom: 22px;
}

.before-after__heading {
	margin-bottom: var(--space-16);
}

.before-after__text {
	margin: 0;
}

/* --- media ------------------------------------------------------------ */
.before-after__media {
	position: relative;
	display: grid;
	/* minmax(0, 1fr), not a bare 1fr: `1fr` is minmax(AUTO, 1fr), so a grid item
	 * wider than its share expands the track. Below 992 the stats panel drops
	 * out of absolute positioning and becomes a real grid item — its min-content
	 * width then pushed track 1 to 463 and squeezed the second photo to 245 at
	 * 768, which is exactly iPad portrait. A 0 floor keeps the halves equal. */
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	/* No gutter: the two halves meet on the centre line in the design. */
	gap: 0;
}

.before-after__pane {
	position: relative;
	margin: 0;
	aspect-ratio: 720 / 600;
	overflow: hidden;
}

.before-after__image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* --- badges ----------------------------------------------------------- */
.before-after__badge {
	position: absolute;
	top: 0;
	padding: var(--space-10) var(--space-20);
	color: var(--white);
	font-family: var(--font-body);
	font-size: var(--fs-18);
	font-weight: 500;
	line-height: var(--lh-18-30);
	text-transform: uppercase;
}

.before-after__badge--before {
	left: 0;
	background-color: var(--primary-black);
}

.before-after__badge--after {
	right: 0;
	background-color: var(--primary-green);
}

/* --- stats strip ------------------------------------------------------ */
/* Anchored to the foot of the pair rather than placed after it, so it sits
 * over the images exactly as the design shows. */
.before-after__stats {
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	display: grid;
	grid-auto-flow: column;
	/* grid-auto-columns: 1fr removed at the developer's instruction. The tracks
	 * now size to their content instead of three equal thirds, so the figures
	 * sit as wide as they need and the dividers follow them. */
	align-items: center;
	margin: 0;
	padding: var(--space-30) var(--space-25);
	/* Frosted, not solid. The design's fill is #010101 at fill opacity 0.5 with a
	 * BACKGROUND_BLUR effect at radius 22 — Figma's blur radius is ~2x the CSS
	 * value, so 11px. The build flattened both: it read the fill's colour and
	 * dropped its 0.5 opacity, and ignored the effect entirely, which is why the
	 * bar read as an opaque slab over the photos instead of glass. */
	background-color: rgba(var(--primary-black-rgb), 0.5);
	backdrop-filter: blur(11px);
	list-style: none;
}

/* No backdrop-filter, no blur — carry more of the black so the white labels
 * keep their contrast against whatever is behind them. */
@supports not (backdrop-filter: blur(1px)) {

	.before-after__stats {
		background-color: rgba(var(--primary-black-rgb), 0.8);
	}
}

.before-after__stat {
	display: flex;
	align-items: baseline;
	justify-content: center;
	/* 0 10 at the developer's instruction. A departure: the design's stat frames
	 * carry no padding at all. The tracks stay 463 either way, so the divider
	 * does not move — this only insets the figures away from it. */
	gap: var(--space-30);
	padding: 0 10px;
}

/* A hairline divides the three figures. The design builds it as a 1px stroke on
 * the RIGHT of stat frames 1 and 2 (borderStrokeWeightsIndependent with only
 * borderRightWeight set), solid #FFFFFF at full opacity — not the 20% white this
 * carried, which rendered it as a faint grey smudge. Mirrored here as a
 * right-hand border on every stat but the last, which is the same construction
 * and the same pixel: the design's line sits at x=488, the right edge of frame 1
 * and the left edge of frame 2. */
.before-after__stat:not(:last-child) {
	border-right: 1px solid var(--white);
}

.before-after__stat-value {
	color: var(--primary-green);
	font-family: var(--font-heading);
	font-size: var(--fs-36);
	font-weight: 700;
	line-height: var(--lh-36);
}

.before-after__stat-label {
	color: var(--white);
	font-family: var(--font-body);
	font-size: var(--fs-18);
	font-weight: 400;
	line-height: var(--lh-18-30);
}

/* --- responsive -------------------------------------------------------- */

@media (min-width: 1200px){
	.before-after__stat-value{
		position: relative;
		top: 5px;
	}
}
@media (max-width: 1199px) {
	.before-after__stat-value {
        position: relative;
        top: 2px;
    }
}
@media (max-width: 991px) {

	.before-after__stats {
		/* Solid here, not the frosted glass. Static below 992 the bar sits BELOW
		 * the photos rather than over them, so there is nothing behind it worth
		 * blurring and the 50% black only costs the labels contrast. */
		background-color: var(--primary-black);
		backdrop-filter: none;
		position: static;
		/* In flow it is a grid item, so it needs saying where it goes — left to
		 * auto-placement it sat in column 1 under the "before" photo. */
		grid-column: 1 / -1;
		gap: var(--space-20);
		padding: var(--space-25);
	}

	.before-after__stat {
		gap: var(--space-15);
	}
}

@media (max-width: 767px) {

	.before-after__media {
		grid-template-columns: 1fr;
	}

	/* 14 at the developer's instruction. BEFORE / AFTER are corner labels, not
	 * copy — at the desktop 18 they take a noticeable bite out of a full-width
	 * photo once the pair stacks. */
	.before-after__badge {
		font-size: 14px;
	}

	.before-after__stats {
		grid-auto-flow: row;
	}

	/* Stacked, the rule turns horizontal — and the right-hand border above has
	 * to be cleared, or it draws a stray vertical tick beside each row. */
	.before-after__stat:not(:last-child) {
		border-right: 0;
	}

	.before-after__stat + .before-after__stat {
		padding-top: var(--space-20);
		border-top: 1px solid var(--white);
	}
}
