/**
 * Elementaz Animated Heading Styles
 */

/* Wrapper */
.elementaz-animated-heading-wrapper {
    display: block;
    position: relative;
    perspective: 1000px;
    -webkit-perspective: 1000px;
}

/* Heading base styles */
.elementaz-animated-heading {
    margin: 0;
    padding: 0;
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
}

/* Word wrapper - critical styles */
.elementaz-word {
    display: inline-block !important;
    white-space: nowrap;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    word-spacing: normal;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
}

/* Character mode: allow better text flow */
.elementaz-character-mode .elementaz-word {
    white-space: normal;
}

/* Hide words until JavaScript initializes them - prevents flash */
.elementaz-animated-heading-wrapper:not(.elementaz-initialized) .elementaz-word {
    visibility: hidden !important;
}

/* Once initialized, remove the hiding */
.elementaz-animated-heading-wrapper.elementaz-initialized .elementaz-word {
    visibility: visible;
}

/* Ensure layout stability during animation */
.elementaz-word {
    position: relative;
    vertical-align: baseline;
}

/* Link styles */
.elementaz-animated-heading-wrapper a {
    text-decoration: inherit;
    color: inherit;
}

.elementaz-animated-heading-wrapper a:hover {
    text-decoration: inherit;
}

/* Performance optimizations */
.elementaz-animated-heading {
    contain: layout style;
}

/* Ensure transforms work properly */
.elementaz-animated-heading,
.elementaz-word {
    transform-style: preserve-3d;
}

/* Editor mode adjustments - show all words in editor */
.elementor-editor-active .elementaz-word {
    opacity: 1 !important;
    filter: none !important;
    transform: none !important;
    transition: none !important;
}
