//
//  Common
//  _____________________________________________

& when (@media-common = true) {
    .cms-block-tiled-module {
        background-position: bottom center;
        background-repeat: no-repeat;
        background-size: cover;
        font-size: 0;
        padding-bottom: 60px;
        padding-top: 60px;
        .tile {
            .overlay-tile {
                display: inline-block;
                font-size: 0;
                position: relative;
                .overlay-tile-anchor {
                    display: block;
                    height: 100%;
                    width: 100%;
                }
                .overlay-tile-inner {
                    height: 100%;
                    width: 100%;
                    .overlay-tile-image-container {
                        height: 100%;
                        overflow: hidden;
                        position: relative;
                        width: 100%;
                        &::after {
                            background-color: rgba(0, 0, 0, .2);
                            bottom: 0;
                            content: '';
                            display: block;
                            height: 100%;
                            position: absolute;
                            transition: max-height .3s;
                            width: 100%;
                        }
                        .overlay-tile-image {
                            position: relative;
                            transition: transform .3s;
                        }
                    }
                    .overlay-tile-text-container {
                        box-sizing: border-box;
                        padding-left: 15px;
                        padding-right: 15px;
                        position: absolute;
                        text-align: center;
                        top: 50%;
                        -webkit-transform: translateY(-50%);
                                transform: translateY(-50%);
                        width: 100%;
                        .overlay-tile-title {
                            display: block;
                            line-height: 1;
                        }
                        .overlay-tile-description {
                            display: inline-block;
                            margin-top: 4px;
                        }
                    }
                    .overlay-tile-cta-container {
                        bottom: 0;
                        position: absolute;
                        text-align: center;
                        width: 100%;
                        .overlay-tile-cta {
                            display: inline-block;
                            letter-spacing: .07em;
                            position: relative;
                            top: 50%;
                            -webkit-transform: translateY(-50%);
                                    transform: translateY(-50%);
                            transition: border-bottom-color .3s;
                            z-index: 1;
                        }
                    }
                }
                &:not(.is-playing-video):hover {
                    .overlay-tile-inner {
                        .overlay-tile-image-container {
                            &::after {
                                max-height: 100%;
                            }
                            .overlay-tile-image {
                                -webkit-transform: scale(1.1);
                                        transform: scale(1.1);
                            }
                        }
                        .overlay-tile-cta-container {
                            .overlay-tile-cta {
                                border-bottom-color: @djo-blue;
                            }
                        }
                    }
                }
                &.overlay-tile-has-video {
                    cursor: pointer;
                    display: block;
                    .overlay-tile-inner {
                        display: inline-block;
                    }
                    .overlay-tile-image-container {
                        display: inline-block;
                        height: auto;
                        width: auto;
                    }
                }
                &.is-playing-video {
                    .overlay-tile-inner {
                        display: block;
                        .overlay-tile-image-container {
                            display: block;
                            height: 0;
                            padding-bottom: 56.25%;
                            position: relative;
                            width: auto;
                            &::after {
                                content: none;
                            }
                            .overlay-tile-image {
                                height: 100%;
                                left: 0;
                                position: absolute;
                                top: 0;
                                width: 100%;
                            }
                        }
                        .overlay-tile-text-container {
                            display: none;
                        }
                        .overlay-tile-cta-container {
                            display: none;
                        }
                    }
                }
            }
        }
    }
}


//
//  Mobile
//  _____________________________________________

.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__s) {
    .cms-block-tiled-module {
        .tile {
            margin-bottom: 12px;
            text-align: center;
            .overlay-tile {
                .overlay-tile-inner {
                    .overlay-tile-image-container {
                        &::after {
                            max-height: 50px;
                        }
                    }
                    .overlay-tile-text-container {
                        .overlay-tile-title {
                            .lib-font-size(30);
                        }
                        .overlay-tile-description {
                            .lib-font-size(14);
                        }
                    }
                    .overlay-tile-cta-container {
                        height: 50px;
                        .overlay-tile-cta {
                            .lib-font-size(12);
                            border-bottom: 2px solid #fff;
                            padding-bottom: 11px;
                        }
                    }
                }
            }
        }
    }
}


