:root {
  /* Existing marketplace detail and mobile seller layouts already use 72px. */
  --tdc-profile-avatar-size: 72px;
}

/*
 * This is the authoritative avatar boundary. The declarations marked
 * !important intentionally defeat legacy page rules that assign independent
 * widths, heights, clipping, borders, and image fitting to avatar wrappers.
 */
html .tdc-framed-avatar {
  --tdc-avatar-photo-scale: 1;
  --tdc-photo-image-scale: 1;
  --tdc-frame-overlay-scale: 1;
  --tdc-avatar-offset-x: 0%;
  --tdc-avatar-offset-y: 0%;
  --tdc-frame-offset-x: 0%;
  --tdc-frame-offset-y: 0%;
  --tdc-frame-rotation: 0deg;
  --tdc-frame-safe-inset: 0%;
  position: relative !important;
  display: inline-grid !important;
  place-items: center !important;
  box-sizing: content-box !important;
  width: var(--tdc-profile-avatar-size) !important;
  min-width: var(--tdc-profile-avatar-size) !important;
  max-width: var(--tdc-profile-avatar-size) !important;
  height: var(--tdc-profile-avatar-size) !important;
  min-height: var(--tdc-profile-avatar-size) !important;
  max-height: var(--tdc-profile-avatar-size) !important;
  flex: 0 0 var(--tdc-profile-avatar-size) !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  overflow: visible !important;
  isolation: isolate;
  vertical-align: middle;
}

html .tdc-framed-avatar .tdc-framed-avatar__stage {
  position: relative !important;
  z-index: 0;
  display: block !important;
  box-sizing: border-box;
  width: var(--tdc-profile-avatar-size) !important;
  height: var(--tdc-profile-avatar-size) !important;
  min-width: var(--tdc-profile-avatar-size) !important;
  max-width: var(--tdc-profile-avatar-size) !important;
  min-height: var(--tdc-profile-avatar-size) !important;
  max-height: var(--tdc-profile-avatar-size) !important;
  border: 0 !important;
  border-radius: 0 !important;
  overflow: visible !important;
}

html .tdc-framed-avatar .tdc-framed-avatar__photo-mask {
  position: absolute !important;
  z-index: 1;
  inset: var(--tdc-frame-safe-inset) !important;
  display: block !important;
  overflow: hidden !important;
  background: var(--surface-pressed, #e6ebef);
  transform: translate(var(--tdc-avatar-offset-x), var(--tdc-avatar-offset-y)) scale(var(--tdc-avatar-photo-scale)) !important;
  transform-origin: center center !important;
}

html .tdc-framed-avatar .tdc-framed-avatar__photo,
html .tdc-framed-avatar .tdc-framed-avatar__frame {
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  right: auto !important;
  bottom: auto !important;
  display: block !important;
  width: 100% !important;
  min-width: 100% !important;
  max-width: none !important;
  height: 100% !important;
  min-height: 100% !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  object-position: center !important;
  transform-origin: center center !important;
}

html .tdc-framed-avatar .tdc-framed-avatar__photo {
  z-index: 1;
  transform: translate(-50%, -50%) scale(var(--tdc-photo-image-scale)) !important;
}

html .tdc-framed-avatar--fit-cover .tdc-framed-avatar__photo { object-fit: cover !important; }
html .tdc-framed-avatar--fit-contain .tdc-framed-avatar__photo { object-fit: contain !important; }

html .tdc-framed-avatar .tdc-framed-avatar__frame {
  z-index: 2 !important;
  object-fit: contain !important;
  pointer-events: none !important;
  transform: translate(-50%, -50%) translate(var(--tdc-frame-offset-x), var(--tdc-frame-offset-y)) rotate(var(--tdc-frame-rotation)) scale(var(--tdc-frame-overlay-scale)) !important;
}

html .tdc-framed-avatar--shape-circle .tdc-framed-avatar__photo-mask { border-radius: 50%; }
html .tdc-framed-avatar--shape-oval .tdc-framed-avatar__photo-mask { clip-path: ellipse(49% 43% at 50% 50%); }
html .tdc-framed-avatar--shape-square .tdc-framed-avatar__photo-mask { border-radius: 0; }
html .tdc-framed-avatar--shape-rounded-square .tdc-framed-avatar__photo-mask { border-radius: 22%; }
html .tdc-framed-avatar--shape-hexagon .tdc-framed-avatar__photo-mask { clip-path: polygon(25% 6.7%, 75% 6.7%, 100% 50%, 75% 93.3%, 25% 93.3%, 0 50%); }
html .tdc-framed-avatar--shape-octagon .tdc-framed-avatar__photo-mask { clip-path: polygon(29% 0, 71% 0, 100% 29%, 100% 71%, 71% 100%, 29% 100%, 0 71%, 0 29%); }
html .tdc-framed-avatar--shape-diamond .tdc-framed-avatar__photo-mask { clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
html .tdc-framed-avatar--shape-triangle .tdc-framed-avatar__photo-mask { clip-path: polygon(50% 2%, 98% 96%, 2% 96%); }
html .tdc-framed-avatar--shape-star .tdc-framed-avatar__photo-mask { clip-path: polygon(50% 0, 61% 34%, 98% 35%, 68% 56%, 79% 92%, 50% 70%, 21% 92%, 32% 56%, 2% 35%, 39% 34%); }
html .tdc-framed-avatar--shape-arch .tdc-framed-avatar__photo-mask { border-radius: 50% 50% 16% 16% / 48% 48% 12% 12%; }
html .tdc-framed-avatar--shape-irregular .tdc-framed-avatar__photo-mask { border-radius: 42% 58% 48% 52% / 55% 43% 57% 45%; }

html .tdc-framed-avatar.user-feature-avatar--neon .tdc-framed-avatar__photo-mask { box-shadow: inset 0 0 0 2px var(--accent, #18c98b), 0 0 14px rgba(var(--neon-rgb, 24, 201, 139), 0.55); }
html .tdc-framed-avatar.user-feature-avatar--platinum .tdc-framed-avatar__photo-mask { box-shadow: inset 0 0 0 3px #8a99a8; }
html .tdc-framed-avatar.user-feature-avatar--carbon .tdc-framed-avatar__photo-mask { box-shadow: inset 0 0 0 3px #303942, inset 0 0 0 4px #72808d; }
html .tdc-framed-avatar.user-feature-avatar--royal .tdc-framed-avatar__photo-mask { box-shadow: inset 0 0 0 3px #9e72d6, 0 0 12px rgba(158, 114, 214, 0.45); }

@media (prefers-reduced-motion: reduce) {
  html .tdc-framed-avatar .tdc-framed-avatar__photo,
  html .tdc-framed-avatar .tdc-framed-avatar__frame { transition: none !important; }
}
