/*
 * Module: CTA Banner
 *
 * Full-width colored bg with rounded top corners.
 * Variants: default (text left, content right), --reversed (image left, text right)
 * Used on: Homepage, Facilitation, Culture
 * Dependencies: tokens.css, buttons.css, testimonial-carousel.css
 */

.cta-banner {
  background: var(--color-primary-dark);
  border-radius: var(--radius-section-sm) var(--radius-section-sm) 0 0;
  width: 100%;
  overflow: hidden;
  padding: 0;
}
.cta-banner__columns,
.cta-banner .wp-block-columns {
  max-width: 1440px; margin: 0 auto;
  display: flex; align-items: center;
}
/* Default CTA: equal halves */
.cta-banner:not(.cta-banner--reversed) .wp-block-columns > .wp-block-column {
  flex-basis: 50% !important;
  flex-grow: 0;
}
/* Reversed CTA: image narrower, text wider */
.cta-banner--reversed .wp-block-columns > .wp-block-column:first-child {
  flex-basis: 40% !important;
  flex-grow: 0;
}
.cta-banner--reversed .wp-block-columns > .wp-block-column:last-child {
  flex-basis: 60% !important;
  flex-grow: 0;
}

/* ── Reversed: image/content on left, text on right ── */
.cta-banner--reversed .cta-banner__columns {
  max-width: var(--max-width);
  justify-content: space-between;
}

/* ── Text column ── */
.cta-banner__text,
.cta-banner .wp-block-column.cta-banner__text {
  padding: var(--space-xl) var(--space-xl) var(--space-xl) var(--space-2xl);
  display: flex !important; flex-direction: column !important; gap: var(--space-lg) !important;
  align-items: flex-start !important;
  flex: 0 0 720px;
  text-align: left !important;
}
.cta-banner--reversed .cta-banner__text {
  flex: 1;
  padding: var(--space-48) 0 var(--space-48) var(--space-100);
}
.cta-banner__text > * {
  margin: 0;
  margin-left: 0 !important;
  margin-right: auto !important;
  text-align: left !important;
}

.cta-banner__title {
  font-family: var(--font-heading); font-weight: 600; font-size: 40px;
  color: #fff; line-height: 1.15;
}
.cta-banner__subtitle {
  font-family: var(--font-body); font-weight: 400;
  font-size: 22px; color: #fff; line-height: 1.3;
}
.cta-banner__body {
  font-size: 22px; line-height: 1.3; color: #fff;
}
.cta-banner__body p + p { margin-top: 1em; }

/* ── CTA buttons ── */
.cta-banner__buttons,
.cta-banner__buttons.wp-block-buttons,
.cta-banner .wp-block-buttons {
  display: flex !important; flex-direction: column !important;
  align-items: flex-start !important;
  justify-content: flex-start !important;
  align-self: flex-start !important;
  margin-left: 0 !important; margin-right: auto !important;
  gap: 0 !important;
  text-align: left !important;
}
/* Force all children in cta-banner text column to left-align */
.cta-banner__text > *,
.cta-banner__text.is-layout-flow > * {
  margin-left: 0 !important;
  margin-right: auto !important;
}
.cta-banner__buttons > .wp-block-button,
.cta-banner .wp-block-buttons > .wp-block-button {
  width: auto !important;
  flex: none !important;
  margin-left: 0 !important;
  margin-right: auto !important;
  text-align: left !important;
}
.cta-banner__buttons .wp-block-button__link {
  margin-left: 0 !important;
  margin-right: auto !important;
  width: auto !important;
  text-align: center;
}
.cta-banner__buttons > .wp-block-button + .wp-block-button {
  margin-top: var(--space-sm) !important;
}
/* Green primary button */
.cta-banner__buttons .wp-block-button.btn--green .wp-block-button__link {
  background: var(--color-success);
  transition: background 0.2s ease;
  height: 50px;
  padding: 15px 25px;
}
.cta-banner__buttons .wp-block-button.btn--green .wp-block-button__link:hover {
  background: #029D6A;
}
/* Underline button — strip all button chrome, just text + underline */
.cta-banner__buttons .wp-block-button.btn--underline .wp-block-button__link {
  background: transparent;
  border: none;
  border-bottom: 4px solid var(--color-success);
  border-radius: 0;
  padding: 0;
  color: #fff;
  height: auto;
}
/* Outline white button */
.cta-banner__buttons .wp-block-button.btn--outline-white .wp-block-button__link {
  border: 2px solid #fff; background: transparent;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.cta-banner__buttons .wp-block-button.btn--outline-white .wp-block-button__link:hover {
  background: var(--color-primary); border-color: var(--color-primary);
}

/* ── Content column (testimonial or image) ── */
.cta-banner__content {
  flex: 1;
  padding: var(--space-xl) 0;
  display: flex; align-items: center; justify-content: center;
}

