/* =============================================================================
   Section Text Reveal — Scroll-driven word reveal (inspirado en MagicUI)
   Prefijo: .tr-reveal-    Ancla: #tr-reveal-section
   ============================================================================= */

#tr-reveal-section {
    --tr-font:      -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
    --tr-fore:      #0A1A2E;
    --tr-back:      rgba(10, 26, 46, 0.18);
    --tr-bg-top:    #F5F9FF;
    --tr-bg-bottom: #FFFFFF;
}

#tr-reveal-section {
    position: relative;
    z-index: 0;
    height: 200vh;                  /* alto que da espacio al progreso de scroll */
    width: 100%;
    background: linear-gradient(180deg, var(--tr-bg-top) 0%, var(--tr-bg-bottom) 100%);
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible;              /* el sticky necesita salir del flujo natural */
}

/* Contenedor sticky — se queda fijo mientras se hace scroll en la sección */
#tr-reveal-section .tr-reveal-section__sticky {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(2rem, 6vw, 5rem) clamp(1rem, 4vw, 3rem);
    box-sizing: border-box;
}

/* Texto principal */
#tr-reveal-section .tr-reveal-section__text {
    font-family: var(--tr-font) !important;
    font-size: clamp(2.2rem, 6vw, 4.8rem) !important;
    font-weight: 800 !important;
    line-height: 1.18 !important;
    letter-spacing: -0.035em !important;
    max-width: 72rem;
    margin: 0 !important;
    padding: 0 !important;
    display: flex;
    flex-wrap: wrap;
    text-align: left;
}

/* Cada palabra: contenedor para las dos capas (back + fore) */
#tr-reveal-section .tr-reveal-section__word {
    position: relative;
    display: inline-block;
    margin: 0 0.38rem;
    line-height: 1.18;
}

/* Capa de fondo: la palabra apagada, siempre visible */
#tr-reveal-section .tr-reveal-section__word-back {
    color: var(--tr-back) !important;
}

/* Capa "fore": la palabra encendida (color sólido), opacidad controlada por JS */
#tr-reveal-section .tr-reveal-section__word-fore {
    position: absolute;
    inset: 0;
    color: var(--tr-fore) !important;
    opacity: 0;
    pointer-events: none;
    will-change: opacity;
    transition: opacity 0.05s linear;
}

/* =============================================================================
   RESPONSIVE
   ============================================================================= */
@media (max-width: 768px) {
    #tr-reveal-section {
        height: 200vh;
    }
    #tr-reveal-section .tr-reveal-section__sticky {
        padding: 2rem 1.25rem;
    }
    #tr-reveal-section .tr-reveal-section__text {
        font-size: clamp(2rem, 8.5vw, 3.6rem) !important;
        line-height: 1.18 !important;
        letter-spacing: -0.03em !important;
    }
    #tr-reveal-section .tr-reveal-section__word {
        margin: 0 0.28rem;
    }
}

@media (max-width: 480px) {
    #tr-reveal-section {
        height: 200vh;
    }
    #tr-reveal-section .tr-reveal-section__sticky {
        padding: 1.5rem 1rem;
    }
    #tr-reveal-section .tr-reveal-section__text {
        font-size: 2rem !important;
        line-height: 1.2 !important;
        letter-spacing: -0.025em !important;
    }
    #tr-reveal-section .tr-reveal-section__word {
        margin: 0 0.22rem;
    }
}

@media (max-width: 380px) {
    #tr-reveal-section .tr-reveal-section__text {
        font-size: 1.75rem !important;
    }
}

/* =============================================================================
   REDUCE MOTION — texto totalmente visible, sin animación de scroll
   ============================================================================= */
@media (prefers-reduced-motion: reduce) {
    #tr-reveal-section {
        height: auto !important;
        padding: clamp(4rem, 8vw, 7rem) 0 !important;
    }
    #tr-reveal-section .tr-reveal-section__sticky {
        position: relative !important;
        height: auto !important;
    }
    #tr-reveal-section .tr-reveal-section__word-fore {
        opacity: 1 !important;
        transition: none !important;
    }
}
