/*------------------------------------*\

    CTA banner

    Spec behaviour:
      - content is always centre-aligned
      - two hardcoded backgrounds: an image with a gradient overlay for
        text visibility, or dark green (#1E3120)
      - heading and button come from the WYSIWYG editor

    The inverted (white) button is inherited from the .cta button variable
    overrides in flexible-content.css.

\*------------------------------------*/

.cta {
    background: var(--fx-dark-green);
    color: rgba(255, 255, 255, 0.88);
    overflow: hidden;
    position: relative;
    z-index: 0;
}

.cta.section-padding {
    padding-block: clamp(4rem, 8vw, 7rem);
}


/*------------------------------------*\
    Image background
\*------------------------------------*/

/* Vertical gradient plus a centre vignette keeps the copy legible over
   any photo the editor picks. */
.cta--image::before {
    background:
        radial-gradient(70% 90% at 50% 50%, rgba(15, 24, 16, 0.35), transparent 70%),
        linear-gradient(180deg, rgba(15, 24, 16, 0.62), rgba(12, 20, 13, 0.82));
    content: "";
    inset: 0;
    position: absolute;
    z-index: -1;
}

.cta__bg {
    height: 100%;
    inset: 0;
    object-fit: cover;
    position: absolute;
    width: 100%;
    z-index: -2;
}


/*------------------------------------*\
    Content
\*------------------------------------*/

.cta__wrapper {
    margin-inline: auto;
    max-width: 56.25rem;
    text-align: center;
}

/* Per spec, this block's content is always centred — not an admin choice.
   The WYSIWYG field still exposes alignment buttons though, so an editor
   can save a paragraph with an inline style or has-text-align-* class;
   override that here rather than leave the block's alignment inconsistent
   with what the field's toolbar implies is possible. */
.cta__content,
.cta__content * {
    text-align: center !important;
}

/* Match the other blocks by anchoring the centered decoration to the first
   h2 instead of the content wrapper. */
.cta__content h2:first-of-type::before {
    --fx-heading-line: rgba(255, 255, 255, 0.35);

    background:
        var(--fx-heading-mark) no-repeat center / 2rem 2rem,
        linear-gradient(
            to right,
            transparent calc(50% - 5rem),
            var(--fx-heading-line) calc(50% - 5rem) calc(50% - 2rem),
            transparent calc(50% - 2rem) calc(50% + 2rem),
            var(--fx-heading-line) calc(50% + 2rem) calc(50% + 5rem),
            transparent calc(50% + 5rem)
        ) no-repeat center / 100% 0.1875rem;
    content: "";
    display: block;
    height: 2rem;
    margin: 0 auto 1.25rem;
    width: 100%;
}

/* "Show Heading Icon" ACF toggle, in this layout's Settings tab */
.cta__content.fx-no-heading-icon h2:first-of-type::before {
    display: none;
}

.cta__content > :first-child {
    margin-top: 0;
}

.cta__content > :last-child {
    margin-bottom: 0;
}

.cta__wrapper h1,
.cta__wrapper h2,
.cta__wrapper h3,
.cta__wrapper h4 {
    color: var(--fx-white);
}

.cta__wrapper h2 {
    font-family: var(--fx-font-display);
    font-size: clamp(2rem, 1.4rem + 2.4vw, 2.875rem);
    letter-spacing: -0.01em;
    line-height: 1.2;
    margin-block: 0 0.5em;
}

.cta__wrapper p {
    color: rgba(255, 255, 255, 0.88);
    font-size: 1.125rem;
    margin-inline: auto !important;
}

.cta__wrapper a:not(.fusion-button) {
    color: var(--fx-white);
}

/* Space the button away from the copy above it */
.cta__content .fusion-button {
    margin-top: 0.75rem;
}

.cta__content .btn-group {
    justify-content: center;
}
