/*
Copyright 2023 DigitalOcean

Licensed under the Apache License, Version 2.0 (the "License") !default;
you may not use this file except in compliance with the License.

You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

@import "theme";

@mixin button {
    background: transparent;
    border: 1px solid $blue2;
    border-radius: 3px;
    box-sizing: border-box;
    color: $blue2;
    cursor: pointer;
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    padding: 8px 24px;
    transition: background 0.25s ease;

    &:disabled {
        border-color: $gray6;
        color: $gray6;
        cursor: not-allowed;
    }

    &:not(:disabled) {
        &:hover,
        &:focus {
            background: $blue3;
        }
    }
}

@mixin code-block-theme($code-background, $code-text) {
    background: $code-background;
    color: $code-text;

    code {
        color: $code-text;
    }

    // Prefixes
    &.prefixed {
        code {
            ol {
                li {
                    &::before {
                        color: $code-text;
                    }
                }
            }
        }

        &.line_numbers { /* stylelint-disable-line selector-class-pattern */
            code {
                ol {
                    li {
                        &::before {
                            border-right-color: rgba($code-text, 0.5);
                        }
                    }
                }
            }
        }
    }
}

@mixin prism-theme-punctuation($color) {
    &.language-css,
    &.style {
        .token {
            &.string {
                color: $color;
            }
        }
    }

    .token {
        &.punctuation,
        &.operator,
        &.entity,
        &.url {
            color: $color;
        }
    }
}

@mixin prism-theme-comment($color) {
    .token {
        &.comment,
        &.prolog,
        &.doctype,
        &.cdata {
            color: $color;
        }
    }
}

@mixin prism-theme-selector($color) {
    .token {
        &.atrule,
        &.property,
        &.tag,
        &.constant,
        &.symbol,
        &.deleted,
        &.selector,
        &.char,
        &.builtin,
        &.keyword,
        &.inserted,
        &.delimiter {
            color: $color;
        }
    }
}

@mixin prism-theme-variable($color) {
    .token {
        &.boolean,
        &.attr-name,
        &.color,
        &.string,
        &.variable {
            color: $color;
        }
    }
}

@mixin prism-theme-function($color) {
    .token {
        &.attr-value,
        &.function,
        &.class-name {
            color: $color;
        }
    }
}

@mixin prism-theme-number($color) {
    .token {
        &.regex,
        &.number,
        &.important {
            color: $color;
        }
    }
}

@mixin mq($size, $limit: "max", $unit: "px") {
    @media only screen and (#{$limit}-width: #{$size}#{$unit}) {
        @content;
    }
}
