/* ==========================================================================
   Register page: only what the sign-up form has, on top of the shared card
   --------------------------------------------------------------------------
   assets/css/auth-modern.css draws the card and everything the sign-in
   pages share: title and lede, alerts, fields, help and error text, the
   show/hide password button, the referral disclosure (.auth-more), the human
   check and the button. This file, loaded by register.php alone through
   $page_styles after it, adds the account-type cards, the invited-by
   notice, the terms line and the "check your email" step after signing up.
   Colours are the --auth-* tokens auth-modern.css sets on .form-page.

   From 700px wide the form card (.reg-card--wide) is twice the login card's
   width and the fields sit in two columns, so the whole form fits on one
   screen: Username | Email, Password | Confirm, Referral | Human check. The
   fields stay in reading order in the HTML, so Tab still runs left to right,
   top to bottom. The "check your email" step keeps the narrow card.
   ========================================================================== */

/* ---------- invited by (?ref= or the referral cookie names a member) ---------- */
.reg-invite {
    display: flex;
    align-items: center;
    gap: 11px;
    margin: 0 0 20px;
    padding: 11px 14px;
    border: 1px solid rgba(46, 230, 160, 0.3);
    border-left: 3px solid var(--auth-success);
    background: var(--auth-success-soft);
    font-size: .98rem;
    font-weight: 500;
    color: var(--auth-ink);
}
.reg-invite i { flex: none; color: var(--auth-success); }
.reg-invite p { margin: 0; }
.reg-invite strong { color: #ffffff; }

/* ---------- account type ---------- */
.reg-roles {
    min-width: 0;
    margin: 0 0 20px;
    padding: 0;
    border: 0;
}
/* Same cut as a field label (.form-group > label in auth-modern.css) */
.reg-roles legend {
    float: none;
    width: auto;
    margin: 0 0 7px;
    padding: 0;
    font-family: var(--auth-font);
    font-size: .95rem;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: .02em;
    color: var(--auth-ink);
}
.reg-roles__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.reg-role {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    padding: 13px 14px 14px;
    border: 1px solid var(--auth-line-2);
    background: var(--auth-inset);
    cursor: pointer;
    transition: border-color .15s ease, background-color .15s ease;
}
/* The radio stays in the page for keyboards and screen readers, laid
   transparently over the whole card, so a tap anywhere on it is a tap on
   the radio itself; the card draws the state. */
.reg-role input {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}
/* The radio dot in the corner */
.reg-role::after {
    content: "";
    position: absolute;
    top: 12px;
    right: 12px;
    width: 14px;
    height: 14px;
    border: 1px solid var(--auth-line-strong);
    border-radius: 50%;
}
.reg-role__icon { font-size: 1.1rem; line-height: 1; color: var(--auth-accent); }
.reg-role__title {
    margin-top: 6px;
    font-family: var(--auth-display);
    font-size: .88rem;
    font-weight: 700;
    letter-spacing: .02em;
    line-height: 1.3;
    color: #ffffff;
}
.reg-role__text { font-size: .92rem; font-weight: 500; line-height: 1.4; color: var(--auth-ink-2); }
.reg-role:hover { border-color: var(--auth-line-strong); }
.reg-role:has(input:checked),
.reg-role.is-checked {
    border-color: var(--auth-accent);
    background: rgba(0, 255, 255, 0.07);
    box-shadow: inset 0 0 0 1px var(--auth-accent);
}
.reg-role:has(input:checked)::after,
.reg-role.is-checked::after {
    border-color: var(--auth-accent);
    background: var(--auth-accent);
    box-shadow: inset 0 0 0 3px var(--auth-inset);
}
.reg-role:has(input:checked) .reg-role__text,
.reg-role.is-checked .reg-role__text { color: #cfd6df; }
.reg-role:has(input:focus-visible) {
    outline: 2px solid var(--auth-accent);
    outline-offset: 2px;
}
/* The note on what the choice means comes before the cards (on the legend's
   line in the wide card) */
.reg-roles .auth-help { margin: 0 0 9px; }

/* ---------- terms line under the button ---------- */
.reg-terms {
    margin: 12px 0 0;
    text-align: center;
    font-size: .88rem;
    font-weight: 500;
    line-height: 1.5;
    color: var(--auth-ink-2);
}
.reg-terms a { color: var(--auth-accent); font-weight: 600; text-decoration: none; white-space: nowrap; }
.reg-terms a:hover { color: #ffffff; text-decoration: underline; text-underline-offset: 3px; }
.reg-terms a:focus-visible { outline: 2px solid var(--auth-accent); outline-offset: 2px; }

/* ---------- after sign-up: check your email (register?done=1) ---------- */
.reg-done__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin: 0 auto 14px;
    border: 1px solid var(--auth-line-strong);
    background: rgba(0, 255, 255, 0.07);
    font-size: 1.45rem;
    color: var(--auth-accent);
}
.reg-done__icon--warn {
    border-color: rgba(255, 194, 71, 0.5);
    background: var(--auth-warning-soft);
    color: var(--auth-warning);
}
.reg-done__head .auth-lede { max-width: 44ch; }
.reg-done__head .auth-lede strong { color: #ffffff; overflow-wrap: anywhere; }

.reg-steps {
    display: grid;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: reg-step;
}
.reg-steps li {
    position: relative;
    min-height: 30px;
    padding: 3px 0 0 44px;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.5;
    color: var(--auth-ink-2);
    counter-increment: reg-step;
}
.reg-steps li::before {
    content: counter(reg-step);
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 1px solid var(--auth-line-strong);
    background: rgba(0, 255, 255, 0.05);
    font-family: var(--auth-display);
    font-size: .78rem;
    font-weight: 700;
    color: var(--auth-accent);
}
.reg-steps strong { color: #ffffff; }
/* The button is a link here: the glass look comes from .form-styled .btn-primary.btn-block */
.reg-done__actions .btn { text-decoration: none; }
.reg-done__more {
    margin: 24px 0 0;
    padding: 16px 0 0;
    border-top: 1px solid var(--auth-line);
    text-align: center;
}
.reg-done__more p { margin: 0; font-size: .95rem; font-weight: 500; line-height: 1.5; color: var(--auth-ink-2); }
.reg-done__more p + p { margin-top: 8px; }
.reg-done__more a { font-weight: 700; color: var(--auth-accent); text-decoration: none; }
.reg-done__more a:hover { color: #ffffff; text-decoration: underline; text-underline-offset: 3px; }
.reg-done__more a:focus-visible { outline: 2px solid var(--auth-accent); outline-offset: 2px; }

/* ---------- wide card: two columns from 700px ---------- */
@media (min-width: 700px) {
    /* Twice the login card, with a little less air above and below than a
       card with one column of fields needs */
    .form-page .widget.reg-card--wide { max-width: 920px; }
    .form-page .reg-card--wide .widget-header { padding: 16px 32px 13px; }
    .reg-card--wide .auth-lede { max-width: none; margin-top: 6px; }
    .form-page .reg-card--wide .widget-content { padding: 16px 32px 22px; }
    .form-page .reg-card--wide .alert,
    .reg-card--wide .reg-invite { margin-bottom: 16px; }

    .reg-card--wide .reg-form {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: 20px;
        align-items: start;
    }
    .reg-card--wide .reg-form > :is(.reg-roles, .btn, .reg-terms) { grid-column: 1 / -1; }
    .form-page .reg-card--wide .reg-form > .form-group { margin: 0 0 12px; }
    .reg-card--wide .reg-form > .form-group > .auth-help { margin-top: 4px; }

    /* Account type: the note on the legend's line, the two cards under it */
    .reg-card--wide .reg-roles { margin-bottom: 13px; }
    .reg-card--wide .reg-roles legend { float: left; margin: 0 20px 7px 0; }
    /* clear: Bootstrap's reboot has legend + * { clear: left } */
    .reg-card--wide .reg-roles .auth-help { clear: none; margin: 0 0 7px; line-height: 1.4; text-align: right; }
    .reg-card--wide .reg-roles__grid { clear: both; gap: 12px; }
    /* Each card on two lines: the icon at the left, the radio dot at the right */
    .reg-card--wide .reg-role {
        display: grid;
        grid-template-columns: 24px minmax(0, 1fr);
        align-items: center;
        /* The shorter of the two cards keeps its lines together */
        align-content: center;
        column-gap: 12px;
        row-gap: 1px;
        padding: 9px 42px 9px 14px;
    }
    .reg-card--wide .reg-role__icon { grid-row: 1 / 3; font-size: 1.2rem; text-align: center; }
    .reg-card--wide .reg-role__title { margin-top: 0; }
    .reg-card--wide .reg-role::after { top: calc(50% - 7px); right: 14px; }

    /* Referral | human check: one row, both boxes the same height */
    .reg-card--wide .reg-form > .auth-more,
    .form-page .reg-card--wide .reg-form > .auth-human { margin-bottom: 0; }
    .reg-card--wide .reg-form > .auth-more > summary { min-height: 54px; }
    .form-page .reg-card--wide .form-styled .auth-human { padding: 4px 4px 4px 14px; }

    .form-page .reg-card--wide .reg-form.form-styled .btn-primary.btn-block { margin-top: 14px; }
    .reg-card--wide .reg-terms { margin-top: 10px; }
    .form-page .reg-card--wide .form-footer { margin-top: 18px; padding-top: 14px; }
}
/* With the desktop header, the gap the site keeps under the fixed header
   (body padding in header.css) is enough: the card starts there */
@media (min-width: 901px) {
    body.auth-register main.main-content.form-page { padding-top: 0 !important; }
}

/* ---------- one column (under 700px): the same card, a little tighter ---------- */
/* Fields, the referral question and the button keep their full height
   (46px and more), and the inputs their 1.05rem text */
@media (max-width: 699px) {
    .form-page .reg-card .widget-header { padding-top: 18px; padding-bottom: 14px; }
    .form-page .reg-card .widget-content { padding-top: 18px; }
    .reg-roles { margin-bottom: 16px; }
    /* The icon beside the title instead of on a line of its own */
    .reg-role {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        align-items: center;
        align-content: start;
        column-gap: 8px;
        row-gap: 5px;
    }
    .reg-role__title { margin-top: 0; padding-right: 18px; }
    .reg-role__text { grid-column: 1 / -1; }
    .form-page .reg-form.form-styled > .form-group,
    .reg-form > .auth-more { margin-bottom: 16px; }
    .form-page .reg-form.form-styled .auth-human { padding: 8px 8px 8px 14px; }
    .form-page .reg-form.form-styled .btn-primary.btn-block { margin-top: 18px; }
    .form-page .reg-card .form-footer { margin-top: 20px; padding-top: 14px; }
}

/* ---------- phones ---------- */
@media (max-width: 420px) {
    .reg-roles__grid { gap: 8px; }
    .reg-role { padding: 11px 12px 12px; }
    .reg-role::after { top: 10px; right: 10px; }
    .reg-role__title { font-size: .82rem; }
    .reg-role__text { font-size: .9rem; }
}

@media (prefers-reduced-motion: reduce) {
    .reg-role { transition: none; }
}
