.ahr-wrapper {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.ahr-animated-container {
    display: inline-block;
    position: relative;
    vertical-align: middle;
    overflow: hidden;
    transition: width 0.3s ease, height 0.3s ease;
}

.ahr-animated-phrase {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: max-content;
    display: inline-block;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.ahr-animated-phrase.ahr-active {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%);
}

/* FADE ANIMATION */
.ahr-wrapper[data-animation="fade"] .ahr-animated-phrase {
    transition: opacity 0.5s ease;
}
.ahr-wrapper[data-animation="fade"] .ahr-animated-phrase.ahr-active {
    opacity: 1;
}
.ahr-wrapper[data-animation="fade"] .ahr-animated-phrase.ahr-leaving {
    opacity: 0;
}

/* SLIDE UP ANIMATION */
.ahr-wrapper[data-animation="slide-up"] .ahr-animated-phrase {
    transform: translate(-50%, 50%);
    transition: opacity 0.5s ease, transform 0.5s ease;
}
.ahr-wrapper[data-animation="slide-up"] .ahr-animated-phrase.ahr-active {
    opacity: 1;
    transform: translate(-50%, -50%);
}
.ahr-wrapper[data-animation="slide-up"] .ahr-animated-phrase.ahr-leaving {
    opacity: 0;
    transform: translate(-50%, -150%);
}

/* SLIDE DOWN ANIMATION */
.ahr-wrapper[data-animation="slide-down"] .ahr-animated-phrase {
    transform: translate(-50%, -150%);
    transition: opacity 0.5s ease, transform 0.5s ease;
}
.ahr-wrapper[data-animation="slide-down"] .ahr-animated-phrase.ahr-active {
    opacity: 1;
    transform: translate(-50%, -50%);
}
.ahr-wrapper[data-animation="slide-down"] .ahr-animated-phrase.ahr-leaving {
    opacity: 0;
    transform: translate(-50%, 50%);
}

/* ZOOM IN ANIMATION */
.ahr-wrapper[data-animation="zoom-in"] .ahr-animated-phrase {
    transform: translate(-50%, -50%) scale(0.7);
    transition: opacity 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.ahr-wrapper[data-animation="zoom-in"] .ahr-animated-phrase.ahr-active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}
.ahr-wrapper[data-animation="zoom-in"] .ahr-animated-phrase.ahr-leaving {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.3);
}

/* ZOOM OUT ANIMATION */
.ahr-wrapper[data-animation="zoom-out"] .ahr-animated-phrase {
    transform: translate(-50%, -50%) scale(1.3);
    transition: opacity 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.ahr-wrapper[data-animation="zoom-out"] .ahr-animated-phrase.ahr-active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}
.ahr-wrapper[data-animation="zoom-out"] .ahr-animated-phrase.ahr-leaving {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.7);
}

/* TYPING EFFECT ANIMATION */
.ahr-wrapper[data-animation="typing"] .ahr-animated-phrase {
    width: 0;
    overflow: hidden;
    white-space: nowrap;
    border-right: .15em solid orange;
    transform: translate(-50%, -50%);
    animation: none;
    opacity: 0;
}
.ahr-wrapper[data-animation="typing"] .ahr-animated-phrase.ahr-active {
    opacity: 1;
    animation: typing-effect 1.5s steps(30, end) forwards, blink-caret .75s step-end infinite;
}
.ahr-wrapper[data-animation="typing"] .ahr-animated-phrase.ahr-leaving {
    opacity: 0;
    width: 0;
    transition: opacity 0.3s ease;
}

@keyframes typing-effect {
    from { width: 0 }
    to { width: 100% }
}
@keyframes blink-caret {
    from, to { border-color: transparent }
    50% { border-color: currentColor; }
}
