/* ==========================================================================
   Avatar Frame Shop — site-wide stylesheet.

   Shipped on every page (the injection slot asks for it whenever our HTML is
   filled in), so it holds nothing but the frame geometry.

   The product sizes `.ls-avatar-frame` in its PC stylesheet only; the mobile
   one just says `pointer-events: none`. Restating it here, keyed on the
   product's own `--ls-avatar-frame-scale` variable, is what makes one rule
   cover both ends — and keeps frames drawn by the `user.decorate` path looking
   identical to frames this module injects itself.

   The profile cover avatars live outside `.ls-avatar`, in whichever module
   draws that page, so they get their own block below.
   ========================================================================== */

.ls-avatar > .ls-avatar-frame {
    position: absolute;
    left: 50%;
    top: 50%;
    width: calc(100% * var(--ls-avatar-frame-scale, 1.6));
    height: calc(100% * var(--ls-avatar-frame-scale, 1.6));
    transform: translate(-50%, -50%);
    display: block;
    pointer-events: none;
    z-index: 3;
}

.ls-avatar > .ls-avatar-frame img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    border: 0;
    border-radius: 0;
    background: none;
}

/* A frame is deliberately drawn outside the avatar box, so the box itself must
   not clip it. Only ever applied to avatars this module decorated. */
.ls-avatar.rclao-af {
    position: relative;
    overflow: visible !important;
}

/* ------------------------------------------------- profile cover avatars -- */

/* PC bento profile. `.rcbu-av` is the 76px circle in the cover's caption; the
   module's own sheet only positions it, so the frame geometry is stated here.
   Scoped on `.rclao-af` (added at paint time) so this beats any later-loaded
   rule of equal specificity. */
.rcbu-av.rclao-af {
    position: relative;
    overflow: visible !important;
}

.rcbu-av.rclao-af > .ls-avatar-frame {
    position: absolute;
    left: 50%;
    top: 50%;
    width: calc(100% * var(--ls-avatar-frame-scale, 1.6));
    height: calc(100% * var(--ls-avatar-frame-scale, 1.6));
    transform: translate(-50%, -50%);
    display: block;
    pointer-events: none;
    z-index: 2;
}

/* Mobile xhs profile. The module already ships this rule, but without a
   fallback for the scale variable — an avatar that carries no scale would get
   `calc(100% * )`, which is invalid and hides the frame. Same geometry, one
   fallback, and specific enough to win wherever it loads. */
.powell-xhs-profile-avatar.rclao-af {
    position: relative;
    overflow: visible !important;
}

.powell-xhs-profile-avatar.rclao-af > .ls-avatar-frame {
    position: absolute;
    left: 50%;
    top: 50%;
    width: calc(100% * var(--ls-avatar-frame-scale, 1.6));
    height: calc(100% * var(--ls-avatar-frame-scale, 1.6));
    transform: translate(-50%, -50%);
    display: block;
    pointer-events: none;
    z-index: 1;
}

.rcbu-av.rclao-af > .ls-avatar-frame img,
.powell-xhs-profile-avatar.rclao-af > .ls-avatar-frame img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    border: 0;
    border-radius: 0;
    background: none;
}

/* ------------------------------------------------- mobile chat bubble avatars */

/* The chat route ships the decor-only bundle (frontend/module.js): core.js
   paints frames there, but the shop sheet never loads on that route, so this
   geometry has to live here - in the sheet the host injects on every page -
   or the frame lands in flow, printed under the avatar. z-index 2 keeps it
   over the picture yet under the online dot (3) and the verify badge (10),
   which the theme anchors to the same box. */
.ls-chat-msg-avatar.rclao-af {
    position: relative;
    overflow: visible !important;
}

.ls-chat-msg-avatar.rclao-af > .ls-avatar-frame {
    position: absolute;
    left: 50%;
    top: 50%;
    width: calc(100% * var(--ls-avatar-frame-scale, 1.6));
    height: calc(100% * var(--ls-avatar-frame-scale, 1.6));
    transform: translate(-50%, -50%);
    display: block;
    pointer-events: none;
    z-index: 2;
}

.ls-chat-msg-avatar.rclao-af > .ls-avatar-frame img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    border: 0;
    border-radius: 0;
    background: none;
}

/* The slot anchor: present so the host ships our assets, invisible everywhere. */
.rclao-af-anchor {
    display: none !important;
    width: 0;
    height: 0;
    visibility: hidden;
}
