/**
 * CTA Banner Styles
 * 
 * @package Clayutility
 * @version 1.0
 */

/* ===== CTA Banner ===== */
.cta-banner {
    position: relative;
    width: 100%;
    overflow: hidden;
    padding: 0 !important;
}

/* GRID 70% / 30% */
.cta-banner__inner {
    display: grid;
    grid-template-columns: 70% 30%;
    align-items: stretch;
    position: relative;
    z-index: auto;
}

/* LEFT - Content with transparent background */
.cta-banner__left {
    background: transparent;
    padding: 80px;
    color: var(--color-white);
    position: relative;
    z-index: 3;
    padding-left: calc(50vw - 600px);
    /* text on top of everything */
}

/* Transparent background by default */
.cta-banner--default-bg .cta-banner__left {
    background: transparent;
}

/* RIGHT - Image behind waves */
.cta-banner__right {
    position: relative;
    overflow: hidden;
    z-index: 0;
    /* image goes below the waves */
}

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

/* If there is a background image, apply it as background-image */
.cta-banner__right[style*="background-image"] {
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

.cta-banner__right[style*="background-image"] img {
    display: none;
    /* Hide img if background-image is used */
}

/* WAVE OVERLAY - Layer over both columns */
.cta-banner__overlay {
    position: absolute;
    top: 0;
    /* Responsive left: dynamic based on viewport width */
    /* Formula: smoothly interpolates between -10px (900px) and -70px (1920px+) */
    /* Reference values: 900px=-10px, 1024px=-14px, 1366px=-30px, 1440px=-38px, 1920px=-70px */
    /* Uses clamp to keep values between -70px (max) and -10px (min) */
    /* The formula calculates: -10px - (60px * width proportion between 900px and 1920px) */
    left: clamp(-70px, calc(-10px - 60px * ((100vw - 900px) / 1020)), -10px);
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    /* overlay on top of text and image */
    background-image: url('../../images/wavesclear.png');
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    pointer-events: none;
}

/* Title */
.cta-banner__title {
    margin: 0;
    font-size: clamp(1.6rem, 2.4vw, 2.2rem);
    font-weight: 800;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.2;
    color: var(--color-white);
}

/* Button */
.cta-banner .btn {
    background-color: var(--color-white);
    margin-top: 45px;
    padding: 25px 60px;
    color: var(--color-blue);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, color 0.2s ease;
    box-shadow: var(--shadow-sm, 0 2px 4px rgba(0, 0, 0, 0.1));
    border-radius: 999px;
    max-width: 100%;
    white-space: normal;
    text-align: center;
    display: inline-block;
    text-decoration: none;
}

.cta-banner .btn:hover {
    background-color: var(--color-magenta);
    color: var(--color-white);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    text-decoration: none;
}

.cta-banner .btn:focus {
    outline: 2px solid var(--color-white);
    outline-offset: 2px;
}

.cta-banner__btn-text {
    margin: 0;
    font-size: 1.5rem;
}

/* Responsive CTA Banner */
/* Note: The left of .cta-banner__overlay is now dynamic using clamp() */
/* It automatically adjusts between -70px (large screens) and -10px (small screens) */

@media (max-width: 1366px) {
    .cta-banner__left {
        padding: 60px;
    }
}

@media (max-width: 900px) {
    .cta-banner__inner {
        grid-template-columns: 1fr;
        /* Single column */
    }

    .cta-banner__left {
        padding: 60px 40px;
        text-align: center;
    }

    .cta-banner__right {
        display: none;
        /* Hide right column on mobile or keep it if preferred */
    }

    /* Alternative: show image as background on mobile */
    /* .cta-banner__right {
        position: absolute;
        inset: 0;
        z-index: 0;
    }
    
    .cta-banner__left {
        position: relative;
        z-index: 1;
    } */
}

@media (max-width: 680px) {
    .cta-banner__left {
        padding: 50px 30px;
    }

    .cta-banner__title {
        font-size: clamp(1.4rem, 4vw, 1.8rem);
    }

    .cta-banner .btn {
        padding: 20px 40px;
        margin-top: 30px;
    }

    .cta-banner__overlay {
        background-image: url("https://clayutility.mystagingwebsite.com/wp-content/uploads/2025/12/AdobeStock_543811977-scaled.jpeg");
    }
}

/* Accesibilidad mejorada */
@media (prefers-reduced-motion: reduce) {
    .cta-banner .btn {
        transition: none;
    }

    .cta-banner .btn:hover {
        transform: none;
    }
}

/* Fallback for browsers without CSS variables */
@supports not (--css: variables) {

    .cta-banner--default-bg .cta-banner__left,
    .cta-banner__left {
        background: linear-gradient(115deg, #2861ad, #b04283 45%, #83ceda 85%);
    }
}