//
// Normalize
// ----------------------------
//
// ### Usage:
// 初始化整站样式时使用。
//
// ### Example:
// .global-normalize;
//
// 删除了对IE6, IE7的兼容支持
//
// ### Reference:
// * http://necolas.github.io/normalize.css/

@import 'variables';
@import 'typography';
@import 'reset';

.global-normalize() {
    // normalize.css v1.1.2 | MIT License | git.io/normalize 

    html {
        font-size: 100%;
        -ms-text-size-adjust: 100%;
        -webkit-text-size-adjust: 100%;
    }

    html,
    button,
    input,
    select,
    textarea {
        .font-family(base);
    }

    body {
        margin: 0;
        font-size: 14px;
    }

    // Address `outline` inconsistency between Chrome and other browsers.

    a:focus {
        outline: thin dotted;
    }

    // Improve readability when focused and also mouse hovered

    a:active,
    a:hover {
        outline: 0;
    }

    // Address font sizes and margins set differently in IE 6/7.
    // Address font sizes in Firefox 4+, Safari 5,
    // and Chrome.

    h1 {
        font-size: 2em;
        margin: 0.67em 0;
    }

    h2 {
        font-size: 1.5em;
        margin: 0.83em 0;
    }

    h3 {
        font-size: 1.17em;
        margin: 1em 0;
    }

    h4 {
        font-size: 1em;
        margin: 1.33em 0;
    }

    h5 {
        font-size: 0.83em;
        margin: 1.67em 0;
    }

    h6 {
        font-size: 0.67em;
        margin: 2.33em 0;
    }

    // Address styling not present in IE 7/8/9, Safari 5, and Chrome.

    abbr[title] {
        border-bottom: 1px dotted;
    }

    // Address style set to `bolder` in Firefox 3+, Safari 4/5, and Chrome.
    b,
    strong {
        font-weight: bold;
    }

    blockquote {
        margin: 1em 40px;
    }

    // Address styling not present in Safari 5 and Chrome.
    dfn {
        font-style: italic;
    }

    // Address differences between Firefox and other browsers.
    hr {
        box-sizing: content-box;
        height: 0;
    }

    // Address margins set differently in IE 6/7.
    p,
    pre {
        margin: 1em 0;
    }
    
    // Correct font family set oddly in IE 6, Safari 4/5, and Chrome.
    code,
    kbd,
    pre,
    samp {
        .font-family(code);
        font-size: 1em;
    }

    // Improve readability of pre-formatted text in all browsers.
    pre {
        white-space: pre;
        white-space: pre-wrap;
        word-wrap: break-word;
    }

    // Address CSS quotes not supported in IE 6/7.
    q {
        quotes: none;
    }

    // Address `quotes` property not supported in Safari 4.
    q:before,
    q:after {
        content: '';
        content: none;
    }

    // Address inconsistent and variable font size in all browsers.
    small {
        font-size: 80%;
    }

    // Prevent `sub` and `sup` affecting `line-height` in all browsers.
    sub,
    sup {
        font-size: 75%;
        line-height: 0;
        position: relative;
        vertical-align: baseline;
    }

    sup {
        top: -0.5em;
    }

    sub {
        bottom: -0.25em;
    }

    // Address margins set differently in IE 6/7.
    dl,
    menu,
    ol,
    ul {
        margin: 1em 0;
    }

    dd {
        margin: 0 0 0 40px;
    }

    // Address paddings set differently in IE 6/7.
    menu,
    ol,
    ul {
        padding: 0 0 0 40px;
    }

    // Correct list images handled incorrectly in IE 7.
    nav ul,
    nav ol {
        list-style: none;
        list-style-image: none;
    }

    // 1. Remove border when inside `a` element in IE 6/7/8/9 and Firefox 3.
    // 2. Improve image quality when scaled in IE 7.
    img {
        border: 0;
        -ms-interpolation-mode: bicubic;
    }
    
    // Correct overflow displayed oddly in IE 9.
    svg:not(:root) {
        overflow: hidden;
    }

    // Correct margin displayed oddly in IE 6/7.
    form {
        margin: 0;
    }

    // Define consistent border, margin, and padding
    fieldset {
        border: 1px solid #c0c0c0;
        margin: 0 2px;
        padding: 0.35em 0.625em 0.75em;
    }

    // Correct color not being inherited in IE 6/7/8/9.
    // Correct text not wrapping in Firefox 3.
    legend {
        border: 0; 
        padding: 0;
        white-space: normal;
    }

    // 1. Correct font size not being inherited in all browsers.
    // 2. Address margins set differently in IE 6/7, Firefox 3+, Safari 5,
    //   and Chrome.

    button,
    input,
    select,
    textarea {
        font-size: 100%;
        margin: 0;
        vertical-align: baseline;
    }

    // Address Firefox 3+ setting `line-height` 
    button,
    input {
        line-height: normal;
    }

    // Address inconsistent `text-transform` 
    // All other form control elements do not inherit `text-transform` values.
    // Correct `button` style inheritance in Chrome, Safari 5+, and IE 6+.
    // Correct `select` style inheritance in Firefox 4+ and Opera.

    button,
    select {
        text-transform: none;
    }


    // 1. Avoid the WebKit bug in Android 4.0.* 
    //   and `video` controls.
    // 2. Correct inability to style clickable `input` types in iOS.
    // 3. Improve usability and consistency of cursor style between image-type
    //   `input` and others.

    button,
    html input[type="button"], 
    input[type="reset"],
    input[type="submit"] {
        -webkit-appearance: button;
        cursor: pointer;
    }

    // Re-set default cursor for disabled elements.
    button[disabled],
    html input[disabled] {
        cursor: default;
    }


    // 1. Address box sizing set to content-box in IE 8/9.
    // 2. Remove excess padding in IE 8/9.
    // 3. Remove excess padding in IE 7.
    //    Known issue: excess padding remains in IE 6.

    input[type="checkbox"],
    input[type="radio"] {
        box-sizing: border-box;
        padding: 0;
    }

    // Remove inner padding and border in Firefox 3+.

    button::-moz-focus-inner,
    input::-moz-focus-inner {
        border: 0;
        padding: 0;
    }

    // 1. Remove default vertical scrollbar in IE 6/7/8/9.
    // 2. Improve readability and alignment in all browsers.

    textarea {
        overflow: auto;
        vertical-align: top;
    }

    // Remove most spacing between table cells.
    table {
        border-collapse: collapse;
        border-spacing: 0;
    }

}

