// Name:              Base
//
// Description:       Amaze UI base style
//
// =============================================================================


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

/**
 * Fix the flawed CSS box model - Yes, IE6's box model is better
 * Browser support: IE8+
 * via: http://paulirish.com/2012/box-sizing-border-box-ftw/
 */

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


/* normalize.css v3.0.2 | git.io/normalize */

/* Set <html> and <body> to inherit the height of the viewport */

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


/**
 * 1. Prevent iOS text size adjust after orientation change, without disabling
 *    user zoom.
 *    https://developer.mozilla.org/en-US/docs/Web/CSS/text-size-adjust
 */

html {
  -ms-text-size-adjust: 100%;   /* 1 */
  -webkit-text-size-adjust: 100%;   /* 1 */
}


/**
 * Remove default margin.
 */

body {
  margin: 0;
}


/* HTML5 display definitions
   ========================================================================== */

/**
 * 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.
 * hgroup has been removed from the HTML5 (W3C) specification
 *        https://developer.mozilla.org/en-US/docs/Web/HTML/Element/hgroup
 */

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


/**
 * 1. Correct `inline-block` display not defined in IE 8/9.
 * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera.
 */

audio,
canvas,
progress,
video {
  display: inline-block; /* 1 */
  vertical-align: baseline; /* 2 */
}


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

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


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

[hidden],
template,
script {
  display: none;
}



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

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

a {
  background-color: transparent;
}


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

a:focus {
  outline: thin dotted;
}


/**
 * Improve readability when focused and also mouse hovered in all browsers.
 */

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



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

/**
 * Remove text-decoration
 */

ins, a {
  text-decoration: none;
}


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

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


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

b,
strong {
  font-weight: bold;
}


/**
 * Improve readability of pre-formatted text in all browsers.
 */

pre {
  white-space: pre-wrap;
}


/**
 * Set consistent quote types.
 */

q {
  quotes: "\201C" "\201D" "\2018" "\2019";
}


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


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

/**
  * 1. Corrects max-width behavior (2.) if padding and border are used
  * 2. Responsiveness: Sets a maxium width relative to the parent and auto scales the height
  * 3. Remove the gap between images and the bottom of their containers
  * 4. Remove border when inside `a` element in IE 8/9.
  * remove 2. for Issue #502
  */

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


/**
 * Correct overflow displayed oddly in IE 9.
 */

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



/* Grouping content
   ========================================================================== */


/**
 * Address margin not present in IE 8/9 and Safari.
 */

figure {
  margin: 0;
}


/**
 * Correct font family set oddly in Safari 5 and Chrome.
 */

code,
kbd,
pre,
samp {
  font-family: @font-family-monospace;
  font-size: 1em;
}


/* Forms
   ========================================================================== */

/**
 * Define consistent border, margin, and padding.
 */

fieldset {
  border: 1px solid #c0c0c0;
  margin: 0 2px;
  padding: 0.35em 0.625em 0.75em;
}


/**
 * 1. Correct `color` not being inherited in IE 8/9.
 * 2. Remove padding so people aren't caught out if they zero out fieldsets.
 */

legend {
  border: 0; /* 1 */
  padding: 0; /* 2 */
}


/**
 * 1. Correct color not being inherited.
 *    Known issue: affects color of disabled elements.
 * 2. Correct font properties not being inherited.
 * 3. Address margins set differently in Firefox 4+, Safari 5, and Chrome.
 */

button,
input,
optgroup,
select,
textarea {
  color: inherit; /* 1 */
  font: inherit; /* 2 */
  margin: 0; /* 3 */
}


/**
 * Address `overflow` set to `hidden` in IE 8/9/10/11.
 */

button {
  overflow: visible;
}


/**
 * Address Firefox 4+ setting `line-height` on `input` using `!important` in
 * the UA stylesheet.
 */

button,
input {
  line-height: normal;
}


/**
 * Address inconsistent `text-transform` inheritance for `button` and `select`.
 * All other form control elements do not inherit `text-transform` values.
 * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera.
 * Correct `select` style inheritance in Firefox.
 */

button,
select {
  text-transform: none;
}


/**
 * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
 *    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"], /* 1 */
input[type="reset"],
input[type="submit"] {
  -webkit-appearance: button; /* 2 */
  cursor: pointer; /* 3 */
}


/*
 * 1. Improves consistency of cursor style for clickable elements
 * 2. Removes excess padding in IE 8/9.
 * 3. Address box sizing set to `content-box` in IE 8/9/10.
 */

input[type="radio"],
input[type="checkbox"] {
  cursor: pointer; /*1*/
  padding: 0; /*2*/
  box-sizing: border-box; /* 3 */
}


/**
 * Re-set default cursor for disabled elements.
 */

button[disabled],
html input[disabled] {
  cursor: default;
}


/**
 * Remove inner padding and border in Firefox 4+.
 */

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



/**
 * Fix the cursor style for Chrome's increment/decrement buttons. For certain
 * `font-size` values of the `input`, it causes the cursor style of the
 * decrement button to change from `default` to `text`.
 */

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  height: auto;
}


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

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


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


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

textarea {
  overflow: auto; /* 1 */
  vertical-align: top; /* 2 */
  resize: vertical;
}

/**
 * Don't inherit the `font-weight` (applied by a rule above).
 * NOTE: the default cannot safely be changed in Chrome and Safari on OS X.
 */

optgroup {
  font-weight: bold;
}



/* Tables
   ========================================================================== */

/**
 * Remove most spacing between table cells.
 */

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

td,
th {
  padding: 0;
}



/* AMUI Base
   ========================================================================== */

