/**
 * Public stylesheet for the Baby in Brazil CTA module.
 *
 * The stylesheet is intentionally independent from Bootstrap. Module instance
 * settings are passed through CSS custom properties on the root `.bib-cta`
 * element, which allows different CTA modules on the same page to use different
 * media widths, feature column counts and spacing without duplicating CSS.
 *
 * Theme variables from the Baby in Brazil template are used when present. Local
 * fallback values keep the module usable in standalone examples and other
 * Joomla templates.
 *
 * @package     Joomla.Site
 * @subpackage  mod_bib_cta
 * @copyright   (C) 2026 Oleg Kosarev. All Rights Reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 * @since       1.0.0
 */

/* Root design tokens and instance-level defaults. */
.bib-cta {
  --bib-cta-color: var(--theme-color, #0f78c8);
  --bib-cta-color-rgb: var(--theme-color-rgb, 15, 120, 200);
  --bib-cta-color-secondary: var(--theme-color-secondary, #12497f);
  --bib-cta-color-secondary-rgb: var(--theme-color-secondary-rgb, 18, 73, 127);
  --bib-cta-surface: var(--theme-surface, #ffffff);
  --bib-cta-surface-soft: var(--theme-surface-soft, #eaf4fb);
  --bib-cta-text: var(--theme-text, #122330);
  --bib-cta-text-soft: var(--theme-text-soft, #54616a);
  --bib-cta-text-muted: var(--theme-text-muted, #767f87);
  --bib-cta-line: var(--theme-line-soft, #e3eef6);
  --bib-cta-on-color: var(--theme-on-color, #ffffff);
  --bib-cta-radius: var(--theme-radius-md, 12px);
  --bib-cta-radius-sm: var(--theme-radius-sm, 8px);
  --bib-cta-radius-xs: var(--theme-radius-xs, 4px);
  --bib-cta-shadow: var(--gallery-shadow-soft, 0 8px 25px rgba(18, 35, 48, .06));
  --bib-cta-shadow-strong: var(--gallery-shadow, 0 14px 45px rgba(18, 35, 48, .08));

  position: relative;
  width: 100%;
  margin-block: 20px;
  color: var(--bib-cta-text);
}

.bib-cta *,
.bib-cta *::before,
.bib-cta *::after {
  box-sizing: border-box;
}

.bib-cta a {
  color: inherit;
  text-decoration: none;
}

.bib-cta img,
.bib-cta svg {
  display: block;
}

.bib-cta svg,
.bib-cta svg * {
  fill: none;
}

.bib-cta__shell {
  width: 100%;
  max-width: var(--bib-cta-container-width, 1140px);
  margin-inline: auto;
}

/*
 * The CTA card is bounded by default so it behaves like the Stats module and
 * does not accidentally stretch edge-to-edge in full-width template positions.
 * The legacy modifier is kept for compatibility with previously documented
 * markup and template overrides.
 */
.bib-cta--contained .bib-cta__shell {
  max-width: var(--bib-cta-container-width, 1140px);
  margin-inline: auto;
}

/* Main CTA card grid. Media/content placement is controlled by modifier classes. */
.bib-cta__inner {
  position: relative;
  isolation: isolate;
  min-height: var(--bib-cta-media-min-height, 224px);
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, var(--bib-cta-media-width, 320px)) minmax(0, 1fr);
  align-items: stretch;
  border: 1px solid rgba(var(--bib-cta-color-rgb), .16);
  border-radius: var(--bib-cta-radius);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, .98) 0%, rgba(234, 244, 251, .96) 56%, rgba(var(--bib-cta-color-rgb), .12) 100%);
  box-shadow: var(--bib-cta-shadow);
}

.bib-cta--media-right .bib-cta__inner {
  grid-template-columns: minmax(0, 1fr) minmax(0, var(--bib-cta-media-width, 320px));
}

.bib-cta--media-none .bib-cta__inner,
.bib-cta--media-background /* Main CTA card grid. Media/content placement is controlled by modifier classes. */
.bib-cta__inner {
  grid-template-columns: minmax(0, 1fr);
}

.bib-cta--square .bib-cta__inner,
.bib-cta--square .bib-cta__media,
.bib-cta--square .bib-cta__background {
  border-radius: 0;
}

.bib-cta--flat /* Main CTA card grid. Media/content placement is controlled by modifier classes. */
.bib-cta__inner {
  box-shadow: none;
}

.bib-cta--soft /* Main CTA card grid. Media/content placement is controlled by modifier classes. */
.bib-cta__inner {
  background:
    radial-gradient(circle at 100% 0, rgba(var(--bib-cta-color-rgb), .13), transparent 28rem),
    var(--bib-cta-surface);
}

.bib-cta--minimal /* Main CTA card grid. Media/content placement is controlled by modifier classes. */
.bib-cta__inner {
  border-color: var(--bib-cta-line);
  background: var(--bib-cta-surface);
}

.bib-cta--dark .bib-cta__inner,
.bib-cta--dark-layout /* Main CTA card grid. Media/content placement is controlled by modifier classes. */
.bib-cta__inner {
  color: var(--bib-cta-on-color);
  border-color: rgba(255, 255, 255, .18);
  background:
    radial-gradient(circle at 100% 0, rgba(255, 255, 255, .15), transparent 26rem),
    linear-gradient(135deg, var(--bib-cta-color-secondary), var(--bib-cta-color));
}

.bib-cta__media {
  position: relative;
  z-index: 1;
  min-height: var(--bib-cta-media-min-height, 224px);
  margin: 0;
  overflow: hidden;
  background: var(--bib-cta-surface-soft);
}

.bib-cta--media-right .bib-cta__media {
  order: 2;
}

.bib-cta__media img,
.bib-cta__background img {
  width: 100%;
  height: 100%;
  min-height: var(--bib-cta-media-min-height, 224px);
  object-fit: var(--bib-cta-media-fit, cover);
}

.bib-cta__background {
  position: absolute;
  inset: 0;
  z-index: -2;
  overflow: hidden;
}

.bib-cta__background::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(255, 255, 255, .96) 0%, rgba(255, 255, 255, .88) 58%, rgba(255, 255, 255, .54) 100%);
}

.bib-cta--dark .bib-cta__background::after,
.bib-cta--dark-layout .bib-cta__background::after {
  background: linear-gradient(90deg, rgba(18, 73, 127, .94) 0%, rgba(15, 120, 200, .86) 100%);
}

.bib-cta__content {
  position: relative;
  z-index: 2;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--bib-cta-content-gap, 24px);
  padding: clamp(22px, 3vw, 34px);
}

.bib-cta__eyebrow {
  margin: 0 calc(var(--bib-cta-content-gap, 24px) * -1) calc(var(--bib-cta-content-gap, 24px) * -0.5) 0;
  color: var(--bib-cta-color);
  font-size: 13px;
  line-height: 1.2;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.bib-cta--dark .bib-cta__eyebrow,
.bib-cta--dark-layout .bib-cta__eyebrow {
  color: rgba(255, 255, 255, .78);
}

.bib-cta__title {
  max-width: 15ch;
  margin: 0;
  color: inherit;
  font-size: clamp(27px, 3vw, 38px);
  line-height: 1.05;
  font-weight: 900;
  letter-spacing: -.045em;
}

.bib-cta__text {
  max-width: 68ch;
  margin: calc(var(--bib-cta-content-gap, 24px) * -0.65) 0 0;
  color: var(--bib-cta-text-soft);
  font-size: 15px;
  line-height: 1.5;
  font-weight: 600;
}

.bib-cta__text p {
  margin: 0;
}

.bib-cta--dark .bib-cta__text,
.bib-cta--dark-layout .bib-cta__text {
  color: rgba(255, 255, 255, .84);
}

/* Feature grid. Exact columns and auto-fit mode are both driven by CSS variables. */
.bib-cta__features {
  display: grid;
  grid-template-columns: repeat(var(--bib-cta-feature-cols-mobile, 1), minmax(0, 1fr));
  gap: var(--bib-cta-features-gap, 12px);
  width: 100%;
}

.bib-cta--features-auto .bib-cta__features {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--bib-cta-feature-min-width, 170px)), 1fr));
}

