/**
 * AutoSEO - CTA block (autoseo/cta)
 *
 * Loaded on the public site and in the editor.
 * Every color goes through a CSS variable, with a fallback chain to the theme:
 * per-block override (inline style) > AutoSEO design (inline rule) > theme palette > Elementor > default blue.
 */

.autoseo-cta {
    --_accent: var(--autoseo-cta-accent, var(--wp--preset--color--primary, var(--e-global-color-primary, #2D5EE5)));
    --_btn-text: var(--autoseo-cta-button-text, #fff);
    --_text: var(--autoseo-cta-text, currentColor);
    --_bg: var(--autoseo-cta-bg, color-mix(in srgb, var(--_accent) 8%, transparent));
    --_border: color-mix(in srgb, var(--_accent) 22%, transparent);
    --_radius: var(--autoseo-cta-radius, 8px);
    font-family: inherit;
}

/* Browsers without color-mix(): neutral tints instead of a transparent box */
@supports not (background: color-mix(in srgb, red 50%, transparent)) {
    .autoseo-cta {
        --_bg: var(--autoseo-cta-bg, rgba(0, 0, 0, 0.04));
        --_border: rgba(0, 0, 0, 0.1);
    }
}

/* ===== BASE ===== */
.wp-block-autoseo-cta.autoseo-cta {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 1em 1.5em;
    margin-top: 2em;
    margin-bottom: 2em;
    padding: 1.4em 1.6em;
    border-radius: var(--_radius);
    background: var(--_bg);
    color: var(--_text);
    line-height: 1.5;
    text-align: left;
    overflow-wrap: break-word;
}

.wp-block-autoseo-cta.autoseo-cta *,
.wp-block-autoseo-cta.autoseo-cta *::before,
.wp-block-autoseo-cta.autoseo-cta *::after {
    box-sizing: border-box;
}

.wp-block-autoseo-cta .autoseo-cta__content {
    flex: 1 1 auto;
    min-width: 0;
}

.wp-block-autoseo-cta.autoseo-cta .autoseo-cta__title {
    margin: 0 0 0.3em;
    padding: 0;
    color: inherit;
    font-family: inherit;
    font-size: 1.15em;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: normal;
    text-transform: none;
}

.wp-block-autoseo-cta.autoseo-cta .autoseo-cta__text {
    margin: 0;
    padding: 0;
    color: inherit;
    font-family: inherit;
    font-size: 0.95em;
    line-height: 1.55;
    opacity: 0.85;
}

.wp-block-autoseo-cta.autoseo-cta .autoseo-cta__title:last-child {
    margin-bottom: 0;
}

/* ===== BUTTON ===== */
.wp-block-autoseo-cta.autoseo-cta .autoseo-cta__button,
.wp-block-autoseo-cta.autoseo-cta a.autoseo-cta__button:hover,
.wp-block-autoseo-cta.autoseo-cta a.autoseo-cta__button:focus,
.wp-block-autoseo-cta.autoseo-cta a.autoseo-cta__button:active,
.wp-block-autoseo-cta.autoseo-cta a.autoseo-cta__button:visited {
    background: var(--_accent);
    color: var(--_btn-text);
    border: 2px solid var(--_accent);
    text-decoration: none;
}

.wp-block-autoseo-cta.autoseo-cta .autoseo-cta__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5em;
    flex: 0 0 auto;
    max-width: 100%;
    margin: 0;
    padding: 0.7em 1.35em;
    border-radius: calc(var(--_radius) * 0.75);
    font-family: inherit;
    font-size: 0.95em;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: normal;
    text-align: center;
    text-transform: none;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: filter 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.wp-block-autoseo-cta.autoseo-cta a.autoseo-cta__button::after {
    content: "\2192";
    display: inline-block;
    font-weight: 400;
    line-height: 1;
    transition: transform 0.15s ease;
}

.wp-block-autoseo-cta.autoseo-cta a.autoseo-cta__button:hover {
    filter: brightness(0.92);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.wp-block-autoseo-cta.autoseo-cta a.autoseo-cta__button:hover::after {
    transform: translateX(3px);
}

.wp-block-autoseo-cta.autoseo-cta a.autoseo-cta__button:focus {
    outline: none;
}

.wp-block-autoseo-cta.autoseo-cta a.autoseo-cta__button:focus-visible {
    outline: 2px solid var(--_accent);
    outline-offset: 3px;
}

.wp-block-autoseo-cta.autoseo-cta a.autoseo-cta__button:active {
    transform: translateY(0);
}

/* A button without label is never shown on the site */
.wp-block-autoseo-cta.autoseo-cta a.autoseo-cta__button:empty {
    display: none;
}

/* ===== VARIANT: INLINE (after "En bref") ===== */
.wp-block-autoseo-cta.autoseo-cta--inline {
    gap: 0.75em 1.25em;
    padding: 0.9em 1.1em 0.9em 1.25em;
    border-left: 4px solid var(--_accent);
    border-radius: 0 var(--_radius) var(--_radius) 0;
}

.wp-block-autoseo-cta.autoseo-cta--inline .autoseo-cta__title {
    font-size: 1em;
    font-weight: 600;
    margin-bottom: 0.15em;
}

.wp-block-autoseo-cta.autoseo-cta--inline .autoseo-cta__text {
    font-size: 0.95em;
    opacity: 0.9;
}

.wp-block-autoseo-cta.autoseo-cta--inline .autoseo-cta__button {
    padding: 0.5em 1.05em;
    font-size: 0.9em;
    box-shadow: none;
}

/* ===== VARIANT: CARD (middle) ===== */
.wp-block-autoseo-cta.autoseo-cta--card {
    padding: 1.6em 1.75em;
    border: 1px solid var(--_border);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* ===== VARIANT: BANNER (end) ===== */
.wp-block-autoseo-cta.autoseo-cta--banner {
    flex-direction: column;
    justify-content: center;
    gap: 1.25em;
    padding: 2.25em 2em;
    background: var(--_accent);
    color: var(--_btn-text);
    text-align: center;
}

.wp-block-autoseo-cta.autoseo-cta--banner .autoseo-cta__content {
    flex: 0 1 auto;
    width: 100%;
    max-width: 38em;
}

.wp-block-autoseo-cta.autoseo-cta--banner .autoseo-cta__title {
    font-size: 1.4em;
    line-height: 1.25;
    margin-bottom: 0.35em;
}

.wp-block-autoseo-cta.autoseo-cta--banner .autoseo-cta__text {
    font-size: 1em;
    opacity: 0.9;
}

/* Inverted button: background = button text color, label = accent */
.wp-block-autoseo-cta.autoseo-cta--banner .autoseo-cta__button,
.wp-block-autoseo-cta.autoseo-cta--banner a.autoseo-cta__button:hover,
.wp-block-autoseo-cta.autoseo-cta--banner a.autoseo-cta__button:focus,
.wp-block-autoseo-cta.autoseo-cta--banner a.autoseo-cta__button:active,
.wp-block-autoseo-cta.autoseo-cta--banner a.autoseo-cta__button:visited {
    background: var(--_btn-text);
    color: var(--_accent);
    border-color: var(--_btn-text);
}

.wp-block-autoseo-cta.autoseo-cta--banner .autoseo-cta__button {
    padding: 0.8em 1.6em;
    font-size: 1em;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.wp-block-autoseo-cta.autoseo-cta--banner a.autoseo-cta__button:focus-visible {
    outline-color: var(--_btn-text);
}

/* ===== EDITOR ===== */
.wp-block-autoseo-cta.autoseo-cta .autoseo-cta__button[contenteditable] {
    cursor: text;
    min-width: 8em;
}

/* ===== SMALL SCREENS ===== */
@media (max-width: 600px) {
    .wp-block-autoseo-cta.autoseo-cta {
        flex-direction: column;
        align-items: stretch;
        padding: 1.25em;
    }

    .wp-block-autoseo-cta.autoseo-cta--inline {
        padding: 1em 1em 1em 1.1em;
    }

    .wp-block-autoseo-cta.autoseo-cta--banner {
        padding: 1.75em 1.25em;
    }

    .wp-block-autoseo-cta.autoseo-cta--banner .autoseo-cta__content {
        max-width: none;
    }

    .wp-block-autoseo-cta.autoseo-cta .autoseo-cta__button {
        width: 100%;
        white-space: normal;
    }
}

@media (prefers-reduced-motion: reduce) {
    .wp-block-autoseo-cta.autoseo-cta .autoseo-cta__button,
    .wp-block-autoseo-cta.autoseo-cta a.autoseo-cta__button::after {
        transition: none;
    }

    .wp-block-autoseo-cta.autoseo-cta a.autoseo-cta__button:hover,
    .wp-block-autoseo-cta.autoseo-cta a.autoseo-cta__button:hover::after {
        transform: none;
    }
}
