/* Outer paragraph spacing — matches other paragraph types */
.paragraph--type-image-with-text-on-right {
  margin-top: 1.25em;
  margin-bottom: 1.25em;
}

/* ── IMAGE COLUMN ────────────────────────────────────────────── */
.image-with-text-right__image-wrap {
  position: relative;
  display: block;
  height: clamp(220px, 25vw, 380px);
  overflow: hidden;
}

.image-with-text-right__image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
}

/* Bootstrap d-none/d-block wrapper divs must fill the parent height
   so the img height:100% resolves correctly — exclude the overlay div */
.image-with-text-right__image-wrap > div:not(.image-with-text-right__overlay) {
  height: 100%;
}

/* Gradient backdrop when overlay is present */
.image-with-text-right__image-wrap:has(.image-with-text-right__overlay)::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.85) 0%,
    rgba(0, 0, 0, 0.35) 42%,
    rgba(0, 0, 0, 0.05) 72%
  );
  pointer-events: none;
  z-index: 2;
}

/* Overlay container — bottom-left, matching mini-slider */
.image-with-text-right__overlay {
  position: absolute;
  left: 1.5rem;
  bottom: 1.5rem;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
  max-width: calc(100% - 3rem);
  pointer-events: none;
}

.image-with-text-right__overlay a {
  pointer-events: auto;
}

/* Tagline text */
.image-with-text-right__tagline {
  color: #fff;
  font-size: clamp(2rem, 2.5vw, 2.9rem);
  font-weight: 500;
  line-height: 1.05;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  margin: 0;
}

/* Tagline CTA button — matches mini-slider button style */
.image-with-text-right__tagline-btn {
  display: inline-flex;
  align-items: center;
  background: #ff4024;
  color: #fff !important;
  padding: 0.65rem 1.15rem;
  text-decoration: none;
  font-size: 1.5rem;
  line-height: 1.1;
  border: 0;
  border-radius: 0;
  font-weight: 400;
}

/* ── TEXT COLUMN ─────────────────────────────────────────────── */
.text-with-text-on-right {
  background-color: #fff;
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  box-sizing: border-box;
  position: relative;
  height: clamp(220px, 25vw, 380px);
  overflow: hidden;
}

/* Fade-out gradient when no button present — signals clipped text */
.text-with-text-on-right:not(:has(.btn))::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2.5rem;
  background: linear-gradient(to bottom, transparent, #fff);
  pointer-events: none;
  z-index: 1;
}

/* Zero out top margin on headings editors put in the description */
.text-with-text-on-right h2,
.text-with-text-on-right h3,
.text-with-text-on-right h4 {
  margin-top: 0;
}

/* Pin the paragraph containing a CTA button to the bottom */
.text-with-text-on-right p:has(.btn) {
  margin-top: auto;
  margin-bottom: 0;
}

.text-with-text-on-right p:has(.btn) ~ p:has(.btn) {
  margin-top: 0.5rem;
}

/* Hide trailing empty paragraphs from the rich text editor */
.text-with-text-on-right p:empty,
.text-with-text-on-right p:has(> br:only-child) {
  display: none;
}

/* ── MOBILE ──────────────────────────────────────────────────── */
@media (max-width: 767px) {
  .image-with-text-right__image-wrap {
    height: clamp(200px, 55vw, 340px);
  }

  .text-with-text-on-right {
    height: auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
  }

  .text-with-text-on-right:not(:has(.btn))::after {
    display: none;
  }
}
