*,
*:before,
*:after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

@if ($minWidth != 0 and $minWidth != false) {
    html,
    body {
        min-width: $minWidth;
    }
}

html {
    font-family: '1';
    font-size: $rootFontSize;
    text-size-adjust: 100%;
}

body {
    @include font($family: $baseFont, $weight: $normalFontWeight, $lineHeight: $baseLineHeight, $size: $baseFontSize);

    @if ($bodyBackground != false) {
        background-color: $bodyBackground;
    }

    color: $baseColor;
    position: relative;
}

main {
    display: block;
}

embed,
img,
object,
video {
    max-width: 100%;
}

svg {
    overflow: hidden;
}

embed,
object {
    height: 100%;
}

audio,
canvas,
video {
    display: inline-block;
}

abbr[title] {
    border-bottom: 1px $abbrUnderline $baseColor;
    cursor: help;
}

b,
strong {
    font-weight: $boldFontWeight;
}

mark {
    background-color: $markBackground;
    color: $markColor;
}

canvas {
    -ms-touch-action: double-tap-zoom;
}

iframe {
    border: 0;
    margin-bottom: $blockMarginBottom;
}

figure {
    @if ($figureRounded != false) {
        @include rounded($defaultRadius);
    }

    @if ($figureBorderColor != false) {
        border: 1px solid $figureBorderColor;
    } @else {
        border: none;
    }

    margin-bottom: $blockMarginBottom;
    padding: $figurePadding;
    position: relative;
    text-align: center;

    img {
        margin-bottom: $blockMarginBottom;
    }

    figcaption {
        color: $figCaptionColor;
        font-style: $figCaptionFontStyle;
        line-height: $figCaptionLineHeight;
    }
}

img {
    display: inline-block;
}

sub,
sup {
    font-size: 0.7em;
    line-height: 0;
    margin-left: 0.2em;
    position: relative;
    vertical-align: baseline;
}

sub {
    bottom: -0.25em;
}

sup {
    top: -1em;
}

::-moz-selection {
    background: $selectionBackground;
    color: $selectionColor;
    text-shadow: none;
}
::selection {
    background: $selectionBackground;
    color: $selectionColor;
    text-shadow: none;
}

/*------------------------------------*\
    # Typography
\*------------------------------------*/

$headings: (
    h1: $h1,
    h2: $h2,
    h3: $h3,
    h4: $h4,
    h5: $h5,
    h6: $h6
);

h1,
h2,
h3,
h4,
h5,
h6 {
    @include heading();
}

@each $level, $value in $headings {
    .#{$level} {
        font-size: $value;
    }
}

p {
    color: $paragraphColor;
    font-weight: $paragraphFontWeight;
    line-height: $paragraphLineHeight;
    margin-bottom: $paragraphMarginBottom;
}

small {
    font-size: $smallFontSize;
}

dfn,
em,
i,
var {
    font-style: italic;
}

blockquote,
q {
    @include font(
        $quoteFont,
        $quoteFontSize,
        $quoteFontWeight,
        $quoteLineHeight,
        $quoteFontStyle
    );

    color: $quoteColor;

    cite {
        @include font(
            $citeFont,
            $citeFontSize,
            $citeFontWeight,
            $citeLineHeight,
            $citeFontStyle
        );

        color: $citeColor;
        margin-top: $citeMarginTop;

        &:before {
            content: $citeIndicator;
        }
    }

    p {
        color: $quoteColor;
    }
}

blockquote {
    margin-bottom: $blockMarginBottom;
    padding: $quotePaddingVertical $quotePaddingHorizontal;

    cite {
        display: block;
    }
}

del,
s,
strike {
    text-decoration: line-through;
}

a {
    color: $linkColor;
    text-decoration: $linkDecoration;

    &:focus {
        outline: thin dotted;
    }

    &:hover {
        color: $linkColorHover;

        @if ($linkDecorationHover != false) {
            text-decoration: $linkDecorationHover;
        }
    }

    &:active {
        color: $linkColorActive;
    }

    img {
        border: 0;
    }
}

hr {
    border: 0;
    border-top: $ruleHeight $ruleStyle $ruleColor;
    display: block;
    height: 1px;
    margin-bottom: $ruleMargin;
    margin-top: $ruleMargin;
}

address {
    @include font($addressFont, $addressFontSize, $addressFontWeight, $addressLineHeight, $addressFontStyle);

    color: $addressColor;
    margin-bottom: $blockMarginBottom;
}

/*------------------------------------*\
    # Lists
\*------------------------------------*/

dl,
ol,
ul {
    color: $listColor;
    line-height: $listLineHeight;
    list-style-position: $listBulletPosition;
    margin-bottom: $listMarginBottom;

    @if ($liMarginBottom != false) {
        li {
            margin-bottom: $liMarginBottom;
        }
    }
}

ol,
ul {
    @if ($listMarginLeft != false) {
        margin-left: $listMarginLeft;
    }

    ol,
    ul {
        margin-bottom: 0;
        margin-left: $nestedListMarginLeft;
    }
}

ul {
    list-style-type: $listBulletStyle;

    ul {
        list-style-type: circle;

        ul {
            list-style-type: square;
        }
    }
}

ol {
    list-style-type: decimal;
}

nav {
    ol,
    ul {
        list-style: none;
        margin: 0;

        li {
            margin-bottom: 0;
        }
    }
}

dl {
    margin-bottom: $dlMarginBottom;
}

dt {
    @include font($dtFont, $dtFontSize);

    color: $dtColor;
    margin-bottom: $dtMarginBottom;
}

dd {
    @include font($ddFont, $ddFontSize);

    color: $ddColor;
    margin-bottom: $ddMarginBottom;
}
