/*!
 *  Licensed to the Apache Software Foundation (ASF) under one or more
 *  contributor license agreements.  See the NOTICE file distributed with
 *  this work for additional information regarding copyright ownership.
 *  The ASF licenses this file to You under the Apache License, Version 2.0
 *  (the "License"); 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.
 */

@use 'sass:map';
@use '@angular/material' as mat;

@mixin generate-prism-theme() {
    pre[class*='language-'] {
        padding-top: 0.75rem;
        padding-bottom: 0.75rem;
    }

    code[class*='language-'],
    pre[class*='language-'] {
        color: var(--nf-prism-language-color);
        text-align: left;
        white-space: pre;
        word-spacing: normal;
        word-break: normal;
        word-wrap: normal;
        line-height: 1.5;

        -moz-tab-size: 4;
        -o-tab-size: 4;
        tab-size: 4;

        -webkit-hyphens: none;
        -moz-hyphens: none;
        -ms-hyphens: none;
        hyphens: none;
    }

    pre[class*='language-']::-moz-selection,
    pre[class*='language-'] ::-moz-selection,
    code[class*='language-']::-moz-selection,
    code[class*='language-'] ::-moz-selection {
        text-shadow: none;
        background: var(--mat-sys-tertiary-container);
    }

    pre[class*='language-']::selection,
    pre[class*='language-'] ::selection,
    code[class*='language-']::selection,
    code[class*='language-'] ::selection {
        text-shadow: none;
        background: var(--mat-sys-tertiary-container);
    }

    @media print {
        code[class*='language-'],
        pre[class*='language-'] {
            text-shadow: none;
        }
    }

    /* Code blocks */
    pre[class*='language-'] {
        display: flex;
        margin: 0.5em 0;
        overflow: auto;
    }

    :not(pre) > code[class*='language-'],
    pre[class*='language-'] {
        @extend .neutral-contrast;
        cursor: default;
        line-height: normal;
        background-color: var(--mat-sys-background);
        border: 1px solid;
    }

    /* Inline code */
    :not(pre) > code[class*='language-'] {
        padding: 0.1em;
        border-radius: 0.3em;
        white-space: normal;
    }

    .token.comment,
    .token.prolog,
    .token.doctype,
    .token.cdata {
        color: var(--nf-prism-token-comment);
    }

    .token.punctuation {
        color: var(--nf-prism-token-punctuation);
    }

    .token.namespace {
        opacity: 0.7;
    }

    .token.property,
    .token.tag,
    .token.boolean,
    .token.number,
    .token.symbol,
    .token.deleted {
        color: var(--nf-prism-token-punctuation);
    }

    .token.constant {
        color: var(--nf-prism-token-constant);
    }

    .token.selector,
    .token.attr-name,
    .token.string,
    .token.char,
    .token.builtin,
    .token.inserted {
        color: var(--nf-prism-token-punctuation);
    }

    .token.keyword {
        color: var(--nf-prism-token-punctuation);
    }

    .token.atrule,
    .token.attr-value {
        color: var(--nf-prism-token-constant);
    }

    .token.function {
        color: var(--nf-prism-token-function);
    }

    .token.class-name {
        color: var(--nf-prism-token-constant);
    }

    .token.important,
    .token.bold {
        font-weight: bold;
    }
    .token.italic {
        font-style: italic;
    }

    .token.entity {
        cursor: help;
    }
}
