/*
 * Palette borrowed from Howest, whose students these pages are for: cyan carries every
 * affordance, pink is reserved for refusals, and everything else is ink on near-white.
 */
:root {
    color-scheme: light;

    --cyan: #44c8f5;
    --cyan-deep: #0079c0;
    --cyan-wash: #ebf6fa;
    --pink: #e6007e;
    --pink-wash: #fdeef6;
    --teal: #009a93;

    --ink: #1c1d1e;
    --body: #343a40;
    --muted: #6c757d;

    --page: #f4fafc;
    --surface: #ffffff;
    --edge: #dce7ec;

    --radius: 0.875rem;
    --shadow: 0 1px 2px rgb(28 29 30 / 4%), 0 12px 32px -12px rgb(28 29 30 / 12%);
}

@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;

        --cyan-deep: #7ad8f8;
        --cyan-wash: #12303c;
        --pink-wash: #3a0e26;

        --ink: #f2f6f8;
        --body: #d3dbe0;
        --muted: #9aa6ad;

        --page: #16181a;
        --surface: #1f2325;
        --edge: #333a3e;

        --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 12px 32px -12px rgb(0 0 0 / 60%);
    }
}

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

body {
    font: 16px/1.6 "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Open Sans",
        Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--page);
    color: var(--body);
    -webkit-font-smoothing: antialiased;
}

/* Header */

.masthead {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 2.75rem 1.5rem 2rem;
}

.masthead__logo {
    width: 10rem;
    aspect-ratio: 309.76 / 212.51;
    background-color: var(--ink);
    mask: url("logo.svg") no-repeat center / contain;
    -webkit-mask: url("logo.svg") no-repeat center / contain;
}

.masthead__name {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.005em;
    color: var(--ink);
}

/* Layout */

main {
    flex: 1;
    width: 100%;
    max-width: 34rem;
    margin: 0 auto;
    padding: 1rem 1.5rem 4rem;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--edge);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    overflow: hidden;
    position: relative;
}

.panel::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 4px;
    background: var(--cyan);
}

.panel--problem::before,
.panel:has([data-state="settled"])::before {
    background: var(--pink);
}

h1 {
    font-size: 1.375rem;
    line-height: 1.3;
    font-weight: 700;
    letter-spacing: -0.011em;
    color: var(--ink);
    margin: 0 0 0.5rem;
    text-wrap: balance;
}

.subtitle {
    margin: 0;
    color: var(--muted);
    text-wrap: pretty;
}

p {
    margin: 0 0 1rem;
}

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

strong {
    color: var(--ink);
    font-weight: 600;
}

/* Blocks inside a panel */

.note {
    margin-top: 1.5rem;
    padding: 1rem 1.125rem;
    border-radius: 0.625rem;
    background: var(--cyan-wash);
}

.reason {
    margin-top: 1.5rem;
    padding: 0.875rem 1rem;
    border-radius: 0.625rem;
    background: var(--cyan-wash);
    font-family: ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace;
    font-size: 0.8125rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.error {
    margin: 0 0 1.5rem;
    padding: 0.875rem 1.125rem;
    border-left: 3px solid var(--pink);
    border-radius: 0 0.5rem 0.5rem 0;
    background: var(--pink-wash);
    color: var(--ink);
}

/* Waiting */

.status {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.spinner {
    flex: none;
    width: 1.5rem;
    height: 1.5rem;
    margin-top: 0.25rem;
    border: 3px solid var(--cyan-wash);
    border-top-color: var(--cyan);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

[data-state="settled"] .spinner {
    display: none;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .spinner {
        animation-duration: 2.4s;
    }
}

/* Group chooser */

fieldset {
    border: 0;
    margin: 0 0 1.5rem;
    padding: 0;
}

legend {
    padding: 0;
    margin-bottom: 0.625rem;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

.choice {
    display: flex;
    align-items: baseline;
    gap: 0.625rem;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    border: 1px solid var(--edge);
    border-radius: 0.625rem;
    color: var(--ink);
    cursor: pointer;
    transition: border-color 0.15s, background-color 0.15s;
}

.choice:hover {
    border-color: var(--cyan);
}

.choice:has(:checked) {
    border-color: var(--cyan);
    background: var(--cyan-wash);
}

.choice:has(:focus-visible) {
    outline: 2px solid var(--cyan-deep);
    outline-offset: 2px;
}

.choice input {
    accent-color: var(--cyan-deep);
    margin: 0;
    flex: none;
}

.choice__note {
    margin-left: auto;
    font-size: 0.8125rem;
    color: var(--muted);
}

label {
    display: block;
}

.field label {
    margin-bottom: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

input[type="text"] {
    font: inherit;
    width: 100%;
    padding: 0.6875rem 0.875rem;
    border: 1px solid var(--edge);
    border-radius: 0.625rem;
    background: var(--surface);
    color: var(--ink);
}

input[type="text"]:focus-visible {
    outline: 2px solid var(--cyan-deep);
    outline-offset: 1px;
    border-color: transparent;
}

/* Buttons */

.actions {
    margin-top: 1.75rem;
}

button,
.button {
    font: inherit;
    font-weight: 600;
    display: inline-block;
    padding: 0.6875rem 1.5rem;
    border: 1px solid transparent;
    border-radius: 999px;
    background: var(--cyan);
    color: #1c1d1e;
    text-decoration: none;
    cursor: pointer;
    transition: filter 0.15s;
}

button:hover,
.button:hover {
    filter: brightness(0.94);
}

button:focus-visible,
.button:focus-visible {
    outline: 2px solid var(--cyan-deep);
    outline-offset: 2px;
}

.button--quiet {
    background: transparent;
    border-color: var(--edge);
    color: var(--ink);
}

/* Howest mark — pinned to the bottom right of the viewport, under everything else */

.howest {
    display: contents;
}

.howest img {
    position: fixed;
    right: 1.5rem;
    bottom: 0;
    width: 12rem;
    z-index: -1;
    pointer-events: none;
}

/* Footer */

.colophon {
    /* Bottom padding clears the pinned Howest mark rather than sitting across it. */
    padding: 0 1.5rem 7rem;
    text-align: center;
    font-size: 0.8125rem;
    color: var(--muted);
}

@media (max-width: 30rem) {
    .masthead {
        padding: 2rem 1.5rem 1.5rem;
    }

    .masthead__logo {
        width: 8rem;
    }

    .howest img {
        right: 0.75rem;
        width: 8rem;
    }

    .colophon {
        padding-bottom: 5rem;
    }

    .panel {
        padding: 1.5rem 1.25rem;
    }
}

.summary {
    margin: 1.5rem 0 0;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.5rem 1.25rem;
}

.summary dt {
    color: var(--muted);
}

.summary dd {
    margin: 0;
}

.summary__aside {
    color: var(--muted);
}

/* Masked like .masthead__logo, so it follows --ink into dark mode. */
.hero {
    display: block;
    width: min(26rem, 65vw);
    aspect-ratio: 309.76 / 212.51;
    margin: 2rem auto;
    background-color: var(--ink);
    mask: url("logo.svg") no-repeat center / contain;
    -webkit-mask: url("logo.svg") no-repeat center / contain;
}
