/* ==========================================================================
   Typography
   ========================================================================== */

/**
 * Note: This sets the <html> element's font-size to 62.5%, which
 * equals 10px (for default browser font size of 16px).
 * This allows rem units to be calculated more intuitively.
 *
 * Font size strategy
 * - <html> element font size set as a percentage so that font sizes are accessible
 *   if the user resizes the text size in their browser.
 * - Font size set on the <body> tag is a rem. A direct relation to the HTML element.
 * - Font sizes for components should be rem. For example, the font size of the navigation
 *   should be set as a rem. The relation is to the <html> tag, which by default is 10px.
 * - Font sizes of elements within a component should be em to be relative to the component.
 *   For example, a navigation link within the navigation menu would be set to an em font size,
 *   which would then be in relation to the navigation component (assuming that a font size in rem
 *   was set on the navigation item).
 *
 * References that influenced this approach:
 * https://css-tricks.com/rem-global-em-local/
 * http://clagnut.com/blog/2384/
 */

/* General
   ========================================================================== */

/**
 * Set the base font size to be a percentage so that it's more accessible to browser text zooming
 * 62.5% = 10px = 1rem
 */

html {
    font-size: 62.5%;
}

/**
 * Set body defaults for other elements to inherit
 */

body {
    color: var(--base-typography-color, #333);
    font-family: var(--base-typography-font-family);
    font-size: var(--base-typography-font-size, 1.8rem);
    font-weight: var(--base-typography-font-weight, 400);
    letter-spacing: var(--base-typography-letter-spacing);
    line-height: var(--base-typography-line-height, 1.6);
}

/**
 * Consistent spacing on block elements
 */

address,
blockquote,
dl,
figure,
hr,
ol,
p,
ul {
    margin: 0 0 var(--base-typography-spacing, 2.5rem);
}

/**
 * Blockquote
 */

blockquote {
    border-left: 10px solid #ccc;
    margin: var(--base-typography-spacing, 2.5rem) calc(var(--base-typography-spacing, 2.5rem) * 0.7);
    padding: 0.5em 1em;
    position: relative;
}

blockquote p:first-child {
    margin-top: 0;
}

blockquote p:last-child {
    margin-bottom: 0;
}

/**
 * Links
 */

a {
    color: var(--base-typography-link-color, #00e);
    font-weight: var(--base-typography-link-font-weight);
    text-decoration: var(--base-typography-link-text-decoration, underline);
    transition: all 250ms;
}

a:hover {
    color: var(--base-typography-link-color-hover, #0000cd);
    text-decoration: var(--base-typography-link-text-decoration-hover, underline);
}

/**
 * Default styling for telephone links to not look like links
 */
a[href^='tel'],
a[href^='tel']:active,
a[href^='tel']:focus,
a[href^='tel']:hover {
    color: inherit;
    text-decoration: none;
}

/**
 * Lists
 */

ol,
ul {
    padding: var(--base-typography-list-padding, 0 0 0 2.4em);
    text-align: var(--base-typography-list-text-align, left);
}

li {
    margin: var(--base-typography-list-item-margin, 0);
    padding: var(--base-typography-list-item-padding, 0);
}

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

dt {
    font-weight: 700;
}

dd {
    margin: 0;
}

/**
 * Inline abbreviations
 */

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

/**
 * Reset browser default
 */

address {
    font-style: normal;
}

/**
 * 1. Remove default hr shading.
 * 2. Inherit text or parent border color.
 */

hr {
    border-style: solid; /* 1 */
    border-width: var(--base-typography-hrule-width, 1px) 0 0 0;
    color: inherit; /* 2 */
}

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

h1,
.h1,
.h1 * {
    color: var(--base-typography-h1-color, #333);
    font-family: var(--base-typography-h1-font-family);
    font-size: var(--base-typography-h1-font-size-sm, 3.2rem);
    font-style: var(--base-typography-h1-font-style);
    font-weight: var(--base-typography-h1-font-weight);
    letter-spacing: var(--base-typography-h1-letter-spacing);
    line-height: var(--base-typography-h1-line-height, 1.6);
    margin: var(--base-typography-h1-margin, 2.5rem 0 1.25rem);
    text-align: var(--base-typography-h1-text-align);
    text-decoration: var(--base-typography-h1-text-decoration);
    text-shadow: var(--base-typograpy-h1-text-shadow);
    text-transform: var(--base-typography-h1-text-transform);
}

h2,
.h2,
.h2 * {
    color: var(--base-typography-h2-color, #333);
    font-family: var(--base-typography-h2-font-family);
    font-size: var(--base-typography-h2-font-size-sm, 2.8rem);
    font-style: var(--base-typography-h2-font-style);
    font-weight: var(--base-typography-h2-font-weight);
    letter-spacing: var(--base-typography-h2-letter-spacing);
    line-height: var(--base-typography-h2-line-height, 1.6);
    margin: var(--base-typography-h2-margin, 2.5rem 0 1.25rem);
    text-align: var(--base-typography-h2-text-align);
    text-decoration: var(--base-typography-h2-text-decoration);
    text-transform: var(--base-typography-h2-text-transform);
}

h3,
.h3,
.h3 * {
    color: var(--base-typography-h3-color, #333);
    font-family: var(--base-typography-h3-font-family);
    font-size: var(--base-typography-h3-font-size-sm, 2.4rem);
    font-style: var(--base-typography-h3-font-style);
    font-weight: var(--base-typography-h3-font-weight);
    letter-spacing: var(--base-typography-h3-letter-spacing);
    line-height: var(--base-typography-h3-line-height, 1.6);
    margin: var(--base-typography-h3-margin, 2.5rem 0 1.25rem);
    text-align: var(--base-typography-h3-text-align);
    text-decoration: var(--base-typography-h3-text-decoration);
    text-transform: var(--base-typography-h3-text-transform);
}

h4,
.h4,
.h4 * {
    color: var(--base-typography-h4-color, #333);
    font-family: var(--base-typography-h4-font-family);
    font-size: var(--base-typography-h4-font-size-sm, 2rem);
    font-style: var(--base-typography-h4-font-style);
    font-weight: var(--base-typography-h4-font-weight);
    letter-spacing: var(--base-typography-h4-letter-spacing);
    line-height: var(--base-typography-h4-line-height, 1.6);
    margin: var(--base-typography-h4-margin, 2.5rem 0 1.25rem);
    text-align: var(--base-typography-h4-text-align);
    text-decoration: var(--base-typography-h4-text-decoration);
    text-transform: var(--base-typography-h4-text-transform);
}

h5,
.h5,
.h5 * {
    color: var(--base-typography-h5-color, #333);
    font-family: var(--base-typography-h5-font-family);
    font-size: var(--base-typography-h5-font-size-sm, 1.8rem);
    font-style: var(--base-typography-h5-font-style);
    font-weight: var(--base-typography-h5-font-weight);
    letter-spacing: var(--base-typography-h5-letter-spacing);
    line-height: var(--base-typography-h5-line-height, 1.6);
    margin: var(--base-typography-h5-margin, 2.5rem 0 1.25rem);
    text-align: var(--base-typography-h5-text-align);
    text-decoration: var(--base-typography-h5-text-decoration);
    text-transform: var(--base-typography-h5-text-transform);
}

h6,
.h6,
.h6 * {
    color: var(--base-typography-h6-color, #333);
    font-family: var(--base-typography-h6-font-family);
    font-size: var(--base-typography-h6-font-size-sm, 1.8rem);
    font-style: var(--base-typography-h6-font-style);
    font-weight: var(--base-typography-h6-font-weight);
    letter-spacing: var(--base-typography-h6-letter-spacing);
    line-height: var(--base-typography-h6-line-height, 1.6);
    margin: var(--base-typography-h6-margin, 2.5rem 0 1.25rem);
    text-align: var(--base-typography-h6-text-align);
    text-decoration: var(--base-typography-h6-text-decoration);
    text-transform: var(--base-typography-h6-text-transform);
}

h1:first-child,
h2:first-child,
h3:first-child,
h4:first-child,
h5:first-child,
h6:first-child {
    margin-top: 0;
}

@media (--m-sm) {
    h1,
    .h1 {
        font-size: var(--base-typography-h1-font-size, 3.6rem);
    }

    h2,
    .h2 {
        font-size: var(--base-typography-h2-font-size, 3.2rem);
    }

    h3,
    .h3 {
        font-size: var(--base-typography-h3-font-size, 2.8rem);
    }

    h4,
    .h4 {
        font-size: var(--base-typography-h4-font-size, 2.4rem);
    }

    h5,
    .h5 {
        font-size: var(--base-typography-h5-font-size, 2rem);
    }

    h6,
    .h6 {
        font-size: var(--base-typography-h6-font-size, 1.8rem);
    }
}
