@import url("https://fonts.cdnfonts.com/css/jetbrains-mono-2");

:root {
    --font-family: "JetBrains Mono", monospace;
    --font-weight-normal: 500;
    --font-weight-medium: 600;
    --font-weight-bold: 800;

    --line-height: 1.2rem;
    --border-thickness: 2px;

    --text-color: #000;
    --text-color-alt: #666;
    --background-color: #fff;
    --background-color-alt: #eee;
    --box-shadow-color: #ccc;
    --body-border-color: #888;
    --thead-background: var(--background-color-alt);

    font-family: var(--font-family);
    font-optical-sizing: auto;
    font-weight: var(--font-weight-normal);
    font-style: normal;
    font-variant-numeric: tabular-nums lining-nums;
    font-size: 14px;
}

/* @media (prefers-color-scheme: dark) {
    :root {
        --text-color: #fff;
        --text-color-alt: #aaa;
        --background-color: #000;
        --background-color-alt: #111;
    }

    table thead {
        background-color: transparent !important;
    }
} */

* {
    box-sizing: border-box;
}

* + * {
    margin-top: var(--line-height);
}

html {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    margin: 0;
    padding: 0;
    background: var(--background-color-alt);
    color: var(--text-color);
}

body {
    position: relative;
    width: 100%;
    min-height: 100svh;
    margin: 2rem 0;
    padding: 0.5rem 1rem 0.25rem;
    max-width: 60rem;
    line-height: var(--line-height);
    overflow-x: hidden;
    box-shadow: 2px 2px var(--box-shadow-color);
    border: 1px solid var(--body-border-color);
    background: var(--background-color);

    display: flex;
    flex-direction: column;
}

body::-webkit-scrollbar {
    display: none;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin: 0;
}

article {
    margin: 0;
}

time {
    margin-top: 0;
    margin-bottom: 0.5em;
}

footer {
    margin-top: var(--line-height);
}

small {
    font-size: 80%;
    text-transform: uppercase;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: var(--font-weight-bold);
    margin-top: 0;
    margin-bottom: 0.5em;
    line-height: var(--line-height);
}

h1 {
    font-size: 2rem;
    line-height: calc(2 * var(--line-height));
    text-transform: uppercase;
}

h2 {
    font-size: 1rem;
    text-transform: uppercase;
}

hr {
    overflow: visible;
    height: 1px;
    margin: 0.5rem 0 0.5rem;
    color: var(--text-color);
    border: none;
    border-top: 1px dashed var(--text-color);
}

hr.solid {
    border-top: none;
    border-bottom: 1px solid var(--text-color);
}

nav {
    margin: 0;
}

a {
    text-decoration-thickness: var(--border-thickness);
}

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

p {
    margin-bottom: var(--line-height);
}

strong {
    font-weight: var(--font-weight-bold);
}
em {
    font-style: italic;
}

sub {
    position: relative;
    display: inline-block;
    margin: 0;
    vertical-align: sub;
    line-height: 0;
    width: calc(1ch / 0.75);
    font-size: 0.75rem;
}

table {
    table-layout: auto;
    position: relative;
    top: calc(var(--line-height) / 2);
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 calc(var(--line-height) * 2);
}

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

th,
td {
    border: var(--border-thickness) solid var(--text-color);
    padding: calc((var(--line-height) / 2)) calc(1ch - var(--border-thickness) / 2)
        calc((var(--line-height) / 2) - (var(--border-thickness)));
    line-height: var(--line-height);
    vertical-align: top;
    text-align: left;
}

table tbody tr:first-child > * {
    padding-top: calc((var(--line-height) / 2) - var(--border-thickness));
}

th {
    font-weight: 700;
}

.w-0 {
    width: 0%;
}

p {
    word-break: break-word;
    word-wrap: break-word;
    hyphens: auto;
}

img,
video {
    display: block;
    object-fit: scale-down;
    overflow: hidden;
    border: var(--border-thickness) solid var(--text-color);
    max-height: 100vh;
}

img {
    font-style: italic;
    color: var(--text-color-alt);
}

details {
    border: var(--border-thickness) solid var(--text-color);
    padding: calc(var(--line-height) - var(--border-thickness)) 1ch;
    margin-bottom: var(--line-height);
}

summary {
    font-weight: var(--font-weight-medium);
    cursor: pointer;
}
details[open] summary {
    margin-bottom: var(--line-height);
}

details ::marker {
    display: inline-block;
    content: "▶";
    margin: 0;
}
details[open] ::marker {
    content: "▼";
}

details :last-child {
    margin-bottom: 0;
}

pre {
    white-space: pre;
    overflow-x: auto;
    margin: var(--line-height) 0;
    overflow-y: hidden;
    padding: 1ch;
    background: var(--background-color-alt);
    border: 1px solid var(--text-color);
}

figure pre {
    margin: 0;
}

pre,
code {
    font-family: var(--font-family);
}

code {
    font-weight: var(--font-weight-medium);
    background: var(--background-color-alt);
}

pre > code {
    font-weight: var(--font-weight-normal);
    background: none;
}

figure {
    margin: calc(var(--line-height) * 2) 0;
    overflow-x: auto;
    overflow-y: hidden;
}

figcaption {
    display: block;
    font-style: italic;
    margin-top: var(--line-height);
}

ul,
ol {
    padding: 0;
    margin: 0 0 var(--line-height);
}

