/* BGL Wellenelemente: position section dividers visibly above adjoining content. */
.bgl-wave-container {
  position: relative !important;
  overflow: visible !important;
  /* The wave must paint above the preceding/succeeding Elementor section. */
  z-index: 2 !important;
  isolation: auto !important;
}
.bgl-wave-container.bgl-wave-has-top::before,
.bgl-wave-container.bgl-wave-has-bottom::after {
  content: "";
  display: block;
  position: absolute;
  left: 0;
  right: 0;
  width: 100%;
  height: auto;
  pointer-events: none;
  z-index: 3;
  box-sizing: border-box;
  background-repeat: no-repeat;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-position: center center;
  mask-position: center center;
}
/* The filled bottom of an upper wave joins flush with the top section edge. */
.bgl-wave-container.bgl-wave-has-top::before {
  top: 0;
  bottom: auto;
  transform: translateY(-100%);
  aspect-ratio: var(--bgl-top-aspect, 10);
  background-color: var(--bgl-top-color, #23538A);
  -webkit-mask-image: var(--bgl-top-mask, none), linear-gradient(#000, #000);
  mask-image: var(--bgl-top-mask, none), linear-gradient(#000, #000);
  -webkit-mask-size: 100% 100%, 100% 6px;
  mask-size: 100% 100%, 100% 6px;
  -webkit-mask-position: center center, center bottom;
  mask-position: center center, center bottom;
}
/* The filled top of a lower wave joins flush with the bottom section edge. */
.bgl-wave-container.bgl-wave-has-bottom::after {
  top: 100%;
  bottom: auto;
  aspect-ratio: var(--bgl-bottom-aspect, 10);
  background-color: var(--bgl-bottom-color, #23538A);
  -webkit-mask-image: var(--bgl-bottom-mask, none), linear-gradient(#000, #000);
  mask-image: var(--bgl-bottom-mask, none), linear-gradient(#000, #000);
  -webkit-mask-size: 100% 100%, 100% 6px;
  mask-size: 100% 100%, 100% 6px;
  -webkit-mask-position: center center, var(--bgl-bottom-seal-position, center top);
  mask-position: center center, var(--bgl-bottom-seal-position, center top);
  transform: var(--bgl-bottom-flip, none);
}
@media (max-width: 1024px) {
  .bgl-wave-container.bgl-wave-has-top::before { aspect-ratio: var(--bgl-top-aspect-tablet, var(--bgl-top-aspect, 10)); }
  .bgl-wave-container.bgl-wave-has-bottom::after { aspect-ratio: var(--bgl-bottom-aspect-tablet, var(--bgl-bottom-aspect, 10)); }
}
@media (max-width: 767px) {
  .bgl-wave-container.bgl-wave-has-top::before { aspect-ratio: var(--bgl-top-aspect-mobile, var(--bgl-top-aspect, 10)); }
  .bgl-wave-container.bgl-wave-has-bottom::after { aspect-ratio: var(--bgl-bottom-aspect-mobile, var(--bgl-bottom-aspect, 10)); }
}

/* Outside clearance: wave remains flush with its section edge. The layout helper
   measures the real wave height and reserves wave height + outer clearance.
   NO padding is added to the selected section. */
.elementor .bgl-wave-container.bgl-wave-has-top {
  margin-block-start: calc(var(--margin-top, 0px) + var(--bgl-top-space, 100px)) !important;
}
.elementor .bgl-wave-container.bgl-wave-has-bottom {
  margin-block-end: calc(var(--margin-bottom, 0px) + var(--bgl-bottom-space, 100px)) !important;
}
/* Live SVG preview in Elementor. PHP masks are suppressed only for sections
   with a DOM-based editor preview, preventing duplicate wave silhouettes. */
.elementor .bgl-wave-container.bgl-wave-editor-preview::before,
.elementor .bgl-wave-container.bgl-wave-editor-preview::after {
  content: none !important;
  display: none !important;
}
.elementor .bgl-wave-editor-preview::before,
.elementor .bgl-wave-editor-preview::after {
  content: none !important;
}
.elementor .bgl-wave-editor-preview {
  position: relative !important;
  overflow: visible !important;
}
.elementor .bgl-wave-editor-decoration {
  position: absolute;
  inset-inline: 0;
  width: 100%;
  height: auto;
  aspect-ratio: var(--bgl-wave-aspect, 10);
  pointer-events: none;
  z-index: 20;
  line-height: 0;
}
.elementor .bgl-wave-editor-decoration svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.elementor .bgl-wave-editor-top {
  top: 0;
  transform: translateY(-100%);
}
.elementor .bgl-wave-editor-bottom {
  top: 100%;
  bottom: auto;
}
@media (max-width: 1024px) {
  .elementor .bgl-wave-editor-decoration {
    aspect-ratio: var(--bgl-wave-aspect-tablet, 10);
  }
}
@media (max-width: 767px) {
  .elementor .bgl-wave-editor-decoration {
    aspect-ratio: var(--bgl-wave-aspect-mobile, 10);
  }
}


/* Edge/Chromium subpixel anti-aliasing: overlap the filled SVG edge into the
   adjacent section by 2 CSS pixels so fractional rasterization leaves no seam. */
.bgl-wave-container.bgl-wave-has-top:not(.bgl-wave-inside-top)::before { top: 2px; }
.bgl-wave-container.bgl-wave-has-bottom:not(.bgl-wave-inside-bottom)::after { top: calc(100% - 2px); }

/* Inside waves are flipped at the section's own edge, not moved into a
   neighboring section. 2px overlap prevents an Edge hairline at the join. */
.bgl-wave-container.bgl-wave-inside-top::before {
  top: -2px;
  bottom: auto;
  transform: none;
  -webkit-mask-image: var(--bgl-top-mask, none), linear-gradient(#000, #000);
  mask-image: var(--bgl-top-mask, none), linear-gradient(#000, #000);
  -webkit-mask-size: 100% 100%, 100% 6px;
  mask-size: 100% 100%, 100% 6px;
  -webkit-mask-position: center center, center bottom;
  mask-position: center center, center bottom;
  /* Flip the mask, not the element box, so the solid edge stays at y=0. */
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: 100% 100%, 100% 6px;
  mask-size: 100% 100%, 100% 6px;
  -webkit-mask-position: center center, center bottom;
  mask-position: center center, center bottom;
}
.bgl-wave-container.bgl-wave-inside-top::before { transform: scaleY(-1); top: 0; }
.bgl-wave-container.bgl-wave-inside-bottom::after {
  top: auto;
  bottom: 0;
  transform: var(--bgl-bottom-inside-flip, scaleY(-1));
}
/* Apply clearance only on the side where the wave lives. */
.elementor .bgl-wave-container.bgl-wave-inside-top { margin-block-start: var(--margin-top, 0px) !important; }
.elementor .bgl-wave-container.bgl-wave-inside-bottom { margin-block-end: var(--margin-bottom, 0px) !important; }
.elementor .bgl-wave-container.bgl-wave-inside-top {
  padding-top: max(var(--padding-top, 0px), var(--bgl-top-space, 100px)) !important;
}
.elementor .bgl-wave-container.bgl-wave-inside-bottom {
  padding-bottom: max(var(--padding-bottom, 0px), var(--bgl-bottom-space, 100px)) !important;
}
/* SVG preview uses the same 2px seam overlap as frontend masks. */
.elementor .bgl-wave-editor-top:not(.bgl-wave-editor-inside) { transform: translateY(calc(-100% + 2px)); }
.elementor .bgl-wave-editor-bottom:not(.bgl-wave-editor-inside) { top: calc(100% - 2px); }
.elementor .bgl-wave-editor-top.bgl-wave-editor-inside { top: 0; bottom: auto; transform: none; }
.elementor .bgl-wave-editor-bottom.bgl-wave-editor-inside { top: auto; bottom: 0; transform: none; }

/* Header shortcode: cover a fractional edge seam to the next section too. */
.bgl-welle.mh-welle {
  position: relative;
  overflow: visible !important;
  z-index: 2;
}
.bgl-welle.mh-welle svg {
  position: relative;
  margin-bottom: -2px;
}

/* 1.3.1: a solid, non-masked join prevents Edge/Chromium hairlines when SVG
   and the adjoining section rasterize to different device-pixel boundaries.
   The second mask layer above makes the join's last 6 CSS px fully opaque. */
.bgl-welle.mh-welle::after {
  content: "";
  display: block;
  position: relative;
  height: 3px;
  margin-top: -2px;
  margin-bottom: -1px;
  background-color: currentColor;
  pointer-events: none;
}
