/* ══════════════════════════════════════════════════════════════
   ACCOUNTS
   The account control at the right of the top bar, the sign-in dialog
   (auth.js) and the password reset page. Tokens come from site.css.
   ══════════════════════════════════════════════════════════════ */

.auth-vh {
    position: absolute !important;
    width: 1px; height: 1px;
    margin: -1px; padding: 0; border: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ── Top bar: page controls sit right, the account control last ── */

/* Takes the line's spare room, so whatever follows sits at the right */
.top-gap { flex: 1 1 0; min-width: 0; height: 0; margin-left: -18px; }

.acct { position: relative; display: flex; align-items: center; flex: 0 0 auto; min-width: 0; }
.acct-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 32px;
    max-width: 100%;
    padding: 7px 12px;
    border: 1px solid var(--rule-2);
    color: var(--tan);
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: .16em;
    text-transform: uppercase;
    white-space: nowrap;
}
.acct-btn:hover, .acct-btn[aria-expanded="true"] { border-color: var(--bone); color: var(--bone); }
.acct-me { text-transform: none; letter-spacing: .04em; font-size: 11.5px; color: var(--bone); }
.acct-dot { flex: 0 0 auto; width: 6px; height: 6px; background: var(--gilt); box-shadow: 0 0 6px rgba(230,185,79,.6); }
.acct-name { overflow: hidden; text-overflow: ellipsis; max-width: 18ch; }
.acct-caret { flex: 0 0 auto; width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid var(--muted); }
.acct-btn[aria-expanded="true"] .acct-caret { transform: rotate(180deg); }

.acct-pop {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 2900;
    width: max-content;
    min-width: 220px;
    max-width: min(320px, calc(100vw - 32px));
    display: grid;
    gap: 3px;
    padding: 12px 14px 14px;
    box-shadow: 0 14px 34px rgba(0,0,0,.65);
}
.acct-pop .kicker { margin-bottom: 2px; }
.acct-who { font-size: 13px; color: var(--bone); overflow-wrap: anywhere; }
.acct-mail { font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
.acct-out { margin-top: 10px; justify-self: start; }

@media (pointer: coarse) {
    .acct-btn { min-height: 40px; }
}

/* Phones: the account control shares the first line with the wordmark */
@media (max-width: 600px) {
    .top > .brand { order: -2; }
    .top > .acct { order: -1; margin-left: auto; }
    .acct-btn { padding: 6px 10px; letter-spacing: .12em; }
    .acct-name { max-width: 9ch; }
}
@media (max-width: 480px) {
    .top > .brand .bs { width: min-content; }   /* "Biblical / World" on two short lines, to make room */
    .acct-me { gap: 6px; padding: 6px 8px; }
    .acct-me .acct-dot { display: none; }
    .acct-name { max-width: 8ch; }
}

/* ── The dialog ────────────────────────────────────────── */

html.auth-open { overflow: hidden; }

dialog.auth-dlg {
    position: fixed;
    inset: 0;
    margin: auto;
    width: min(440px, calc(100% - 32px));
    max-width: none;
    max-height: calc(100dvh - 32px);
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--bone);
    overflow: visible;
}
dialog.auth-dlg::backdrop { background: rgba(3, 4, 9, .76); }
dialog.auth-dlg:focus { outline: none; }

.auth-card {
    display: flex;
    flex-direction: column;
    max-height: inherit;
    font-family: var(--mono);
    box-shadow: 0 26px 70px rgba(0,0,0,.7), 0 0 0 1px rgba(230,185,79,.06);
}
.auth-ph { align-items: center; padding-right: 4px; }
.auth-x {
    width: 34px; height: 30px;
    display: grid; place-items: center;
    font-size: 20px; line-height: 1;
    color: var(--muted);
    font-weight: 400;
}
.auth-x:hover { color: var(--bone); }
.auth-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 20px 22px 18px; overscroll-behavior: contain; }

.auth-pane { display: grid; gap: 14px; }
.auth-h { margin: 0; font-family: var(--serif); font-weight: 500; font-size: 28px; line-height: 1.1; color: var(--bone); }
.auth-h[tabindex="-1"]:focus { outline: none; }   /* focused only so screen readers read the new state */
.auth-lede { margin: -6px 0 2px; font-family: var(--serif); font-size: 16.5px; line-height: 1.4; color: var(--tan); }

