/* auth pages (2026-11 redesign). Loaded site-wide after shell.css.
   Sign in, sign up, 2FA, email verification, password reset/change,
   forgot username, lockout, forum sign-out. Everything is scoped under
   .auth so the older .auth-page / .form rules used by other groups'
   templates stay untouched. Tokens only. */

.auth {
    max-width: 420px;
    margin: 0 auto;
    padding: 1rem 0 3rem;
}
.auth .page-head { margin-bottom: 1.5rem; }
.auth .page-head h1 { font-size: var(--fs-h2); }
.auth .page-lede strong { color: var(--text); }
.auth p { max-width: none; }

/* ---------- Notices above the form ---------- */
.auth-note {
    margin: 0 0 1.5rem;
    padding: 0.875rem 1rem;
    border: 1px solid var(--border);
    border-left: 4px solid var(--amber-fill);
    border-radius: var(--radius-md);
    background: var(--amber-soft);
    color: var(--text);
}
.auth-note p { margin: 0; }
.auth-note form { margin: 0.5rem 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.5rem; }
.auth-note .btn-link { padding: 0; border: 0; background: none; color: var(--amber-text); cursor: pointer; font: inherit; font-weight: 600; text-decoration: underline; }
.auth .error-summary ul { list-style: none; margin: 0; padding: 0; }
.auth .error-summary li + li { margin-top: 0.25rem; }
.auth .error-summary:focus { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---------- Form fields ---------- */
.auth-form { display: flex; flex-direction: column; gap: 1.25rem; margin: 0; }
.auth-form .field { display: flex; flex-direction: column; margin: 0; }
.auth-form .field[hidden] { display: none; }
.auth-form .field > label,
.auth-form .field-label {
    display: block;
    margin: 0 0 0.375rem;
    font-family: var(--font-sans);
    font-size: var(--fs-body);
    font-weight: 600;
    color: var(--text);
    text-transform: none;
    letter-spacing: normal;
}
.auth-form input[type="text"],
.auth-form input[type="email"],
.auth-form input[type="password"],
.auth-form select {
    width: 100%;
    box-sizing: border-box;
    padding: 0.625rem 0.875rem;
    font-family: var(--font-sans);
    border: 1px solid var(--field-border);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text);
    box-shadow: none;
}
.auth-form input:focus,
.auth-form select:focus { border-color: var(--accent); box-shadow: none; }
.auth-form .field-hint,
.auth-form .helptext { margin-top: 0.375rem; }
.auth-form .helptext ul { margin: 0.25rem 0 0; padding-left: 1.25rem; }
.auth-form .helptext li { margin: 0.125rem 0; }
.auth-form .field.has-error input,
.auth-form .field.has-error select { border-color: var(--danger); border-width: 2px; }

/* Field-level error: icon + text above the input (GOV.UK order). */
.auth .errorlist,
.auth-form .errorlist {
    list-style: none;
    margin: 0 0 0.375rem;
    padding: 0;
    background: none;
    border: 0;
    border-radius: 0;
    color: var(--danger);
    font-size: var(--fs-small);
    font-weight: 600;
}
.auth .errorlist li { display: flex; gap: 0.375rem; align-items: flex-start; }
.auth .errorlist li::before {
    content: "";
    flex: none;
    width: 4px;
    align-self: stretch;
    border-radius: 2px;
    background: var(--danger);
}

/* Live check feedback (username, display name, email, password match).
   The inline script sets data-state and the hidden attribute. */
.live-feedback { display: block; margin-top: 0.375rem; font-size: var(--fs-small); color: var(--text-2); }
.live-feedback[hidden] { display: none; }
.live-feedback[data-state="ok"] { color: var(--accent-deep); font-weight: 600; }
[data-theme="dark"] .live-feedback[data-state="ok"] { color: var(--accent-2); }
.live-feedback[data-state="error"] { color: var(--danger); font-weight: 600; }
.live-feedback[data-state="info"] { color: var(--text-2); }

