@font-face {
    font-family: CommitMonoVariable;
    font-style: normal;
    font-weight: 200 700;
    font-display: swap;
    src: url("/fonts/CommitMono-VariableFont.woff2") format("woff2"), url("/fonts/CommitMono-VariableFont.ttf") format("truetype");
}

@font-face {
    font-family: CommitMonoVariable;
    font-style: italic;
    font-weight: 200 700;
    font-display: swap;
    src: url("/fonts/CommitMono-VariableFont.woff2") format("woff2"), url("/fonts/CommitMono-VariableFont.ttf") format("truetype");
}

:root {
    /* Color variables */
    --accent: #b462cbff;
    --background: light-dark(#f3dffc, #16051d);
    --foreground: light-dark(#faf0ff, #08020b);
    --text: light-dark(#0f0f0f, #efefef);
    --border-color: color-mix(in srgb, var(--background) 70%, var(--text));

    --success: #9ece6a;
    --warn: #e0af68;
    --error: #f7768e;

    /* Font variables */
    --font-main: Inter;
    --font-mono: monospace;

    /* Layout variables */
    --container-width: 768px;
    --radius: 0.5rem;

    font-family: var(--font-main), sans-serif;
}

@supports (font-variation-settings: normal) {
    :root {
        --font-main: InterVariable;
        --font-mono: CommitMonoVariable;
    }
}

body {
    margin: 0;
    padding: 0;

    color-scheme: light dark;
    background-color: var(--background);
    color: var(--text);
}

a {
    color: var(--accent);
}

a:visited {
    color: var(--accent);
}

a[target="_blank"]:not(:has(>img))::after {
    display: inline-block;
    margin-left: 0.25em;
    content: "↗";
}

abbr {
    cursor: help;
}

details {
    margin: 1rem 0;
    padding: 0 1rem;

    border: 2px dotted var(--border-color);
    border-radius: var(--radius);

    summary {
        padding: 1rem 0;

        font-weight: bold;
        cursor: pointer;
    }
}

details[open] {
    padding-bottom: 1rem;
}

article {
    font-size: large;
    line-height: 1.4;
}

hr {
    color: var(--border-color);
}

code {
    padding: 0.1em 0.2em;
    
    font-family: var(--font-mono), monospace;
    background-color: var(--foreground);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

pre {
    position: relative;
}

pre code {
    display: block;
    padding: 1rem;
    overflow-x: auto;

    text-wrap: nowrap;
    line-height: 1;
}

figcaption {
    text-align: center;
}

img, video {
    max-width: 100%;
}

table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
}

table:not(.no-rows) tbody tr:nth-child(2n-1) {
    background-color: var(--foreground);
}

button, input[type=submit] {
    display: inline-block;
    padding: 0.5em 1em;

    font-size: small;
    font-weight: bold;
    line-height: 1;
    background-color: var(--accent);
    color: var(--background);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: 0.2s background-color;
}

button:hover, button:focus, input[type=submit]:hover, input[type=submit]:focus {
    background-color: color-mix(in srgb, var(--accent) 80%, var(--background));
}

input, textarea {
    padding: 0.5rem;
    outline: none;

    background-color: var(--foreground);
    color: var(--text);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    transition: 0.2s border;
}

input, textarea:focus {
    border-color: var(--accent);
}

.copy-code-button {
    position: absolute;
    top: 0;
    right: 0;
    opacity: 0;

    font-size: x-small;
    border-top-left-radius: 0;
    border-bottom-right-radius: 0;
    transition: 0.2s opacity;
}

pre code:hover + .copy-code-button, .copy-code-button:hover {
    opacity: 1;
}

.container {
    margin-left: auto;
    margin-right: auto;
    padding: 1rem;
    max-width: var(--container-width);
}

.card {
    display: block;
    padding: 1rem;

    background-color: var(--foreground);
    border-radius: var(--radius);
}

.img-invert {
    filter: invert() hue-rotate(180deg);
}

.no-decorations {
    text-decoration: none;
}

.validation-errors {
    color: var(--error);
}

.inline-icon {
    display: inline-block;
    vertical-align: middle;
    height: 1.5em;
}

.table-y {
    background-color: var(--success);
    color: black;
}

.table-p {
    background-color: var(--warn);
    color: black;
}

.table-n {
    background-color: var(--error);
    color: black;
}

@keyframes title-fade-in {
    0% {
        margin-top: 0;
        opacity: 0;
    }
}

@media (pointer: coarse), (hover: none) {
    [title]:hover::after, [title]:focus::after {
        display: block;
        position: absolute;
        width: max-content;
        margin-top: 0.5rem;
        padding: 0.5rem;
        content: attr(title);
        z-index: +10;

        background-color: var(--foreground);
        border: 1px solid var(--border-color);
        border-radius: var(--radius);
        animation: 0.3s ease-out title-fade-in;
    }

    .copy-code-button {
        opacity: 1;
    }
}