.bib-cta-feature {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  color: inherit;
}

.bib-cta-feature__icon {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  border: 1px solid rgba(var(--bib-cta-color-rgb), .25);
  border-radius: 50%;
  color: var(--bib-cta-color);
  background: rgba(255, 255, 255, .78);
  font-size: 45px;
  font-weight: 900;
  line-height: 45px;
  text-align: center;
}

.bib-cta-feature__icon .bib-cta-icon {
  width: 45px;
  height: 45px;
  stroke: currentColor;
  stroke-width: 1.9;
}

.bib-cta-feature__body {
  min-width: 0;
  display: block;
}

.bib-cta-feature__title {
  display: block;
  color: inherit;
  font-size: 13px;
  line-height: 1.1;
  font-weight: 850;
}

.bib-cta-feature__text {
  display: block;
  margin-top: 3px;
  color: var(--bib-cta-text-soft);
  font-size: 12px;
  line-height: 1.2;
  font-weight: 600;
}

.bib-cta--dark .bib-cta-feature__text,
.bib-cta--dark-layout .bib-cta-feature__text {
  color: rgba(255, 255, 255, .78);
}

.bib-cta--dark .bib-cta-feature__icon,
.bib-cta--dark-layout .bib-cta-feature__icon {
  color: var(--bib-cta-on-color);
  border-color: rgba(255, 255, 255, .35);
  background: rgba(255, 255, 255, .14);
}

