@font-face {
    font-family: 'Gentium Book Plus';
    font-style: normal;
    font-weight: normal;
    src: url('/fonts/gentium/gentiumbookplus-regular.woff2') format('woff2');
}

@font-face {
    font-family: 'Gentium Book Plus';
    font-style: italic;
    font-weight: normal;
    src: url('/fonts/gentium/gentiumbookplus-italic.woff2') format('woff2');
}

@font-face {
    font-family: 'Gentium Book Plus';
    font-style: normal;
    font-weight: bold;
    src: url('/fonts/gentium/gentiumbookplus-bold.woff2') format('woff2');
}

@font-face {
    font-family: 'Gentium Book Plus';
    font-style: italic;
    font-weight: bold;
    src: url('/fonts/gentium/gentiumbookplus-bold-italic.woff2') format('woff2');
}

@font-face {
    font-family: 'JetBrains Mono';
    font-style: normal;
    src: url('/fonts/JetBrainsMono.ttf');
}


:root {
    font-family: 'Gentium Book Plus';
    font-size: 24px;
    line-height: 1.7;

    --primary: #FF6B81;
    --secondary: #B3394B;
    --tertiary: #FF875E;
    --complementary: #39B396;
    --comment: #803641;

    --pale: #FEF9F4;
    --dark: #E8D9D1;

    --gray: #69625E;
    --yellow: #FFDF78;
    --lightblue: #36C3C9;
}


@media (max-width: 600px) {
    :root {
        font-size: 20px
    }
}



.primary {
    color: var(--primary);
}

.secondary {
    color: var(--secondary);
}

.tertiary {
    color: var(--tertiary);
}

.complementary {
    color: var(--complementary);
}

.comment {
    color: var(--comment);
    font-weight: bold;
}



html, body {
    padding: 0;
    margin: 0;
    height: 100%;

    overflow: unset;
}


/* Restrict the main content to be 80 characters wide, as narrower columns are widely easier to read. */
main {
    margin: auto;
    max-width: min(80ch, 90vw);
}

body > header {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    padding: 0 1em;
}


/* Hyphenate words automatically */
p {
    hyphens: auto;
    text-align: justify;
}


p#noscript {
    text-align: center;
}

p#noscript span {
    background-color: var(--pale);
    border: 3px red dashed;
    padding: 1ch 2ch;
}


h1, h2, h3, h4, h5, h6 {
    text-wrap: balance;
    text-align: center;
}

hgroup, p, h1, h2, h3, h4, h5, h6 {
    margin: 1em 0 1em 0;
}

hgroup :is(p, h1) {
    text-align: center;
    margin: 0;
}

hgroup h1 + p {
    filter: contrast(20%);
}



/* Adding a border of 1px at the bottom makes them visually a little thicker. */
hr {
    color: var(--dark);
    border-bottom: 1px solid var(--dark);
}



/* "computery text" should have a monospace font. Smaller font size to match the other one visually */
code, samp, output, kbd {
    font-family: 'JetBrains Mono';
    font-size: 0.8em;
}

pre {
    overflow-x: scroll;
}

pre, :not(pre) > code {
    border: 2px solid var(--dark);
    background-color: var(--pale);

    padding: 0.15ch 0.3ch;
    border-radius: 5px;
}

.codesample {
    border: 2px solid var(--primary);
    background-color: var(--pale);
    overflow-x: auto;
    border-radius: 3px;
}

.codesample pre {
    border: unset;
    margin: 5px 5px 0 5px;
}

.codesample .caption {
    display: inline;
    user-select: none;

    position: sticky;
    left: 0;

    color: white;
    background-color: var(--primary);

    padding: 6px 10px;
    border-bottom-right-radius: 5px;
}

a, a:visited {
    color: inherit;
    position: relative;

    text-decoration: dotted underline var(--primary) 0.1em;
}

/* for external links, add an arrow indicator.
 * This adds the underlining to the ::after too, but it is preferable to
 * the previous hacky method that I was using. */
a[rel~=external]::after {
    color: inherit;
    font-weight: bold;
    font-size: 50%;
    content: "↗";
    vertical-align: text-top;
}

em {
    font-style: normal;
}

em::before, em::after {
    content: "*";
}

nav {
    display: flex;
    justify-content: center;
}

nav > * {
    margin: 10px;
}

aside {
    border: 1px solid var(--secondary);
    border-left: 4px solid var(--secondary);

    background-color: var(--pale);

    padding: 0 2ch 0 2ch;
}


/* By making them inline we can treat them as text, i.e. horizontal */
nav#breadcrumbs,
nav#breadcrumbs :is(ol, li) {
    display: inline;

    margin: 0;
    padding: 0;
}

/* Remove the special colours */
nav#breadcrumbs li:last-of-type a {
    color: black;
}

/* add slashes between entries */
nav#breadcrumbs li:not(:last-of-type)::after {
    content: "/";
    margin-left: 5px;
}



footer {
    color: var(--gray);

    width: 90vw;
    margin: auto;

    margin-top: 2em;
    height: 3em;

    font-size: 0.75em;

    display: flex;
    justify-content: center;
    align-items: center;

    border-top: 1px solid var(--dark);
}



table {
    margin: auto;

    border-collapse: collapse;
}

table, td, th {
    border: 1px solid var(--dark);
    padding: 0.5ch 1ch;
}

tbody tr {
    color: var(--gray);
}

tr:nth-child(2n) {
    background-color: var(--pale);
}

table thead {
    background-color: var(--dark);
}

.wiggle {
    animation: wiggle 1.5s alternate infinite ease-in-out;
}

@keyframes wiggle {
    to {
        transform: translateY(10px);
    }
}

/* please release me from this prison oh `sibling-index`. why must i keep doing this?? */
.wiggle:nth-child(2) { animation-delay: 100ms; }
.wiggle:nth-child(3) { animation-delay: 200ms; }
.wiggle:nth-child(4) { animation-delay: 300ms; }
.wiggle:nth-child(5) { animation-delay: 400ms; }
.wiggle:nth-child(6) { animation-delay: 500ms; }
.wiggle:nth-child(7) { animation-delay: 600ms; }
.wiggle:nth-child(8) { animation-delay: 700ms; }
.wiggle:nth-child(9) { animation-delay: 800ms; }
.wiggle:nth-child(10) { animation-delay: 900ms; }
.wiggle:nth-child(11) { animation-delay: 1000ms; }
.wiggle:nth-child(12) { animation-delay: 1100ms; }
.wiggle:nth-child(13) { animation-delay: 1200ms; }
