/*
 * Subtle paper/watercolour texture (brand guide §6, brief §1.6):
 * "at very low opacity, echoing the logo's medium... must never compete
 * with product photography or hurt legibility."
 *
 * Built as an inline SVG feTurbulence grain — no raster asset, no extra
 * HTTP request, stays crisp at any zoom, and its opacity is driven by
 * two theme.json custom tokens so it is a genuine on/off toggle:
 *   --wp--custom--texture--enabled  ("1" or "0")
 *   --wp--custom--texture--opacity  (e.g. "0.04")
 * Phase 7's Dev Panel flips `enabled` through the Global Styles API;
 * nothing here needs to change when it does.
 */

body {
	position: relative;
}

body::before {
	content: "";
	position: fixed;
	inset: 0;
	z-index: -1;
	pointer-events: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0.14   0 0 0 0 0.17   0 0 0 0 0.1   0 0 0 0.5 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
	background-repeat: repeat;
	opacity: calc(var(--wp--custom--texture--opacity, 0.04) * var(--wp--custom--texture--enabled, 1));
}

/*
 * Stronger, differently-seeded tile for alternating homepage bands that
 * want a touch more texture (e.g. the About or Testimonials section on
 * a cream-100 fill). Add `vv-texture-band` to a Group block.
 */
.vv-texture-band {
	position: relative;
	isolation: isolate;
}

.vv-texture-band::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	pointer-events: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' seed='23' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0.29   0 0 0 0 0.36   0 0 0 0 0.24   0 0 0 0.5 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
	background-repeat: repeat;
	opacity: calc((var(--wp--custom--texture--opacity, 0.04) * 1.5) * var(--wp--custom--texture--enabled, 1));
}

@media (prefers-contrast: more) {
	body::before,
	.vv-texture-band::before {
		display: none;
	}
}
