/* OPTIMIZED ANIMATED HEADLINE CSS - REDUCED FORCED REFLOWS */

.headline-dynamic-wrapper {
    padding: 0;
    width: 100%;
    position: relative;
    display: inline-block;
    height: 1.2em;
    vertical-align: top;
    contain: layout style; /* Isolate layout */
    will-change: height; /* Hint for responsive height changes */
}

.headline-dynamic-text {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    transform: translateY(100%) translateZ(0); /* GPU acceleration */
    transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94); /* Specific properties only */
    font-family: "Ease Standard", sans-serif;
    font-weight: 700;
    font-size: 58px;
    line-height: 1.3;
    white-space: normal;
    word-break: keep-all;
    overflow-wrap: normal;
    display: block;
    text-align: center;
    width: 100%;
    will-change: opacity, transform; /* Optimize animations */
    backface-visibility: hidden; /* Improve rendering */
    -webkit-font-smoothing: antialiased; /* Better text rendering */
    transform-style: preserve-3d; /* Promote to 3D layer */
}

.headline-dynamic-text.active {
    opacity: 1;
    transform: translateY(0) translateZ(0);
}

.headline-dynamic-text.exit {
    opacity: 0;
    transform: translateY(-100%) translateZ(0);
}

/* Gradient colors - GPU accelerated */
.headline-dynamic-wrapper .headline-dynamic-text:nth-child(1) {
    background: linear-gradient(65deg, #818CF8 2%, #3B82F6 68%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.headline-dynamic-wrapper .headline-dynamic-text:nth-child(2) {
    background: linear-gradient(90deg, #F3CA4D 0%, #FF989A 51%, #CBABFF 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.headline-dynamic-wrapper .headline-dynamic-text:nth-child(3) {
    background: linear-gradient(90deg, #A63FFF 0%, #CD8EC7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .headline-dynamic-text {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

/* Responsive optimizations */
@media (max-width: 1280px) {
    .headline-dynamic-wrapper {
        height: 124px !important;
        /* Batch height change with other properties */
        transition: height 0.3s ease;
    }
    .headline-dynamic-text {
        font-size: 48px !important;
        text-align: center;
        display: flex;
        justify-content: center;
        align-items: center;
        /* Ensure transforms still use GPU */
        transform: translateY(100%) translateZ(0);
    }
    .headline-dynamic-text.active {
        transform: translateY(0) translateZ(0);
    }
    .headline-dynamic-text.exit {
        transform: translateY(-100%) translateZ(0);
    }
}

@media (max-width: 768px) {
    .headline-dynamic-text {
        font-size: 48px !important;
        text-align: center;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    .headline-dynamic-wrapper {
        height: 200px !important;
        transition: height 0.3s ease;
    }
}

/* High DPI optimizations */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .headline-dynamic-text {
        -webkit-font-smoothing: subpixel-antialiased;
    }
}

/* Print styles - disable animations */
@media print {
    .headline-dynamic-text {
        opacity: 1 !important;
        transform: translateY(0) !important;
        transition: none !important;
    }
    .headline-dynamic-text:not(.active) {
        display: none !important;
    }
}