.awesome-squiggle-wave {
	display: block;
	overflow: hidden;
	position: relative;
	background-color: transparent !important; /* Container always transparent */
	/* Prevent flash of incorrect sizing */
	min-width: 0; /* Allow shrinking in flex containers */
	box-sizing: border-box;
}

.awesome-squiggle-wave svg {
	display: block;
	width: 100%;
	height: 100%;
}

/* Unified wave animation - applies to all wave types */
.awesome-squiggle-wave .wave-path {
	transform-origin: center;
	animation: var(--animation-name, wave-flow)
		var(--animation-duration, 1.6s) linear infinite;
	vector-effect: non-scaling-stroke;
}

/* Paused state for all wave types */
.awesome-squiggle-wave.is-paused .wave-path {
	animation-play-state: paused;
}

/* Static state for style presets (when animation is disabled) */
.wp-block-separator.is-style-squiggle.is-paused .wave-path,
.wp-block-separator.is-style-zigzag.is-paused .wave-path,
.wp-block-separator.is-style-lightning.is-paused .wave-path,
.wp-block-separator.is-style-pixel.is-paused .wave-path {
	animation: none;
}

/* Force transparent background for all squiggle containers */
.wp-block-separator.awesome-squiggle-wave {
	background-color: transparent !important; /* Always transparent */
	padding: 0;
	border: none;
	/* Prevent layout flash by ensuring immediate proper sizing */
	transition: none !important; /* Disable any transitions that might cause flash */
}

/* Even when WordPress adds background classes, keep container transparent */
.wp-block-separator.awesome-squiggle-wave.has-background {
	background-color: transparent !important;
}

/* Remove any default border styles that might interfere */
.wp-block-separator.awesome-squiggle-wave.has-background,
.wp-block-separator.awesome-squiggle-wave.has-text-color {
	border: none !important;
}

/* Strip padding from wave separators — WordPress's layout system and
   block spacing controls can inject padding via preset spacing variables
   (e.g., --wp--preset--spacing--30), which creates gaps between the wave
   and container edges. Padding has no purpose on a decorative separator. */
.wp-block-separator.awesome-squiggle-wave {
	padding: 0 !important;
}

/* Responsive height: respect the inline height from block attributes.
   Only set min-height as a safety floor — never override to auto,
   which collapses the container and causes SVG scaling/stroke issues. */
.awesome-squiggle-wave,
.wp-block-separator.awesome-squiggle-wave {
	min-height: 50px;
}

/* ========================================
   FLEX/GRID CONTAINER SUPPORT
   Ensures squiggles display properly inside
   Group, Row, Stack, Grid, and Columns blocks
   ======================================== */

/* Inside Row blocks (horizontal flex) */
.wp-block-group.is-layout-flex .awesome-squiggle-wave,
.wp-block-group.is-layout-flex > .wp-block-separator.awesome-squiggle-wave {
	flex: 1 1 auto;
	min-width: 100px;
	width: auto;
	align-self: center;
}

/* Inside Stack blocks (vertical flex) */
.wp-block-group.is-layout-flow .awesome-squiggle-wave,
.wp-block-group.is-layout-flow > .wp-block-separator.awesome-squiggle-wave {
	width: 100%;
	flex-shrink: 0;
}

/* Inside Grid blocks */
.wp-block-group.is-layout-grid .awesome-squiggle-wave,
.wp-block-group.is-layout-grid > .wp-block-separator.awesome-squiggle-wave {
	width: 100%;
	min-height: 50px;
	justify-self: stretch;
	align-self: center;
}

/* Inside Columns blocks */
.wp-block-column .awesome-squiggle-wave,
.wp-block-column > .wp-block-separator.awesome-squiggle-wave {
	width: 100%;
	flex-shrink: 0;
}

/* SVG scaling inside flex/grid contexts */
.is-layout-flex .awesome-squiggle-wave svg,
.is-layout-grid .awesome-squiggle-wave svg {
	width: 100%;
	height: inherit;
}

/* UNIFIED WAVE ANIMATIONS - 80px = 1 full wave cycle (up + down) for seamless loop */
/* Decorative animations — direction should not be flipped for RTL */
/* rtl:begin:ignore */
@keyframes wave-flow {
	0% {
		transform: translateX(0);
	}
	100% {
		transform: translateX(-80px);
	}
}

@keyframes wave-flow-reverse {
	0% {
		transform: translateX(0);
	}
	100% {
		transform: translateX(80px);
	}
}

/* rtl:end:ignore */

/* Improved spacing controls support */
.wp-block-separator.awesome-squiggle-wave {
	margin: 1.5em auto; /* Default margin that can be overridden by spacing controls */
}

/* Ensure squiggle respects WordPress separator width settings */
.wp-block-separator.awesome-squiggle-wave.is-style-wide {
    width: 100%;
    max-width: none;
}

/* ========================================
   FULL WIDTH (alignfull) SUPPORT
   Theme-agnostic approach with multiple fallbacks
   ======================================== */

