/* Source: https://www.joshwcomeau.com/css/custom-css-reset/ */
/* 1. Use a more-intuitive box-sizing model */
*, *::before, *::after {
    box-sizing: border-box;
}

/* 2. Remove default margin */
* {
    margin: 0;
}

/* 3. Enable keyword animations */
@media (prefers-reduced-motion: no-preference) {
    html {
        interpolate-size: allow-keywords;
    }
}

body {
    /* 4. Add accessible line-height */
    line-height: 1.5;
    /* 5. Improve text rendering */
    -webkit-font-smoothing: antialiased;
}

/* 6. Improve media defaults */
img, picture, video, canvas, svg {
    display: block;
    max-width: 100%;
}

/* 7. Inherit fonts for form controls */
input, button, textarea, select {
    font: inherit;
}

/* 8. Avoid text overflows */
p, h1, h2, h3, h4, h5, h6 {
    overflow-wrap: break-word;
}

/* 9. Improve line wrapping */
p {
    text-wrap: pretty;
}

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

/* Begin custom CSS */

body {
    font-family: sans-serif;
    color: black;
}

body, table caption {
    background-color: white;
}

a {
    color: #005;
}

a:visited {
    color: #505;
}

main, form, table {
    background-color: #f5f5ff;
    margin: 0.5rem auto;
}

main, form {
    border-radius: 1rem;
    max-width: 51rem;
    padding: 1rem;
}

header {
    display: grid;
    grid-template-columns: 8fr 1fr;
}

h1 {
    padding: 0;
    margin: 1px 0 0;
    text-box-trim: trim-both;
    text-box-edge: cap alphabetic;
}

header img {
    justify-self: end;
}

p {
    margin: 0.7rem 0 0;
}

form {
    display: grid;
    gap: 0.7rem;

    @media (width >= 720px) {
        grid-template-columns: 1fr 1fr;
    }
}

.form-group {
    display: grid;
}

button, input, select {
    background-color: white;
    color: black;
    border: 2px solid #7f7f7f;
    border-radius: 0.3rem;
}

input, select {
    height: 1.5rem;
}

input::selection {
    background-color: #bdf;
    color: black;
}

select:disabled {
    opacity: 1;
    color: #778;
    border-color: #bbb;
}

[type=reset] {
    justify-self: end;
}

table {
    display: block;
    border-collapse: collapse;
    max-width: fit-content;
    padding: 0;
    overflow-x: scroll;
    scrollbar-color: #e5e5f5 white;
}

table caption {
    font-weight: bold;
    padding: 0.25rem;
    text-align: left;
    white-space: nowrap;
}

thead th {
    background-color: #e5e5f5;
    position: sticky;
    text-align: left;
    top: 0;
    z-index: 10;
}

th, td {
    border: 1px solid #7f7f7f;
    padding: 0.5rem;
    vertical-align: top;
}

td ul {
    padding-left: 1rem;
}

td.num {
    text-align: right;
}

button:hover,
select:hover,
tr:hover {
    background-color: #ececfc;
}

#not-found main {
    max-width: max-content;
}

#not-found h1 {
    text-align: center;
    margin: 0;
}

#not-found img {
    position: fixed;
    top: 50%;
    left: 50%;
    margin-top: -350px;
    margin-left: -700px;
    max-width: none;
    z-index: -1;
}

.fine-print {
    font-size: 80%;
}

@media only screen and (prefers-color-scheme: dark) {
    body, table caption {
        background-color: black;
        color: white;
    }

    a {
        color: #aaf;
    }

    a:visited {
        color: #faf;
    }

    main, form, table {
        background-color: #223;
    }

    table {
        scrollbar-color: #7f7f7f black;
    }

    thead th {
        background-color: #001;
    }

    button, input, select {
        background-color: black;
        color: white;
    }

    input::selection {
        background-color: royalblue;
        color: white;
    }

    select:disabled {
        color: #99a;
        border-color: #778;
    }

    button:hover,
    select:hover,
    tr:hover {
        background-color: #112;
    }
}