.bib-cta__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.bib-cta-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 30px;
  border: 1px solid transparent;
  border-radius: var(--bib-cta-radius-sm);
  font-size: 15px;
  font-weight: 850;
  line-height: 1.2;
  text-align: center;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease, background .2s ease;
}

.bib-cta-button:hover,
.bib-cta-button:focus-visible {
  transform: translateY(-1px);
}

.bib-cta-button--primary {
  color: var(--bib-cta-on-color) !important;
  background: var(--bib-cta-color);
  box-shadow: 0 12px 24px rgba(var(--bib-cta-color-rgb), .24);
  font-size: 16px;
  line-height: 1.25;
  text-align: center;
}

.bib-cta-button--primary .bib-cta-icon {
  color: currentColor;
}

.bib-cta-button--primary span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  text-align: center;
}

.bib-cta--dark .bib-cta-button--primary,
.bib-cta--dark-layout .bib-cta-button--primary {
  color: var(--bib-cta-on-color) !important;
  background: var(--bib-cta-color);
  box-shadow: 0 12px 24px rgba(var(--bib-cta-color-rgb), .24);
}

.bib-cta-button--secondary {
  color: var(--bib-cta-text);
  border-color: #d8dfe6;
  background: rgba(255, 255, 255, .9);
}

.bib-cta--dark .bib-cta-button--secondary,
.bib-cta--dark-layout .bib-cta-button--secondary {
  color: var(--bib-cta-on-color);
  border-color: rgba(255, 255, 255, .32);
  background: rgba(255, 255, 255, .12);
}

.bib-cta-button--link {
  min-height: auto;
  padding: 0;
  color: var(--bib-cta-color);
  border: 0;
  background: transparent;
}

.bib-cta--dark .bib-cta-button--link,
.bib-cta--dark-layout .bib-cta-button--link {
  color: var(--bib-cta-on-color);
}

.bib-cta-button__icon {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 1.9;
}

.bib-cta__lineart {
  position: absolute;
  right: -10px;
  bottom: 0;
  z-index: 1;
  width: 300px;
  height: 190px;
  color: rgba(var(--bib-cta-color-rgb), .22);
  stroke: currentColor;
  stroke-width: 2;
  pointer-events: none;
}

.bib-cta--dark .bib-cta__lineart,
.bib-cta--dark-layout .bib-cta__lineart {
  color: rgba(255, 255, 255, .16);
}

.bib-cta--compact /* Main CTA card grid. Media/content placement is controlled by modifier classes. */
.bib-cta__inner {
  min-height: 0;
}

.bib-cta--compact .bib-cta__content {
  padding: clamp(18px, 2.2vw, 26px);
}

.bib-cta--compact .bib-cta__title {
  max-width: none;
  font-size: clamp(24px, 2.4vw, 32px);
}

.bib-cta--centered .bib-cta__content {
  align-items: center;
  text-align: center;
}

.bib-cta--centered .bib-cta__title,
.bib-cta--centered .bib-cta__text {
  max-width: 760px;
}

.bib-cta--centered .bib-cta__features {
  max-width: 960px;
}

@media (min-width: 768px) {
  .bib-cta__features {
    grid-template-columns: repeat(var(--bib-cta-feature-cols-tablet, 2), minmax(0, 1fr));
  }

  .bib-cta--features-auto .bib-cta__features {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--bib-cta-feature-min-width, 170px)), 1fr));
  }
}

@media (min-width: 992px) {
  .bib-cta__features {
    grid-template-columns: repeat(var(--bib-cta-feature-cols-desktop, 4), minmax(0, 1fr));
  }

  .bib-cta--features-auto .bib-cta__features {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--bib-cta-feature-min-width, 170px)), 1fr));
  }
}

@media (min-width: 1200px) {
  .bib-cta__features {
    grid-template-columns: repeat(var(--bib-cta-feature-cols-wide, 4), minmax(0, 1fr));
  }

  .bib-cta--features-auto .bib-cta__features {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--bib-cta-feature-min-width, 170px)), 1fr));
  }
}

/* Tablet and mobile stacking behavior. */
@media (max-width: 991.98px) {
  .bib-cta__inner,
  .bib-cta--media-right .bib-cta__inner {
    grid-template-columns: minmax(0, 1fr);
  }

  .bib-cta--media-right .bib-cta__media {
    order: 0;
  }

  .bib-cta__lineart {
    display: none;
  }
}

@media (max-width: 575.98px) {
  .bib-cta__content {
    padding: 22px 18px 24px;
  }

  .bib-cta__actions,
  .bib-cta-button {
    width: 100%;
  }
}
