:root :where(.wp-block-group.is-style-contact-form-background) {
    background-image: url(/wp-content/themes/convertgence/assets/images/contact-form-background-mobile.svg);
    background-size: calc(100% + 2px);
    background-position: -1px 0;
}

.wpcf7 {
    margin: 0;
}

.wpcf7-form {
    position: relative;

    .wpcf7-form-control-wrap {
        display: block;
        margin: 0 0 20px 0;

        &[data-name="entreprise"] {
            margin-bottom: 48px;
        }

        &[data-name="infolettre"] {
            margin-bottom: 30px;
        }
    }

    fieldset {
        display: grid;
        grid-template-columns: 1fr;
        border: none;
        margin: 0;
        padding: 0;
    }

    h5 {
        font-size: 1.875rem;
        line-height: 1em;
        font-weight: 400;
        margin: 24px 0;
    }

    input {
        box-sizing: border-box;
        border: 1px solid var(--wp--preset--color--petrol);
        color: var(--wp--preset--color--petrol);

        &[type="text"],
        &[type="email"] {
            height: 84px;
            width: 100%;
            border-radius: 20px;
            font-size: 20px;
            line-height: 30px;
            background: transparent;
            padding: 16px;
            outline: none;
            font-family: Buenos Aires, sans-serif;
            font-weight: 300;

            &::placeholder {
                color: var(--wp--preset--color--petrol);
                opacity: .5;
            }

            &:focus {
                box-shadow: 0 0 0 1px var(--wp--preset--color--ocean-light);
            }
        }

        &.wpcf7-not-valid {
            border-color: var(--wp--preset--color--red-error);

            &::placeholder {
                color: var(--wp--preset--color--red-error);
            }
        }
    }

    .choices,
    .choices[data-type*="select-one"] {
        margin: 0;

        .choices__inner {
            padding: 24px 70px 24px 24px;
            min-height: unset;
            font-size: 20px;
            line-height: 30px;
            font-weight: 300;
            color: var(--wp--preset--color--petrol);
            border: 1px solid var(--wp--preset--color--petrol);
            border-radius: 12px;
            box-sizing: border-box;
            background: transparent;
            background-size: 27px;

            .choices__list--single {
                padding: 0;
            }

            &:has(select.wpcf7-not-valid) {
                border-color: var(--wp--preset--color--red-error);

                .choices__placeholder {
                    color: var(--wp--preset--color--red-error);
                }
            }
        }

        .choices__item {
            word-break: normal;
        }

        &:after {
            display: block;
            position: absolute;
            content: url(/wp-content/themes/convertgence/assets/images/chevron.svg);
            border: none;
            height: 20px;
            width: 28px;
            right: 25px;
            top: 50%;
            transform: translateY(-50%);
            margin: 0;
            transform-origin: center;
            transition: transform 0.3s ease-in-out;
        }

        &:has(select.wpcf7-not-valid) {
            &:after {
                content: url(/wp-content/themes/convertgence/assets/images/chevron-error.svg);
            }
        }

        &.is-open {
            &::after {
                border: none;
                margin: 0;
                transform: translateY(-50%) rotate(180deg);
            }
        }

        .choices__list--dropdown {
            background: var(--wp--preset--color--cream);;
            border: none;
            border-radius: 0 0 12px 12px;

            .choices__list {
                max-height: unset;

                .choices__item {
                    padding: 24px;
                    min-height: unset;
                    font-size: 18px;
                    line-height: 30px;
                    font-weight: 300;
                    color: var(--wp--preset--color--petrol);
                    border: 1px solid var(--wp--preset--color--petrol);
                    box-sizing: border-box;
                    background: var(--wp--preset--color--cream);
                    background-size: 27px;

                    &.is-highlighted {
                        background: var(--wp--preset--color--petrol);
                        color: var(--wp--preset--color--base);
                    }

                    &:not(:last-child) {
                        border-bottom: none;
                    }
                }
            }
        }

        &.is-open {
            .choices__inner {
                border-radius: 12px 12px 0 0;
            }

            .choices__list--dropdown {
                .choices__list {
                    .choices__item {
                        &:first-child {
                            display: none;
                        }

                        &:last-child {
                            border-radius: 0 0 12px 12px;
                        }
                    }
                }
            }

            &.choices--dropup {
                .choices__inner {
                    border-radius: 0 0 12px 12px;
                }

                .choices__list--dropdown {
                    border-radius: 12px 12px 0 0;

                    .choices__list {
                        .choices__item {
                            &:nth-child(2) {
                                border-radius: 12px 12px 0 0;
                            }

                            &:last-child {
                                border-radius: 0;
                            }
                        }
                    }
                }
            }
        }
    }

    .wpcf7-radio-with-desc {
        display: flex;
        gap: 14px;
        margin-bottom: 60px;

        .wpcf7-list-item {
            margin: 0;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 10px;
            width: calc(100% - (32px * 2) - (14px * 4) * 0.2);
            aspect-ratio: 1;
            max-width: 100px;

            label {
                display: flex;
                justify-content: center;
                align-items: center;
                width: 100%;
                height: 100%;
                border: 1px solid var(--wp--preset--color--petrol);
                border-radius: 11px;
                font-size: 2.25rem;
                line-height: 1em;
                font-weight: 300;
                color: var(--wp--preset--color--petrol);
                cursor: pointer;
                box-sizing: border-box;
                padding-bottom: 3px;

                &:has(input:checked) {
                    background: var(--wp--preset--color--ocean);
                    border-color: var(--wp--preset--color--ocean);
                    color: var(--wp--preset--color--base);

                    & + small {
                        font-weight: 400;
                    }
                }

                &:hover {
                    background: var(--wp--preset--color--ocean);
                    border-color: var(--wp--preset--color--ocean);
                    color: var(--wp--preset--color--base);
                }
            }

            input {
                display: none;
            }

            small {
                display: none;
                font-size: 0.875rem;
                line-height: 1em;
                color: var(--wp--preset--color--ocean);
                font-weight: 300;
            }
        }
    }

    p {
        margin: 0;
    }

    legend {
        font-size: 1.125rem;
        line-height: 1.5rem;
        font-weight: 300;
        max-width: 365px;
        margin-bottom: 10px;
    }

    small {
        font-size: 0.875rem;
        line-height: 1.5rem;
        font-weight: 300;
        color: rgba(0, 0, 0, .6);
    }

    aside {
        margin-bottom: 24px;
    }

    .wpcf7-acceptance, .wpcf7-checkbox {
        .wpcf7-list-item {
            margin: 0;

            label {
                font-size: 1rem;
                line-height: 1.25rem;
                font-weight: 300;
                display: block;
                cursor: pointer;

                &:has(input:checked) {
                    .wpcf7-list-item-label {
                        &:before {
                            background: var(--wp--preset--color--petrol);
                            background-image: url(/wp-content/themes/convertgence/assets/images/check-validation.svg);
                            background-repeat: no-repeat;
                            background-position: center;
                            background-size: 20px;
                        }
                    }
                }
            }

            .wpcf7-list-item-label {
                display: flex;
                min-height: 32px;
                padding-left: 50px;
                color: var(--wp--preset--color--petrol);

                &:before {
                    content: "";
                    display: block;
                    width: 32px;
                    height: 32px;
                    position: absolute;
                    left: 0;
                    top: 0;
                    border: 1px solid var(--wp--preset--color--petrol);;
                    border-radius: 7px;
                }
            }

            input {
                display: none;
            }
        }

        &.wpcf7-not-valid {
            .wpcf7-list-item-label {
                color: var(--wp--preset--color--red-error);

                &:before {
                    border-color: var(--wp--preset--color--red-error);
                }
            }
        }
    }

    input[type="submit"] {
        padding: 16px 32px;
        border-radius: 16px;
        background: var(--wp--preset--color--green-main);
        border: none;
        color: var(--wp--preset--color--base);
        font-size: 1.125rem;
        line-height: 1.375;
        font-weight: 700;
        margin-top: 50px;
        text-transform: uppercase;
        cursor: pointer !important;

        &:hover {
            background: var(--wp--preset--color--ocean);
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.25);
        }
    }

    .wpcf7-not-valid-tip {
        margin-top: 12px;
        color: var(--wp--preset--color--red-error);
        font-size: var(--wp--preset--font-size--medium);
        font-weight: 300;
        line-height: 1em;
        display: flex;
        align-items: center;

        &:before {
            content: "";
            display: block;
            width: 18px;
            aspect-ratio: 1 / 1;
            margin-right: 8px;
            background-image: url(/wp-content/themes/convertgence/assets/images/alert.svg);
            background-repeat: no-repeat;
            background-size: 18px;
        }
    }

    .wpcf7-spinner {
        background: var(--wp--preset--color--green-main);
    }

    .wpcf7-response-output {
        display: none;
    }

    .custom-response-output {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        padding: 32px 42px 32px 80px;
        border-radius: 16px;
        background: var(--wp--preset--color--green-main);
        color: var(--wp--preset--color--base);
        display: flex;
        flex-direction: column;
        gap: 10px;

        .message-text {
            position: relative;

            span, p {
                font-weight: 700;
                line-height: 22px;
            }

            span {
                font-size: 1.5rem;
            }

            p {
                font-size: 1.25rem;
            }

            &:before {
                content: "";
                position: absolute;
                width: 34px;
                height: 34px;
                background: var(--wp--preset--color--base) url(/wp-content/themes/convertgence/assets/images/check-blue.svg);
                background-size: 24px;
                background-repeat: no-repeat;
                background-position: center;
                border-radius: 100%;
                top: 0;
                right: calc(100% + 24px);
            }
        }

        a {
            font-size: 1.25rem;
            font-weight: 700;
            line-height: 22px;
            align-self: flex-end;
            cursor: pointer;
        }
    }

    * {
        -webkit-tap-highlight-color: transparent;
    }
}

