html {
    margin: 0 auto;
    max-width: 960px;
    background-color: var(--background-color-html);
    box-shadow: 0 0 0.5em var(--background-color-html-shadow);
    color: var(--text-color);
    overscroll-behavior: none;
}

body {
    font-family: var(--font-system);
    font-weight: normal;
    background-color: var(--background-color);
    padding: var(--body-padding-tb) var(--body-padding-lr);
    padding-bottom: 0;
    /* make room for navigation */
    padding-top: calc(var(--body-padding-tb) + 5em);
}

a, a:hover {
    color: var(--link-color);
}

h1 {
    font-size: 3.5em;
    position: relative;
    left: -5px;
    font-weight: lighter;
}

h2, h3, h4, p {
    margin-bottom: 1em;
}

h2 {
    margin-top: 1em;
    font-size: 1.5em;
    font-weight: lighter;
}

h3 {
    margin-top: 1em;
    font-size: 1.2em;
}

h4 {
    font-size: 1em;
}

ul {
    padding-left: 2em;
    margin-top: 0.5em;
}

ul ul {
    margin-top: 0;
}

dl {
    padding-left: 0;
}

dt {
    margin: 0.5em 0;
}

dt::before {
    content: "";
    border-left: 3px solid var(--base-color);
    margin: 0 calc(1em - 3px) 0 0;
}

dd {
    margin-left: 1em;
    margin-bottom: 1em;
}

hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: -0.5em 0 1em 0;
    width: 100%;
}

section {
    position: relative;
}

a.section-anchor {
    color: inherit;
    display: none;
    position: absolute;
    left: -1.5em;
    padding-left: 0.6em;
    font-size: 120%;
    top: 0;
    padding-top: 0.2em;
    width: 1.5em;
    height: 3em;
    opacity: 0.4;
}

section:hover > a.section-anchor {
    display: inline;
}

section:hover > a.section-anchor:hover {
    opacity: 1;
    color: var(--link-color);
}

blockquote {
    border-left: 10px solid var(--base-color-tint-light);
    margin: 1.5em 0 1em 0.5em;
    padding: 0.5em 10px;
    quotes: "\201C""\201D""\2018""\2019";
    color: var(--text-color-mute);
    font-size: 90%;
}

cite {
    display: block;
    margin: 0 0 1em 0.5em;
}

table {
    margin-bottom: 1em;
}

/* page header and navigation */

header {
    margin-bottom: 1.5em;
    text-align: left;
}

nav {
    position: fixed;
    border: none;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    padding: 3em 0 0 0;
    /* make content scroll underneath it */
    background-color: var(--background-color);
    z-index: 1;
    box-shadow: 0 1em 1em var(--background-color);
    clip-path: inset(0px 0 -2em 0);
}

nav ol {
    display: flex;
    margin: 0 var(--body-padding-lr);
    list-style-type: none;
    padding: 0.7em 0;

    border-bottom: 1px solid black;
}

nav ol a {
    text-decoration: none;
    color: inherit;
}

nav ol a:hover {
    text-decoration: underline;
    color: inherit;
}

nav ol a[aria-current],
nav ol a[aria-current]:hover {
    font-weight: bold;
    text-decoration: none;
}

nav ol li {
    display: inline;
}

nav ol li::before {
    content: "";
    border-left: 1px solid black;
    margin: 0 0.4em;
}

nav ol li:first-child::before {
    display:none;
}

nav ol li.nav-right {
    margin-left: auto;
}

nav ol li.nav-right::before {
    display: none;
}

/* responsive nav menu and other content on smaller screens */

@media screen and (max-width: 600px) {

    body {
        padding-top: var(--body-padding-tb);
    }

    h1 {
        font-size: 3em;
    }

    nav[popover] {
        top: 4em;
        right: 1em;
        padding-top: 1em;
        background-color: color-mix(in srgb, var(--background-color) 90%, transparent);
    }

    button[popovertarget] {
        position: absolute;
        top: 0;
        right: 0.5em;
        padding: 0.5em;
        font-size: 2em;
        background: none;
        color: inherit;
        border: none;
    }

    nav ol {
        flex-direction: column;
    }

    nav ol li {
        text-align: right;
        font-size: 1.4em;
    }

    nav ol li::before {
        border-left: none;
        margin: 0;
    }

    nav ol li.nav-right {
        margin-left: 0;
    }
}

@media screen and (min-width: 601px) {
    nav[popover] {
        display: block;
    }

    button[popovertarget] {
        display: none;
    }
}

/* (hidden) skip to content link */

a.skip-to-content {
  /* from https://www.a11y-collective.com/blog/skip-to-main-content/ */
  position: absolute;
  left: -9999px;
  z-index: 999;
  padding: 1em;
  background-color: black;
  color: white;
  opacity: 0;
}

a.skip-to-content:focus {
  left: 50%;
  transform: translateX(-50%);
  opacity: 1;
}

main[id] {
    /* take sticky header into account when scrolling via skip content */
    scroll-margin-top: 8em;
}

/* code examples */

code {
    color: var(--code-text-color);
    background-color: var(--code-text-color-bg);
    overflow-wrap: break-word;
    font-family: var(--font-system-code);
    font-size: var(--font-system-code-size);
}

x-code-viewer {
    border: 1px solid var(--border-color);
    margin: 1em 0 1.5em 0;
    min-height: 6em;
    max-height: 30em;
}

x-tab-panel {
    border: 1px solid var(--border-color);
    margin: 1em 0 1.5em 0;
    min-height: 8em;
}

x-tab-panel x-code-viewer {
    border: none;
    margin: 0;
}

iframe {
    display: block;
    width: 100%;
    margin: 1em 0;
}

/* asides */

aside {
    position: relative;
    background-color: var(--background-color-mute);
    text-align: left;
    margin: 3em 0 3em calc(var(--body-padding-lr) * -1);
    padding: 3em 2em 3em var(--body-padding-lr);
}

aside.aside-mirror {
    margin: 3em calc(var(--body-padding-lr) * -1) 3em 0;
    padding: 3em var(--body-padding-lr) 3em 2em;
    text-align: right;
}

aside h2, aside h3, aside h4 {
    margin: 0;
}

aside p {
    margin: 1em 0 0.5em 0;
}

aside x-code-viewer {
    margin: 1em 0;
}

/* page footer */

footer {
    margin: 4em calc(var(--body-padding-lr) * -1);
    padding: 3em var(--body-padding-lr);
    margin-bottom: 0;
    background-color: var(--background-color-invert);
    color: var(--text-color-invert);
    text-align: right;
}

footer .top-link {
    margin-top: 1.5em;
    font-size: 0.9em;
}

footer a {
    color: inherit;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
    color: inherit;
}

footer .contact a::before {
    font-size: 0.9em;
    content: "";
    border-left: 1px solid var(--text-color-invert);
    margin: 0 0.4em 0 0.2em;
}

footer .contact a:first-child::before {
    display:none;
}

/* utilities */

.hero-text {
    font-size: 1.2em;
    line-height: 1.9em;
    margin-bottom: 1.8em;
}

a.button {
    display: inline-block;
    font-size: 1.1em;
    color: var(--base-color-shade-darker);
    background-color: var(--base-color);
    margin-top: 0.5em;
    padding: 0.5em 3em;
    border-radius: 5px;
    box-shadow: 0.1em 0.1em 0.2em -0.1em var(--background-color-html);
    text-decoration: none;
}

a.button:hover {
    background-color: var(--base-color-tint-light);
}