/* ---------- Password rules checklist (signup) ---------- */
.pw-rules {
    list-style: none;
    margin: 0.625rem 0 0;
    padding: 0;
    font-size: var(--fs-small);
    color: var(--text-2);
}
.pw-rules li { display: flex; align-items: center; gap: 0.5rem; padding: 0.125rem 0; max-width: none; }
.pw-rules .rule-mark {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border: 2px solid var(--field-border);
    border-radius: 50%;
    box-sizing: border-box;
}
.pw-rules .rule-mark svg { display: none; }
.pw-rules li.satisfied { color: var(--accent-deep); }
[data-theme="dark"] .pw-rules li.satisfied { color: var(--accent-2); }
.pw-rules li.satisfied .rule-mark { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.pw-rules li.satisfied .rule-mark svg { display: block; }

/* ---------- Show/hide password (from _password_toggle.html) ---------- */
.pw-wrap { position: relative; display: block; }
.pw-wrap input,
.form .pw-wrap input[type="password"],
.form .pw-wrap input[type="text"],
.auth-form .pw-wrap input[type="password"],
.auth-form .pw-wrap input[type="text"] { padding-right: 4.75rem; }
.pw-toggle {
    position: absolute;
    top: 50%;
    right: 2px;
    transform: translateY(-50%);
    min-width: var(--tap);
    min-height: 40px;
    padding: 0 0.75rem;
    border: 0;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--accent-deep);
    font: inherit;
    font-size: var(--fs-small);
    font-weight: 600;
    cursor: pointer;
}
[data-theme="dark"] .pw-toggle { color: var(--accent-2); }
.pw-toggle:hover { background: var(--surface-hi); }

/* ---------- Terms checkbox (signup clickwrap) ---------- */
.terms-consent {
    padding: 0.875rem 1rem;
    border: 1px solid var(--field-border);
    border-radius: var(--radius-md);
    background: var(--surface);
}
.terms-consent label {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    margin: 0;
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: var(--fs-small);
    font-weight: 400;
    line-height: 1.55;
    color: var(--text);
    text-transform: none;
    letter-spacing: normal;
}
.terms-consent input[type="checkbox"] { flex: none; margin: 0.125rem 0 0; }
.terms-consent .errorlist { margin: 0.75rem 0 0; }

.cf-turnstile { margin: 0; min-height: 0; }

/* ---------- One-time code inputs ---------- */
.auth-form input.code-input {
    font-family: var(--font-mono);
    font-size: var(--fs-large);
    letter-spacing: 0.3em;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.auth-form input.code-input--backup { letter-spacing: 0.15em; text-transform: uppercase; }

/* ---------- Primary action + secondary links ---------- */
.auth-form .btn { width: 100%; justify-content: center; }
.auth-actions { margin: 1.5rem 0 0; }
.auth-actions .btn { width: 100%; justify-content: center; }
.auth-links {
    list-style: none;
    margin: 1.5rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: var(--fs-body);
    color: var(--text-2);
}
.auth-links li { max-width: none; }
.auth-links a,
.auth-links .btn-link {
    display: inline-flex;
    align-items: center;
    min-height: var(--tap);
    color: var(--accent-deep);
    font-weight: 500;
}
[data-theme="dark"] .auth-links a,
[data-theme="dark"] .auth-links .btn-link { color: var(--accent-2); }
.auth-links form { display: inline; margin: 0; }
.auth-links .btn-link {
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    font-weight: 500;
    cursor: pointer;
    text-decoration: underline;
}
.auth-links .with-label { display: flex; flex-wrap: wrap; align-items: center; gap: 0 0.375rem; }
.auth-hint { margin: 1rem 0 0; color: var(--text-2); font-size: var(--fs-small); }

/* Benefits below the login form: brief, never louder than the button. */
.auth-benefits {
    margin: 2.5rem 0 0;
    padding: 1.25rem 0 0;
    border-top: 1px solid var(--border);
    color: var(--text-2);
    font-size: var(--fs-small);
}
.auth-benefits h2 { margin: 0 0 0.5rem; font-size: var(--fs-body); color: var(--text); }
.auth-benefits ul { margin: 0; padding-left: 1.25rem; line-height: 1.6; }

.auth-body p { color: var(--text-2); line-height: 1.6; }
.auth-body p strong { color: var(--text); }

/* Phone keyboard overlap on the tall signup form: leave room to scroll the
   terms box, Turnstile and the button above the keyboard (paired with
   interactive-widget=resizes-content in base.html). */
@media (max-width: 599.98px) {
    .auth { padding-top: 0.5rem; }
    .auth--signup { padding-bottom: 55vh; }
}