@media screen and (max-width: 768px) {
    .wpcf7-form {
        .wpcf7-not-valid-tip {
            align-items: flex-start;

            &:before {
                margin-top: 2px;
            }
        }
    }
}

@media screen and (min-width: 992px) {
    :root :where(.wp-block-group.is-style-contact-form-background) {
        background-image: url(/wp-content/themes/convertgence/assets/images/contact-form-background.svg);
        background-position: 0 100%;
        padding-top: 100px;
        padding-bottom: 160px;
    }

    .wpcf7-form {
        .wpcf7-radio-with-desc {
            .wpcf7-list-item {
                label {
                    box-sizing: border-box;
                    padding-bottom: 0;
                }
            }
        }
    }
}

@media screen and (min-width: 1200px) {
    .wpcf7-form {
        fieldset {
            grid-template-columns: repeat(2, 1fr);
            gap: 14px;

            &.form-container {
                gap: 72px;
            }
        }

        input {
            &[type="text"],
            &[type="email"] {
                padding: 24px;
            }
        }

        .wpcf7-radio-with-desc {
            .wpcf7-list-item {
                width: auto;
                height: auto;

                label {
                    width: 100px;
                    height: 100px;
                }

                small {
                    display: block;
                }
            }
        }

        .choices,
        .choices[data-type*="select-one"] {
            .choices__inner {
                font-size: 20px;
            }

            .choices__list--dropdown {
                .choices__list {
                    .choices__item {
                        font-size: 20px;
                    }
                }
            }
        }

        input[type="submit"] {
            float: right;
        }
    }

    :root :where(.wp-block-group.is-style-contact-form-background) {
        padding-bottom: 240px;
    }
}