/* ============================================================================
Base CSS
============================================================================ */

/* stylelint-disable-next-line swissquote/no-type-outside-scope */
body {
    line-height: 1.5;

    font-family: var(--font-family-text);
    font-feature-settings: "kern" 1;
    font-kerning: normal;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* stylelint-disable-next-line swissquote/no-type-outside-scope */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-family-heading);
    font-weight: 300;
}

.s-content {
    h1,
    h2,
    h3,
    h4,
    h5,
    h6 {
        cursor: text;
        line-height: 1.4em;
        margin: 2em 0 0.5em;

        tt,
        code {
            font-size: inherit;
        }

        i {
            font-size: 0.7em;
        }

        p {
            margin-top: 0;
        }
    }

    h1 {
        margin-top: 0;
        font-size: var(--type-size-3);
    }

    h2 {
        font-size: var(--type-size-4);
    }

    h3 {
        font-size: var(--type-size-5);
    }

    h4 {
        font-size: var(--type-size-6);
    }

    h5 {
        font-size: var(--type-size-6);
    }

    h6 {
        font-size: var(--type-size-6);
    }

    a {
        text-decoration: underline;
    }

    small {
        font-size: var(--type-size-6);
    }

    p {
        margin-bottom: 1.3em;
    }

    ul,
    ol {
        padding-left: 2em;
    }

    ul p {
        margin: 0;
    }

    ul ul {
        margin: 0;
    }

    dl {
        padding: 0;

        dt {
            font-weight: bold;
            font-style: italic;
            padding: 0;
            margin: 15px 0 5px;
        }

        dt:first-child {
            padding: 0;
        }

        dd {
            margin: 0 0 15px;
            padding: 0 15px;
        }
    }

    blockquote {
        margin: 0.75em 2em;
        padding: 0.5em 1em;
        font-style: italic;
        border-left: 0.25em solid var(--blockquote-border-color);

        cite {
            font-style: italic;
        }

        cite:before {
            content: "\2014";
            padding-right: 0.5em;
        }
    }

    table {
        width: 100%;
        padding: 0;
        margin-bottom: 1em;
        border-collapse: collapse;

        font-size: var(--type-size-6);

        + table {
            margin-top: 1em;
        }

        tr {
            border-top: 1px solid var(--table-border);
            background-color: var(--table-background);
            margin: 0;
            padding: 0;
        }

        tr:nth-child(2n) {
            background-color: var(--table-background-odd);
        }

        th {
            font-weight: bold;
            border: 1px solid var(--table-border);
            background: var(--table-header-background);
            margin: 0;
            padding: 0.5em;
        }

        td {
            border: 1px solid var(--table-border);
            margin: 0;
            padding: 0.5em;
        }
    }

    ul,
    ol,
    blockquote,
    dl dt,
    dl dd,
    table th,
    table td {
        > :first-child {
            margin-top: 0;
        }

        > :last-child {
            margin-bottom: 0;
        }
    }

    img {
        max-width: 100%;
        display: inline-block;
    }

    code {
        font-family: var(--font-family-monospace);
        padding-top: 0.1rem;
        padding-bottom: 0.1rem;
        background: var(--code-tag-background-color);
        border: 1px solid var(--code-tag-border-color);
        border-radius: var(--code-tag-border-radius);
        box-shadow: var(--code-tag-box-shadow);

        &:before,
        &:after {
            letter-spacing: -0.2em;
            content: "\00a0"; /* non-breaking space*/
        }
    }

    pre {
        background: #f5f2f0;
        color: #333;
        line-height: 1.5em;
        overflow: auto;
        border: none;
        border-radius: 0;
        padding: 0.75em 20px;
        margin: 0 -20px 20px -20px;

        code {
            margin: 0;
            padding: 0;
            white-space: pre;
            box-shadow: none;
        }

        code:before,
        code:after {
            display: none;
        }

        code,
        tt {
            background-color: transparent;
            border: none;
        }
    }

    u,
    ins {
        text-decoration: none;
        border-bottom: 1px solid var(--color-text);

        a {
            color: inherit;
        }
    }

    del a {
        color: inherit;
    }

    details {
        background: var(--details-bg-color);
        border-radius: var(--details-border-radius);
        padding: var(--details-padding);
        margin-bottom: 1.3em;
    }

    summary {
        display: list-item;
        list-style: disclosure-closed inside;
    }

    details[open] > summary {
        list-style-type: disclosure-open;
    }

    // stylelint-disable-next-line selector-class-pattern
    .mermaid {
        background: #fff;
    }
}
