/*
CMS elements
==============================================
General styling for cms elements
*/

.cms-element-image {
    position: relative;
    height: 100%;

    .cms-image {
        display: block;
        max-width: 100%;
    }

    .cms-image-container {
        display: block;
        max-width: 100%;
        position: relative;

        &.is-cover {
            object-fit: contain;
            height: 100%;

            .cms-image {
                object-fit: cover;
                height: 100%;
                position: absolute;
                top: 0;
                right: 0;
                bottom: 0;
                left: 0;
            }
        }

        &.is-cover,
        &.is-stretch {
            .cms-image {
                width: 100%;
            }
        }
    }

    .cms-image-link {
        display: block;
    }
}

.cms-element-youtube-video {
    position: relative;
    width: 100%;

    display: flex;
    align-items: center;
    justify-content: center;

    &.is--streched {
        height: 100%;
    }

    &::before {
        display: block;
        content: '';
        width: 100%;
        padding-top: calc((9 / 16) * 100%);
    }

    &__video,
    &__placeholder {
        width: 100%;
        height: 100%;
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        border: 0 none;
    }

    &__placeholder img {
        object-fit: cover;
        height: 100%;
        width: 100%;
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
    }

    &__backdrop {
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;

        > div {
            background: rgba(255, 255, 255, 0.5);
            padding: $spacer;
        }
    }
}

.cms-element-vimeo-video {
    position: relative;
    width: 100%;

    &::before {
        display: block;
        content: '';
        width: 100%;
        padding-top: 56.25%;
    }

    &__video,
    &__placeholder {
        width: 100%;
        height: 100%;
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        border: 0 none;
    }

    &__placeholder img {
        object-fit: cover;
        height: 100%;
        width: 100%;
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
    }

    &__backdrop {
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;

        > div {
            background: rgba(255, 255, 255, 0.5);
            padding: $spacer;
        }
    }
    &__container:hover .js-vimeo-link {
        display: block;
    }
}


.cms-element-product-listing {
    .cms-listing-col {
        margin-bottom: $spacer-lg;
    }
}

.cms-element-product-listing-actions {
    display: flex;
    align-items: center;
    margin-bottom: 20px;

    .sorting {
        margin-left: auto;
    }
}

.cms-element-buy-box,
.cms-element-product-box {
    width: 100%;
}

.cms-element-product-slider {
    .cms-element-title {
        font-size: $font-size-lg;
        font-weight: $font-weight-bold;
        color: $headings-color;
    }

    &.has-border {
        .cms-element-title {
            margin-top: $spacer-sm;
        }
    }
}

.cms-element-text,
.cms-element-image,
.cms-element-product-box,
.cms-element-buy-box,
.cms-element-product-slider,
.cms-element-image-slider,
.cms-element-product-description-reviews,
.cms-element-image-gallery {
    word-break: break-word;

    &.has-vertical-alignment {
        display: flex;
        height: 100%;
    }
}

.cms-element-image-gallery {
    .js-magnifier-zoom-image-container {
        // hides magnifier overlay because zoom container is displayed over gallery
        .magnifier-overlay {
            display: none;
        }
    }
}

@include media-breakpoint-down(lg) {
    .cms-element-product-listing-actions {
        flex-wrap: wrap;
        justify-content: center;

        .sorting {
            width: 100%;
            margin-top: 5px;
            margin-left: 0;
        }
    }
}

div.card-tabs .cms-card-header {
    padding-left: 0;
    padding-right: 0;
}

.cms-element-text {
    position: relative;
}
