@media screen {
    // This is a hack such that when we link to a fragment on a page, the page
    // scrolls correctly in relation to the fixed header. Without this hack, the
    // page scrolls with the fragment at the top of the page, below the header!
    h2[id]:before, h3[id]:before, h4[id]:before, h5[id]:before, h6[id]:before {
          display: block;
          content: ' ';
          margin-top: -1.8em;
          height: 1.8em;
          visibility: hidden;
    }

    html {
        overflow-y: scroll;
        position: relative;
        min-height: 100%;
    }

    body {
        padding-top: $headerHeight;
        margin-bottom: calc(#{$footerHeight} + 3rem);
        font-family: "Roboto", "Helvetica Neue", Helvetica, Arial, sans-serif;
        color: $textColor;
        background-color: $backgroundColor;
    }
}

a {
    color: $linkColor;
    text-decoration: none;
    font-weight: $linkWeight;
}

a:hover, a:focus {
    color: $linkHoverColor;
    text-decoration: underline;
    font-weight: $linkWeight;
}

a.disabled {
    color: $linkDisabledColor;
    text-decoration: none;
    font-weight: $linkWeight;
}

a.active {
    color: $linkActiveColor;
    text-decoration: none;
    font-weight: $linkWeight;
}

table, th, td, tr {
    padding: .5em;
}

table {
    margin-left: 1em;
    margin-right: 1em;
}

table p:first-of-type {
    margin-top: 0
}

table p:last-of-type {
    margin-bottom: 0
}

th {
    color: $textBrandColor;
    background-color: $secondBrandColor;
    font-weight: $tableHeaderWeight;
}

tr.oneof>td {
    border-bottom: 1px dashed $dividerBarColor;
    border-top: 1px dashed $dividerBarColor;
}

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

th, td {
    border-left: 1px solid $boxBorderColor;
    border-top: 1px solid $boxBorderColor;
}

tr:first-child th:first-child {
    border-radius: 4px 0 0 0;
}

tr:first-child td:first-child {
    border-radius: 4px 0 0 0;
}

tr:first-child th:last-child {
    border-radius: 0 4px 0 0;
}

tr:first-child td:last-child {
    border-radius: 0 4px 0 0;
}

tr:last-child td {
    border-bottom: 1px solid $boxBorderColor;
}

tr:last-child td:first-child {
    border-radius: 0 0 0 4px;
}

tr:last-child td:last-child {
    border-radius: 0 0 4px 0;
}

tr th:last-child {
    border-right: 1px solid $boxBorderColor;
}

tr td:last-child {
    border-right: 1px solid $boxBorderColor;
}

thead+tbody tr:first-child td:first-child {
    border-radius: 0;
}

thead+tbody tr:first-child td:last-child {
    border-radius: 0;
}

code {
    color: $textCodeColor;
    font-size: 80%;
    font-weight: $textCodeWeight;
    word-break: normal;
}

pre {
    margin: 1em;
    max-height: 31em;
    border: 1px solid $preBlockBorderColor;
    border-left: 5px solid $preBlockBorderColor;
    border-radius: 4px;
    box-shadow: 3px 3px 8px $preBlockShadowColor;
	font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
	text-align: left;
	white-space: pre;
	word-spacing: normal;
	word-break: normal;
	word-wrap: normal;
	line-height: 1.5;
	tab-size: 4;
	hyphens: none;
	background: $preBlockBackgroundColor;

    code {
        display: block;
        color: $textColor;
        padding: .5em;
    }

    code.command-output {
        padding: 0;

        .command {
            padding: .5em .5em 0 .5em;
        }

        .output {
            color: $preBlockCommandOutputTextColor;
            background-color: $preBlockCommandOutputBackgroundColor;
            font-style: italic;
            padding: 0 .5em .5em .5em;
        }

        // if the output div is empty, we need extra padding
        div:only-of-type {
            padding: .5em;
        }
    }

    @media print {
        max-height: unset;
    }
}

// this is necessary in order for proper positioning of the Copy button
div.copy {
    position: relative;
}

button.copy {
    font-size: .8em;
    padding: 0 .5em;
    border-radius: .3em;
    background-color: $secondBrandColor;
    cursor: pointer;
    color: $textBrandColor;
    text-decoration: none;
    border: 0;

    position: absolute;
    top: 3px;
    right: 1.3em;
    z-index: 5;
}

button.copy-hide {
    transition: opacity .4s ease-in-out;
    opacity: 0;
}

button.copy-show {
    transition: opacity 1.2s ease-in-out;
    opacity: 1;
}

p {
    font-size: $font-size--xs;
    font-weight: $textWeight;
    line-height: 1.5;
    margin: .25em 0;

    @media (min-width: $bp-md) {
        margin: 1.5em 0;
    }
}

li, dt, dd {
    font-size: $font-size--xs;
    font-weight: $textWeight;
    line-height: 1.5;
    margin: .25em;
}

ol, ul, dl {
    list-style: initial;
    font-size: $font-size--primary;
    font-weight: $textWeight;
    margin: 0 0 0 1.5em;
    padding: 0;
}

li p, dt p, dd p {
    margin: .4em 0;
}

ol {
    list-style: decimal;
}

h1, h2, h3, h4, h5, h6 {
    border: 0;
}

h1 {
    font-size: $font-size--xxl;
    color: $h1Color;
    font-weight: $h1Weight;
    margin: 30px 0;
}

h2 {
    font-size: $font-size--xl;
    color: $h2Color;
    font-weight: $h2Weight;
    margin-bottom: 20px;
    margin-top: 30px;
    padding-bottom: 10px;
    border-bottom: 1px solid $h2UnderlineColor;
}

h3 {
    font-size: $font-size--l;
    color: $h3Color;
    font-weight: $h3Weight;
    letter-spacing: 1px;
    margin-bottom: 20px;
    margin-top: 30px;
}

h4 {
    font-size: $font-size--l;
    color: $h4Color;
    font-weight: $h4Weight;
    margin: 30px 0 20px;

    // Text immediately following h4 should have same level of indention
    + p {
        margin: 5px 0;

        @media (min-width: $bp-md) {
            margin: 10px 0;
        }
    }
}

h5 {
    font-size: $font-size--s;
    color: $h5Color;
    font-weight: $h5Weight;
}

h6 {
    font-size: .9rem;
    color: $h6Color;
    font-weight: $h6Weight;
}

.header-link {
    position: relative;
    left: 0.5em;
    top: -.1em;
    opacity: 0;
    font-size: 0.6em;
}

h2:hover .header-link,
h3:hover .header-link,
h4:hover .header-link,
h5:hover .header-link,
h6:hover .header-link,
dt:hover .header-link {
    transition: opacity .4s ease-in-out;
    opacity: 1;
}

@media print {
    .header-link {
        display: none;
    }
}

em {
    font-style: italic;
}

strong {
    font-weight: $boldTextWeight;
}

img {
    width: 100%;
}

blockquote {
    display: block;
    margin: 1em 3em;
    padding-left: 1em;
    padding-right: 1em;
    background-color: $blockQuoteBackgroundColor;
    border-radius: 4px 4px 4px 4px;
}

.spacer {
    height: .1rem;

    @media (min-width: $bp-md) {
        height: 1rem;
    }
}

.deprecated {
    background: $deprecatedBackgroundColor;
}

.card {
    background-color: $backgroundColor;
    border-color: $dividerBarColor;
}

.card-header {
    border-bottom-color: $dividerBarColor;
}

#scroll-to-top {
    display: none;
    position: fixed;
    top: $headerHeight;
    right: 10px;
    z-index: 99;
    outline: none;
    background-color: rgba($backgroundColor, .7);
    color: $floatingButtonColor;
    cursor: pointer;
    padding: 3px 5px;
    border-radius: 10px;
    font-size: 1rem;
    border: 0;
    box-shadow: 0 0 2px 2px $floatingButtonColor;

    &:hover {
        color: $textBrandHighlightColor;
    }
}

@media screen {
    .endnote-ref {
        display: none;
    }
}

@media print {
    // Soak up space used up by the TOC when printing
    .col-md-9, .col-lg-7, .col-xl-8 {
        max-width: 83.2%;
        flex: 0 0 83.2%;
    }

    // Soak up space used up by the TOC when printing
    .col-12 {
        max-width: 100%;
        flex: 0 0 100%;
    }

    h1, h2, h3 {
        color: #000;
        background: none;
        page-break-after: avoid;
    }

    img {
        max-width: 100% !important;
    }

    pre, blockquote, img {
        page-break-inside: avoid;
    }
}
