/* ... your existing styles ... */

.word-rotation {
    display: inline-block;
    width: 400px;
    /* Adjust based on your longest word to ensure the container doesn't change width */
    height: 1.65em;
    /* Assuming 1.2em line-height for the p tag. Adjust if needed */
    overflow: hidden;
    vertical-align: middle;
    /* This is to align it correctly with the surrounding text */
    position: relative;
    
}

.word {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    text-align: left;
    line-height: 1.5em;
        /* Adjust to a value slightly less than the paragraph's line-height */
    transform: none;
    transition: top 0.4s;
    color: yellow;
}