/* Shared by the login, register, account and change-password pages.
   Builds on the tokens in site.css. */

.auth {
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Near the top rather than centred, so the form is in view straight away */
    padding: clamp(24px, 6vh, 64px) 16px 32px;
}

.auth-card {
    width: 100%;
    max-width: 360px;
    padding: 26px 24px 22px;
    animation: fadeUp 0.4s var(--ease) both;
}

.auth-brand {
    display: block;
    margin-bottom: 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
}

.auth-card h1 {
    margin: 0 0 4px;
    text-align: center;
    font-size: 1.3rem;
    font-weight: 650;
    letter-spacing: -0.02em;
}

.auth-sub {
    margin: 0 0 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.92rem;
}

/* --- Error --- */
.auth-error {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    margin-bottom: 16px;
    padding: 8px 11px;
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #f87171;
    font-size: 0.88rem;
    animation: shake 0.35s var(--ease);
}

html[data-theme="light"] .auth-error {
    color: #b91c1c;
}

/* --- Form --- */
.field {
    margin-bottom: 14px;
}

.field label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.85rem;
    font-weight: 600;
}

.field input {
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    font-size: 0.95rem;
    color: inherit;
    font: inherit;
    transition:
        border-color 0.2s var(--ease),
        box-shadow 0.2s var(--ease);
}

.field input:focus {
    outline: none;
    border-color: var(--text-muted);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--text-muted) 20%, transparent);
}

.field .hint {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 0.78rem;
}

.auth-submit {
    width: 100%;
    margin-top: 4px;
    padding: 9px;
    border: 0;
    border-radius: 8px;
    background: var(--ink);
    color: var(--ink-text);
    font: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.2s var(--ease), transform 0.1s var(--ease);
}

.auth-submit:hover {
    opacity: 0.88;
}

.auth-submit:active {
    transform: scale(0.98);
}

.auth-alt {
    margin: 18px 0 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.88rem;
}

.auth-alt a {
    color: var(--text-color);
    font-weight: 600;
    text-decoration: none;
}

.auth-alt a:hover {
    text-decoration: underline;
}

/* --- Account --- */
.profile {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 18px;
}

.avatar {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    border-radius: 50%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 1.15rem;
    font-weight: 600;
    text-transform: uppercase;
}

.profile h1 {
    margin: 0;
}

.details {
    margin: 0 0 18px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.9rem;
    overflow: hidden;
}

.details div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 9px 12px;
}

.details div + div {
    border-top: 1px solid var(--border);
}

.details dt {
    color: var(--text-muted);
    white-space: nowrap;
}

.details dd {
    margin: 0;
    font-weight: 500;
    text-align: right;
    min-width: 0;
    overflow-wrap: anywhere;
}

.details .mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.8rem;
    font-weight: 400;
}

.actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.actions form {
    margin: 0;
}

.action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 0.92rem;
    text-decoration: none;
    text-align: left;
    cursor: pointer;
    transition:
        border-color 0.2s var(--ease),
        transform 0.1s var(--ease);
}

.action::after {
    content: "›";
    color: var(--text-muted);
    font-size: 1.2rem;
    line-height: 1;
}

.action:hover {
    background: var(--surface-2);
}

.action:active {
    transform: scale(0.98);
}

.action.danger {
    color: #f87171;
}

html[data-theme="light"] .action.danger {
    color: #b91c1c;
}

.action.danger:hover {
    border-color: rgba(239, 68, 68, 0.5);
}

@keyframes shake {
    20%, 60% { transform: translateX(-4px); }
    40%, 80% { transform: translateX(4px); }
}
