:root {
    --qr-size: 300px;
    --fg: #111111;
    --bg: #FFFFFF;
}
body{
    background-color: var(--bg);
    color: var(--fg);
    display: flex;
    flex-direction: column;
    min-height: 100%;
    padding: 1rem;
}

@media (prefers-color-scheme: dark) {
    :root {
        --fg: #CCCCCC;
        --bg: #000000;
    }
    #qrcode {
        filter: invert(1);
    }
}

html {
    height: 100%;
}

header {
    flex: 0 1;
}
footer {
    margin-top:auto;
}
main {
    flex: 0 auto;
    gap: 1rem;
    display: grid;
    align-items: stretch;
    grid-template-columns: repeat(auto-fit, minmax(min(var(--qr-size), 100%), 1fr));
}

.form {
    display: flex;
    gap: 1rem;
    padding: 2rem;
    height: 100%;
    flex-wrap: wrap;
    justify-content: space-evenly;
    align-items: baseline;
    align-content: flex-start;
    flex-direction: row;
}

label {
    width: max-content;
}

textarea {
    resize: none;
}

#text {
    flex: 1 1 var(--qr-size);
    max-height: calc(var(--qr-size) - 1.5em - 1rem);
    padding: 0.5ch;
}

#qrcode {
    align-self: center;
    flex: 1;
    justify-self: center;
    max-width: var(--qr-size);
    display: block;
}

#qrcode > * {
    max-width: 100%;
}

/* kindly stolen from https://css-tricks.com/auto-growing-inputs-textareas */
.textarea {
    display: block;
    overflow: auto;
    resize: none;
    min-height: 40px;
    line-height: 20px;
    white-space: pre;
    border: grey 1px solid;
}
#text:empty:before {
    content: "Enter your mesage";
    color: grey;
}
#fake {
    display: none;
}

#qrcode:has(canvas:not([height])):before,
#qrcode:empty
{
    content: url("fakeQR.gif");
}
