/**
 * Text Motion Engine & White Sweep Shader Styles
 * Creator: VynaaValerie
 */

/* Stage Box */
.stage {
    position: relative;
    width: 100%;
    aspect-ratio: 852 / 506;
    overflow: hidden;
    background: #ffffff;
    border-radius: var(--radius-xl);
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    transition: aspect-ratio 0.4s cubic-bezier(0.16, 1, 0.3, 1), background 0.4s ease;
}

/* Stage Background Variants */
.stage.stage-white {
    background: #ffffff;
}

.stage.stage-dark {
    background: #09090b;
}

.stage.stage-aurora {
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #311042 100%);
}

.stage.stage-midnight {
    background: radial-gradient(circle at 50% 50%, #1e293b 0%, #090d16 100%);
}

.stage.stage-grid {
    background-color: #f8fafc;
    background-image: linear-gradient(#e2e8f0 1px, transparent 1px), linear-gradient(90deg, #e2e8f0 1px, transparent 1px);
    background-size: 20px 20px;
}

/* Stage Floating Badge */
.stage-badge {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 100;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.45);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.5px;
    pointer-events: none;
    transition: all 0.3s ease;
}

.stage-dark .stage-badge,
.stage-aurora .stage-badge,
.stage-midnight .stage-badge {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.7);
}

/* Text Position */
.text-box {
    position: absolute;
    left: 8%;
    right: 8%;
    top: 50%;
    transform: translateY(-50%);
    text-align: center;
}

/* Base Text */
.text {
    position: relative;
    z-index: 5;
    margin: 0;
    color: #050505;
    font-size: clamp(24px, 4.2vw, 56px);
    line-height: 1.05;
    font-weight: 900;
    letter-spacing: -1.5px;
    text-transform: uppercase;
    white-space: pre-wrap;
    transition: color 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", Arial, sans-serif;
}

/* Character Spans */
.char {
    display: inline-block;
    opacity: 0;
    transform-origin: center center;
    will-change: transform, opacity, filter;
}

.space {
    width: 0.28em;
}

/* Generated Motion Keyframe Utility */
.motion {
    animation-fill-mode: both;
    animation-timing-function: cubic-bezier(0.18, 0.8, 0.22, 1);
}

/* White Sweep Layer 1: Core Sweep */
.sweep {
    position: absolute;
    z-index: 20;
    left: 0;
    top: 0;
    width: 100%;
    margin: 0;
    color: transparent;
    font-size: clamp(24px, 4.2vw, 56px);
    line-height: 1.05;
    font-weight: 900;
    letter-spacing: -1.5px;
    text-transform: uppercase;
    white-space: pre-wrap;
    pointer-events: none;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", Arial, sans-serif;

    background-image: linear-gradient(
        100deg,
        rgba(5, 5, 5, 0) 0%,
        rgba(5, 5, 5, 0) 34%,
        rgba(90, 90, 90, 0.12) 41%,
        rgba(150, 150, 150, 0.45) 44%,
        rgba(230, 230, 230, 0.85) 47%,
        rgba(255, 255, 255, 1) 49.2%,
        rgba(255, 255, 255, 1) 50.8%,
        rgba(230, 230, 230, 0.85) 53%,
        rgba(150, 150, 150, 0.45) 56%,
        rgba(90, 90, 90, 0.12) 59%,
        rgba(5, 5, 5, 0) 66%,
        rgba(5, 5, 5, 0) 100%
    );
    background-size: 250% 100%;
    background-position: 125% 0;
    -webkit-background-clip: text;
    background-clip: text;
    opacity: 0;
    will-change: background-position, opacity;
}

/* White Sweep Layer 2: Soft Glow Edge */
.sweep-soft {
    position: absolute;
    z-index: 19;
    left: 0;
    top: 0;
    width: 100%;
    color: transparent;
    font-size: clamp(24px, 4.2vw, 56px);
    line-height: 1.05;
    font-weight: 900;
    letter-spacing: -1.5px;
    text-transform: uppercase;
    white-space: pre-wrap;
    pointer-events: none;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", Arial, sans-serif;

    background-image: linear-gradient(
        100deg,
        transparent 0%,
        transparent 35%,
        rgba(255, 255, 255, 0.01) 40%,
        rgba(255, 255, 255, 0.04) 43%,
        rgba(255, 255, 255, 0.12) 46%,
        rgba(255, 255, 255, 0.20) 48%,
        rgba(255, 255, 255, 0.25) 50%,
        rgba(255, 255, 255, 0.20) 52%,
        rgba(255, 255, 255, 0.12) 54%,
        rgba(255, 255, 255, 0.04) 57%,
        rgba(255, 255, 255, 0.01) 60%,
        transparent 65%,
        transparent 100%
    );
    background-size: 250% 100%;
    background-position: 125% 0;
    -webkit-background-clip: text;
    background-clip: text;
    opacity: 0;
    filter: blur(2.5px);
    mix-blend-mode: screen;
    will-change: background-position, opacity;
}

/* Sweep Animation Trigger */
.sweep.active {
    animation: sweepText var(--sweep-duration, 3000ms) cubic-bezier(0.16, 0.72, 0.2, 1) forwards;
}

.sweep-soft.active {
    animation: sweepSoft var(--sweep-duration, 3000ms) cubic-bezier(0.16, 0.72, 0.2, 1) forwards;
}

@keyframes sweepText {
    0% { opacity: 0; background-position: 125% 0; }
    7% { opacity: 0.18; background-position: 115% 0; }
    18% { opacity: 0.45; background-position: 98% 0; }
    30% { opacity: 0.78; background-position: 76% 0; }
    42% { opacity: 0.95; background-position: 53% 0; }
    50% { opacity: 1; background-position: 38% 0; }
    58% { opacity: 1; background-position: 23% 0; }
    68% { opacity: 0.88; background-position: 4% 0; }
    78% { opacity: 0.65; background-position: -18% 0; }
    88% { opacity: 0.35; background-position: -42% 0; }
    96% { opacity: 0.10; background-position: -68% 0; }
    100% { opacity: 0; background-position: -90% 0; }
}

@keyframes sweepSoft {
    0% { opacity: 0; background-position: 125% 0; }
    15% { opacity: 0.02; background-position: 100% 0; }
    30% { opacity: 0.08; background-position: 75% 0; }
    48% { opacity: 0.20; background-position: 38% 0; }
    62% { opacity: 0.28; background-position: 10% 0; }
    78% { opacity: 0.16; background-position: -25% 0; }
    92% { opacity: 0.05; background-position: -65% 0; }
    100% { opacity: 0; background-position: -90% 0; }
}
