/* Sign-in and account pages */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.auth-card {
    max-width: 400px;
    margin: 60px auto;
    background: #fff;
    padding: 36px 28px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
.auth-card h1 {
    margin: 0 0 24px;
    font-size: 1.5em;
    text-align: center;
    color: var(--color-ink);
}
.auth-card form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.auth-label {
    font-size: 0.9em;
    color: var(--color-ink-light);
}
.auth-optional,
.auth-hint,
.account-muted {
    color: var(--color-ink-light);
    font-size: 0.9em;
}
.auth-hint {
    margin: 0;
}

.auth-input {
    width: 100%;
    box-sizing: border-box;
    padding: 12px;
    font-size: 1em;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    color: var(--color-ink);
}
.auth-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.auth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    color: var(--color-ink);
    font: inherit;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
}
.auth-btn:hover { background: #f7f7f7; }
.auth-btn:disabled { opacity: 0.6; cursor: default; }
.auth-btn-primary {
    background: var(--color-burgundy);
    border-color: var(--color-burgundy);
    color: #fff;
}
.auth-btn-primary:hover { background: #5e262d; }
.auth-btn-small {
    width: auto;
    padding: 6px 12px;
    font-size: 0.9em;
}
.auth-btn-danger { color: #b3261e; }
.account-danger { border: 1px solid #f1c4c0; }
.account-danger .auth-btn-danger { border-color: #b3261e; margin-top: 4px; }

/* A main button with a "?" beside it; the tip shows on hover, keyboard
   focus, or a tap (login.js toggles .open). */
.auth-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.auth-row > .auth-btn { flex: 1; }
.auth-help { position: relative; flex-shrink: 0; }
.auth-help-btn {
    width: 28px;
    height: 28px;
    border: 1px solid #ccc;
    border-radius: 50%;
    background: #fff;
    color: var(--color-ink-light);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    /* The serif face sets "?" off center in a small circle. */
    font: 600 15px/1 system-ui, sans-serif;
    cursor: help;
}
.auth-tip {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 10;
    width: min(300px, 80vw);
    padding: 10px 12px;
    border-radius: 6px;
    background: #2b2b2b;
    color: #fff;
    font-size: 0.85em;
    line-height: 1.45;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}
.auth-help:hover .auth-tip,
.auth-help:focus-within .auth-tip,
.auth-help.open .auth-tip { display: block; }
.auth-link {
    display: block;
    margin: 10px auto 0;
    padding: 0;
    border: 0;
    background: none;
    color: var(--color-burgundy);
    font: inherit;
    font-size: 0.9em;
    cursor: pointer;
    text-decoration: underline;
}
.auth-link:disabled { opacity: 0.6; cursor: default; }

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0;
    color: var(--color-ink-light);
    font-size: 0.85em;
}
.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    border-top: 1px solid #ddd;
}
.google-icon { flex-shrink: 0; }

.auth-section {
    margin-top: 18px;
    font-size: 0.95em;
}
.auth-section summary {
    cursor: pointer;
    color: var(--color-burgundy);
}
.auth-section form { margin-top: 12px; }

.auth-message {
    margin: 0 0 16px;
    padding: 10px 12px;
    border-radius: 4px;
    background: #fdecea;
    color: #8a1c14;
    font-size: 0.95em;
}
.auth-unsupported {
    color: var(--color-ink-light);
    text-align: center;
}

/* Account page */
.account-page {
    max-width: 680px;
    margin: 40px auto;
    padding: 0 16px;
}
.account-page h1 { margin-bottom: 20px; }
.account-section {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
    padding: 20px;
    margin-bottom: 20px;
}
.account-section h2 {
    margin: 0 0 14px;
    font-size: 1.15em;
}
.account-section > .auth-btn { width: auto; }
.account-next-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}
.account-next-links .auth-btn { width: auto; flex: 1 1 160px; }
.account-inline-form {
    display: flex;
    gap: 10px;
}
.account-inline-form .auth-btn { width: auto; }
.account-list {
    list-style: none;
    margin: 0 0 14px;
    padding: 0;
}
.account-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}
.account-item:last-child { border-bottom: none; }
.account-item-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    overflow-wrap: anywhere;
}
.account-item-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}
.account-tag {
    align-self: flex-start;
    font-size: 0.75em;
    padding: 1px 8px;
    border-radius: 10px;
    background: var(--color-cream);
    color: var(--color-ink);
}
.account-tag-current {
    background: var(--color-gold);
    color: #fff;
}
.account-notice,
.account-warning {
    padding: 12px 14px;
    border-radius: 6px;
    margin-bottom: 20px;
}
.account-notice { background: #e8f5e9; color: #1e4d22; }
.account-warning { background: #fff4e5; color: #6b3d00; border: 1px solid #f0c27a; }
.recovery-codes {
    margin-top: 12px;
}
.recovery-codes ol {
    columns: 2;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 1.05em;
    padding-left: 2em;
}
.recovery-codes .auth-btn {
    display: inline-flex;
    width: auto;
    margin-right: 8px;
}

@media (max-width: 520px) {
    .auth-card { margin: 24px auto; padding: 28px 18px; }
    .account-item { flex-direction: column; align-items: flex-start; }
    .account-inline-form { flex-direction: column; }
    .recovery-codes ol { columns: 1; }
}

/* Dark mode */
[data-theme="dark"] .auth-card,
[data-theme="dark"] .account-section {
    background: #131e2e;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}
[data-theme="dark"] .auth-input,
[data-theme="dark"] .auth-btn:not(.auth-btn-primary) {
    background: #1a2a3e;
    color: #e8e2d6;
    border-color: #2d4560;
}
[data-theme="dark"] .auth-btn:not(.auth-btn-primary):hover { background: #223550; }
[data-theme="dark"] .account-item { border-bottom-color: #2d4560; }
[data-theme="dark"] .auth-divider::before,
[data-theme="dark"] .auth-divider::after { border-top-color: #2d4560; }
[data-theme="dark"] .account-tag { background: #223550; color: #e8e2d6; }
[data-theme="dark"] .account-notice { background: #1d3a24; color: #cfe8d2; }
[data-theme="dark"] .account-warning { background: #3a2a10; color: #f3d9a8; border-color: #6b4a14; }
[data-theme="dark"] .auth-message { background: #3a1a18; color: #f4c7c3; }
[data-theme="dark"] .auth-help-btn { background: #1a2a3e; color: #e8e2d6; border-color: #2d4560; }
[data-theme="dark"] .auth-tip { background: #1a2a3e; color: #e8e2d6; border: 1px solid #2d4560; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5); }
/* styles.css gives every button a dark background: keep the primary
   button a primary (gold, as button.primary is site-wide) and the link a link. */
[data-theme="dark"] .auth-btn-primary,
[data-theme="dark"] .auth-btn-primary:hover {
    background: var(--color-gold);
    border-color: var(--color-gold);
    color: #0d1520;
}
[data-theme="dark"] .auth-link {
    background: none;
    border: 0;
    color: var(--color-burgundy);
}
[data-theme="dark"] .account-danger { border-color: #5a2a2e; }
[data-theme="dark"] .account-danger .auth-btn-danger { color: #f28b82; border-color: #f28b82; }
/* Links in account text use the site's link colors, not the browser's blue. */
.account-page a:not(.auth-btn) { color: var(--color-burgundy); }
[data-theme="dark"] .account-page a:not(.auth-btn) { color: var(--color-gold); }
