/* Application pages: the two doors, the printed questionnaire, the profile. */
.app-page {
    width: min(var(--page-max), 100% - 2 * var(--gutter));
}

/* Gate: a band between rules. What stands in the way, and the way through. */
.app-gate {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 24px clamp(32px, 5vw, 80px);
    padding: clamp(30px, 3.6vw, 44px) 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.app-gate-title {
    margin: 0 0 10px;
    color: var(--ink);
    font: 400 clamp(28px, 3vw, 40px)/1.05 var(--font-title);
    letter-spacing: .02em;
}

.app-gate .meta {
    max-width: 56ch;
    margin: 0;
    font-size: 17px;
}

.app-gate .btn-row {
    justify-content: flex-end;
}

.app-gate + .choices {
    border-top: 0;
}

.app-choice {
    display: grid;
    align-content: start;
}

.app-choice .notice {
    margin: calc(-1 * var(--door-y) + 28px) var(--door-x) var(--door-y);
}

.choices > :first-child .notice {
    margin-left: 0;
}

.choices > :last-child .notice {
    margin-right: 0;
}

.app-choice .notice a,
.app-gate .notice a {
    color: var(--ink);
    white-space: nowrap;
}

/* Questionnaire: each question is a row of the printed form. A big Lino
   numeral in the margin, the question beside it, the answer field on the
   right. The declaration at the end carries no number. */
.app-form {
    --num-col: clamp(48px, 4.6vw, 64px);
    counter-reset: question;
}

.app-form .field {
    grid-template-columns: var(--num-col) minmax(0, 5fr) minmax(0, 7fr);
    align-items: start;
    gap: 0 clamp(24px, 3.4vw, 52px);
    padding: clamp(34px, 3.8vw, 52px) 0;
    border-top: 1px solid var(--line);
}

.app-form .field::before {
    grid-column: 1;
    grid-row: 1;
    margin-top: -2px;
    color: var(--ink);
    font: 400 clamp(56px, 5.6vw, 80px)/.8 var(--font-title);
    transition: color .2s;
}

.app-form .field:not(.field-check) {
    counter-increment: question;
}

.app-form .field:not(.field-check)::before {
    content: counter(question);
}

.app-form .field.has-error::before {
    color: var(--red);
}

.field-q,
.field-a {
    display: grid;
    align-content: start;
    gap: 10px;
    min-width: 0;
    grid-row: 1;
}

.field-q {
    grid-column: 2;
    padding-top: 2px;
}

.field-a {
    grid-column: 3;
}

.field-check .field-a {
    grid-column: 2 / -1;
}

.field-check .field-hint {
    padding-left: 42px;
    font-size: 15px;
}

.app-count {
    justify-self: end;
    margin: 0;
    color: var(--ink-faint);
    font-size: 13px;
    letter-spacing: .04em;
    font-variant-numeric: tabular-nums;
}

.app-number {
    max-width: 160px;
}

.app-form-end {
    display: grid;
    grid-template-columns: var(--num-col) minmax(0, 5fr) minmax(0, 7fr);
    gap: 24px clamp(24px, 3.4vw, 52px);
    padding: clamp(40px, 4.4vw, 60px) 0 clamp(44px, 4.8vw, 64px);
    border-top: 4px double rgba(244, 241, 234, .3);
}

.app-form-end > * {
    grid-column: 3;
}

/* Profile: the head is the personal sheet (portrait, name, Discord ID),
   then the whitelist state on one paper slip beside the ledger. */
.app-portrait {
    position: relative;
    display: block;
    width: clamp(112px, 11vw, 148px);
    aspect-ratio: 1;
    margin: 0 0 clamp(34px, 3.6vw, 44px);
    overflow: hidden;
    background: #100e0c;
    outline: 1px solid rgba(244, 241, 234, .34);
    outline-offset: 7px;
    transition: outline-color .5s var(--ease);
}

.app-avatar {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(1) sepia(.3) contrast(1.06) brightness(.84);
    transition: filter .7s var(--ease);
}

.app-who:hover .app-portrait {
    outline-color: var(--ink);
}

.app-who:hover .app-avatar {
    filter: none;
}

.app-who-name {
    font-size: clamp(42px, 6vw, 84px);
}

.app-who-id {
    user-select: all;
}

.app-profile {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    align-items: start;
    gap: clamp(48px, 6vw, 96px);
}

.app-wire {
    padding: clamp(32px, 3.4vw, 46px) clamp(28px, 3.4vw, 48px) clamp(36px, 3.6vw, 50px);
}

.app-wire .btn-row {
    margin-top: 30px;
}

/* Account links at the foot of the slip: printed in paper ink, a hairline above. */
.app-wire-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 28px;
    margin-top: 30px;
    padding-top: 18px;
    border-top: 1px solid var(--paper-line);
    font: 400 20px/1.2 var(--font-title);
    letter-spacing: .03em;
}

/* .paper a would print the label in paper ink; the red stroke keeps white. */
.app-wire .btn-primary {
    color: #fff;
}

.app-history .panel-title {
    margin-bottom: clamp(24px, 3vw, 36px);
}

/* Below this the slip column gets too narrow for its button: stack. */
@media (max-width: 1100px) {
    .app-profile {
        grid-template-columns: minmax(0, 1fr);
    }

    .app-wire {
        justify-self: center;
        width: min(100%, 600px);
    }
}

@media (max-width: 860px) {
    .choices .app-choice .notice {
        margin-right: 0;
        margin-left: 0;
    }
}

@media (max-width: 900px) {
    .app-form .field {
        grid-template-columns: auto minmax(0, 1fr);
        gap: 22px 20px;
    }

    .app-form .field::before {
        min-width: 36px;
        font-size: 52px;
    }

    .field-a,
    .field-check .field-a {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .field-check .field-a {
        grid-row: 1;
    }

    .app-form-end {
        grid-template-columns: minmax(0, 1fr);
    }

    .app-form-end > * {
        grid-column: 1;
    }
}

@media (max-width: 640px) {
    .app-gate {
        grid-template-columns: minmax(0, 1fr);
    }

    .app-gate .btn-row {
        justify-content: flex-start;
    }

    .app-form-end .btn {
        flex: 1 1 100%;
    }

    .app-wire .btn {
        width: 100%;
        padding-inline: 16px;
        font-size: 18px;
    }
}
