/* assets/css/nav-balance.css
   Live credit figure in the top bar.
   Loaded after nav.css; only touches the balance pill and the guest login link. */

.nav-right .user-chip {
    display: flex; align-items: center; gap: 8px;
    padding: 4px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    transition: border-color .14s ease, background-color .14s ease, transform .14s ease;
}
.nav-right .user-chip:hover { border-color: var(--sky-l, #bfdbfe); background: var(--bg-sky); }

/* the credit figure is the thing people glance at; give it weight and tabular digits
   so it does not jitter sideways when the amount changes */
.nav-right .balance { display: flex; flex-direction: column; line-height: 1.06; text-decoration: none; }
.nav-right .balance small { font-size: 9.5px; color: var(--ink-3); letter-spacing: .03em; }
.nav-right .balance b {
    font-size: 13.5px; font-weight: 700; color: var(--sky-d);
    font-variant-numeric: tabular-nums;
}

/* a top-up is good news — flash green; a purchase is neutral — flash grey */
.nav-right .balance.is-bump { animation: bal-up .9s cubic-bezier(.22,.68,.24,1); }
.nav-right .balance.is-down { animation: bal-down .9s cubic-bezier(.22,.68,.24,1); }

@keyframes bal-up {
    0%   { transform: none; }
    18%  { transform: translateY(-2px) scale(1.06); background: #dcfce8; border-radius: 8px; }
    55%  { transform: none; background: #dcfce8; }
    100% { background: transparent; }
}
@keyframes bal-down {
    0%   { transform: none; }
    18%  { transform: scale(.97); background: #f1f5f9; border-radius: 8px; }
    55%  { transform: none; background: #f1f5f9; }
    100% { background: transparent; }
}
html.theme-dark .nav-right .balance.is-bump { animation-name: bal-up-dark; }
@keyframes bal-up-dark {
    0%   { transform: none; }
    18%  { transform: translateY(-2px) scale(1.06); background: #123023; border-radius: 8px; }
    55%  { transform: none; background: #123023; }
    100% { background: transparent; }
}

/* guest: a plain login link instead of an avatar bubble */
.nav-login {
    font-size: 12.5px; font-weight: 600;
    color: var(--sky-d); text-decoration: none;
    padding: 4px 2px; white-space: nowrap;
}
.nav-login:hover { text-decoration: underline; }

@media (max-width: 480px) {
    .nav-right .user-chip { padding: 3px 9px; gap: 6px; }
    .nav-right .balance b { font-size: 12.5px; }
}

@media (prefers-reduced-motion: reduce) {
    .nav-right .balance.is-bump { animation: none; }
    .nav-right .balance.is-down { animation: none; }
}