ul {
    list-style-type: square;
    padding: 0 0 0 2ch;
}
ol {
    list-style-type: none;
    counter-reset: item;
    padding: 0;
}
ol ul,
ol ol,
ul ol,
ul ul {
    padding: 0 0 0 3ch;
    margin: 0;
}
ol li:before {
    content: counters(item, ".") ". ";
    counter-increment: item;
    font-weight: var(--font-weight-medium);
}

li {
    margin: 0;
    padding: 0;
}

li::marker {
    line-height: 0;
}

input,
button,
textarea {
    border: var(--border-thickness) solid var(--text-color);
    padding: calc(var(--line-height) / 2 - var(--border-thickness))
        calc(1ch - var(--border-thickness));
    margin: 0;
    font: inherit;
    font-weight: inherit;
    height: calc(var(--line-height) * 2);
    width: auto;
    overflow: visible;
    background: var(--background-color);
    color: var(--text-color);
    line-height: normal;
    -webkit-font-smoothing: inherit;
    -moz-osx-font-smoothing: inherit;
    appearance: none;
    -webkit-appearance: none;
}

input[type="checkbox"],
input[type="radio"] {
    display: inline-grid;
    place-content: center;
    vertical-align: top;
    width: 2ch;
    height: var(--line-height);
    cursor: pointer;
}
input[type="checkbox"]:checked:before,
input[type="radio"]:checked:before {
    content: "";
    width: 1ch;
    height: calc(var(--line-height) / 2);
    background: var(--text-color);
}
input[type="radio"],
input[type="radio"]:before {
    border-radius: 100%;
}

button:focus,
input:focus {
    --border-thickness: 3px;
    outline: none;
}

input {
    width: calc(round(down, 100%, 1ch));
}
::placeholder {
    color: var(--text-color-alt);
    opacity: 1;
}
::-ms-input-placeholder {
    color: var(--text-color-alt);
}
button::-moz-focus-inner {
    padding: 0;
    border: 0;
}

button {
    text-transform: uppercase;
    font-weight: var(--font-weight-medium);
    cursor: pointer;
}

button:hover {
    background: var(--background-color-alt);
}
button:active {
    transform: translate(2px, 2px);
}

label {
    display: block;
    width: calc(round(down, 100%, 1ch));
    height: auto;
    line-height: var(--line-height);
    font-weight: var(--font-weight-medium);
    margin: 0;
}

label input {
    width: 100%;
}

.tree,
.tree ul {
    position: relative;
    padding-left: 0;
    list-style-type: none;
    line-height: var(--line-height);
}
.tree ul {
    margin: 0;
}
.tree ul li {
    position: relative;
    padding-left: 1.5ch;
    margin-left: 1.5ch;
    border-left: var(--border-thickness) solid var(--text-color);
}
.tree ul li:before {
    position: absolute;
    display: block;
    top: calc(var(--line-height) / 2);
    left: 0;
    content: "";
    width: 1ch;
    border-bottom: var(--border-thickness) solid var(--text-color);
}
.tree ul li:last-child {
    border-left: none;
}
.tree ul li:last-child:after {
    position: absolute;
    display: block;
    top: 0;
    left: 0;
    content: "";
    height: calc(var(--line-height) / 2);
    border-left: var(--border-thickness) solid var(--text-color);
}

.grid {
    --grid-cells: 0;
    display: flex;
    gap: 1ch;
    width: calc(round(down, 100%, (1ch * var(--grid-cells)) - (1ch * var(--grid-cells) - 1)));
    margin-bottom: var(--line-height);
}

.grid > *,
.grid > input {
    flex: 0 0 calc(round(down, (100% - (1ch * (var(--grid-cells) - 1))) / var(--grid-cells), 1ch));
}
.grid:has(> :last-child:nth-child(1)) {
    --grid-cells: 1;
}
.grid:has(> :last-child:nth-child(2)) {
    --grid-cells: 2;
}
.grid:has(> :last-child:nth-child(3)) {
    --grid-cells: 3;
}
.grid:has(> :last-child:nth-child(4)) {
    --grid-cells: 4;
}
.grid:has(> :last-child:nth-child(5)) {
    --grid-cells: 5;
}
.grid:has(> :last-child:nth-child(6)) {
    --grid-cells: 6;
}
.grid:has(> :last-child:nth-child(7)) {
    --grid-cells: 7;
}
.grid:has(> :last-child:nth-child(8)) {
    --grid-cells: 8;
}
.grid:has(> :last-child:nth-child(9)) {
    --grid-cells: 9;
}

.flex {
    display: flex;
}

.flex-wrap {
    flex-wrap: wrap;
}

.flex-row {
    flex-direction: row;
}

.flex-col {
    flex-direction: column;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.items-center {
    align-items: center;
}

.m-0 {
    margin: 0;
}

.mt-0 {
    margin-top: 0;
}

.mb-0 {
    margin-bottom: 0;
}

.mb-1 {
    margin-bottom: 0.25rem;
}

.mt-1 {
    margin-top: 0.25rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-3 {
    margin-bottom: 0.75rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mt-4 {
    margin-top: 1rem;
}

.mb-8 {
    margin-bottom: 2rem;
}

.mt-8 {
    margin-top: 2rem;
}

.inline-block {
    display: inline-block;
    margin-right: 0.5em;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-4 {
    gap: 1rem;
}

.my-4 {
    margin-top: 1rem;
    margin-bottom: 1rem;
}
