@use './config.scss' as *;

@mixin resets($fontRegular, $fontBold) {
    @if ($fontRegular) {
        @font-face {
            font-family: Regular;
            font-display: swap;
            src: url(#{$fontRegular}) format('woff2');
        }
    }

    @if ($fontBold) {
        @font-face {
            font-family: Bold;
            font-display: swap;
            src: url(#{$fontBold}) format('woff2');
        }
    }

    * {
        box-sizing: border-box;
    }

    body {
        @include background(primary-70);
        @include typography(primary, default);
        @include spacing(m0);

        font-family: Regular, 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
    }

    h1,
    h2,
    h3,
    h4,
    h5,
    h6,
    strong,
    b {
        font-family: Bold, 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;

        @if ($fontBold) {
            font-weight: normal;
        }
    }

    a {
        @include transition(color);
        @include typography(primary);
    }

    button {
        font-family: Regular;
    }

    code,
    pre {
        @include border(primary-50);
        @include border-radius(md);
        @include typography(md);
    }

    code {
        @include spacing(px-xs);
        display: inline-block;
    }

    pre {
        @include background(primary-60);
        @include spacing(p-sm, my-default);

    }

    img {
        @include visibility(block);
        @include border-radius();

        object-fit: cover;
    }

    figure {
        @include spacing(my-default);
        @include layout(inline-flex, column, v-center, xs);
    }

    figcaption {
        @include typography(md, primary-20);  
        
        a {
            @include typography(primary-20);

            &:hover {
                @include typography(primary); 
            }
        }
    }

    p, ul, ol {
        @include typography(hlg);
        @include spacing(my-default);
    }

    li {
        @include spacing(mb-sm);
    }

    blockquote {
        @include spacing(my-default, mx-none, pl-default);
        @include border(2px, left, primary-30);
    }

    hr {
        @include size('w100%', h1px);
        @include border(0);
        @include background(primary-50);
    }

    table {
        @include size('w100%');
        @include typography(left);

        border-collapse: collapse;
    }

    thead,
    tfoot,
    th {
        @include typography(bold);

        @if ($fontBold) {
            font-weight: normal;
        }
    }

    th,
    td {
        @include spacing(py-xs, px-sm);
    }

    thead,
    tr {
        @include border(bottom, primary-50);

        &:last-child {
            @include border(bottom, 0);
        }
    }
}    
