@font-face {
    src: url(/assets/font.ttf);
    font-family: "biro";
    font-display: swap;
}

:root {
    --ink: #000;
    --paper: #fff;

    /* Each range tops out by 1024px, so every desktop keeps the sizes this page
       has always used (35px text, 70px question, 50px buttons) and only
       narrower screens scale down. */
    --text: clamp(18px, 2.68vw + 7.5px, 35px);
    --lead: clamp(17px, 2.05vw + 9px, 30px);
    --button: clamp(24px, 4.1vw + 8px, 50px);
    --display: clamp(30px, 6.31vw + 5.4px, 70px);

    --gap: clamp(16px, 3vw, 24px);
    --edge: clamp(16px, 6vw, 130px);
    /* Vertical breathing room is bounded by the viewport height, not its width,
       so a wide-but-short window does not spend its height on padding. */
    --edge-y: clamp(10px, 2vh, 32px);
    --rule: 3px solid var(--ink);

    /* Compared images share one width so the scaling stays truthful. */
    --figure: clamp(120px, 12vw, 220px);
}

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

body {
    margin: 0px;
    padding: 0px;
    font-family: biro, system-ui, sans-serif;
    font-size: var(--text);
    /* This face reports a very airy normal line-height (~1.7); tighten it so
       the wording sits together instead of spreading down the page. */
    line-height: 1.25;
    color: var(--ink);
    background: var(--paper);
    -webkit-text-size-adjust: 100%;
}

h1, h2, h3, h4, h5 {
    margin: 0px;
    padding: 0px;
}

img {
    display: block;
    max-width: 100%;
    height: auto;
}

.title {
    font-size: var(--display);
    text-align: center;
    font-weight: bold;
    text-wrap: balance;
}

.subtitle {
    font-size: var(--lead);
    text-align: center;
    font-weight: bold;
}

.center {
    text-align: center;
}

/* Question at the top, stage in the middle, answers at the bottom. */
.container {
    width: 100%;
    max-width: 1500px;
    min-height: 100vh;
    min-height: 100svh;
    margin: 0px auto;
    padding-inline: var(--edge);
    padding-block: var(--edge-y);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: var(--gap);
}

.stage {
    margin-block: auto;
}

.row {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--gap);
}

.spaced-evenly {
    justify-content: space-evenly;
}

.spaced {
    justify-content: space-between;
}

.column {
    display: flex;
    flex-direction: column;
}

.row.centered, .column.centered {
    align-items: center;
}

/* One side of a comparison: picture over its numbers. */
.panel {
    flex: 1 1 300px;
    max-width: 620px;
    min-width: 0px;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Equal-height panels keep the captions on a common baseline. */
    align-self: stretch;
    justify-content: flex-start;
    gap: clamp(8px, 1.5vw, 18px);
    text-align: center;
}

.panel + .panel {
    padding-left: var(--gap);
    border-left: var(--rule);
}

/* A picture supports the question, it does not fill the screen: it is capped in
   px as well as vh so a tall monitor does not simply scale it up. */
.figure {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: min(30vh, 230px);
}

@media (min-width: 701px) {
    .figure {
        max-width: 32vw;
        max-height: min(30vh, 300px);
    }

    /* Two pictures share the row, so each takes less. */
    .row:has(.panel + .panel) .figure {
        max-width: 26vw;
        max-height: min(24vh, 210px);
    }
}

.case, .reference {
    width: var(--figure);
    transition: transform 0.4s;
}

button {
    font-family: inherit;
    font-size: var(--button);
    line-height: 1.2;
    padding: 0.4em 0.6em;
    color: var(--ink);
    background: var(--paper);
    border: 2px solid var(--ink);
    border-radius: 10px;
    text-decoration: underline;
    cursor: pointer;
}

button:focus-visible {
    outline: 3px solid var(--ink);
    outline-offset: 3px;
}

.container > button {
    align-self: center;
    min-width: min(300px, 70vw);
}

/* Sticky, not fixed: the answers stay in reach on a short screen without
   floating over the picture on a tall one. */
.actions {
    position: sticky;
    bottom: 0px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-evenly;
    gap: var(--gap);
    padding-block: var(--edge-y);
    margin-bottom: calc(var(--edge-y) * -1);
    background: var(--paper);
}

/* Basis 0 so the pair always shares one line; they grow to the 300px this page
   has always used, and space-evenly spreads the slack on a wide screen. */
.actions button {
    flex: 1 1 0px;
    min-width: 0px;
    max-width: 300px;
}

