.flip-image-buttons {
    position: relative;
    z-index: 1;
}

.flip-image-buttons .container {
    padding: 0 20px;
}

.flip-image-buttons__bg {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -1;
}

.bg-dark-green .flip-image-buttons__heading p {
    color: var(--white);
}

.flip-image-buttons__heading h2 {
    margin: 0 0 10px;
}

.flip-image-buttons__heading {
    margin: 0 0 20px;
}

.flip-image-buttons__wrapper {
    padding: 25px 15px;
    background: var(--secondary-color);
    border-radius: 30px;
    margin: 0 0 84px;
}

.flip-image-buttons__wrapper h5 {
    color: var(--heading-color);
    text-align: center;
    font-size: 19px;
    padding: 0 13px;
    margin: 0 0 12px;
}

.flip-image-button__font {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 18px;
    gap: 14px;
    background: var(--beige);
    border: 1px solid #102419;
    border-radius: 20px;
}

.flip-image-button__font__image {
    width: 129px;
    height: 60px;
    border-radius: 8px 24px 24px 24px;
    overflow: hidden;
}

.flip-image-button__font > div:not(.flip-image-button__font__image) {
    display: flex;
    flex-direction: column-reverse;
    gap: 7px;
    align-items: flex-start;
    margin: 0;
    width: calc(100% - 143px);
}

.flip-image-button__font h3 {
    width: 100%;
    font-size: 16px;
    font-weight: 500;
    color: var(--heading-color);
    display: flex;
    flex-direction: column-reverse;
    gap: 7px;
    margin: 0;
    align-items: flex-start;
}

.flip-image-button__font__desc {
    font-size: 18px;
}

.flip-image-popup-button {
    width: 50px;
    height: 25px;
    background: url(../../../img/plus-icon.svg);
    padding: 0;
    border: none;
    background-position: left;
    background-repeat: no-repeat;
}

.flip-image-button-list {
    gap: 20px 0;
    position: relative;
}

/* Equal-height cards: stretch each column and pass the height down to the card
   so the front face always matches the tallest card in the row. */
.flip-image-button-list > [class*="col-"] {
    display: flex;
    flex-direction: column;
}

.flip-image-button {
    display: flex;
    flex-direction: column;
    flex: 1;
    perspective: 1000px;
}

.flip-image-button__inner {
    display: flex;
    flex-direction: column;
    flex: 1;
    position: relative;
    width: 100%;
    transform-style: preserve-3d;
    transition: transform 0.8s;
}

/* Triggered by JS on mobile/tablet click; on desktop the :hover rule takes over */
.flip-image-button.is-flipped .flip-image-button__inner {
    transform: rotateY(180deg);
}

.flip-image-button__font {
    flex: 1;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

/* Back face: always in position, hidden via backface until the inner rotates */
.flip-image-button__back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform: rotateY(180deg);
}

.flip-image-button__back__wrapper {
    border-radius: 30px;
    color: var(--white);
    position: relative;
    text-align: center;
    width: 100%;
    height: 100%;
}

.flip-image-button__back__image {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    border-radius: 30px;
    height: 100%;
    background: var(--heading-color);
}

.flip-image-button__back__image img {
    opacity: 0.15;
    border-radius: 30px;
}

.flip-image-button__back__overlay {
    /* padding: 20px; */
    position: relative;
    z-index: 1;
    border-radius: 30px;
    padding: 5px 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
}

/* Hide the description paragraph on mobile; shown with a scrollable fixed height on tablet+ */
.flip-image-button__back__overlay p {
    display: none;
}

.flip-image-button__back .btn-tertiary {
    color: var(--secondary-color);
    padding: 8px 38px 8px 0;
}

.flip-image-button__back .btn-tertiary::before {
    background-image: radial-gradient(var(--secondary-color) 5px, transparent 3px);
    background-size: 14.4px 7px;
    background-repeat: repeat-x;
}

.flip-image-button__back h3 {
    position: relative;
    color: var(--floral-white);
    padding: 0;
    font-size: 20px;
    margin-bottom: 0;
}

.flip-image-button__back h3:after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -9px;
    display: none;
    height: 10px;
    width: 99%;
    background-image: radial-gradient(var(--white) 3px, transparent 2px);
    background-size: 10.4px 7px;
    background-repeat: repeat-x;
}

.flip-image-button__close-btn {
    position: absolute;
    right: -10px;
    top: -10px;
    width: 30px;
    height: 30px;
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50px;
    color: var(--heading-color);
    font-size: 14px;
    z-index: 4;
    border: 1px solid var(--heading-color);
}

.flip-image-button-slider .slick-arrow {
    bottom: 0px;
    background: var(--secondary-color);
}

.flip-image-button-slider .slick-arrow:before {
    color: var(--primary-color);
}

.flip-image-button__back p {
    color: var(--secondary-color);
}