.auth-field { display: grid; gap: 6px; }
.auth-lab { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.auth-lab label { font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--tan); }
.auth-in { position: relative; }
.auth-in .field { font-size: 13px; padding: 10px 11px; min-height: 40px; border-radius: 0; }
.auth-in.pw .field { padding-right: 64px; }
.auth-in .field[aria-invalid="true"] { border-color: var(--signal); }
.auth-in .field[aria-invalid="true"]:focus { border-color: var(--gilt); box-shadow: inset 0 0 0 1px var(--signal); }
.auth-eye {
    position: absolute; top: 1px; right: 1px; bottom: 1px;
    min-width: 56px; padding: 0 10px;
    font-size: 10px; letter-spacing: .14em; text-transform: uppercase;
    color: var(--muted);
    border-left: 1px solid var(--rule);
}
.auth-eye:hover { color: var(--bone); }
.auth-eye:focus-visible { outline-offset: -2px; }
.auth-hint { margin: 0; font-size: 11px; color: var(--muted); }
.auth-err { margin: 0; font-size: 11.5px; color: #f08a68; }
.auth-err:empty, .auth-msg:empty, .auth-note:empty { display: none; }
.auth-err::before { content: "\25B2  "; font-size: 8px; vertical-align: 1px; }

.auth-msg {
    margin: 0;
    padding: 9px 11px;
    border-left: 2px solid var(--signal);
    background: rgba(224, 96, 59, .08);
    color: var(--bone);
    font-size: 12px;
}
.auth-note {
    display: grid;
    gap: 4px;
    padding: 12px 13px;
    border-left: 2px solid var(--gilt);
    background: rgba(230, 185, 79, .07);
    font-family: var(--serif);
    font-size: 16px;
    line-height: 1.45;
    color: var(--bone);
}
.auth-note strong { font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--gilt); }
.auth-ask { display: grid; gap: 14px; }

.auth-go { justify-content: center; width: 100%; min-height: 42px; padding: 11px 14px; font-size: 11px; font-weight: 600; letter-spacing: .18em; }
.auth-go.is-busy { cursor: progress; background: var(--gilt-dim); border-color: var(--gilt-dim); color: var(--black); }
.auth-go.is-busy::after {
    content: "";
    width: 8px; height: 8px;
    border: 1.5px solid currentColor;
    border-right-color: transparent;
}
@media (prefers-reduced-motion: no-preference) {
    .auth-go.is-busy::after { animation: auth-spin .7s linear infinite; }
    @keyframes auth-spin { to { transform: rotate(360deg); } }
}

.auth-alt { margin: 2px 0 0; padding-top: 12px; border-top: 1px solid var(--rule); font-size: 11.5px; color: var(--muted); }
.auth-link {
    color: var(--gilt);
    font-size: inherit;
    letter-spacing: .02em;
    text-decoration: underline;
    text-decoration-color: rgba(230,185,79,.45);
    text-underline-offset: 3px;
}
.auth-link:hover { text-decoration-color: var(--gilt); }
.auth-lab .auth-link { font-size: 10.5px; }

/* Phones: a full-width sheet from the bottom; 16px inputs so iOS doesn't zoom */
@media (max-width: 560px) {
    dialog.auth-dlg { width: 100%; max-height: 100dvh; margin: auto 0 0; }
    .auth-card { border-left: 0; border-right: 0; border-bottom: 0; }
    .auth-body { padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px)); }
    .auth-h { font-size: 25px; }
}
@media (max-width: 560px), (pointer: coarse) {
    .auth-in .field { font-size: 16px; min-height: 44px; }
    .auth-link { padding: 6px 0; }
    .auth-x { width: 44px; height: 40px; }
}

/* ── The reset page ────────────────────────────────────── */

.reset-wrap { flex: 1 0 auto; display: grid; justify-items: center; align-content: start; padding: 4vh 0 40px; }
.reset { width: min(460px, 100%); }
.reset .auth-body { overflow: visible; }
.reset-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.reset-acts .btn { min-height: 38px; padding: 9px 14px; }