//
//  Desktop
//  _____________________________________________

.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__s) {
    .cms-block-tiled-module {
        .tile {
            margin-bottom: 12px;
            text-align: center;
            .overlay-tile {
                .overlay-tile-inner {
                    .overlay-tile-image-container {
                        &::after {
                            max-height: 50px;
                        }
                    }
                    .overlay-tile-text-container {
                        .overlay-tile-title {
                            .lib-font-size(30);
                        }
                        .overlay-tile-description {
                            .lib-font-size(14);
                        }
                    }
                    .overlay-tile-cta-container {
                        height: 50px;
                        .overlay-tile-cta {
                            .lib-font-size(12);
                            border-bottom: 2px solid #fff;
                            padding-bottom: 11px;
                        }
                    }
                }
            }
        }
    }
}

.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) {
    .cms-block-tiled-module {
        .tiled-module-left {
            box-sizing: border-box;
            display: inline-block;
            padding-right: 4px;
            width: 60%;
            .tiled-module-left-top {
                padding-bottom: 4px;
                > .tile {
                    box-sizing: border-box;
                    display: inline-block;
                    padding-right: 4px;
                    text-align: right;
                    width: 65.3%;
                }
                .tiled-module-left-top-stacked {
                    box-sizing: border-box;
                    display: inline-block;
                    padding-left: 4px;
                    width: 34.4%;
                    .tile:first-child {
                        margin-bottom: 8px;
                    }
                }
            }
            .tiled-module-left-bottom {
                padding-top: 4px;
                .tile {
                    &:first-child {
                        box-sizing: border-box;
                        display: inline-block;
                        padding-right: 4px;
                        vertical-align: top;
                        width: 33.33%;
                    }
                    &:last-child {
                        box-sizing: border-box;
                        display: inline-block;
                        padding-left: 4px;
                        width: 66.67%;
                    }
                }
            }
        }
        .tiled-module-right {
            box-sizing: border-box;
            display: inline-block;
            padding-left: 4px;
            padding-top: 50px;
            vertical-align: top;
            width: 40%;
            .tile:first-child {
                margin-bottom: 8px;
            }
        }
        .tile {
            margin-bottom: 0;
            text-align: left;
        }
    }
}

.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__l) {
    .cms-block-tiled-module {
        .tiled-module-left {
            padding-right: 12.5px;
            .tiled-module-left-top {
                padding-bottom: 12.5px;
                > .tile {
                    padding-right: 12.5px;
                }
                .tiled-module-left-top-stacked {
                    padding-left: 12.5px;
                    .tile:first-child {
                        margin-bottom: 25px;
                    }
                }
            }
            .tiled-module-left-bottom {
                padding-top: 12.5px;
                .tile {
                    &:first-child {
                        padding-right: 12.5px;
                    }
                    &:last-child {
                        padding-left: 12.5px;
                    }
                }
            }
        }
        .tiled-module-right {
            padding-left: 12.5px;
            .tile:first-child {
                margin-bottom: 25px;
            }
        }
    }
}

.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__xl) {
    .cms-block-tiled-module {
        .tile {
            .overlay-tile {
                .overlay-tile-inner {
                    .overlay-tile-image-container {
                        &::after {
                            max-height: 70px;
                        }
                    }
                    .overlay-tile-text-container {
                        .overlay-tile-title {
                            .lib-font-size(34);
                        }
                        .overlay-tile-description {
                            .lib-font-size(16);
                        }
                    }
                    .overlay-tile-cta-container {
                        height: 70px;
                        .overlay-tile-cta {
                            .lib-font-size(13);
                            border-bottom: 3px solid #fff;
                            padding-bottom: 14px;
                        }
                    }
                }
            }
        }
    }
}
