/* ============================================================================
   Breeze — 18 · COMPOSITING BUDGET
   ----------------------------------------------------------------------------
   Why this file exists: a 24–40px backdrop blur on the shell's full-height
   columns is re-rastered by the compositor every frame, and again any time a
   layer in front of it animates. Measured with design_notes/fps.js (60 rows,
   40 messages, 1440×900) the blurred shell sat at 33ms frames — 30fps — in
   *every* phase, including idle, with spikes to 83ms while scrolling:

       phase    base            backdrop-filter off
       idle     33.3ms / 50ms  16.7ms / 16.7ms
       list     33.3ms / 50ms  16.7ms / 16.7ms
       chat     33.4ms / 50ms  16.7ms / 16.7ms
       switch   33.3ms / 50ms  16.7ms / 16.7ms

   Backdrop blur was the entire cost (removing box-shadows changed nothing), and
   it is invisible at these very low background opacities: the fills below are
   the same colour, just opaque enough not to need the blur, so the shell keeps
   its pearl-glass look while the compositor does nothing per frame.

   The frosted treatment stays where it is actually legible and short-lived —
   popovers, menus, modals, toasts, the image viewer, the call window — where a
   single open/close is worth the blur.
   ========================================================================== */

/* ---- always-on chrome: fill, no blur ------------------------------------ */

.bz-topbar,
.chat-header {
    background: rgba(252, 253, 252, 0.94);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.bz-footbar {
    background: rgba(250, 252, 250, 0.94);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.wechat-rail {
    background: rgba(249, 251, 249, 0.95);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.sidebar {
    background: rgba(250, 252, 250, 0.93);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.detail-panel {
    background: rgba(252, 253, 252, 0.96);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

/* the composer keeps its plate and shadow, it just stops paying for a 32px
   blur behind text that is already 90% opaque */
.input-area {
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

/* tooltips ride along with the chrome they belong to */
.rail-btn::after,
.icon-btn::after,
.header-icon::after,
.tool-btn::after {
    background: rgba(25, 31, 26, 0.9);
    backdrop-filter: none;
}

/* this stamp scrolls *with* the message list, so it would re-blur every frame */
.message .bubble.is-image .msg-time {
    background: rgba(25, 31, 26, 0.58);
    backdrop-filter: none;
}

.scroll-bottom-btn {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: none;
}

/* ---- genuinely floating surfaces: keep the frost, spend less on it ------ */
/* radii are trimmed one step; at 24–28px the edge of a popover looks the same
   as at 40px, and the raster cost falls with the radius */

.modal-box {
    backdrop-filter: blur(26px) saturate(150%);
    -webkit-backdrop-filter: blur(26px) saturate(150%);
}

#change-avatar-modal .modal-box {
    backdrop-filter: blur(26px) saturate(150%);
    -webkit-backdrop-filter: blur(26px) saturate(150%);
}

.auth-card {
    backdrop-filter: blur(22px) saturate(140%);
    -webkit-backdrop-filter: blur(22px) saturate(140%);
}

.video-call-window {
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
}

/* ---- motion that costs nothing -----------------------------------------
   Signal dot: the halo used to be a box-shadow on the dot's own layer, and the
   dot sat inside the blurred topbar, so the loop repainted the whole plate on
   every frame. The halo is now a ring in a pseudo-element that only ever
   animates opacity and transform — the two properties the compositor can move
   without touching a single pixel of layout or paint. It also fixes the old
   side effect where `bz-breathe` was redefined further down the sheet and the
   dot quietly bobbed up and down instead of pulsing. */

.bz-sync-dot {
    position: relative;
    animation: none;
    box-shadow: none;
}

.bz-sync-dot::after {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: 50%;
    border: 1px solid rgba(88, 161, 115, 0.55);
    animation: bz-halo 3.4s var(--bz-ease-soft) infinite;
    pointer-events: none;
}

.bz-sync-pill[data-state="slow"] .bz-sync-dot::after {
    border-color: rgba(181, 117, 31, 0.6);
}

.bz-sync-pill[data-state="heavy"] .bz-sync-dot::after,
.bz-sync-pill[data-state="stalled"] .bz-sync-dot::after {
    border-color: rgba(186, 26, 26, 0.6);
    animation: none;
    opacity: 0.9;
}

@keyframes bz-halo {
    0% { opacity: 0.85; transform: scale(1); }
    70% { opacity: 0; transform: scale(2.6); }
    100% { opacity: 0; transform: scale(2.6); }
}

/* ---- interaction feel: snap where Telegram snaps ------------------------
   `scroll-behavior: smooth` turns every jump — picking a conversation, jumping
   to the newest message, revealing a quoted message — into a multi-hundred-ms
   animated scroll that competes with the entrance animation. The transcript and
   the row list now land where they were told to land, immediately. */

.user-list,
#chat-window,
.chat-window,
.messages {
    scroll-behavior: auto;
}

/* A conversation change re-renders the whole transcript, so *all* entries used
   to rise together: forty overlapping 420ms animations that read as the UI
   being sluggish. Only the newest entry rises now, and it does so in 240ms. */

.message {
    animation: none;
}

.message:last-child {
    animation: bz-rise 240ms var(--bz-ease) both;
}

/* ---- drawers arrive, they do not pop -----------------------------------
   The resonance drawer changes its grid column width, which is layout, so it
   cannot be animated without relaying out the whole shell 24 times. The width
   snap stays instantaneous and the panel itself slides in on the compositor,
   which is what the eye actually reads as the motion. */

.detail-panel.is-open {
    animation: bz-drawer-in 240ms var(--bz-ease) both;
}

@keyframes bz-drawer-in {
    from { opacity: 0; transform: translateX(14px); }
    to { opacity: 1; transform: none; }
}

/* ---- press feedback ---------------------------------------------------
   A pointer-down should be acknowledged on the very next frame. Every one of
   these is a scale on an already-composited layer, so the whole set is free. */

.rail-btn:active,
.icon-btn:active,
.header-icon:active,
.tool-btn:active,
.bz-chip:active,
.chip:active,
.func-item:active,
.list-chip:active {
    transform: scale(0.96);
}

.user-item:active {
    background: rgba(56, 82, 68, 0.07);
}

@media (prefers-reduced-motion: reduce) {
    .detail-panel.is-open {
        animation: none;
    }
}

/* ---- hover that stays on the compositor --------------------------------
   Every row transitioned box-shadow, so moving the mouse across the list asked
   the rasterizer for a fresh 66px-tall layer per row. The inset hairline can
   simply appear; the background cross-fade carries the hover cue. */

.user-item {
    transition: background-color var(--bz-dur-fast) var(--bz-ease),
                transform var(--bz-dur-fast) var(--bz-ease);
}

@media (prefers-reduced-motion: reduce) {
    .bz-sync-dot::after {
        animation: none;
        opacity: 0.8;
    }
}
