@keyframes nod { from { transform: rotate(2deg); } to { transform: rotate(8deg); } } @keyframes tail-wag { from { transform: rotate(-3deg); } to { transform: rotate(7deg); } } .logo { display: block; color: #aaa; padding: 0.9em 1.2em; -webkit-font-smoothing: auto; } // Desktop styling (override mobile styling): @include media-breakpoint-up(sm) { .logo { margin: 1em auto; text-align: center; } } .wagtail-logo-container__mobile { .wagtail-logo { width: 20px; float: left; border: 0; margin-right: 1em; } &:hover { color: $color-white; } } .wagtail-logo-container__desktop { display: block; margin: auto; width: 60px; height: 75px; position: relative; transition: all 0.25s cubic-bezier(0.28, 0.15, 0, 2.1); .wagtail-logo { display: block; left: 0; top: 0; width: 100%; height: 100%; position: absolute; transition: inherit; &.wagtail-logo__eye--open { // stylelint-disable-next-line declaration-no-important display: inline !important; // doesn't work without `!important`, likely a specificity issue } &.wagtail-logo__eye--closed { // stylelint-disable-next-line declaration-no-important display: none !important; } } // Wagtail 'serious' animation (nod): &.logo-serious { &:hover { transform: rotate(4deg); } } // Wagtail 'playful' animation (tail-wag, triggered by JS in base.html): &.logo-playful { &:hover { animation: nod 1.2s forwards; .wagtail-logo { // stylelint-disable max-nesting-depth &.wagtail-logo__tail { animation: tail-wag 0.09s alternate; animation-iteration-count: infinite; } &.wagtail-logo__eye--open { // stylelint-disable-next-line declaration-no-important display: none !important; } &.wagtail-logo__eye--closed { // stylelint-disable-next-line declaration-no-important display: inline !important; } } } } }