// Name:            Base
// Description:     Sets default values for HTML elements
//
// Component:       `uk-h1`, `uk-h2`, `uk-h3`, `uk-h4`, `uk-h5`, `uk-h6`
//                  `uk-link`
//                  `uk-img-preserve`
//
// ========================================================================


// Variables
// ========================================================================

@base-body-background:                          @global-background;
@base-body-dark-background:                     @global-dark-background;
@base-body-font-family:                         -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;
@base-body-font-weight:                         normal;
@base-body-font-size:                           @global-font-size;
@base-body-line-height:                         @global-line-height;
@base-body-color:                               @global-color;
@base-body-dark-color:                          @global-dark-color;

@base-link-color:                               @global-link-color;
@base-link-text-decoration:                     none;
@base-link-hover-color:                         @global-link-hover-color;
@base-link-hover-text-decoration:               none;

@base-code-color:                               @global-danger-background;
@base-code-font-size:                           12px;
@base-code-font-family:                         Menlo,Monaco,Droid Sans Mono,Ubuntu Mono,Consolas,source-code-pro,monospace;
@base-code-border:                              @global-border;
@base-code-dark-border:                         fade(@global-dark-border, 60%);
@base-code-border-radius:                       @global-border-radius;
@base-code-padding:                             @global-margin-mini;

@base-em-color:                                 @global-primary-background;
@base-ins-background:                           #ffa;
@base-ins-color:                                @global-color;
@base-mark-background:                          #ffa;
@base-mark-color:                               @global-color;
@base-quote-font-style:                         italic;
@base-margin-vertical:                          @global-margin;

@base-heading-text-transform:                   none;
@base-heading-font-weight:                      500;
@base-heading-color:                            #474747;
@base-heading-dark-color:                       #ebebeb;
@base-heading-margin-top:                       0;
@base-h1-font-size:                             40px;
@base-h1-line-height:                           56px;
@base-h2-font-size:                             32px;
@base-h2-line-height:                           48px;
@base-h3-font-size:                             24px;
@base-h3-line-height:                           40px;
@base-h4-font-size:                             18px;
@base-h4-line-height:                           32px;
@base-h5-font-size:                             16px;
@base-h5-line-height:                           24px;
@base-h6-font-size:                             14px;
@base-h6-line-height:                           20px;

@base-list-padding-left:                        @global-margin-large;

@base-hr-margin-vertical:                       @global-margin;
@base-hr-border:                                @global-border;
@base-hr-dark-border:                           @global-dark-border;

@base-blockquote-padding-left:                  @global-margin;
@base-blockquote-border:                        #ddd;
@base-blockquote-border-width:                  5px;
@base-blockquote-font-size:                     16px;
@base-blockquote-line-height:                   22px;
@base-blockquote-font-style:                    italic;

@base-pre-padding:                              @global-margin-small;
@base-pre-color:                                @global-color;
@base-pre-background:                           @global-default-active-background;
@base-pre-font-size:                            12px;
@base-pre-line-height:                          18px;
@base-pre-font-family:                          @base-code-font-family;
@base-pre-border:                               @global-border;
@base-pre-dark-border:                          @base-code-dark-border;
@base-pre-border-radius:                        @global-border-radius;

@base-selection-background:                     #39f;
@base-selection-color:                          #fff;


/* ========================================================================
   Component: Base
 ========================================================================== */

/*
 * 1. Normalize default `font-family` and set `font-size` to support `rem` units
 * 2. Prevents iOS text size adjust after orientation change, without disabling user zoom
 */