/**
 * `font-size` is set in `html` element to support the `rem` unit for font-sizes
 * NOTE: IE9 & IE10 do not recognize `rem` units when used with the
   `font` shorthand property.
 */

html {
  // font-size: 62.5%; // set base font-size to 10px (16px * 62.5), 1rem = 10px
  font-size: 10px; // Firefox on Mac default font-size is 15px
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

body {
  position: relative;
  background: @base-background;
  font-family: @base-font-family;
  font-weight: @base-font-weight;
  line-height: @base-line-height;
  color: @base-text-color;
  font-size: @global-font-size;
  .hook-base-body;
}


/**
 * 1. http://usabilitypost.com/2012/11/15/w-optimizelegibility-on-mobile-devices/
 * 2. http://maxvoltar.com/archive/-webkit-font-smoothing
 * NOTE: http://usabilitypost.com/2012/11/05/stop-fixing-font-smoothing/
 * 3. http://maximilianhoffmann.com/posts/better-font-rendering-on-osx
 *    http://jaydenseric.com/blog/css-font-smoothing-for-firefox-mac
 */

body,
input,
textarea,
select,
button {
  text-rendering: optimizeLegibility;  /* 1 */
  -webkit-font-smoothing: antialiased; /* 2 */
  -moz-osx-font-smoothing: grayscale;  /* 3 Default: auto */
  -moz-font-feature-settings: "liga", "kern"
}


// Responsive font-size

@media @medium-up {
  body {
    //font-size: 1.4rem;
  }
}

/*Only phones */

@media @small-only {

  /**
   * Break strings if their length exceeds the width of their container
   */
  body {
    word-wrap: break-word;
    -webkit-hyphens: auto;
    -ms-hyphens: auto;
    -moz-hyphens: auto;
    hyphens: auto;
  }
}


/**
 * links
 */

a {
  color: @link-color;
  &:hover,
  &:focus {
    color: @link-hover-color;
    //text-decoration: underline;
  }

  &:focus {
    .tab-focus();
  }
}


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

/* Insert */
ins {
  background: @base-ins-background;
  color: @base-ins-color;
}


/**
 * Mark
 * Note: Addresses styling not present in IE 8/9.
 */
mark {
  background: @base-mark-background;
  color: @base-mark-color;
}


/**
 * Abbreviation and definition
 */
abbr[title],
dfn[title] {
  cursor: help;
}

dfn[title] {
  border-bottom: 1px dotted;
  font-style: normal;
}


/* Spacing for block elements */
p,
hr,
ul,
ol,
dl,
blockquote,
pre,
address,
fieldset,
figure {
  margin: 0 0 0 0;
}

* + p,
* + hr,
* + ul,
* + ol,
* + dl,
* + blockquote,
* + pre,
* + address,
* + fieldset,
* + figure {
  margin-top: 0;
}



/* Headings
   ========================================================================== */
h1,
h2,
h3,
h4,
h5,
h6 {
  //margin: 0;
  margin: 0 0 0 0;
  font-weight: @base-heading-font-weight;
  font-size: 100%;
}

h1 {
  font-size: 1.5em;
}

h2 {
  font-size: 1.25em;
}

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


// List
// ========================================================================

/* Ordered and unordered lists */
ul,
ol {
  padding-left: 0;
}

/* Reset margin for nested lists */
ul > li > ul,
ul > li > ol,
ol > li > ol,
ol > li > ul {
  margin: 0;
}


/* Description lists */
dt {
  font-weight: bold;
  & + dd {
    margin-top: .5em;
  }
}

dd {
  margin-left: 0;
  & + dt {
    margin-top: 1em;
  }
}


/**
 * Horizontal rule
 * 1. Address differences between Firefox and other browsers.
 */
hr {
  display: block;
  padding: 0;
  border: 0;
  height: 0;
  border-top: 1px solid @base-hr-border;
  -moz-box-sizing: content-box; /* 1 */
  box-sizing: content-box; /* 1 */
}


/* Address */
address {
  font-style: normal;
}


/* Quotes */
q,
blockquote {
  //font-style: italic;
}

blockquote {
  padding-top: 5px;
  padding-bottom: 5px;
  padding-left: 15px;
  border-left: 4px solid @base-blockquote-border;
  font-family: @font-family-kai;
  //font-size: @base-blockquote-font-size;
  //line-height: @base-blockquote-line-height;

  /* Small print for identifying the source */
  small {
    display: block;
    color: @base-blockquote-small-color;
    font-family: @font-family-sans-serif;
    text-align: right;
  }

  /* Smaller margin if `small` follows */
  p:last-of-type {
    margin-bottom: 0;
  }
}


/* iframe */
iframe {
  border: 0;
}



/* Forms
   ========================================================================== */

/**
  * Vertical alignment
  * Exclude `radio` and `checkbox` elements because the default `baseline` value aligns better with text
  */
button,
input:not([type="radio"]):not([type="checkbox"]),
select {
  vertical-align: middle;
}


/**
 * Fix viewport for IE10 snap mode
 * http://timkadlec.com/2012/10/ie10-snap-mode-and-responsive-design/
 * http://msdn.microsoft.com/en-us/library/ie/hh869615%28v=vs.85%29.aspx
 * http://msdn.microsoft.com/zh-cn/library/ie/hh708740(v=vs.85).aspx
 * @2014.01.20: 设置一下属性以后，windows Phone 8 上显示的字体过小，暂时注释掉
 * ========================================================================== */
/*
@-ms-viewport {
  width: device-width;
}
*/


// Scrollbar measure help class
.@{ns}scrollbar-measure {
  width: 100px;
  height: 100px;
  overflow: scroll;
  position: absolute;
  top: -9999px;
}

// Base Hooks

.hook-base-body() {}
