@font-face {
    font-family: "Cascadia Code PL";
    src: url("CascadiaCodePL.woff2") format("woff2");
    font-style: normal;
    font-weight: 200 700;
    font-display: swap;
}

:root {
    color-scheme: dark;
    --surface: #232323;
    --field: #1b1b1b;
    --border: #515151;
    --text: #eeeeee;
    --muted: #b4b4b4;
    --accent: #3391ff;
    --radius: 6px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100svh;
    margin: 0;
    background-color: #121414;
    background-image:
        linear-gradient(#ffffff08 1px, transparent 1px),
        linear-gradient(90deg, #ffffff08 1px, transparent 1px),
        linear-gradient(#ffffff0a 1px, transparent 1px),
        linear-gradient(90deg, #ffffff0a 1px, transparent 1px);

    background-size:
        20px 20px,
        20px 20px,
        100px 100px,
        100px 100px;
    color: var(--text);
    font: 1rem / 1.55 "Cascadia Code PL", ui-monospace, monospace;
}

.site-header {
    padding: 16px 20px;
}

.site-header a {
    color: inherit;
    font-weight: 600;
    text-decoration: none;
}

.site-header a:hover {
    text-decoration: underline;
}

button,
input,
textarea {
    font: inherit;
}

.page {
    flex: 1;
    display: grid;
    place-items: center;
    padding: 32px 16px;
}

.mailer {
    width: min(100%, 550px);
    padding: 28px 32px;
    background: var(--surface);
    border: 1px solid #3e3e3e;
    border-radius: 10px;
    margin-top: 10px;
}

.profile {
    margin-bottom: 16px;
}

#pfp {
    display: block;
    width: 114px;
    height: 114px;
    margin-inline: auto;
    object-fit: cover;
    border: 1px solid var(--border);
    border-radius: 50%;
}

.intro {
    margin-bottom: 24px;
    text-align: center;
}

.intro h1 {
    margin: 0;
    color: var(--accent);
    font-size: 1.5rem;
    font-weight: 600;
    text-wrap: balance;
}

.intro p:not(.privacy-note) {
    margin: 8px 0 0;
}

.privacy-note {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 0.875rem;
}

#messageForm,
.field {
    display: grid;
}

#messageForm {
    gap: 16px;
}

.field {
    gap: 6px;
}

.field > label {
    font-size: 0.875rem;
    font-weight: 600;
}

.optional {
    color: var(--muted);
    font-weight: 400;
}

input[type="text"],
textarea {
    width: 100%;
    min-width: 0;
    padding: 10px 12px;
    color: var(--text);
    background: var(--field);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

input[type="text"] {
    min-height: 44px;
}

input[type="text"]::placeholder,
textarea::placeholder {
    color: var(--muted);
    opacity: 1;
}

input[type="text"]:focus,
textarea:focus,
.site-header a:focus-visible,
.button:focus-visible,
.settings summary:focus-visible,
.toggle input:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.grow-wrap {
    display: grid;
    min-width: 0;
}

.grow-wrap::after,
.grow-wrap > textarea {
    grid-area: 1 / 1;
    width: 100%;
    min-width: 0;
    min-height: 112px;
    padding: 10px 12px;
    border: 1px solid transparent;
    font: inherit;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.grow-wrap::after {
    content: attr(data-replicated-value) " ";
    visibility: hidden;
    pointer-events: none;
}

.grow-wrap > textarea {
    position: relative;
    resize: none;
    overflow: hidden;
    border-color: var(--border);
}

.field-footer {
    text-align: right;
}

.character-count,
.settings {
    color: var(--muted);
    font-size: 0.8125rem;
}

.character-count {
    font-variant-numeric: tabular-nums;
}

.character-count.near-limit,
.character-count.at-limit {
    color: var(--text);
}

.character-count.at-limit {
    font-weight: 700;
}

.button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 8px 16px;
    color: #181818;
    background: var(--accent);
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-weight: 650;
    cursor: pointer;
}

.button:hover:not(:disabled) {
    background: #69adfc;
}

.button:disabled {
    opacity: 0.65;
    cursor: wait;
}

.status {
    margin: 0;
    font-size: 0.875rem;
    text-align: center;
    overflow-wrap: anywhere;
}

.status:empty {
    display: none;
}

.status.pending {
    color: var(--muted);
}

.status.error {
    font-weight: 650;
}

.settings {
    margin-top: 20px;
    padding-top: 12px;
    border-top: 1px solid #3e3e3e;
}

.settings summary {
    width: fit-content;
    cursor: pointer;
}

.settings summary:hover {
    color: var(--text);
}

.settings-content {
    padding-top: 12px;
}

.settings-content p {
    margin: 8px 0 0;
}

.toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    color: var(--text);
    cursor: pointer;
}

.toggle input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--accent);
    cursor: pointer;
}

kbd {
    display: inline-block;
    padding: 1px 4px;
    color: var(--text);
    background: var(--field);
    border: 1px solid var(--border);
    border-radius: 3px;
    font: inherit;
}

@media (max-width: 550px) {
    .page {
        align-items: start;
        padding: 16px 12px;
    }

    .mailer {
        padding: 20px 16px;
    }
}
