<img src="https://assets.codepen.io/1480814/av+1.png" alt="a random avatar picture" >
+
<div class="box"></div>
=
<img src="https://assets.codepen.io/1480814/av+1.png" alt="a random avatar picture" >
img {
  width: var(--s);
  aspect-ratio: 1;
  padding-top: calc(var(--s)/5);
  cursor: pointer;
  border-radius: 0 0 999px 999px;
  outline: var(--b) solid var(--c);
  outline-offset: var(--_o);
  background: 
    radial-gradient(
      circle closest-side,
      #ECD078 calc(99% - var(--b)),var(--c) calc(100% - var(--b)) 99%,#0000
     ) var(--_g), lightblue;
  transform: scale(var(--f));
  transition: .5s;
}
img ~ img {
  -webkit-mask:
    linear-gradient(#000 0 0) no-repeat
     50% calc(1px - var(--_o)) / calc(100%/var(--f) - 2*var(--b) - 2px) 50%,
    radial-gradient(circle closest-side,#000 99%,#0000) var(--_g);
}
.box {
  width: var(--s);
  padding-top: calc(var(--s)/5);
  aspect-ratio: 1;
  outline: 1px solid red;
  background:
    linear-gradient(blue 0 0) no-repeat
     50% calc(1px - var(--_o)) / calc(100%/var(--f) - 2*var(--b) - 2px) 50%,
    radial-gradient(circle closest-side,green 99%,#0000) var(--_g);
  transform: scale(var(--f));
  transition: .5s;
}

body {
  --s: 180px; /* image size */
  --b: 4px; /* border thickness */
  --c: #C02942; /* border color */
  --f: 1; /* initial scale */
  --_g: 50%/calc(100%/var(--f)) 100% no-repeat content-box;
  --_o: calc((1/var(--f) - 1)*var(--s)/2 - var(--b));
  
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-auto-flow:column;
  gap:20px;
  font-size:50px;
  font-weight:bold;
  place-content: center;
  place-content: center;
  align-items:center;
  background: #E0E4CC;
}
body:hover {
  --f: 1.2; /* hover scale */
}
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.