/* Text Scroll Reveal Component - EXACT implementation from text-scroll-reveal.md */

/* Container styles - EXACT from spec */
.min-h-200vh {
    min-height: 200vh;
}

.w-full {
    width: 100%;
}

.relative {
    position: relative;
}

.fixed {
    position: fixed;
}

.inset-0 {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.pointer-events-none {
    pointer-events: none;
}

.pointer-events-auto {
    pointer-events: auto;
}

.max-w-5xl {
    max-width: 64rem;
}

.mx-auto {
    margin-left: auto;
    margin-right: auto;
}

.p-4 {
    padding: 1rem;
}

.text-2xl {
    font-size: 1.5rem;
    line-height: 2rem;
}

.pt-14 {
    padding-top: 3.5rem;
}

.w-700px {
    width: 700px;
}

.h-500px {
    height: 500px;
}

.flex-col {
    flex-direction: column;
}

.items-start {
    align-items: flex-start;
}

.justify-end {
    justify-content: flex-end;
}

.h-200vh {
    height: 200vh;
}

/* TextGradientScroll component - EXACT from spec */
.text-gradient-scroll {
    position: relative;
    display: flex;
    margin: 0;
    flex-wrap: wrap;
}

.m-0 {
    margin: 0;
}

.flex-wrap {
    flex-wrap: wrap;
}

/* Word and Letter components */
.text-word {
    position: relative;
    margin-right: 0.5rem; /* me-2 */
    margin-top: 0.5rem; /* mt-2 */
}

.text-letter {
    position: relative;
    margin-right: 0.5rem; /* me-2 */
    margin-top: 0.5rem; /* mt-2 */
}

/* Background text with opacity - EXACT from spec */
.text-background {
    position: absolute;
    opacity: 0.1; /* Default soft opacity */
}

.text-background.opacity-none {
    opacity: 0; /* textOpacity == "none" */
}

.text-background.opacity-soft {
    opacity: 0.1; /* textOpacity == "soft" */
}

.text-background.opacity-medium {
    opacity: 0.3; /* textOpacity == "medium" */
}

/* Animated text - EXACT from spec */
.text-animated {
    transition: all 0.5s ease; /* transition: "all .5s" */
    opacity: 0; /* Will be animated by JavaScript */
}

/* Character spans */
.text-char {
    position: relative;
}

.text-char .char-background {
    position: absolute;
}

.text-char .char-animated {
    transition: all 0.5s ease;
}

/* Responsive design */
@media (max-width: 1024px) {
    .w-700px {
        width: 90%;
        max-width: 700px;
    }
    
    .text-2xl {
        font-size: 1.25rem;
        line-height: 1.75rem;
    }
    
    .h-500px {
        height: 400px;
    }
}

@media (max-width: 768px) {
    .min-h-200vh {
        min-height: 150vh;
    }
    
    .h-200vh {
        height: 150vh;
    }
    
    .w-700px {
        width: 95%;
    }
    
    .text-2xl {
        font-size: 1.125rem;
        line-height: 1.5rem;
    }
    
    .h-500px {
        height: 300px;
    }
    
    .pt-14 {
        padding-top: 2rem;
    }
    
    .p-4 {
        padding: 0.75rem;
    }
}

/* Animation states */
.text-word.revealed .text-animated,
.text-letter.revealed .text-animated,
.text-char.revealed .char-animated {
    opacity: 1;
}

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth;
}

/* Performance optimizations */
.text-gradient-scroll,
.text-word,
.text-letter,
.text-char {
    transform: translateZ(0); /* GPU acceleration */
    will-change: opacity;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .text-background {
        color: rgba(255, 255, 255, 0.1);
    }
    
    .text-background.opacity-soft {
        opacity: 0.15;
    }
    
    .text-background.opacity-medium {
        opacity: 0.4;
    }
}

/* Additional utility classes for exact Tailwind compatibility */
.relative { position: relative; }
.absolute { position: absolute; }
.flex { display: flex; }
.inline { display: inline; }
.block { display: block; }

/* Ensure proper text rendering */
.text-gradient-scroll {
    font-feature-settings: "kern" 1;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .text-animated,
    .char-animated {
        transition: none;
    }
    
    .text-word.revealed .text-animated,
    .text-letter.revealed .text-animated,
    .text-char.revealed .char-animated {
        opacity: 1;
    }
}

/* Focus states for accessibility */
.text-gradient-scroll:focus-within {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}
