@hdeng-hr-color: @hdeng-body-bg-contrast-color;

@hdeng-caption-bg-color: @hdeng-body-bg-contrast-color;
@hdeng-caption-font-color: darken(@hdeng-body-font-default-color, 20%);

//== Generates

.hdeng-base-critical-generate() {
    *,
    *:before,
    *:after {
        box-sizing: border-box;
    }

    html, body, div, span, applet, object, iframe,
    h1, h2, h3, h4, h5, h6, p, blockquote, pre,
    a, abbr, acronym, address, big, cite, code,
    del, dfn, em, img, ins, kbd, q, s, samp,
    small, strike, strong, sub, sup, tt, var,
    b, u, i, center,
    dl, dt, dd, ol, ul, li,
    fieldset, form, label, legend,
    table, caption, tbody, tfoot, thead, tr, th, td,
    article, aside, canvas, details, embed,
    figure, figcaption, footer, header,
    menu, nav, output, ruby, section, summary,
    time, mark, audio, video {
        margin: 0;
        padding: 0;
        border: 0;
    }

    // HTML5 display-role reset for older browsers
    article, aside, details, figcaption, figure,
    footer, header, main, menu, nav, section, summary {
        display: block;
    }

    html, body {
        width: 100%;
        min-height: 100%;
    }

    html {
        -webkit-text-size-adjust: none;
    }

    body {
        background: @hdeng-body-bg-default-color;
        color: @hdeng-body-font-default-color;
    }

    table {
        border-collapse: collapse;
        border-spacing: 0;
    }

    td,
    th {
        padding: 0;
    }

    ul, ol,
    dd, p, figure,
    pre, table, fieldset,
    blockquote, form {
        margin: 0 0 @hdeng-spacing;
    }

    sub, sup {
        // Specified in % so that the sup/sup is the right size relative to the surrounding text
        font-size: 65%;

        // Zero out the line-height so that it doesn't interfere with the positioning that follows
        line-height: 0;

        // Where the magic happens: makes all browsers position the sup/sup properly, relative to the surrounding text
        position: relative;
        left: 2px;

        // Note that if you're using Eric Meyer's reset.css, this is already set and you can remove this rule
        vertical-align: baseline;
    }

    sup {
        // Move the superscripted text up
        top: -0.42em;
    }

    sub {
        // Move the subscripted text down, but only half as far down as the superscript moved up
        bottom: -0.25em;
    }

    ul, ol {
        padding: 0 0 0 @hdeng-spacing;
        list-style-position: outside;

        ul, ol {
            margin-bottom: 0;
        }
    }

    ul {
        list-style-type: square;

        &.red {
            padding-left: 15px;
            list-style-image: url('img/square.gif');
        }
    }

    ol {
        list-style-type: decimal;
    }

    b,
    strong {
        font-weight: bold;
    }

    .italic {
        font-style: italic;
    }

    small,
    .small {
        font-size: 80%;
    }

    img {
        max-width: 100%;
        height: auto;
    }

    .content {
        .hdeng-content-padding();

        padding-top: @hdeng-content-padding-vertical;
        padding-bottom: @hdeng-content-padding-vertical;

        @media (max-width: @hdeng-breakpoint-mobile) {
            padding-top: @hdeng-content-padding-vertical-mobile;
            padding-bottom: @hdeng-content-padding-vertical-mobile;
        }
    }

    .sidebar {
        .hdeng-content-padding();

        padding-top: @hdeng-content-padding-vertical;
        padding-bottom: @hdeng-content-padding-vertical;

        @media (max-width: @hdeng-breakpoint-mobile) {
            padding-top: @hdeng-content-padding-vertical-mobile;
            padding-bottom: @hdeng-content-padding-vertical-mobile;
        }
    }
}

.hdeng-base-generate() {
    ul.legend {
        margin-top: @hdeng-spacing*2;
        list-style: none;
        padding: 0;
    }

    .legend,
    .note {
        font-size: @hdeng-base-font-size-small;
        color: @hdeng-body-font-contrast-color;
    }
    hr {
        clear: both;
        height: 0;
        border: 0;
        border-bottom: 1px solid @hdeng-hr-color;
        margin: @hdeng-base-line-height-computed 0;
        padding: 0;
    }

    blockquote {
        margin: 0 0 @hdeng-spacing;
        padding: @hdeng-spacing;

        background: @hdeng-body-bg-contrast-color;
        border-left: 2px solid @hdeng-body-bg-highlight-color;
        border-radius: @hdeng-border-radius;
        color: @hdeng-body-font-default-color;
        font-size: 90%;

        &:after {
            content: none;
        }

        *:first-child {
            margin-top: 0;
        }

        *:last-child {
            margin-bottom: 0;
        }
    }

    .align-left,
    .alignleft {
        float: left;
        margin: 0 @hdeng-spacing (@hdeng-spacing / 2) 0;
    }

    .align-right,
    .alignright {
        float: right;
        margin: 0 0 (@hdeng-spacing / 2) @hdeng-spacing;
    }

    .align-center,
    .aligncenter,
    .align-none,
    .alignnone {
        float: none !important;
        margin: 0 0 @hdeng-spacing 0;

        ul &:last-child,
        ol &:last-child,
        dd &:last-child,
        p &:last-child,
        figure &:last-child,
        pre &:last-child,
        table &:last-child,
        fieldset &:last-child,
        blockquote &:last-child,
        form &:last-child {
            margin-bottom: 0;
        }
    }

    .align-center,
    .aligncenter {
        text-align: center;
        margin: 0 auto @hdeng-spacing auto;
    }

    img.align-left,
    img.alignleft,
    img.align-right,
    img.alignright,
    img.align-center,
    img.aligncenter,
    img.align-none,
    img.alignnone {
        // Do not use .hdeng-img-responsive(), it sets width to auto which is
        // not desired!
        // Inherits max-width and height from global img style.
        display: block;
    }

    @media (max-width: @hdeng-breakpoint-default) {
        .align-left,
        .alignleft,
        .align-right,
        .alignright {
            float: none !important;
            text-align: center;
            margin: 0 auto @hdeng-spacing auto;
        }
    }

    figure {
        // See http://stackoverflow.com/a/11652170/422773
        // Do _not_ use !important here as it breaks other <figure> styles
        display: table;

        // Reset widths set via style attributes from WP editor
        max-width: 100%;

        img {
            // Do not use .hdeng-img-responsive(), it sets width to auto which
            // is not desired!
            // Inherits max-width and height from global img style.
            display: block;
        }

        img[class*="align"] {
            float: none;
            margin: 0;
        }
    }

    figcaption {
        padding: floor(@hdeng-spacing / 4) floor(@hdeng-spacing / 2);
        font-size: @hdeng-base-font-size-small;
        background: @hdeng-caption-bg-color;
        color: @hdeng-caption-font-color;
        text-align: center;

        // See http://stackoverflow.com/a/11652170/422773
        display: table-caption;
        caption-side: bottom;
    }

    .caret,
    .caret-up.caret--reverse {
        border-left: 5px solid transparent;
        border-right: 5px solid transparent;
        border-top: 5px solid;
        border-bottom: 0;
        display: inline-block;
        height: 0;
        margin-left: 2px;
        vertical-align: middle;
        width: 0;
    }

    .caret-up,
    .caret.caret--reverse {
        border-left: 5px solid transparent;
        border-right: 5px solid transparent;
        border-top: 0;
        border-bottom: 5px solid;
        display: inline-block;
        height: 0;
        margin-left: 2px;
        vertical-align: middle;
        width: 0;
    }
}
