.section--construction-wave,
.section--services-wave {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  --construction-fade-top: var(--aqua-light);
  --construction-fade-bottom: var(--aqua-light);
  /* Set in JS from headline height; fallback until measured */
  --construction-wave-top: 12rem;
  --construction-wave-bottom: 0px;
}

.section--construction-wave {
  background-color: var(--aqua-light);
  /* Maintenance follows directly below #build (logo band sits after Maintenance). */
  --construction-fade-top: var(--aqua-light);
  --construction-fade-bottom: var(--aqua-light);
}

.section--construction-wave > .construction-wave-bg,
.section--services-wave > .construction-wave-bg {
  position: absolute;
  left: 0;
  right: 0;
  top: var(--construction-wave-top);
  bottom: var(--construction-wave-bottom);
  width: 100%;
  max-width: none;
  z-index: 0;
  pointer-events: none;
  /* Background layer — always below .wrap content (cards) */
  /* Fades keep a px minimum so short bands (testimonials) still blend softly. */
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0,
    #000 max(14%, 4.5rem),
    #000 min(64%, calc(100% - 9rem)),
    rgba(0, 0, 0, 0.45) min(84%, calc(100% - 3.5rem)),
    transparent 100%
  );
  mask-image: linear-gradient(
    to bottom,
    transparent 0,
    #000 max(14%, 4.5rem),
    #000 min(64%, calc(100% - 9rem)),
    rgba(0, 0, 0, 0.45) min(84%, calc(100% - 3.5rem)),
    transparent 100%
  );
}

.construction-wave-bg canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  min-width: 100%;
  min-height: 100%;
}

.construction-wave-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(
    165deg,
    rgba(247, 251, 254, 0.42) 0%,
    rgba(247, 251, 254, 0.12) 45%,
    rgba(247, 251, 254, 0.28) 100%
  );
}

/* Soft blend between adjacent homepage sections */
.section--construction-wave::before,
.section--construction-wave::after,
.section--services-wave::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  z-index: 0;
  pointer-events: none;
}

.section--construction-wave::before {
  top: 0;
  height: clamp(8rem, 28vw, 14rem);
  background: linear-gradient(
    to bottom,
    var(--construction-fade-top) 0%,
    rgba(247, 251, 254, 0.88) 22%,
    rgba(247, 251, 254, 0.45) 58%,
    rgba(247, 251, 254, 0) 100%
  );
}

.section--construction-wave::after,
.section--services-wave::after {
  display: none;
}

/*
 * Every wave section follows the #projects pattern: the wave spans the card row
 * (ending just above the card bottoms, see gradient-wave.js) and the section keeps
 * plain aqua space below the cards so nothing is clipped by overflow:hidden.
 */
.section--construction-wave#build {
  scroll-margin-top: calc(var(--header-h) + 1rem);
}

.section--construction-wave#build::before {
  display: none;
}

.section--construction-wave#build > .construction-maintenance-blend {
  display: none;
}

.section--services-wave#services,
.section--construction-wave#build {
  padding-bottom: clamp(3.5rem, 7vw, 5.5rem);
}

.section--services-wave#projects,
.section--testimonials-wave#testimonials {
  padding-bottom: 0;
}

.section--testimonials-wave#testimonials {
  overflow: visible;
}

/* Full-bleed fade directly under each section’s card row */
.section-cards-blend {
  --section-blend-to: var(--aqua-light);
  position: relative;
  z-index: 0;
  pointer-events: none;
  width: 100vw;
  max-width: none;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  margin-top: clamp(0.35rem, 1vw, 0.65rem);
  height: clamp(4.25rem, 12vw, 7.5rem);
  background: linear-gradient(
    to bottom,
    rgba(247, 251, 254, 0) 0%,
    rgba(247, 251, 254, 0.38) 28%,
    rgba(247, 251, 254, 0.88) 52%,
    var(--section-blend-to) 78%,
    var(--section-blend-to) 100%
  );
}

.section-cards-blend--to-aqua {
  --section-blend-to: var(--aqua-light);
}

.section-cards-blend--to-white {
  --section-blend-to: #fff;
}

.section-cards-blend--to-navy {
  --section-blend-to: var(--navy);
  background: linear-gradient(
    to bottom,
    rgba(247, 251, 254, 0) 0%,
    rgba(247, 251, 254, 0.35) 26%,
    rgba(15, 35, 55, 0.55) 58%,
    var(--navy) 82%,
    var(--navy) 100%
  );
}

.section--maintenance {
  position: relative;
  z-index: 1;
  isolation: isolate;
  margin-top: 0;
  padding-top: clamp(1.5rem, 3vw, 2.5rem);
}

.section--maintenance::before {
  display: none;
}

.section--maintenance > .wrap {
  position: relative;
  z-index: 1;
}

.section--services-wave > .wrap,
.section--construction-wave > .wrap {
  position: relative;
  z-index: 1;
}

.section--services-wave .card-grid,
.section--services-wave .project-grid,
.section--services-wave#projects > .wrap > p,
.section--services-wave#testimonials .client-feedback-grid,
.section--testimonials-wave#testimonials .testimonials-section-foot,
.section--testimonials-wave#testimonials .testimonials-below-wave,
.section--services-wave .section-cards-blend {
  position: relative;
  z-index: 1;
}

#testimonials .testimonials-section-foot {
  position: relative;
  z-index: 4;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: clamp(6.75rem, 17vw, 10.25rem);
  margin-top: 0;
}

#testimonials .testimonials-section-foot > .section-cards-blend {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100vw;
  max-width: none;
  height: 100%;
  margin: 0;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  background: linear-gradient(
    to bottom,
    rgba(247, 251, 254, 0) 0%,
    rgba(247, 251, 254, 0.32) 22%,
    rgba(247, 251, 254, 0.78) 48%,
    var(--aqua-light) 76%,
    var(--aqua-light) 100%
  );
}

#testimonials .testimonials-section-foot .testimonials-below-wave {
  z-index: 2;
  width: 100%;
  flex: 0 0 auto;
}

#contact.section {
  position: relative;
  z-index: 1;
  margin-top: 0;
  padding-top: 0;
}

@media (prefers-reduced-motion: reduce) {
  .construction-wave-bg {
    display: none;
  }
}
