/* =============================================================================
   Image CTA circles — .top-left-img / .bottom-right-img
   ============================================================================= */

/* Allow circle to escape column / row bounds */
.img-cta-figure {
  position: relative !important;
  overflow: visible !important;
  cursor: pointer;
  /* No z-index here — keeping it out of a stacking context so sub-images
     (z-index:3) and .img-cta (z-index:10) compete in the same context. */
}

.kb-row-layout-wrap:has(.img-cta-figure),
.kt-row-column-wrap:has(.img-cta-figure),
.wp-block-kadence-column:has(.img-cta-figure),
.kt-inside-inner-col:has(.img-cta-figure),
.wp-block-kadence-image:has(.img-cta-figure),
figure:has(.img-cta-figure) {
  overflow: visible !important;
}

/* ---- Trigger wrapper (not a link) ---- */

.img-cta {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 10;
  pointer-events: auto;
}

/* Right variant: [dot][label] — dot at bottom-right corner, nudged up into the edge */
.img-cta--right {
  flex-direction: row;
  transform: translateY(calc(-50% - 6px));
}

/* Left variant: [label][dot] — dot at top-left corner, nudged down into the edge */
.img-cta--left {
  flex-direction: row-reverse;
  transform: translateY(calc(-50% + 6px));
}

/* ---- Circle link (the only true <a> element) ---- */

.img-cta-link {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none !important;
  pointer-events: auto;
  flex-shrink: 0;
}

.img-cta-circle {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background-color: #0C244A;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: width  0.5s cubic-bezier(0.22, 1, 0.36, 1),
              height 0.5s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Residential — grows and slides up-left to overlap the image */
.img-cta-figure:hover .img-cta--right .img-cta-circle,
.img-cta--right:hover .img-cta-circle,
.kt-inside-inner-col:has(.sub-image-1:hover) .img-cta--right .img-cta-circle {
  width: 110px;
  height: 110px;
  transform: translate(-28px, -52px);
}

/* Commercial — grows and slides down-right to overlap the image */
.img-cta-figure:hover .img-cta--left .img-cta-circle,
.img-cta--left:hover .img-cta-circle,
.kt-inside-inner-col:has(.sub-image-2:hover) .img-cta--left .img-cta-circle {
  width: 110px;
  height: 110px;
  transform: translate(28px, 52px);
}

/* ---- "Learn more" text (hidden until hover) ---- */

.img-cta-learn {
  font-size: 0.82rem;
  font-weight: 400;
  text-align: center;
  line-height: 1.4;
  opacity: 0;
  white-space: nowrap;
  pointer-events: none;
  transition: opacity 0.2s ease 0.2s;
}

.img-cta-figure:hover .img-cta-learn,
.img-cta:hover .img-cta-learn,
.kt-inside-inner-col:has(.sub-image-1:hover) .img-cta-learn,
.kt-inside-inner-col:has(.sub-image-2:hover) .img-cta-learn {
  opacity: 1;
}

/* ---- Label (display only, not clickable) ---- */

.img-cta-label {
  font-size: 0.82rem;
  font-weight: 400;
  color: #0C244A;
  line-height: 1.45;
  white-space: nowrap;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.15s ease;
}

.img-cta-figure:hover .img-cta-label,
.img-cta:hover .img-cta-label,
.kt-inside-inner-col:has(.sub-image-1:hover) .img-cta-label,
.kt-inside-inner-col:has(.sub-image-2:hover) .img-cta-label {
  opacity: 0;
}

/* ---- Sub-images (overlapping secondary images) ---- */

/* Positioning context for sub-images; allow overflow so they can extend beyond column */
.kt-inside-inner-col:has(.sub-image-1),
.kt-inside-inner-col:has(.sub-image-2) {
  position: relative !important;
  overflow: visible !important;
}

/* Allow overflow up the tree so sub-images aren't clipped */
.kb-row-layout-wrap:has(.sub-image-1),
.kb-row-layout-wrap:has(.sub-image-2),
.kt-row-column-wrap:has(.sub-image-1),
.kt-row-column-wrap:has(.sub-image-2),
.wp-block-kadence-column:has(.sub-image-1),
.wp-block-kadence-column:has(.sub-image-2) {
  overflow: visible !important;
}

/* Section 2: main image stops before sub-image-2 so they sit side by side, no overlap */
.kt-inside-inner-col:has(.sub-image-2) > .bottom-right-img {
  width: 58% !important;
}

/* Sub-image base — pure CSS positioning, vertically centred on the column midpoint */
.sub-image-1,
.sub-image-2 {
  position: absolute !important;
  width: 40% !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  z-index: 20 !important;
  margin: 0 !important;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18) !important;
}

/* subtle-float-up on sub-images: combine the -50% centering with the float animation
   so the two transforms don't fight each other */
@keyframes sub-image-float-up {
  from { opacity: 0; transform: translateY(calc(-50% + 40px)); }
  to   { opacity: 1; transform: translateY(-50%); }
}