.global-normalize() when (@support-html5 = true) {

    // Correct `block` display not defined in IE 6/7/8/9 and Firefox 3.
    article,
    aside,
    details,
    figcaption,
    figure,
    footer,
    header,
    hgroup,
    main,
    nav,
    section,
    summary {
        display: block;
    }

    // Correct `inline-block` display not defined in IE and Firefox 3.
    audio,
    canvas,
    video {
        display: inline-block;
    }

    // Prevent modern browsers from displaying `audio` without controls.
    // Remove excess height in iOS 5 devices.

    audio:not([controls]) {
        display: none;
        height: 0;
    }

    // Address styling not present in IE 7/8/9, Firefox 3, and Safari 4.
    // Known issue: no IE 6 support.

    [hidden] {
        display: none;
    }

    // Address styling not present in IE 6/7/8/9.
    mark {
        background: #FF0;
        color: @default-text-color;
    }

    // Address margin not present in IE 6/7/8/9, Safari 5, and Opera 11.

    figure {
        margin: 0;
    }

    // 1. Address `appearance` set to `searchfield` in Safari 5 and Chrome.
    // 2. Address `box-sizing` set to `border-box` in Safari 5 and Chrome
    //    (include `-moz` to future-proof).

    input[type="search"] {
        -webkit-appearance: textfield;
        box-sizing: content-box;
    }

    // Remove inner padding and search cancel button in Safari 5 and Chrome
    // on OS X.

    input[type="search"]::-webkit-search-cancel-button,
    input[type="search"]::-webkit-search-decoration {
        -webkit-appearance: none;
    }
}

.global-reset() {
    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,
    dl, dt, dd, ol, ul, li,
    fieldset, form, label, legend,
    table, caption, tbody, tfoot, thead, tr, th, td {
        .reset-box-model;
        .reset-focus;
        .reset-font;
    }
    body {
        .reset-body;
    }
    ol, ul {
        .reset-list-style;
    }
    table {
        .reset-table;
    }
    caption, th, td {
        .reset-table-cell;
    }
    a img {
        border: none;
    }
}

.nested-reset() {
    div, span, object, iframe, h1, h2, h3, h4, h5, h6, p,
    pre, a, abbr, acronym, address, code, del, dfn, em, img,
    dl, dt, dd, ol, ul, li, fieldset, form, label,
    legend, caption, tbody, tfoot, thead, tr {
        .reset-box-model;
        .reset-focus;
        .reset-font;
    }
    table {
        .reset-table;
    }
    caption, th, td {
        .reset-table-cell;
    }
    a img {
        border: none;
    }
}