@use 'colors' as *;
@use 'fonts' as *;

@mixin overflow-ellipsis() {
    overflow: hidden;
    text-overflow: ellipsis;
}

@mixin typography-header() {
    :global(.hero-header), h1, h2, h3, h4, h5, h6 {
        margin: 0;
    }

    :global(.hero-header) {
        font-family: $font-museo-slab;
        font-weight: 700;
        margin: 30px 0;
        font-size: 66px;
        line-height: 72px;
    }

    :global(.hero-header), :global(.promo-header) {
        color: $gray90;
        text-align: center;
    }

    :global(.promo-header), h1, h2, h3 {
        font-family: $font-museo-sans;
        font-weight: 500;
    }

    :global(.promo-header) {
        text-transform: uppercase;
    }

    h4, h5, h6 {
        font-family: $font-source-sans;
        font-weight: 600;
    }

    h1, h2, h3, h4, h5, h6 {
        margin-bottom: 0.5em;
        margin-top: 1.2em;
        line-height: 1.35em;
    }

    h1 {
        font-size: 36px;
    }

    h2 {
        font-size: 30px;
        letter-spacing: 0.1px;

        &:global(.promo-header) {
            letter-spacing: 2px;
        }
    }

    h3 {
        font-size: 24px;
    }

    h4 {
        font-size: 18px;
        letter-spacing: 0.1px;
    }

    h5 {
        font-size: 16px;
    }

    h6 {
        font-size: 14px;
    }
}

@mixin typography-inline() {
    b, strong {
        font-family: $font-source-sans;
        font-weight: 600;
    }

    i, em {
        font-family: $font-source-sans;
        font-weight: 400;
        font-style: italic;
    }

    a {
        display: inline-flex;
        align-items: center;
        color: $blue;
        text-decoration: underline;

        &:visited {
            color: #5214CC;

            &:hover {
                color: #3F0F9E;
            }
        }

        &:hover {
            color: $blue-dark;
        }
    }

    code {
        padding: 0.125em 0.25em;
        color: $gray80;
        background-color: $gray30;
        font-family: $font-roboto-mono;
        font-weight: 400;
        white-space: pre-wrap;
        word-wrap: normal;
    }
}

@mixin typography-block() {
    ol, ul {
        padding: 0;
    }

    li {
        margin-left: 1.25em;
        line-height: 1.5;
    }

    pre {
        padding: 1.25em;
        font-family: monospace;
        white-space: pre-wrap;
        word-wrap: normal;
    }

    img {
        max-width: 100%;
    }

    figure {
        margin: 0;

        figcaption {
            font-size: 0.9em;
            opacity: 0.9;
            text-align: center;
        }
    }

    p {
        margin: 0.5em 0;
        line-height: 1.5;
    }
}

@mixin typography-12() {
    font-size: 12px;
}

@mixin typography-14() {
    font-size: 14px;
}

@mixin typography-16() {
    font-size: 16px;
}

@mixin typography-promo() {
    @include typography-header();
    @include typography-block();
    @include typography-inline();
    color: $gray80;
    font-family: $font-source-sans;
}
