/* ==========================================================================
   Backdrop blur (frosted glass)
   Ported from Keragroup / FF Theme (_backdrop-blur.scss). Paired with
   dist/js/backdrop-blur.js. Loaded on every front-end page (footer parts can
   use it too) and in the editor.
   ========================================================================== */

.has-ff-backdrop-blur {
	--ff-backdrop-blur: 8px;
	--ff-backdrop-bg-default: rgb(255 255 255 / 15%);
	--ff-backdrop-bg-fallback: rgb(255 255 255 / 85%);
}

/* Group (Row / Stack / Grid) and single columns blur what is behind them */
.wp-block-group.has-ff-backdrop-blur,
.wp-block-column.has-ff-backdrop-blur {
	-webkit-backdrop-filter: blur(var(--ff-backdrop-blur, 8px));
	backdrop-filter: blur(var(--ff-backdrop-blur, 8px));
}

/* No background colour: light frosted tint */
.wp-block-group.has-ff-backdrop-blur:not(.has-background),
.wp-block-column.has-ff-backdrop-blur:not(.has-background) {
	background-color: var(--ff-backdrop-bg-default);
}

/* Background colour set: draw it translucent (rgba), or the blur never shows.
   !important beats the palette class (.has-*-background-color, also !important,
   lower specificity) and the inline style of a custom colour. */
.wp-block-group.has-ff-backdrop-blur.has-background[style*="--ff-backdrop-bg:"],
.wp-block-column.has-ff-backdrop-blur.has-background[style*="--ff-backdrop-bg:"] {
	background-color: color-mix(in srgb, var(--ff-backdrop-bg) var(--ff-backdrop-bg-opacity, 60%), transparent) !important;
}

/* Cover: a blur-only layer between the media and the overlay.
   backdrop-filter on the overlay itself does nothing (it carries opacity). */
.wp-block-cover.has-ff-backdrop-blur::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
	pointer-events: none;
	-webkit-backdrop-filter: blur(var(--ff-backdrop-blur, 8px));
	backdrop-filter: blur(var(--ff-backdrop-blur, 8px));
}
.wp-block-cover.has-ff-backdrop-blur > .wp-block-cover__background { z-index: 2; }
.wp-block-cover.has-ff-backdrop-blur > .wp-block-cover__inner-container { z-index: 3; }

/* No backdrop-filter support: a more opaque panel keeps text legible */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
	.wp-block-group.has-ff-backdrop-blur:not(.has-background),
	.wp-block-column.has-ff-backdrop-blur:not(.has-background),
	.wp-block-cover.has-ff-backdrop-blur::before {
		background-color: var(--ff-backdrop-bg-fallback);
	}
}