@media(min-width: 768px) {
    .flip-image-button__font {
        flex-direction: column;
        padding: 32px 28px;
        gap: 25px;
        border-radius: 23px;
    }

    .flip-image-button__font > div:not(.flip-image-button__font__image) {
        display: flex;
        align-items: center;
        height: calc(100% - 160px);
        width: 100%;
        flex-direction: row;
    }

    .flip-image-button__font__image {
        width: 260px;
        height: 135px;
    }

    .flip-image-button__font h3 {
        width: 100%;
        font-size: 25px;
        flex-direction: row;
        justify-content: center;
        align-items: center;
    }

    .flip-image-buttons__wrapper {
        padding: 40px 31px;
        margin: 0 0px 98px;
    }

    .flip-image-buttons__wrapper h5 {
        font-size: 36px;
        padding: 0 24px;
        text-transform: capitalize;
        margin: 0 0 22px;
    }

    .flip-image-button-list {
        gap: 32px 0;
        justify-content: center;
    }

    .flip-image-button-slider .slick-arrow {
        bottom: 2px;
    }

    .flip-image-buttons__heading {
        margin: 0 0 35px;
    }

    .flip-image-button__back h3 {
        font-size: 25px;
        padding: 0 0 8px;
        margin-bottom: revert;
    }

    .flip-image-button__back h3:after {
        display: block;
    }

    .flip-image-button__back .btn-tertiary {
        padding: 0 40px 0 0;
    }

    .flip-image-button__back__overlay {
        padding: 40px 20px;
        display: block;
    }

    .flip-image-popup-button {
        background-position: center;
    }

    .flip-image-button__back__overlay p {
        display: block;
        height: 85px;
        overflow-y: auto;
        margin: 0 0 30px;
        padding-right: 10px;

        /* Firefox */
        scrollbar-width: thin;
        scrollbar-color: var(--floral-white) rgba(255, 255, 255, 0.15);
    }

    /* WebKit / Blink (Chrome, Safari, Edge) */
    .flip-image-button__back__overlay p::-webkit-scrollbar {
        width: 5px;
    }

    .flip-image-button__back__overlay p::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.15);
        border-radius: 10px;
    }

    .flip-image-button__back__overlay p::-webkit-scrollbar-thumb {
        background: var(--floral-white);
        border-radius: 10px;
    }

    .flip-image-button__back__overlay p::-webkit-scrollbar-thumb:hover {
        background: var(--white);
    }
}

@media(min-width: 1200px) {
    .flip-image-buttons__wrapper h5 {
        font-size: 36px;
        padding: 0;
        margin: 0 auto 22px;
        max-width: 826px;
    }

    .flip-image-buttons__heading {
        margin: 0 auto 50px;
        max-width: 832px;
    }

    .flip-image-buttons__heading h2 {
        font-size: 55px;
        margin: 0 0 20px;
    }

    .flip-image-buttons__wrapper {
        padding: 42px 52px 52px;
        margin: 0 0 111px;
    }

    .flip-image-buttons .container {
        max-width: 1414px;
    }

    .flip-image-button__font {
        padding: 30px 35px;
        gap: 24px;
        border-radius: 30px;
        justify-content: start;
    }

    .flip-image-button__font > div:not(.flip-image-button__font__image) {
        display: unset;
        align-items: unset;
        height: unset;
    }

    /* On desktop the :hover replaces the JS is-flipped trigger used on mobile/tablet */
    .flip-image-button:hover .flip-image-button__inner {
        transform: rotateY(180deg);
    }

    /* At desktop the back face overlays the front face absolutely.
       The front face stays in normal flow so it drives the card's content height. */
    .flip-image-button__back {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }

    .flip-image-button__font {
        width: 100%;
    }

    .flip-image-button__font__image {
        width: 100%;
        height: 172px;
        border-radius: 10px 30px 30px 30px;
    }

    .flip-image-button__font h3 {
        font-size: 32px;
        text-align: center;
        flex-direction: column;
    }

    .flip-image-popup-button {
        display: none;
    }

    .flip-image-button__back__overlay {
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding: 20px;
    }

    .flip-image-button__back__overlay p {
        height: auto;
    }

    .flip-image-button__back h3 {
        padding: 0 0 15px;
        font-size: 32px;
        margin: 0 14px 30px;
    }

    .flip-image-button__back .btn-tertiary {
        width: max-content;
        margin: 0 auto;
    }

    .flip-image-button-slider .slick-slide {
        margin: 0;
    }

    .flip-image-button-slider .slick-arrow {
        bottom: 10px;
    }

    .flip-image-button-slider .slick-arrow:hover {
        background: var(--secondary-hover-color);
    }

    .flip-image-button-slider {
        margin: 0 -16px;
    }

    .flip-image-button-slide {
        padding: 0 16px;
    }
}
