/* Quiet botanical motifs sit behind the hero content, outside the tab order. */
.botanical-hero {
  position: relative;
  isolation: isolate;
  --botanical-left: url("../images/patterns/botanical-leaves.svg?v=2");
  --botanical-right: url("../images/patterns/botanical-flowers.svg?v=2");
}

.botanical-hero::before,
.botanical-hero::after {
  content: "";
  position: absolute;
  top: 1.6rem;
  bottom: 1.6rem;
  width: clamp(12rem, 24vw, 38rem);
  z-index: -1;
  pointer-events: none;
  opacity: 0.07;
  background-repeat: no-repeat;
  background-size: contain;
}

.botanical-hero::before {
  left: 1.6rem;
  background-image: var(--botanical-left);
  background-position: left bottom;
}

.botanical-hero::after {
  display: none;
  right: 1.6rem;
  background-image: var(--botanical-right);
  background-position: right top;
}

.botanical-flowers {
  --botanical-left: url("../images/patterns/botanical-flowers.svg?v=2");
  --botanical-right: url("../images/patterns/botanical-leaves.svg?v=2");
}

.botanical-trees {
  --botanical-left: url("../images/patterns/botanical-trees.svg?v=2");
  --botanical-right: url("../images/patterns/botanical-leaves.svg?v=2");
}

/* Keep the complete motifs beside the content on wide desktop screens. */
@media (min-width: 1800px) {
  .botanical-hero::before,
  .botanical-hero::after {
    display: block;
    width: min(28rem, calc((100% - var(--content-max)) / 2 - 3.2rem));
  }

  .botanical-hero::before {
    left: max(1.6rem, calc((100% - var(--content-max)) / 2 - 31.2rem));
  }

  .botanical-hero::after {
    right: max(1.6rem, calc((100% - var(--content-max)) / 2 - 31.2rem));
  }
}

@media (max-width: 600px) {
  .botanical-hero::before,
  .botanical-hero::after {
    opacity: 0.045;
    width: 40%;
  }

  .botanical-hero::before {
    display: none;
  }

  .botanical-hero::after {
    display: block;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .botanical-hero::before {
    animation: botanicalDriftLeft 18s ease-in-out infinite alternate;
  }

  .botanical-hero::after {
    animation: botanicalDriftRight 22s ease-in-out infinite alternate;
  }

  @keyframes botanicalDriftLeft {
    from {
      transform: translateY(0) translateX(0);
    }
    to {
      transform: translateY(-10px) translateX(6px);
    }
  }

  @keyframes botanicalDriftRight {
    from {
      transform: translateY(0) translateX(0);
    }
    to {
      transform: translateY(10px) translateX(-6px);
    }
  }
}