/* Circle image + star composite in reversed variant */
.cta-banner--reversed .cta-banner__image-col,
.cta-banner--reversed .wp-block-column.cta-banner__image-col {
  flex: 0 0 514px;
  position: relative;
  align-self: center;
  height: 514px;
  overflow: visible;
}
.cta-banner--reversed .cta-banner__image-col > .wp-block-image:first-child img {
  width: 514px; max-width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  object-fit: cover;
}
/* Star overlay — positioned over bottom-right of circle image */
.cta-banner--reversed .cta-banner__image-col > .wp-block-image.cta-banner__kd-star,
.cta-banner--reversed .cta-banner__image-col > .cta-banner__kd-star {
  position: absolute !important;
  bottom: 12%; left: 330px;
  width: 93px;
  margin: 0 !important;
}
.cta-banner--reversed .cta-banner__kd-star img {
  width: 93px; height: auto;
  border-radius: 0;
  aspect-ratio: auto;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .cta-banner { border-radius: 60px 60px 0 0; }
  .cta-banner__columns { flex-direction: column; }
  .cta-banner--reversed .cta-banner__columns { flex-direction: column-reverse; }
  .cta-banner__text { flex: none; padding: 48px 24px; }
  .cta-banner--reversed .cta-banner__text { padding: 48px 24px; }
  .cta-banner__content { padding: 0 24px 48px; }
  .cta-banner--reversed .cta-banner__image-col { flex: none; }
}
@media (max-width: 768px) {
  .cta-banner { border-radius: 32px 32px 0 0; padding: 24px 0 40px; overflow: hidden; }
  .cta-banner__text,
  .cta-banner--reversed .cta-banner__text { padding: 32px 16px 16px !important; max-width: 100% !important; }
  .cta-banner__title { font-size: 28px; }
  .cta-banner__subtitle { font-size: 18px; }
  .cta-banner__body { font-size: 18px; }
  .cta-banner__content { padding: 0 16px 24px; }

  /* Image column — add horizontal padding so image doesn't touch screen edges,
     and collapse height to image so star anchors to image bottom, not column bottom */
  .cta-banner__image-col {
    padding: 0 24px !important;
    height: fit-content !important;
    min-height: 0 !important;
    align-self: center !important;
  }

  /* Circle image shrinks within the padded column */
  .cta-banner__image-col > .wp-block-image:first-child img,
  .cta-banner--reversed .cta-banner__image-col > .wp-block-image:first-child img {
    width: 100%; max-width: 320px; height: auto; margin: 0 auto;
  }

  /* Buttons — wrap and never exceed column width */
  .cta-banner .wp-block-buttons,
  .cta-banner__content .wp-block-buttons { flex-wrap: wrap; gap: 12px !important; }
  .cta-banner .wp-block-button,
  .cta-banner__content .wp-block-button { max-width: 100%; }
  .cta-banner .wp-block-button__link,
  .cta-banner__content .wp-block-button__link {
    font-size: 14px !important;
    padding: 12px 20px !important;
    white-space: normal;
    line-height: 1.3;
    text-align: center;
  }

  /* Star — bottom-left of padded image */
  .cta-banner--reversed .cta-banner__image-col > .wp-block-image.cta-banner__kd-star,
  .cta-banner--reversed .cta-banner__image-col > .cta-banner__kd-star {
    width: 50px; right: auto; left: 15%; bottom: 5%;
  }
  .cta-banner--reversed .cta-banner__kd-star img { width: 50px; }
}

/* Fallback star positioning when parent is not .cta-banner--reversed
   (used by rebuilt Section 10 with WP core blocks) */
.cta-banner__image-col {
  position: relative;
}
.cta-banner__image-col > .wp-block-image.cta-banner__kd-star,
.cta-banner__image-col > .cta-banner__kd-star {
  position: absolute !important;
  top: auto !important;
  right: auto !important;
  bottom: 8% !important;
  left: 8% !important;
  width: 93px !important;
  height: auto !important;
  margin: 0 !important;
  z-index: 2;
}
.cta-banner__image-col > .cta-banner__kd-star img {
  width: 93px !important;
  height: 104px !important;
  max-height: 104px !important;
  aspect-ratio: auto !important;
  border-radius: 0 !important;
  object-fit: contain !important;
  display: block !important;
  animation: kd-star-float 5s ease-in-out infinite;
  transform-origin: center;
}
@keyframes kd-star-float {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50%      { transform: translateY(-6px) rotate(2deg); }
}
@media (prefers-reduced-motion: reduce) {
  .cta-banner__image-col > .cta-banner__kd-star img { animation: none; }
}
@media (max-width: 768px) {
  .cta-banner__image-col > .wp-block-image.cta-banner__kd-star,
  .cta-banner__image-col > .cta-banner__kd-star {
    width: 50px !important;
    bottom: 5% !important;
    left: 15% !important;
  }
  .cta-banner__image-col > .cta-banner__kd-star img {
    width: 50px !important;
    height: 56px !important;
    max-height: 56px !important;
  }
}
