/*
 * THE SIGN-UP AND SIGN-IN FORMS (docs/design/06-public-corrections.md,
 * item 5): every form a person signs up, signs in, gets a code, resets a
 * password or unlocks with, on every surface - the platform's own site, a
 * shop's admin, a shop's storefront - and the operator's.
 *
 * Every length here is the same length everywhere: the card, the field,
 * the select, the button, the label, the (i), the line that says what went
 * wrong, and the room between them. Colours and the typeface stay each
 * surface's own - the platform's gold, an admin's accent, a shop's palette -
 * because a shop's customers sign in to the shop, not to us.
 *
 * Loaded last on those pages, after the surface's own sheets, and scoped to
 * .auth-panel, the card the form sits in.
 */

.auth-panel {
    --auth-control: var(--field-height);
    --auth-radius: .75rem;
    --auth-accent: var(--primary, var(--accent, var(--gold)));
    box-sizing: border-box;
    display: grid;
    align-content: start;
    gap: var(--gap-form);
    width: 100%;
    max-width: 28rem;
    margin-inline: auto;
    padding: var(--space-6);
    border-radius: var(--glass-radius-lg);
}

/* The two sign-ups ask the most, so their card is wider and the fields
   that belong together share a row once there is room for two; the grid
   folds them to one column on a phone by itself. Boxes in a row line up
   because every label is one line tall (the owner, 9 October 2026). */
.auth-panel.auth-wide,
.section.narrow.auth-wide-wrap { max-width: 44rem; }
.auth-panel .field-pair {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
    gap: var(--gap-form);
    align-items: start;
}

/* One column, with the same room between every two things in it, and the
   room before the button that sends it that every form has (DESIGN.md,
   Forms): 16 between fields, 24 above the submit. */
.auth-panel form,
.auth-panel .stack {
    display: grid;
    gap: var(--gap-form);
    margin: 0;
}
.auth-panel :is(.field, .field-pair, .check, .cf-turnstile, .cf-turnstile ~ script, .cf-turnstile ~ .field-error) + .button { margin-top: calc(var(--gap-actions) - var(--gap-form)); }

.auth-panel h1 { margin: 0; font-size: 1.75rem; line-height: 1.25; }
.auth-panel p { margin: 0; }
.auth-panel .eyebrow { margin: 0; }
.auth-panel .muted.small,
.auth-panel .small { font-size: .875rem; line-height: 1.25rem; }

/* A field: its label, with an (i) where the field needs explaining, the
   box, and what went wrong directly under it. */
.auth-panel .field {
    display: grid;
    align-content: start;
    gap: var(--gap-field);
    margin: 0;
    font-size: .9375rem;
    font-weight: 600;
    line-height: 1.5rem;
}

.auth-panel .field > span:first-child {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-height: var(--label-height);
}

.auth-panel .field > input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.auth-panel .select-button {
    box-sizing: border-box;
    width: 100%;
    height: var(--auth-control);
    min-height: var(--auth-control);
    margin: 0;
    padding: 0 var(--space-4);
    border-radius: var(--auth-radius);
    font: inherit;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5rem;
}

.auth-panel .field > input:focus-visible,
.auth-panel .select-button:focus-visible {
    outline: 2px solid var(--auth-accent);
    outline-offset: 1px;
}

.auth-panel .field-error,
.auth-panel .field > .hint,
.auth-panel .searchable-select > .hint {
    margin: 0;
    font-size: .875rem;
    line-height: 1.25rem;
}

.auth-panel .field-error { font-weight: 600; }
.auth-panel .field > .hint,
.auth-panel .searchable-select > .hint { font-weight: 400; }

/* The (i): the same button on every surface. The platform's own site has
   none of its own, so the rules for it and for the note it opens live here
   too; the note is moved to the end of the page when it opens. */
.info-pop { position: relative; display: inline-flex; }
.info-pop-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
}
.info-pop-button:hover,
.info-pop-button[aria-expanded="true"] { color: var(--text); border-color: var(--auth-accent, var(--primary, var(--accent, var(--gold)))); }
.info-pop-panel {
    position: absolute;
    z-index: 70;
    display: grid;
    gap: var(--space-1);
    width: max-content;
    max-width: min(20rem, 78vw);
    padding: var(--space-3);
    font-weight: 400;
    font-size: .875rem;
    line-height: 1.25rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: .75rem;
    box-shadow: var(--shadow);
}
.auth-panel .info-pop-button { width: 1.5rem; height: 1.5rem; }
.auth-panel .info-pop-button svg { width: .875rem; height: .875rem; }

/* Every button, full width: the one action filled, the others not. */
.auth-panel .button {
    box-sizing: border-box;
    width: 100%;
    height: var(--auth-control);
    min-height: var(--auth-control);
    padding: 0 var(--space-5);
    justify-content: center;
    border-radius: 999px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.5rem;
}

/* A choice: the box, then its words. */
.auth-panel .check {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    margin: 0;
    font-size: .9375rem;
    font-weight: 400;
    line-height: 1.5rem;
}
.auth-panel .check input { flex: none; width: 1.125rem; height: 1.125rem; margin: .1875rem 0 0; }

/* The same gutter round the card on every surface's sign-in page, and the
   same width for the card a shop's lock screen stands on. */
.login-page { padding: var(--space-5); }
.lock-screen .auth-panel { max-width: 28rem; }

@media (max-width: 30rem) {
    .auth-panel { padding: var(--space-5); }
}
