/* --bxyz-sektion: kinetic typography styles (gsap-inspired) */

.kinetic-typography {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    perspective: 1000px;
}

.kinetic-line {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.kinetic-word {
    display: inline-block;
    opacity: 0;
    transform: translateY(30px);
    animation: wordReveal 1.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    will-change: transform, opacity;
}

/* --bxyz-sektion: font variations */
.kinetic-typography[data-font="karrik"] .kinetic-word {
    font-family: 'Karrik', sans-serif;
}

.kinetic-typography[data-font="abc-maxi"] .kinetic-word {
    font-family: 'ABC Maxi Round Variable Edu', sans-serif;
}

/* --bxyz-sektion: case variations */
.kinetic-typography[data-case="uppercase"] .kinetic-word {
    text-transform: uppercase;
}

.kinetic-typography[data-case="lowercase"] .kinetic-word {
    text-transform: lowercase;
}

.kinetic-typography[data-case="normal"] .kinetic-word {
    text-transform: none;
}

/* --bxyz-sektion: word-by-word stagger (inte rad för rad) */
.kinetic-line:nth-child(1) .kinetic-word:nth-child(1) { animation-delay: 0.05s; }
.kinetic-line:nth-child(1) .kinetic-word:nth-child(2) { animation-delay: 0.15s; }
.kinetic-line:nth-child(1) .kinetic-word:nth-child(3) { animation-delay: 0.25s; }
.kinetic-line:nth-child(1) .kinetic-word:nth-child(4) { animation-delay: 0.35s; }
.kinetic-line:nth-child(1) .kinetic-word:nth-child(5) { animation-delay: 0.45s; }

.kinetic-line:nth-child(2) .kinetic-word:nth-child(1) { animation-delay: 0.55s; }
.kinetic-line:nth-child(2) .kinetic-word:nth-child(2) { animation-delay: 0.65s; }
.kinetic-line:nth-child(2) .kinetic-word:nth-child(3) { animation-delay: 0.75s; }
.kinetic-line:nth-child(2) .kinetic-word:nth-child(4) { animation-delay: 0.85s; }
.kinetic-line:nth-child(2) .kinetic-word:nth-child(5) { animation-delay: 0.95s; }
.kinetic-line:nth-child(2) .kinetic-word:nth-child(6) { animation-delay: 1.05s; }

.kinetic-line:nth-child(3) .kinetic-word:nth-child(1) { animation-delay: 1.15s; }
.kinetic-line:nth-child(3) .kinetic-word:nth-child(2) { animation-delay: 1.25s; }
.kinetic-line:nth-child(3) .kinetic-word:nth-child(3) { animation-delay: 1.35s; }
.kinetic-line:nth-child(3) .kinetic-word:nth-child(4) { animation-delay: 1.45s; }
.kinetic-line:nth-child(3) .kinetic-word:nth-child(5) { animation-delay: 1.55s; }

.kinetic-line:nth-child(4) .kinetic-word:nth-child(1) { animation-delay: 1.65s; }
.kinetic-line:nth-child(4) .kinetic-word:nth-child(2) { animation-delay: 1.75s; }
.kinetic-line:nth-child(4) .kinetic-word:nth-child(3) { animation-delay: 1.85s; }
.kinetic-line:nth-child(4) .kinetic-word:nth-child(4) { animation-delay: 1.95s; }
.kinetic-line:nth-child(4) .kinetic-word:nth-child(5) { animation-delay: 2.05s; }
.kinetic-line:nth-child(4) .kinetic-word:nth-child(6) { animation-delay: 2.15s; }
.kinetic-line:nth-child(4) .kinetic-word:nth-child(7) { animation-delay: 2.25s; }

@keyframes wordReveal {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes textGradientShift {
    0% { background-position: 100% 50%; }
    50% { background-position: 0% 50%; }
    100% { background-position: 100% 50%; }
}

/* --bxyz-sektion: hover effects med gradient */
.kinetic-word {
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), 
                color 0.15s ease,
                opacity 0.15s ease,
                background 0.15s ease;
    position: relative;
    color: #353535;
}

.kinetic-word:hover {
    transform: translateY(-5px) scale(1.08);
    color: transparent;
    background: linear-gradient(135deg, #fef8e6, #e6fefb, #d7fbf0, #ece4fb, #fbe4f9);
    background-size: 200% 200%;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-position: 0% 50%;
    animation: hoverGradientShift 2s ease-in-out infinite;
    opacity: 1;
}

@keyframes hoverGradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* --bxyz-sektion: responsive */
@media (max-width: 767px) {
    .kinetic-line {
        gap: 0.3rem;
    }
    
    .kinetic-word {
        font-size: 0.9em;
    }
}
