/* ---------------------------------------------------------------------------
   CTA section designs

   Layout rules for the on-page CTA sections built by
   functions/ecommerce/cta-section-renderer.php. One block per design key in
   functions/ecommerce/cta-section-designs.php.

   Imported from every theme's cta-content.css, which keeps the older
   .main-cta-section / .final-cta-section rules for themes still on the
   pre-design markup. Design selectors carry two classes, so they outrank those
   single-class rules regardless of import order.
   --------------------------------------------------------------------------- */

.cta-section {
    --cta-radius: 14px;
    position: relative;
    background-size: cover;
    background-position: center;
}

.cta-section .cta-inner {
    position: relative;
    z-index: 1;
}

/* Banner is the only design that lays copy over an image, and it paints its own
   tint below. Every other design switches off cta-content.css's dark scrim. The
   attribute selector supplies the specificity needed to beat it, and matches
   every section this renderer produces. */
.cta-section[class*="cta-design-"]:not(.cta-design-banner)::before {
    display: none;
}

/* cta-content.css narrows and centres .cta-content for the pre-design markup.
   Each design decides its own width and alignment below. */
.cta-section .cta-content {
    max-width: none;
    margin: 0;
    text-align: inherit;
}

.cta-section .cta-title {
    font-size: clamp(1.75rem, 3.2vw, 2.5rem);
    line-height: 1.2;
    margin: 0 0 0.75rem;
    color: inherit;
}

.cta-section .cta-text {
    font-size: 1.0625rem;
    line-height: 1.45;
    margin: 0 0 1.5rem;
    color: inherit;
}

.cta-section .cta-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* One button treatment across every design, independent of whichever button
   system the surrounding page happens to load. */