.sub-image-1.subtle-float-up,
.sub-image-2.subtle-float-up {
  opacity: 0;
  transform: translateY(calc(-50% + 40px));
  animation: none !important;
}

.sub-image-1.subtle-float-up.is-visible,
.sub-image-2.subtle-float-up.is-visible {
  animation: sub-image-float-up 2s cubic-bezier(0.22, 1, 0.36, 1) forwards !important;
}

/* Section 1: sub-image sits LEFT of the main image, no overlap */
.kt-inside-inner-col:has(.sub-image-1) {
  padding-left: 27% !important;
}

.sub-image-1 {
  left: -15% !important;
}

/* Section 2: sub-image sits RIGHT of the main image, no overlap (main is 58%, gap at 60%) */
.sub-image-2 {
  left: 60% !important;
}

.sub-image-1 img,
.sub-image-2 img {
  width: 100% !important;
  height: auto !important;
  display: block !important;
}

/* ---- 981px–1350px: hide sub-images and reset layout offsets ---- */
@media (min-width: 981px) and (max-width: 1350px) {
  .sub-image-1,
  .sub-image-2 {
    display: none !important;
  }

  /* Section 1: remove the padding that was there to make room for sub-image-1 */
  .kt-inside-inner-col:has(.sub-image-1) {
    padding-left: 0 !important;
  }

  /* Section 2: let the main image fill its column now that sub-image-2 is gone */
  .kt-inside-inner-col:has(.sub-image-2) > .bottom-right-img {
    width: 100% !important;
  }
}

/* ---- 1350px+: hide sub-images (uncomment block below to enable) ---- */
/*
@media (min-width: 1350px) {
  .sub-image-1,
  .sub-image-2 {
    display: none !important;
  }

  .kt-inside-inner-col:has(.sub-image-1) {
    padding-left: 0 !important;
  }

  .top-left-img .img-cta--right {
    left: calc(100% + 20px) !important;
  }

  .kt-inside-inner-col:has(.sub-image-2) > .bottom-right-img {
    width: 100% !important;
  }
}
*/

/* ---- Tablet (768px–980px): smaller sub-images, reset section 2 main image ---- */
@media (min-width: 768px) and (max-width: 980px) {
  /* Commercial section heading — left-align to match body text below */
  .kb-row-layout-wrap:has(.bottom-right-img) .wp-block-kadence-advancedheading {
    text-align: left !important;
  }

  .kt-inside-inner-col:has(.sub-image-1) {
    padding-left: 0 !important;
  }

  /* Push the main image right directly via margin */
  .kt-inside-inner-col:has(.sub-image-1) > .top-left-img {
    margin-left: 14% !important;
  }

  .sub-image-1 {
    left: 6% !important;
    width: 26% !important;
  }

  .sub-image-2 {
    left: auto !important;
    right: 0 !important;
    width: 26% !important;
  }

  /* Section 2: reset main image width since sub-image-2 is smaller */
  .kt-inside-inner-col:has(.sub-image-2) > .bottom-right-img {
    width: 80% !important;
  }

}

/* ---- Mobile (≤767px): hide sub-images, reset all offsets ---- */
@media (max-width: 767px) {
  .sub-image-1,
  .sub-image-2 {
    display: none !important;
  }

  .kt-inside-inner-col:has(.sub-image-1) {
    padding-left: 0 !important;
  }

  .kt-inside-inner-col:has(.sub-image-2) > .bottom-right-img {
    width: 100% !important;
  }
}

/* ---- Mobile — dot + label below the image ---- */

@media (max-width: 767px) {
  /* Make the figure/wrapper a column so the CTA flows after the image */
  .img-cta-figure {
    display: flex !important;
    flex-direction: column !important;
  }
  /* Commercial wrapper: reset figure float so it fills width */
  .img-cta-figure > figure {
    float: none !important;
    width: 100% !important;
  }
  /* Pull CTA out of absolute positioning, show as a row */
  .img-cta {
    position: static !important;
    transform: none !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    bottom: auto !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 8px !important;
    padding-top: 10px !important;
  }
  /* Small static dot */
  .img-cta-circle {
    width: 10px !important;
    height: 10px !important;
    flex-shrink: 0 !important;
    transform: none !important;
  }
  /* No hover expansion on mobile */
  .img-cta-figure:hover .img-cta-circle,
  .img-cta:hover .img-cta-circle {
    width: 10px !important;
    height: 10px !important;
    transform: none !important;
  }
  /* Allow label to wrap and stay visible */
  .img-cta-label {
    white-space: normal !important;
    opacity: 1 !important;
  }
  .img-cta-figure:hover .img-cta-label,
  .img-cta:hover .img-cta-label {
    opacity: 1 !important;
  }
  /* "Learn more" text is hover-only — hide on mobile */
  .img-cta-learn {
    display: none !important;
  }
}
