@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), h2 {
        font-family: $font-source-sans;
        font-weight: 700;
    }

    :global(.hero-header) {
        margin: 30px 0;
        font-size: 72px;
        line-height: 72px;
    }

    h3, 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: 42px;
    }

    h2 {
        font-size: 30px;
    }

    h3 {
        font-size: 24px;
    }

    h4 {
        font-size: 18px;
    }

    h5 {
        font-size: 16px;
    }

    h6 {
        font-size: 14px;
    }
}

@mixin typography-inline() {
    b, strong {
        font-family: $font-source-sans;
        font-weight: 600;
        color: $night900;
    }

    i, em {
        font-family: $font-source-sans;
        font-weight: 400;
        font-style: italic;
    }

    a {
        display: inline-flex;
        align-items: center;
        color: $sky;
        text-decoration: underline;

        &:hover {
            color: darken($sky, 10%);
        }
    }

    code {
        padding: 0.125em 0.25em;
        color: $night50;
        background-color: $night700;
        border-radius: 3px;
        font-family: monospace;
        font-weight: 400;
        white-space: pre-wrap;
        word-wrap: normal;
    }
}

@mixin typography-block() {
    b, strong {
        color: $night900;
    }

    ol, ul {
        padding: 0;
    }

    li {
        margin-left: 1.25em;
        line-height: 1.5;
    }

    pre {
        padding: 1.25em;
        color: $night50;
        background-color: $night700;
        border-radius: 3px;
        font-family: monospace;
        font-weight: 400;
        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-loveship() {
    font-family: $font-source-sans;
    color: $night700;
    @include typography-header();
    @include typography-block();
    @include typography-inline();
}