/* Alignfull: break out of any padded container to reach viewport edges.
   Uses 100vw width + negative margins, which works regardless of whether
   the parent padding comes from --wp--style--root--padding-*, inline
   preset spacing (--wp--preset--spacing--*), or classic theme wrappers. */
.wp-block-separator.awesome-squiggle-wave.alignfull {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
}

/* ========================================
   EDITOR-SPECIFIC FULL WIDTH SUPPORT
   The block editor uses an iframe with different container structure.
   alignfull blocks need to extend to the full iframe viewport width.
   ======================================== */

/* Editor: alignfull blocks should fill the full iframe viewport */
.editor-styles-wrapper .wp-block-separator.awesome-squiggle-wave.alignfull,
.block-editor-block-list__layout .wp-block-separator.awesome-squiggle-wave.alignfull {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
}

/* Support for custom widths set via WordPress controls */
.wp-block-separator.awesome-squiggle-wave[style*="width"] {
	max-width: none; /* Allow custom width to take precedence */
}

/* Force transparent background for ALL wave separators.
   The [class] selector adds specificity to override WordPress background
   color classes, attribute selectors, and inline style overrides without
   needing to enumerate every possible class combination. */
.wp-block-separator.awesome-squiggle-wave[class] {
	background-color: transparent !important;
	background: transparent !important;
	border: none !important;
}

/* Responsive adjustments */
@media screen and (max-width: 768px) {
	.awesome-squiggle-wave {
		min-height: 60px;
	}
}

@media screen and (max-width: 480px) {
	.awesome-squiggle-wave {
		min-height: 50px;
	}
}

/* High contrast mode support */
@media (prefers-contrast: high) {
	.awesome-squiggle-wave .wave-path {
		stroke-width: 3px;
	}
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
	.awesome-squiggle-wave .wave-path {
		animation: none !important;
	}
}

/* Windows High Contrast / forced-colors mode */
@media (forced-colors: active) {
	.awesome-squiggle-wave .wave-path {
		stroke: CanvasText;
	}
}


/* Pixel style: crisp edges for 8-bit aesthetic */
.wp-block-separator.is-style-pixel .wave-path {
	shape-rendering: crispEdges;
	stroke-linecap: square;
	stroke-linejoin: miter;
}

/* Fallback for squiggle separators before wave class is applied */
.wp-block-separator.is-style-squiggle:not(.awesome-squiggle-wave),
.wp-block-separator.is-style-zigzag:not(.awesome-squiggle-wave),
.wp-block-separator.is-style-lightning:not(.awesome-squiggle-wave),
.wp-block-separator.is-style-pixel:not(.awesome-squiggle-wave) {
	border-top: 2px solid currentcolor;
	height: auto;
	min-height: 0;
}

/* ========================================
   SQUIGGLE BACKDROP BLOCK
   Wave band behind nested content. Animation reuses the
   wave-flow / wave-flow-reverse keyframes defined above
   (build_wave_svg() emits those animation-names).
   ======================================== */
/* The wave is the only thing the chosen color/gradient should paint.
   WordPress's color support paints the wrapper background from a named
   gradient (has-*-gradient-background, defined by core with !important);
   neutralise it at higher specificity so the gradient colours the wave
   (via the SVG stroke), not the whole block box. Mirrors the separator. */
.wp-block-awesome-squiggle-backdrop[class] {
	background: transparent !important;
	background-image: none !important;
}

.wp-block-awesome-squiggle-backdrop {
	position: relative;
	/* Clip the wave band to the block box so a band taller than the content
	   can't bleed over neighboring blocks (this also makes the padding-frame
	   work). isolation scopes the internal z-index (wave 0 / content 1) so the
	   wave never interacts with page or nested stacking contexts. */
	overflow: hidden;
	isolation: isolate;
}

.wp-block-awesome-squiggle-backdrop > .asquig-backdrop__wave {
	position: absolute;
	left: 0;
	right: 0;
	z-index: 0;
	overflow: hidden;
	pointer-events: none;
}

.wp-block-awesome-squiggle-backdrop > .asquig-backdrop__wave svg {
	display: block;
	width: 100%;
	height: 100%;
}

/* Content sits above the wave within the block's own stacking context. */
.wp-block-awesome-squiggle-backdrop > .asquig-backdrop__content {
	position: relative;
	z-index: 1;
}

.wp-block-awesome-squiggle-backdrop .wave-path {
	vector-effect: non-scaling-stroke;
}

@media (prefers-reduced-motion: reduce) {
	.wp-block-awesome-squiggle-backdrop .wave-path {
		animation: none !important;
	}
}

@media (forced-colors: active) {
	.wp-block-awesome-squiggle-backdrop .wave-path {
		stroke: CanvasText;
	}
}

/* High contrast mode — parity with the separator's rule above. */
@media (prefers-contrast: high) {
	.wp-block-awesome-squiggle-backdrop .wave-path {
		stroke-width: 3px;
	}
}
