/* Buttons
/* ---------------------------------------------------------- */

/* Base button style */
/* Should only be applied to <a> tags */
.gh-btn {
    display: inline-block;
    outline: none;
    border: 1px solid color-mod(var(--lightgrey) l(-5%) s(-10%));
    color: color-mod(var(--lightgrey) l(-27%) blackness(+15%));
    text-shadow: 0 1px 0 #fff;
    text-decoration: none !important;
    user-select: none;
    fill: color-mod(var(--lightgrey) l(-27%) blackness(+15%));
    border-radius: 5px;
    transition: all 0.2s ease;
    transition-property: color, border-color, background, width, height;

    -webkit-font-smoothing: subpixel-antialiased;
}

/* ALL buttons must have a span for content */
.gh-btn span {
    display: block;
    overflow: hidden;
    padding: 0 12px;
    height: 33px;
    font-size: 1.3rem;
    line-height: 33px;
    font-weight: 400;
    text-align: center;
    letter-spacing: 0.2px;
    border-radius: 4px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.gh-btn:hover {
    border-color: color-mod(var(--lightgrey) l(-15%) s(-10%));
}

/* When disabled */
.gh-btn.disabled,
.gh-btn[disabled],
fieldset[disabled] .gh-btn {
    box-shadow: none;
    opacity: 0.8;
    cursor: not-allowed;
    pointer-events: none;
}

.gh-btn svg {
    display: inline-block;
}

/* Button highlights
/* ---------------------------------------------------------- */

.gh-btn-hover-blue:hover {
    border-color: var(--blue);
    color: var(--blue);
}

.gh-btn-hover-green:hover {
    border-color: var(--green);
    color: var(--green);
}

.gh-btn-hover-red:hover {
    border-color: var(--red);
    color: var(--red);
}


/* Grey button - First so that other colors will override
/* ---------------------------------------------------------- */

/* The background of the button creates 1px gradient border */
.gh-btn-grey {
    padding: 1px;
    border: 0;
    color: color-mod(var(--darkgrey) l(+15%));
    text-shadow: 0 1px 0 #fff;
    fill: var(--darkgrey);
    background: linear-gradient(
    color-mod(var(--lightgrey) l(-3%)),
    color-mod(var(--lightgrey) l(-8%))
    );
    box-shadow: 0 1px 0 rgba(0,0,0,0.05);
    transition: none !important;
}

/* The background of the span is the main visual element */
.gh-btn-grey span {
    background: linear-gradient(
    color-mod(var(--lightgrey) l(+10%)),
    color-mod(var(--lightgrey) l(+4%))
    );
    box-shadow: 0 1px 0 #fff inset;
}

/* When clicked or focused with keyboard */
.gh-btn-grey:active,
.gh-btn-grey:focus {
    background: color-mod(var(--midgrey) l(+25%));
}
.gh-btn-grey:active span,
.gh-btn-grey:focus span {
    background: color-mod(var(--lightgrey) l(+15%));
    box-shadow: none;
}


/* Blue button
/* ---------------------------------------------------------- */

/* The background of the button creates 1px gradient border */
.gh-btn-blue {
    padding: 1px;
    border: 0;
    color: #fff;
    text-shadow: 0 -1px 0 rgba(0,0,0,0.1);
    fill: #fff;
    background: linear-gradient(
    color-mod(var(--blue) blackness(+10%)),
    color-mod(var(--blue) l(-15%) saturation(-15%))
    );
    box-shadow: 0 1px 0 rgba(0,0,0,0.12);
    transition: none !important;
}

/* The background of the span is the main visual element */
.gh-btn-blue span {
    background: linear-gradient(
    color-mod(var(--blue) whiteness(+5%)),
    color-mod(var(--blue) l(-5%) saturation(-8%)) 60%,
    color-mod(var(--blue) l(-5%) saturation(-8%)) 90%,
    color-mod(var(--blue) l(-3%) saturation(-8%))
    );
    box-shadow: 0 1px 0 rgba(255,255,255,0.1) inset;
}

/* When clicked or focused with keyboard */
.gh-btn-blue:active,
.gh-btn-blue:focus {
    background: color-mod(var(--blue) l(-20%) saturation(-15%));
}
.gh-btn-blue:active span,
.gh-btn-blue:focus span {
    background: color-mod(var(--blue) l(-7%) saturation(-10%));
    box-shadow: none;
}

/* Green button
/* ---------------------------------------------------------- */

/* The background of the button creates 1px gradient border */
.gh-btn-green {
    padding: 1px;
    border: 0;
    color: #fff;
    text-shadow: 0 -1px 0 rgba(0,0,0,0.1);
    fill: #fff;
    background: linear-gradient(
    color-mod(var(--green) blackness(+5%)),
    color-mod(var(--green) l(-9%) saturation(-9%))
    );
    box-shadow: 0 1px 1px rgba(0,0,0,0.14);
    transition: none !important;
}

/* The background of the span is the main visual element */
.gh-btn-green span {
    background: linear-gradient(
    color-mod(var(--green) whiteness(+4%)),
    color-mod(var(--green) l(-3%) saturation(-7%)) 60%,
    color-mod(var(--green) l(-3%) saturation(-7%)) 90%,
    color-mod(var(--green) l(-3%) saturation(-9%))
    );
    box-shadow: 0 1px 0 rgba(255,255,255,0.1) inset;
}

/* When clicked or focused with keyboard */
.gh-btn-green:active,
.gh-btn-green:focus {
    background: color-mod(var(--green) l(-9%) saturation(-9%));
}
.gh-btn-green:active span,
.gh-btn-green:focus span {
    background: color-mod(var(--green) l(-3%) saturation(-7%));
    box-shadow: none;
}


/* Red button
/* ---------------------------------------------------------- */

/* The background of the button creates 1px gradient border */
.gh-btn-red {
    padding: 1px;
    border: 0;
    color: #fff;
    text-shadow: 0 -1px 0 rgba(0,0,0,0.1);
    fill: #fff;
    background: linear-gradient(
    color-mod(var(--red) blackness(+10%)),
    color-mod(var(--red) l(-15%) saturation(-15%))
    );
    box-shadow: 0 1px 0 rgba(0,0,0,0.12);
    transition: none !important;
}

/* The background of the span is the main visual element */
.gh-btn-red span {
    background: linear-gradient(
    color-mod(var(--red) whiteness(+7%)),
    color-mod(var(--red) l(-7%) saturation(-10%)) 60%,
    color-mod(var(--red) l(-7%) saturation(-10%)) 90%,
    color-mod(var(--red) l(-4%) saturation(-10%))
    );
    box-shadow: 0 1px 0 rgba(255,255,255,0.1) inset;
}

/* When clicked or focused with keyboard */
.gh-btn-red:active,
.gh-btn-red:focus {
    background: color-mod(var(--red) l(-20%) saturation(-15%));
}
.gh-btn-red:active span,
.gh-btn-red:focus span {
    background: color-mod(var(--red) l(-7%) saturation(-10%));
    box-shadow: none;
}

/* Black button
/* ---------------------------------------------------------- */

/* The background of the button creates 1px gradient border */
.gh-btn-black {
    padding: 1px;
    border: 0;
    color: #fff;
    text-shadow: 0 -1px 0 rgba(0,0,0,0.1);
    fill: #fff;
    background: linear-gradient(
    color-mod(var(--darkgrey) blackness(+10%)),
    color-mod(var(--darkgrey) l(-15%) saturation(-15%))
    );
    box-shadow: 0 1px 0 rgba(0,0,0,0.12);
    transition: none !important;
}

/* The background of the span is the main visual element */
.gh-btn-black span {
    background: linear-gradient(
    color-mod(var(--darkgrey) whiteness(+7%)),
    color-mod(var(--darkgrey) l(-7%) saturation(-10%)) 60%,
    color-mod(var(--darkgrey) l(-7%) saturation(-10%)) 90%,
    color-mod(var(--darkgrey) l(-4%) saturation(-10%))
    );
    box-shadow: 0 1px 0 rgba(255,255,255,0.1) inset;
}

/* When clicked or focused with keyboard */
.gh-btn-black:active,
.gh-btn-black:focus {
    background: color-mod(var(--darkgrey) l(-20%) saturation(-15%));
}
.gh-btn-black:active span,
.gh-btn-black:focus span {
    background: color-mod(var(--darkgrey) l(-7%) saturation(-10%));
    box-shadow: none;
}


/* Special Buttons
/* ---------------------------------------------------------- */

.gh-btn-white {
    background: #fff;
}

.gh-btn-white span {
    height: 38px;
}

.gh-btn-block {
    display: block;
    width: 100%;
}

.gh-btn-icon span {
    display: flex;
    align-items: center;
    justify-content: center;
}

.gh-btn-icon svg,
.gh-btn-block svg {
    width: 1em;
    height: 1em;
    margin-right: 0.5em;
    fill: #fff;
}

.gh-btn-icon svg.gh-spinner {
    left: 5px;
}

.gh-btn-icon svg.gh-spinner rect {
    fill: color-mod(var(--midgrey) l(+15%));
}

.gh-btn-icon-right svg,
svg.gh-btn-icon-right {
    margin-left: 0.5em;
    margin-right: 0;
}

.gh-btn-icon svg path {
    stroke: #fff;
}

.gh-btn-icon-no-margin {
    margin: 0;
}


/*
/* Button Variations
/* ---------------------------------------------------------- */

.gh-btn-block {
    display: block;
    width: 100%;
}

/* Vertically space out multiple block buttons */
.gh-btn-block + .gh-btn-block {
    margin-top: 5px;
}

/* Specificity overrides */
input[type="submit"].gh-btn-block,
input[type="reset"].gh-btn-block,
input[type="button"].gh-btn-block {
    width: 100%;
}


/*
/* Button Groups
/* ---------------------------------------------------------- */
/*

Usage: CTA buttons grouped together horizontally.

<div class="gh-btn-group">
    <a class="gh-btn gh-btn-green" href="#"><span>Button 1</span></a>
    <a class="gh-btn gh-btn-white" href="#"><span>Button 2</span></a>
</div>

*/

.gh-btn-group .gh-btn {
    margin-left: 15px;
}

.gh-btn-group .gh-btn:first-of-type {
    margin-left: 0;
}

.gh-btn-block + .gh-btn-block {
    margin-top: 5px;
}

.gh-btn-link {
    border: none;
}


/* Spin Buttons!
/* ---------------------------------------------------------- */
.spinner {
    position: relative;
    display: inline-block;
    box-sizing: border-box;
    margin: -2px 0;
    width: 14px;
    height: 14px;
    border: rgba(0,0,0,0.2) solid 4px;
    border-radius: 100px;
    animation: spin 1s linear infinite;
}

.spinner:before {
    content: "";
    display: block;
    margin-top: 6px;
    width: 4px;
    height: 4px;
    background: rgba(0,0,0,0.6);
    border-radius: 100px;
}
