@charset 'utf-8';

/*  ========================================================================
    JUICE -> ELEMENTS -> TYPOGRAPHY -> PRE
    ========================================================================  */

// Check if the elements with pre should be imported
@if $import-elements and $import-element-pre {
    pre {
        display: block;
        background-color: $pre-background-color;
        border: 0 $pre-border-style $pre-border-color;
        border-bottom-left-radius: $pre-border-radius-bottom-left;
        border-bottom-right-radius: $pre-border-radius-bottom-right;
        border-bottom-width: $pre-border-width-bottom;
        border-left-width: $pre-border-width-left;
        border-top-left-radius: $pre-border-radius-top-left;
        border-top-right-radius: $pre-border-radius-top-right;
        border-top-width: $pre-border-width-top;
        border-right-width: $pre-border-width-right;
        box-shadow: none;
        color: $pre-font-color;
        font-family: $pre-font-family;
        font-size: $pre-font-size;
        margin: 0;
        margin-bottom: $pre-element-spacing;
        padding: $pre-content-spacing;
        position: relative;
        overflow-x: auto;
        white-space: pre-wrap;

        // Pseudo elements
        &::after {
            // Styles
            display: block;
            content: attr(data-language);
            font-family: $default-monoface-typeface;
            font-size: 75%;
            padding: 5px 10px;
            position: absolute;
            right: 0;
            text-transform: uppercase;
            top: 0;
        }

        // Check if the pre size modifiers should be declared
        @if $pre-size-modifiers {
            // Cycle through all of the sizes
            @each $size in $sizes {
                // Modifiers: Sizes
                &.is-#{$size} {
                    font-size: map-get($pre-font-size-sizes, $size);
                    padding: map-get($pre-content-spacing-sizes, $size);
                }

                // Check if the pre size modifiers with breakpoints should be declared
                @if $pre-size-modifiers-with-breakpoints {
                    // Cycle through all of the breakpoints
                    @each $breakpoint-name, $breakpoint-value in $breakpoints {
                        // Breakpoint
                        @include breakpoint($breakpoint-name) {
                            // Modifiers: Size
                            &.is-#{$size}\@#{$breakpoint-name} {
                                font-size: map-get($pre-font-size-sizes, $size);
                                padding: map-get($pre-content-spacing-sizes, $size);
                            }
                        }
                    }
                }
            }
        }

        // Nested selectors
        code {
            // Styles
            background-color: transparent;
            color: inherit;
            font-size: inherit;
            white-space: nowrap;
        }
    }
}