html {
    /* 1 */
    font: @base-body-font-weight @base-body-font-size e("/") @base-body-line-height @base-body-font-family;
    /* 2 */
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

/*
 * Removes default margin.
 */

body {
    margin: 0;
    /* Style */
    background: @base-body-background;
    color: @base-body-color;
    .hook-base-body;
}


/*
 * Removes tap highlight on some browsers
 */
button, a {
    -webkit-tap-highlight-color: transparent;
}

/* Links
 ========================================================================== */

/*
 * Remove the gray background color from active links in IE 10.
 */

a { background: transparent; }

/*
 * Improve readability of focused elements when they are also in an active/hover state.
 */

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

/*
 * Style
 */

a,
.uk-link {
    color: @base-link-color;
    text-decoration: @base-link-text-decoration;
    cursor: pointer;
    .hook-base-link;
}

.uk-notouch {
    a:hover,
    .uk-link:hover {
        color: @base-link-hover-color;
        text-decoration: @base-link-hover-text-decoration;
        .hook-base-link-hover;
    }
}

/* Text-level semantics
 ========================================================================== */

/*
 * Address styling not present in IE 8/9/10/11, Safari, and Chrome.
 */

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

/*
 * Address style set to `bolder` in Firefox 4+, Safari, and Chrome.
 */

b,
strong { font-weight: 500; }

/*
 * 1. Address odd `em`-unit font size rendering in all browsers.
 * 2. Consolas has a better baseline in running text compared to `Courier`
 */

:not(pre) > code,
:not(pre) > kbd,
:not(pre) > samp {
    /* 1 */
    font-size: @base-code-font-size;
    /* 2 */
    font-family: @base-code-font-family;
    /* 3 */
    color: @base-code-color;
    border: 1px solid @base-code-border;
    border-radius: @base-code-border-radius;
    padding: 0 @base-code-padding;

    .dark & {
        border-color: @base-code-dark-border;
    }

    .hook-base-code;
}

/*
 * Emphasize
 */

em { color: @base-em-color; }

/*
 * Insert
 */

ins {
    background: @base-ins-background;
    color: @base-ins-color;
    text-decoration: none;
}

/*
 * Mark
 * Note: Addresses styling not present in IE 8/9.
 */

mark {
    background: @base-mark-background;
    color: @base-mark-color;
}

/*
 * Quote
 */

q { font-style: @base-quote-font-style; }

/*
 * Addresses inconsistent and variable font size in all browsers.
 */

small { font-size: 80%; }

/*
 * Prevents `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; }


/* Embedded content
 ========================================================================== */

/*
 * Remove the gap between audio, canvas, iframes, images, videos and the bottom of their containers.
 */

audio,
canvas,
iframe,
img,
svg,
video { vertical-align: middle; }

/*
 * 1. Responsiveness: Sets a maximum width relative to the parent and auto scales the height
 * 2. Corrects `max-width` behavior if padding and border are used
 * 3. Remove border when inside `a` element in IE 8/9/10.
 */

img {
    /* 1 */
    max-width: 100%;
    height: auto;
    /* 2 */
    box-sizing: border-box;
    /* 3 */
    border: 0;
}

/*
 * Preserve original image dimensions
 */

.uk-img-preserve,
.uk-img-preserve img { max-width: none; }

/*
 * Correct overflow not hidden in IE 9/10/11.
 */

svg:not(:root) { overflow: hidden; }


/* Block elements
 ========================================================================== */

/*
 * Reset margin
 */

blockquote,
figure { margin: 0; }

/*
 * Margins
 */

p,
ol,
blockquote,
pre,
address,
fieldset,
figure { margin-bottom: @base-margin-vertical; }

* + p,
* + ul,
* + dt,
* + ol,
* + blockquote,
* + pre,
* + address,
* + fieldset,
* + figure { margin-top: @base-margin-vertical; }


/* Headings
 ========================================================================== */

h1, h2, h3, h4, h5, h6 {
    margin: 0;
    text-transform: @base-heading-text-transform;
    color: @base-heading-color;
    font-weight: @base-heading-font-weight;

    .dark & {
        color: @base-heading-dark-color;
    }
}

/*
 * Margins
 */

* + h1,
* + h2,
* + h3,
* + h4,
* + h5,
* + h6 {margin-top: @base-heading-margin-top; }

/*
 * Sizes
 */

h1, .uk-h1 {
    font-size: @base-h1-font-size;
    line-height: @base-h1-line-height;
}

h2, .uk-h2 {
    font-size: @base-h2-font-size;
    line-height: @base-h2-line-height;
}

h3, .uk-h3 {
    font-size: @base-h3-font-size;
    line-height: @base-h3-line-height;
}

h4, .uk-h4 {
    font-size: @base-h4-font-size;
    line-height: @base-h4-line-height;
}

h5, .uk-h5 {
    font-size: @base-h5-font-size;
    line-height: @base-h5-line-height;
}

h6, .uk-h6 {
    font-size: @base-h6-font-size;
    line-height: @base-h6-line-height;
}


/* Lists
 ========================================================================== */

ul,
ol { padding-left: @base-list-padding-left; }

/*
 * Reset margin for nested lists
 */

ul > li > ul,
ul > li > ol,
ol > li > ol,
ol > li > ul { margin: 0; }


/* Description lists
 ========================================================================== */

dt { font-weight: 500; }
dd { margin-left: 0; }


/* Horizontal rules
 ========================================================================== */

/*
 * 1. Address differences between Firefox and other browsers.
 * 2. Style
 */

hr {
    /* 1 */
    box-sizing: content-box;
    height: 0;
    /* 2 */
    margin: @base-hr-margin-vertical 0;
    border: 0;
    border-top: 1px solid @base-hr-border;

    .dark & {
        border-color: @base-hr-dark-border;
    }
}


/* Address
 ========================================================================== */

address { font-style: normal; }


/* Blockquotes
 ========================================================================== */

blockquote {
    padding-left: @base-blockquote-padding-left;
    border-left: @base-blockquote-border-width solid @base-blockquote-border;
    font-size: @base-blockquote-font-size;
    line-height: @base-blockquote-line-height;
    font-style: @base-blockquote-font-style;
    .hook-base-blockquote;
}


/* Preformatted text
 ========================================================================== */

/*
 * 1. Contain overflow in all browsers.
 */

pre {
    font: @base-pre-font-size e("/") @base-pre-line-height @base-pre-font-family;
    color: @base-pre-color;
    background: @base-pre-background;
    padding: @base-pre-padding;
    border: 1px solid @base-pre-border;
    border-radius: @base-pre-border-radius;
    -moz-tab-size: 4;
    tab-size: 4;
    /* 1 */
    overflow: auto;

    .dark & {
        border-color: @base-pre-dark-border;
    }
    .hook-base-pre;
}

pre > code {
    font: inherit;
}


/* Selection pseudo-element
 ========================================================================== */

::-moz-selection {
    background: @base-selection-background;
    color: @base-selection-color;
    text-shadow: none;
}

::selection {
    background: @base-selection-background;
    color: @base-selection-color;
    text-shadow: none;
}


/* HTML5 elements
 ========================================================================== */

/*
 * Correct `block` display not defined for any HTML5 element in IE 8/9.
 * Correct `block` display not defined for `details` or `summary` in IE 10/11 and Firefox.
 * Correct `block` display not defined for `main` in IE 11.
 */

article,
aside,
details,
figcaption,
figure,
footer,
header,
main,
nav,
section,
summary { display: block; }

/*
 * Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera.
 */

progress { vertical-align: baseline; }

/*
 * Prevent displaying `audio` without controls in Chrome, Safari and Opera
 */

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

/*
 * Address `[hidden]` styling not present in IE 8/9/10.
 * Hide the `template` element in IE 8/9/10/11, Safari, and Firefox < 22.
 */

[hidden],
template { display: none; }


/* Iframe
 ========================================================================== */

iframe { border: 0; }


/* Fix viewport for IE10 snap mode
 ========================================================================== */

@media screen and (max-width: 400px) {
    @-ms-viewport{
        width: device-width;
    }
}


// Hooks
// ========================================================================

.hook-base-body() {
    .dark & {
        color: @base-body-dark-color;
        background: @base-body-dark-background;
    }
}
.hook-base-link() {}
.hook-base-link-hover() {}
.hook-base-code() {
    white-space: normal;       /* css-3 */
    word-wrap: break-word;     /* Internet Explorer 5.5+ */
}
.hook-base-blockquote() {}
.hook-base-pre() {
    white-space: pre-wrap;       /* css-3 */
    word-wrap: break-word;       /* Internet Explorer 5.5+ */
}