:root {
    --color-text: #333;
    --color-accent: rgb(249, 64, 131);

    --bg-gray: rgb(245, 245, 247);
    --bg-dark: rgb(80, 80, 95);
    --bg-red: rgba(249, 64, 131, 0.05);

    --border-dark: rgba(0, 0, 0, .15);
    --border-light: rgba(255, 255, 255, .15);

    --highlight-red: rgba(249, 64, 131, 0.17);
    --highlight-green: rgba(36, 230, 13, 0.25);
    --highlight-blue: rgba(64, 199, 249, 0.25);
    --highlight-violet: rgba(179, 14, 255, 0.16);

    --max-width: 38rem;
    --sidebar-width: 350px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: IBM Plex Sans, system-ui, -apple-system;
    font-size: 18px;
    line-height: 1.5rem;
    font-weight: 400;
    hyphens: auto;
    color: var(--color-text);
}

.text-wrapper {
    position: relative;
    max-width: var(--max-width);
    padding: .75rem 1.5rem;
    text-align: justify;
}

h1, h2, h3 {
    margin-top: 3rem;
    font-weight: 500;
    line-height: 1.2;
    text-align: left;
}

ul {
    list-style-type: square;
}

ul li {
    margin-bottom: .375em;
}

main {
    margin-top: 4rem;
    margin-left: var(--sidebar-width);
}

a {
    color: inherit;
}

pre {
    padding: .75rem;
    background-color: var(--bg-gray);
    border-radius: 3px;
    font-family: IBM Plex Mono, monospace;
    font-size: .85rem;
    max-height: 500px;
    overflow: auto;
}

code {
    background-color: var(--bg-gray);
    padding: .25em;
    border-radius: 2px;
    font-family: IBM Plex Mono, monospace;
}

kbd {
    font-family: inherit;
    border: 1px solid rgba(0, 0, 0, .15);
    background-color: var(--bg-gray);
    padding: 0 .5em;
    border-radius: 3px;
    box-shadow: 1px 1px 0 rgba(0, 0, 0, .15);
}

.highlight {
    display: inline-block;
    background-color: rgba(0, 0, 0, .15);
    padding: .25rem;
    line-height: 1;
    border-radius: 5px;
    font-weight: 500;
}

pre .highlight {
    font-weight: bold;
}

.highlight + .highlight {
    margin-left: .5em;
}

.highlight-red {
    background-color: var(--highlight-red);
}

.highlight-blue {
    background-color: var(--highlight-blue);
}

.highlight-green {
    background-color: var(--highlight-green);
}

.highlight-violet {
    background-color: var(--highlight-violet);
}

.highlight-line {
    background-color: transparent;
    border: 1px solid rgba(0, 0, 0, .15);
}

.sidebar {
    position: fixed;
    top: 0;
    width: var(--sidebar-width);
    height: 100%;
}

.page-title, .site-title {
    z-index: 100;
    top: 0;
    padding: 1.25rem;
    font-weight: bold;
}

.site-title, .sidebar {
    background-color: var(--bg-dark);
    color: white;
}

.page-title {
    position: fixed;
    left: var(--sidebar-width);
    right: 0;
    background-color: white;
    border-bottom: 1px solid var(--border-dark);
}

.site-title {
    border-bottom: 1px solid var(--border-light);
}

footer {
    display: flex;
    margin-left: var(--sidebar-width);
    padding: 1.25em;
    border-top: 1px solid var(--border-dark);
}

footer .prev,
footer .next {
    width: 50%;
}

footer .prev a,
footer .next a {
    text-decoration: none;
}

footer .next {
    text-align: right;
}

footer .prev a::before {
    content: '← ';
}

footer .next a::after {
    content: ' →';
}

nav {
    padding: .5rem 1.25rem;
}

nav ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

nav li {
    padding: .125rem 0;
}

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

nav .active::before {
    content: '—';
    display: inline-block;
    width: 1.5em;
    margin-left: -1.5em;
    color: var(--color-accent);
}

.caps {
    margin-top: .75em;
    text-transform: uppercase;
    font-weight: bold;
    letter-spacing: .1em;
    font-size: .8em;
    opacity: .8;
}

body {
    counter-reset: footnote;
}

.footnote {
    position: absolute;
    right: 0;
    transform: translateX(100%);
    width: 250px;
    margin-top: -.75rem;
    padding: 1rem .75rem;
    font-size: .75em;
    line-height: 1rem;
    text-align: left;
}

.footnote::before {
    display: inline-block;
    width: 1em;
    margin-left: -1em;
    content: counter(footnote);
    color: var(--color-accent);
}

.footnote-ref::after {
    counter-increment: footnote;
    content: counter(footnote);
    color: var(--color-accent);
    vertical-align: text-bottom;
    font-size: .75rem;
}

figure {
    display: flex;
    margin: 0;
    padding: 2rem 1.5rem;
    background-color: var(--bg-red);
}

figure > img {
    max-width: var(--max-width);
}

figure > figcaption {
    max-width: 250px;
    align-self: center;
    margin-left: 3rem;
    font-size: .75rem;
    line-height: 1rem;
}

figure > figcaption::before {
    content: '←';
    display: inline-block;
    width: 1.5em;
    margin-left: -1.5em;
    color: var(--color-accent);
}

.example {
    display: flex;
    margin: 1.5rem 0;
    background-color: var(--bg-gray);
    overflow: hidden;
}

.example:last-child {
    margin-bottom: 0;
}

.example-panel {
    position: relative;
    flex-grow: 1;
    padding: .75rem 1.5rem;
    margin: -1px;
    background-color: var(--bg-gray);
    border: 1px solid var(--border-dark);
}

.example-label {
    margin-bottom: .75rem;
}

.example-input {
    display: flex;
    flex-direction: column;
    width: 66%;
    flex-grow: 1;
}

.example-output {
    width: 34%;
    flex-shrink: 0;
}

.example-code {
    height: 250px;
}

.example-code-large {
    height: 600px;
}

.example-code > textarea,
.example-output > iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;

    box-sizing: border-box;
    padding: 1.5rem;
    padding-top: 2.75rem;
    border: none;
}

.example-code > textarea {
    display: block;
    min-height: 250px;

    font-size: .85rem;
    line-height: 1.5;
    font-family: IBM Plex Mono, monospace;

    background: none;
    color: var(--color-text);
    resize: none;
    white-space: pre;
}

.example-code > textarea:focus {
    outline: none;
}
