@import 'variables';

$block-border-radius: 4px;

@mixin codelike {
    display: inline-block;
    border-radius: 3px;
    font-family: 'Source Code Pro', monospace;
    background-color: $gray-100;
    border: 1px solid $gray-200;
}

.markdown {
    line-height: 1.4;
    @media all and (min-width: $sm-breakpoint) {
        margin-left: 12px;
    }

    h1:first-of-type {
        text-transform: capitalize;
        font-weight: 500;
        margin-top: 0;
        margin-bottom: 0;
        font-size: 2.8em;

        @media all and (max-width: $sm-breakpoint){
            font-size: 2em;
        }
    }

    h1:not(:first-of-type) {
        margin-top: 48px;
        margin-left: -12px;
        padding: 3px 12px;
        @include codelike;
    }

    h2 {
        margin-top: 60px;
        margin-bottom: 6px;
        font-size: 1.8em;
    }

    h3 {
        margin-top: 48px;
        font-size: 1.4em;
    }

    h3.member-title {
        margin-top: 6px;
        margin-left: 6px;
        padding: 2px 6px;
        @include codelike;
    }

    h4 {
        margin-top: 32px;
    }

    h1, h2, h3, h4, h5 {
        font-family: $brand-font-face;
        font-weight: 400;
        line-height: 1.25;

        &[id]:target {
            scroll-margin-top: 60px;
            text-decoration: underline;
        }
    }

    b, optgroup, strong {
        font-weight: 700;
    }

    a {
        text-decoration: none;

        &:hover {
            text-decoration: underline;
        }
    }

    li {
        margin-bottom: 6px;
    }

    code:not([data-lang]) {
        font-family: 'Source Code Pro', monospace;
        padding: 0 $padding-4;
        background: $gray-200;
        color: $gray-700;
        font-size: 0.9em;
        border-radius: $block-border-radius;
        border: 1px solid $gray-300;
    }

    a > code:not([data-lang]) {
        color: $color-link;
    }

    pre:not(.chroma) {
        padding: $padding-16;
        background: $color-code-bg;
        border-radius: $block-border-radius;
        font-size: $font-size-14;
        overflow-x: auto;

        code {
            color: $color-code-text;
            background: none;
            padding: none;
        }
    }

    blockquote {
        margin: 0;
        padding: $padding-16 $padding-16 * 2;
        position: relative;
        // font-size: 22px;
        color: $gray-700;
        border-left: 2px solid $gray-300;

        :first-child { margin-top: 0; }
        :last-child { margin-bottom: 0; }

        ::before {
            content: '“';
            position: absolute;
            font-family: Georgia, 'Times New Roman', Times, serif;
            font-size: 48px;
            top: 0px;
            left: 10px;
            color: $gray-500;
        }
    }

    table {
        width: 100%;
        th {
            text-align: left;
        }
        td, th {
            padding: $padding-4;
        }
        tr:nth-child(odd) td {
            background-color: $gray-100;
        }
    }

    figure {
        margin: $padding-16 0;
        figcaption p {
            text-align: center;
            font-size: $font-size-12;
            margin-top: $padding-4;
        }
    }
}