.modal-backdrop {
    position: fixed;
    inset: 0px;
    z-index: 1000;
    padding: var(--edge);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.85);
}

.modal {
    width: min(700px, 100%);
    max-height: 90vh;
    max-height: 90svh;
    overflow-y: auto;
    padding: var(--gap);
    background: var(--paper);
    border: 2px solid var(--ink);
    border-radius: 10px;
}

.modal .title {
    font-size: calc(var(--lead) * 1.2);
}

.modal-select {
    display: block;
    margin: var(--gap) auto 0px auto;
    max-width: 100%;
    padding: 5px 10px;
    font-family: inherit;
    font-size: var(--text);
    color: var(--ink);
    background: var(--paper);
    border: 2px solid var(--ink);
    border-radius: 10px;
    cursor: pointer;
}

.modal-chart {
    height: min(320px, 40vh);
    margin: var(--gap) 0px;
}

.modal-total {
    display: block;
}

.modal-next {
    display: block;
    margin: var(--gap) auto 0px auto;
    min-width: min(300px, 70vw);
}

/* One threshold decides stacking, so the dividers never disagree with it. */
@media (max-width: 700px) {
    :root {
        --figure: min(200px, 46vw);
    }

    .row {
        flex-direction: column;
        align-items: center;
    }

    /* Stacked panels need a rule across, not down. */
    .panel + .panel {
        padding-left: 0px;
        padding-top: var(--gap);
        border-left: 0px;
        border-top: var(--rule);
    }

    /* Stacked, two pictures share one screen: keep the answers in reach. */
    .row:has(.panel + .panel) .figure {
        max-height: clamp(100px, 18vh, 175px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .case, .reference {
        transition-duration: 0.01ms;
    }
}

.captcha {
    display: flex;
    justify-content: center;
    min-height: 65px;
}

/* Turnstile injects its own wrapper and iframe; center those too. */
.captcha .cf-turnstile {
    display: flex;
    justify-content: center;
    width: 100%;
}

.captcha .cf-turnstile > *,
.captcha iframe {
    margin-inline: auto;
}

.container > button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.suggest {
    gap: var(--gap);
    width: min(700px, 100%);
    align-self: center;
}

.suggest textarea {
    width: 100%;
    padding: 10px;
    font-family: inherit;
    font-size: var(--text);
    color: var(--ink);
    background: var(--paper);
    border: 2px solid var(--ink);
    border-radius: 10px;
    resize: vertical;
}

.suggest button {
    min-width: min(300px, 70vw);
}

.about {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: calc(var(--gap) / 2);
    margin-top: var(--gap);
    padding-top: var(--gap);
    border-top: var(--rule);
}

.about p {
    margin: 0px;
}

.about a {
    color: var(--ink);
}

/* Multi-color call-out: a rainbow gradient clipped to the text, sliding slowly. */
.about .open-to-work {
    font-size: var(--lead);
    font-weight: bold;
    background: linear-gradient(90deg, #e40303, #ff8c00, #d4b000, #008026, #004dff, #750787, #e40303);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-decoration: underline;
    text-decoration-color: var(--ink);
    display: inline-block;
    animation: rainbow 4s linear infinite, bob 2.4s ease-in-out infinite;
    transition: transform 0.2s;
}

/* The bob moves `translate`, so it keeps going under the hover tilt on `transform`. */
.about .open-to-work:hover {
    transform: scale(1.1) rotate(-3deg);
}

/* A little wiggle on hover, like a pen tapping the link. */
.about .projects-link {
    display: inline-block;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
    transition: text-underline-offset 0.2s, text-decoration-thickness 0.2s;
}

.about .projects-link:hover {
    text-decoration-thickness: 4px;
    text-underline-offset: 6px;
    animation: wiggle 0.5s ease-in-out;
}

.about .projects-link:focus-visible {
    outline: 3px solid var(--ink);
    outline-offset: 3px;
}

.about .open-to-work:focus-visible {
    outline: 3px solid var(--ink);
    outline-offset: 3px;
}

@keyframes rainbow {
    to { background-position: 200% 0; }
}

@keyframes bob {
    0%, 100% { translate: 0px 0px; }
    50% { translate: 0px -4px; }
}

@keyframes wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-4deg); }
    50% { transform: rotate(3deg); }
    75% { transform: rotate(-2deg); }
}

@media (prefers-reduced-motion: reduce) {
    .about .open-to-work,
    .about .projects-link:hover {
        animation: none;
    }

    .about .open-to-work,
    .about .projects-link {
        transition: none;
    }
}
