/* Copyright © 2023-2024  Eris */

:root {
    color-scheme: dark light;

    --primary-hue: 300;
    --secondary-hue: 180;
    --saturation: 100%;
    --lightness: 25%;

    --primary: hsl(var(--primary-hue), var(--saturation), var(--lightness));
    --secondary: hsl(var(--secondary-hue), var(--saturation), var(--lightness));

    --floating-delay: 0s;
    --floating-width: 100%;
    --floating-height: 8rem;
}

@font-face {
    font-family: "M PLUS 2";
    font-display: swap;
    src: url("/MPLUS2.ttf"), local("M PLUS 2");
}

@font-face {
    font-family: "M PLUS 1 Code";
    font-display: swap;
    src: url("/MPLUS1Code.ttf"), local("M PLUS 1 Code");
}

html {
    height: 100%;
    width: 100%;
    font-family: "M PLUS 2", sans-serif;
    line-height: 120%;
    text-rendering: optimizeLegibility;
}

.canvas-wrap {
    position: relative;
}

.canvas-label {
    position: absolute;
    padding: 0.5rem;
    border: 2px solid white;
    border-radius: 4px;
    background: hsl(0, 0%, 20%);
    color: hsl(var(--primary-hue), var(--saturation), 70%);
}

h1 {
    font-size: 150%;
    line-height: 110%;
}

h2 {
    font-size: 115%;
}

h3 {
    font-size: 100%;
}

b {
    color: hsl(var(--secondary-hue), var(--saturation), 30%);
}

u {
    text-decoration-color: var(--secondary);
}

pre, code {
    font-family: "M PLUS 1 Code", monospace;
    color: var(--secondary);
    background-color: #e0e0e0;
    border-radius: 4px;
}

body {
    background: hsl(var(--primary-hue), 1%, 99%);
    display: grid;
    grid-template-rows: auto 1fr auto;
    height: 100%;
    width: 100%;
}

header {
    display: flex;
    flex-direction: row;
    align-items: center;        /* Vertical align */
    background: hsl(var(--secondary-hue), 1%, 74%);
    margin-bottom: 1rem;
    border-bottom: 1px solid black;

    font-size: 125%;
    line-height: 150%;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

header * {
    margin-top: 0.1rem;
    margin-left: 0.25rem;
    margin-right: 0.25rem;
}

header > * {
    display: flex;
    align-items: center;
}

header > .left {
    justify-content: left;
}

header > .fill {
    flex: 1;
}

header > .right {
    justify-content: right;
}

header > :first-child {
    margin-left: 0.5rem;
}

header p {
    margin: 0;
}

body > header svg {
    margin: 0.1rem;
    height: 2.5rem;
    width: 2.5rem;
}

dialog header svg {
    height: 1.5rem;
    width: 1.5rem;
}

footer {
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
    font-height: 80%;
    margin-top: 1rem;
    border-top: 1px solid black;
}

#banners img {
    height: 1.5rem;
}

footer > p {
    margin-bottom: 0.5rem;
}

.field-row {
    display: flex;
    align-items: end;
    flex-direction: row;
}

.field-row label {
    margin-right: 0.5rem;
}

a {
    color: var(--secondary);
    text-decoration: none;
}

a:hover {
    color: var(--primary);
}

a:hover {
    background-color: #f0f0f0;
    border-radius: 4px;
}

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

#banners a,
header a,
header a:visited {
    color: currentcolor;
}

#banners a:hover,
header a:hover {
    background-color: transparent;
    border-radius: 0;
}

dialog {
    padding: 0;
}

dialog main {
    margin: 1rem;
}

.clickthru {
    pointer-events: none;
}

.floating {
    position: fixed;
    z-index: 1000;
    pointer-events: none;
}

.floating img {
    width: var(--floating-width);
    height: var(--floating-height);
}

.floating-x {
    animation: floating-x 16s linear infinite alternate;
    animation-delay: var(--floating-delay);
}

.floating-y {
    animation: floating-y 9s linear infinite alternate;
    animation-delay: var(--floating-delay);
}

.bob {
    --floating-delay: -50s;
}

@keyframes floating-x {
    100% {
        transform: translateX(calc(100vw - var(--floating-width)));
    }
}

@keyframes floating-y {
    100% {
        transform: translateY(calc(100vh - var(--floating-height)));
    }
}

@media (min-width: 1140px) {
    body > main {
        margin-left: 9rem;
        margin-right: 9rem;
    }
}

@media (min-width: 800px) and (max-width: 1140px) {
    body > main {
        margin-left: 5rem;
        margin-right: 5rem;
    }
}

@media (max-width: 800px) {
    body > main {
        margin-left: 1rem;
        margin-right: 1rem;
    }
}

@media (prefers-color-scheme: dark) {
    body {
        background: hsl(var(--primary-hue), 1%, 17%);
    }

    header {
        background: hsl(var(--secondary-hue), 1%, 12%);
    }

    b {
        color: hsl(var(--secondary-hue), var(--saturation), 75%);
    }
}