.cta-section .cta-button {
    display: inline-block;
    padding: 0.85rem 1.9rem;
    border-radius: 999px;
    border: 2px solid transparent;
    background-color: var(--color-white, #fff);
    color: var(--color-primary, #34495e);
    font-weight: 600;
    font-size: 1rem;
    line-height: 1.2;
    text-decoration: none;
    transition: background-color 0.18s ease, color 0.18s ease,
                border-color 0.18s ease, transform 0.18s ease;
}

.cta-section .cta-button:hover,
.cta-section .cta-button:focus {
    background-color: transparent;
    border-color: var(--color-white, #fff);
    color: var(--color-white, #fff);
    transform: translateY(-2px);
    text-decoration: none;
}

/* Designs sitting on a light background need the inverse treatment */
.cta-section.cta-design-card .cta-button {
    background-color: var(--color-primary, #34495e);
    color: var(--color-white, #fff);
}

.cta-section.cta-design-card .cta-button:hover,
.cta-section.cta-design-card .cta-button:focus {
    background-color: transparent;
    border-color: var(--color-primary, #34495e);
    color: var(--color-primary, #34495e);
}

/* ---------- Stacked — image across the top, message below ----------
   The replacement for the old Overlay design. Because the copy sits beside the
   image rather than on it, there is no scrim to balance: the artwork shows at
   full strength and the message can run as long as it needs to. */
.cta-section.cta-design-stacked {
    padding: 0;
    background: linear-gradient(160deg,
                var(--color-primary, #34495e),
                var(--color-secondary, #486c8d));
}

.cta-section.cta-design-stacked .container {
    padding-left: 0;
    padding-right: 0;
    max-width: none;
    width: 100%;
}

.cta-section.cta-design-stacked .cta-media {
    height: clamp(200px, 26vw, 340px);
    overflow: hidden;
}

.cta-section.cta-design-stacked .cta-content {
    max-width: 820px;
    margin: 0 auto;
    padding: clamp(2rem, 4vw, 3rem) clamp(1.5rem, 5vw, 3rem);
    text-align: center;
}

/* ---------- Split — image one side, message the other ---------- */
.cta-section.cta-design-split,
.cta-section.cta-design-split-reverse {
    padding: 0;
    background: linear-gradient(135deg,
                var(--color-primary, #34495e),
                var(--color-secondary, #486c8d));
}

.cta-section.cta-design-split .container,
.cta-section.cta-design-split-reverse .container {
    padding-left: 0;
    padding-right: 0;
    max-width: none;
    width: 100%;
}

.cta-section.cta-design-split .cta-inner,
.cta-section.cta-design-split-reverse .cta-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: stretch;
    min-height: 340px;
}

.cta-section.cta-design-split .cta-media,
.cta-section.cta-design-split-reverse .cta-media {
    min-height: 260px;
    overflow: hidden;
}

.cta-section.cta-design-split .cta-content,
.cta-section.cta-design-split-reverse .cta-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 3.5rem clamp(1.5rem, 5vw, 4rem);
}

/* Flipped: the media column moves to the right without touching the markup */
.cta-section.cta-design-split-reverse .cta-media {
    order: 2;
}

/* ---------- Card — a raised card on a soft band ---------- */
.cta-section.cta-design-card {
    /* Two classes, so this beats cta-content.css's white `.cta-section` ink */
    color: var(--color-dark-black, #2c3e50);
    padding: 64px 0;
    background: linear-gradient(180deg,
                var(--color-off-white, #fafafa),
                var(--color-light-gray, #eef1f5));
}

.cta-section.cta-design-card .cta-inner {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    align-items: center;
    gap: 0;
    background: var(--color-white, #fff);
    border-radius: var(--cta-radius);
    overflow: hidden;
    box-shadow: 0 18px 45px rgba(16, 24, 40, 0.12);
}

.cta-section.cta-design-card .cta-media {
    align-self: stretch;
    min-height: 260px;
    overflow: hidden;
}

.cta-section.cta-design-card .cta-content {
    padding: clamp(1.75rem, 4vw, 3rem);
}

.cta-section.cta-design-card .cta-title {
    font-size: clamp(1.5rem, 2.6vw, 2.05rem);
}

.cta-section.cta-design-card .cta-text {
    font-size: 1.0625rem;
    opacity: 0.85;
}

/* A card with no image is just a centred card */
.cta-section.cta-design-card.no-media .cta-inner {
    grid-template-columns: minmax(0, 1fr);
    text-align: center;
}

/* ---------- Gradient — text only, on brand colours ---------- */
.cta-section.cta-design-gradient {
    padding: 72px 20px;
    background: linear-gradient(120deg,
                var(--color-primary, #34495e),
                var(--color-secondary, #486c8d));
}

.cta-section.cta-design-gradient .cta-inner {
    max-width: 680px;
    margin: 0 auto;
    text-align: center;
}

/* ---------- Banner — a slim strip with the button alongside ---------- */
.cta-section.cta-design-banner {
    padding: 22px 0;
    background: linear-gradient(90deg,
                var(--color-primary, #34495e),
                var(--color-secondary, #486c8d));
}

/* A two-column grid rather than wrapping flex: the headline and message stack
   on the left and the button holds its own column on the right, so it can never
   be orphaned onto a line of its own however long the copy runs. */
.cta-section.cta-design-banner .cta-content {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
        "title  button"
        "text   button";
    align-items: center;
    column-gap: 1.75rem;
    row-gap: 0.2rem;
}

.cta-section.cta-design-banner .cta-title {
    grid-area: title;
    font-size: 1.3rem;
    margin: 0;
}

.cta-section.cta-design-banner .cta-text {
    grid-area: text;
    font-size: 0.975rem;
    margin: 0;
    opacity: 0.92;
}

.cta-section.cta-design-banner .cta-button {
    grid-area: button;
    justify-self: end;
    padding: 0.6rem 1.4rem;
    font-size: 0.9375rem;
}

/* With an image the brand gradient becomes a tint over it rather than the
   background itself. Heavy on purpose: the bar is slim, so only a band of the
   picture shows, and the copy has to stay readable across all of it. */
.cta-section.cta-design-banner.has-media {
    background-image: var(--cta-bg-image);
    background-size: cover;
    background-position: center;
}

.cta-section.cta-design-banner.has-media::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
                var(--color-primary, #34495e),
                var(--color-secondary, #486c8d));
    opacity: 0.86;
}

.cta-section.cta-design-banner.has-media .cta-content {
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.45);
}

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
    .cta-section.cta-design-split .cta-inner,
    .cta-section.cta-design-split-reverse .cta-inner,
    .cta-section.cta-design-card .cta-inner {
        grid-template-columns: minmax(0, 1fr);
    }

    /* Image back on top once the columns collapse, flipped or not */
    .cta-section.cta-design-split-reverse .cta-media {
        order: 0;
    }

    .cta-section.cta-design-split .cta-media,
    .cta-section.cta-design-split-reverse .cta-media,
    .cta-section.cta-design-card .cta-media {
        min-height: 220px;
        max-height: 300px;
    }

    .cta-section.cta-design-split .cta-content,
    .cta-section.cta-design-split-reverse .cta-content {
        padding: 2.5rem 1.5rem;
        text-align: center;
        align-items: center;
    }

    .cta-section.cta-design-card.has-media .cta-inner {
        text-align: center;
    }
}

@media (max-width: 767.98px) {
    .cta-section.cta-design-stacked .cta-media {
        height: clamp(160px, 42vw, 220px);
    }

    .cta-section.cta-design-gradient {
        padding: 52px 16px;
    }

    .cta-section .cta-text {
        font-size: 1rem;
    }

    /* One column, button underneath, once there is no room for two */
    .cta-section.cta-design-banner .cta-content {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "title"
            "text"
            "button";
        justify-items: center;
        text-align: center;
        row-gap: 0.6rem;
    }

    .cta-section.cta-design-banner .cta-button {
        justify-self: center;
    }
}
