.web-banner { text-decoration: none; display: flex; justify-content: space-between; height: 52px; background: #D919FF !important; padding: 7px 35px; font-family: "Work Sans"; z-index: 9999; cursor: pointer; &:hover { text-decoration: none; color: $white; .button-icon{ animation: iconJitter 0.7s ease-in-out forwards; transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1); } } color: $white !important; text-align: center; font-family: "Work Sans"; font-size: 26px; // Further scaled down from 28px font-style: normal; font-weight: 600; letter-spacing: -0.32px; // Pseudo-element for the fill animation &::after { content: ""; position: absolute; top: 0; left: 0; width: 100%; // Full width so that we can scale it height: 100%; background-color: #7919FF; z-index: 0; transform: scaleX(0); // Start scaled down to 0 transform-origin: left; // Scale from the left edge transition: transform 0.7s cubic-bezier(0.7, 0, 0.84, 0); will-change: transform; // Hint for smoother animations } // On hover, scale to full width &:hover::after { transform: scaleX(1); transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1); } // Ensure direct children are above the pseudo-element > * { position: relative; z-index: 1; } @media (max-width: 768px) { font-size: 18px; padding: 11px 35px; } @media (max-width: 564px) { font-size: 15px; padding: 5px 40px; .banner-event-details{ gap: 0px !important; flex-direction: column; text-align: left; line-height: 21px; } .banner-button{ align-self: baseline; gap: 8px !important; } } .banner-button{ display: flex; align-items: center; gap: 14.5px; padding-top: 1px; img{ width: 24.5px; height: 33.7px; @media (max-width: 768px) { width: 19.5px; height: 18.7px; padding-top: 0px; } @media (max-width: 564px) { width: 15.5px; height: 20.85px; padding-top: 0px; } } } .banner-event-details { display: flex; gap: 32px; } .button-icon { transform-style: preserve-3d; aspect-ratio: 0.71; object-fit: contain; animation: none; transform: rotateZ(0deg); transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1); // Adjust duration as needed align-self: stretch; margin: auto 0; transform-style: preserve-3d; } @keyframes iconJitter { from { transform: translate3d(0, 0, 0) scale3d(1, 1, 1) rotateZ(0deg) skew(0deg, 0deg); } to { transform: translate3d(0, 0, 0) scale3d(1, 1, 1) rotateZ(45deg) skew(0deg, 0deg); } } } .web-banner a { text-decoration: none; } .button-icon { animation: iconJitter 0.7s ease-in-out; animation-iteration-count: 1; transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1); } @keyframes iconReturn { from { transform: translate3d(0, 0, 0) scale3d(1, 1, 1) rotateZ(45deg) skew(0deg, 0deg); } to { transform: translate3d(0, 0, 0) scale3d(1, 1, 1) rotateZ(0deg) skew(0deg, 0deg); } } /* After the banner has been hovered once, on unhover run the reverse animation */ .web-banner.has-hover:not(:hover) .button-icon { animation: iconReturn 0.7s ease-in-out forwards; transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1); }