/* ============================================
   WELCOME ANIMATION - SmartQ E-Connect
   Futuristic walking character + digital board
   ============================================ */

/* ---- Overlay ---- */
.welcome-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background:
        repeating-linear-gradient(0deg, transparent, transparent 60px, rgba(66, 165, 245, 0.025) 60px, rgba(66, 165, 245, 0.025) 61px),
        repeating-linear-gradient(90deg, transparent, transparent 60px, rgba(66, 165, 245, 0.025) 60px, rgba(66, 165, 245, 0.025) 61px),
        radial-gradient(ellipse at 30% 50%, rgba(30, 136, 229, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse at center, rgba(10, 36, 99, 0.94) 0%, rgba(6, 20, 55, 0.98) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.6s ease, visibility 0.6s;
}

.welcome-overlay.active {
    opacity: 1;
    visibility: visible;
}

.welcome-overlay.farewell {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* ---- Skip Button ---- */
.welcome-skip {
    position: absolute;
    top: 2rem;
    right: 2rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.6);
    padding: 0.5rem 1.25rem;
    border-radius: 50px;
    font-family: 'Lato', sans-serif;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.welcome-skip:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
}

/* ---- Stage ---- */
.welcome-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* ---- Actor Container (slides in from left) ---- */
.welcome-actor {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    transform: translateX(calc(-50vw - 160px));
    will-change: transform;
}

.welcome-overlay.active .welcome-actor {
    animation: actor-walk-in 2.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes actor-walk-in {
    0% { transform: translateX(calc(-50vw - 160px)); }
    100% { transform: translateX(0); }
}

/* ---- Character SVG Container ---- */
.welcome-character {
    width: 140px;
    height: 260px;
    position: relative;
}

.char-svg {
    width: 100%;
    height: 100%;
    will-change: transform;
}

/* SVG transform helpers */
.char-leg,
.char-arm,
.char-shadow {
    transform-box: fill-box;
}

.char-leg--left,
.char-leg--right {
    transform-origin: center top;
}

.char-arm--left,
.char-arm--right {
    transform-origin: center top;
}

.char-shadow {
    transform-origin: center center;
}

/* ---- Walk Cycle Animations ---- */
/* Bounce: 0.5s x 5 iterations = 2.5s (matches walk-in duration) */
.welcome-actor.walking .char-svg {
    animation: walk-bounce 0.5s ease-in-out 5;
}

.welcome-actor.walking .char-leg--left {
    animation: leg-walk-left 0.5s ease-in-out 5;
}

.welcome-actor.walking .char-leg--right {
    animation: leg-walk-right 0.5s ease-in-out 5;
}

.welcome-actor.walking .char-arm--left {
    animation: arm-swing-left 0.5s ease-in-out 5;
}

.welcome-actor.walking .char-arm--right {
    animation: arm-swing-right 0.5s ease-in-out 5;
}

.welcome-actor.walking .char-shadow {
    animation: shadow-walk 0.5s ease-in-out 5;
}

@keyframes walk-bounce {
    0%, 100% { transform: translateY(0); }
    25%, 75% { transform: translateY(-5px); }
    50% { transform: translateY(0); }
}

@keyframes leg-walk-left {
    0%, 100% { transform: rotate(-18deg); }
    50% { transform: rotate(18deg); }
}

@keyframes leg-walk-right {
    0%, 100% { transform: rotate(18deg); }
    50% { transform: rotate(-18deg); }
}

@keyframes arm-swing-left {
    0%, 100% { transform: rotate(12deg); }
    50% { transform: rotate(-12deg); }
}

@keyframes arm-swing-right {
    0%, 100% { transform: rotate(-12deg); }
    50% { transform: rotate(12deg); }
}

@keyframes shadow-walk {
    0%, 100% { transform: scaleX(1); opacity: 0.12; }
    25%, 75% { transform: scaleX(0.85); opacity: 0.18; }
    50% { transform: scaleX(1); opacity: 0.12; }
}

/* ---- Idle Animations (after walking stops) ---- */
.welcome-actor.idle .char-svg {
    animation: idle-breathe 3s ease-in-out infinite;
}

.welcome-actor.idle .char-shadow {
    animation: idle-shadow 3s ease-in-out infinite;
}

@keyframes idle-breathe {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

@keyframes idle-shadow {
    0%, 100% { transform: scaleX(1); }
    50% { transform: scaleX(0.92); }
}

/* ---- Character Persistent Animations ---- */
/* Antenna glow pulse */
.char-antenna {
    animation: antenna-pulse 2s ease-in-out infinite;
}

@keyframes antenna-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Chest core pulse */
.char-chest-pulse {
    animation: chest-pulse 2.5s ease-in-out infinite;
}

@keyframes chest-pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.15; }
}

/* Eye blink */
.char-blink {
    opacity: 0;
    animation: eye-blink 4s ease-in-out infinite;
}

@keyframes eye-blink {
    0%, 90%, 100% { opacity: 0; }
    93%, 97% { opacity: 1; }
}

/* Visor shimmer */
.char-visor-shine {
    animation: visor-shimmer 3s ease-in-out infinite alternate;
}

@keyframes visor-shimmer {
    0% { opacity: 0.3; }
    100% { opacity: 0.6; }
}

/* ---- Digital Board ---- */
.welcome-board {
    opacity: 0;
    transform: scale(0.7) translateY(15px);
    transition: opacity 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    will-change: transform, opacity;
    pointer-events: none;
}

.welcome-board.visible {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

.welcome-board__screen {
    background: rgba(8, 28, 70, 0.65);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(66, 165, 245, 0.3);
    border-radius: 16px;
    padding: 2rem 3rem;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 0 40px rgba(30, 136, 229, 0.12),
        0 0 80px rgba(30, 136, 229, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    min-width: 340px;
    text-align: center;
}

/* Scan-line sweep */
.welcome-board__screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, transparent 0%, rgba(66, 165, 245, 0.06) 45%, rgba(66, 165, 245, 0.06) 55%, transparent 100%);
    transform: translateY(-100%);
    animation: board-scan 3.5s linear infinite;
    pointer-events: none;
    z-index: 1;
}

@keyframes board-scan {
    from { transform: translateY(-100%); }
    to { transform: translateY(100%); }
}

/* Inner tech border */
.welcome-board__screen::after {
    content: '';
    position: absolute;
    top: 6px;
    left: 6px;
    right: 6px;
    bottom: 6px;
    border: 1px solid rgba(66, 165, 245, 0.1);
    border-radius: 11px;
    pointer-events: none;
}

/* Text */
.welcome-board__text {
    font-family: 'Raleway', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
    min-height: 2rem;
    position: relative;
    z-index: 2;
    display: inline;
    letter-spacing: 0.5px;
}

/* Typing cursor */
.welcome-board__text::after {
    content: '\2502';
    color: #42A5F5;
    font-weight: 300;
    animation: cursor-blink 0.6s step-end infinite;
    margin-left: 1px;
}

.welcome-board__text.done::after {
    display: none;
}

@keyframes cursor-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Tagline */
.welcome-board__tagline {
    font-family: 'Lato', sans-serif;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.5);
    margin: 0.75rem 0 0;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.6s ease, transform 0.6s ease;
    position: relative;
    z-index: 2;
    letter-spacing: 1px;
}

.welcome-board__tagline.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .welcome-character {
        width: 110px;
        height: 210px;
    }

    .welcome-board__screen {
        padding: 1.5rem 2rem;
        min-width: 270px;
    }

    .welcome-board__text {
        font-size: 1.2rem;
    }

    .welcome-board__tagline {
        font-size: 0.85rem;
    }

    .welcome-skip {
        top: 1rem;
        right: 1rem;
        padding: 0.4rem 1rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .welcome-character {
        width: 90px;
        height: 170px;
    }

    .welcome-board__screen {
        padding: 1.25rem 1.5rem;
        min-width: 230px;
    }

    .welcome-board__text {
        font-size: 1rem;
    }

    .welcome-board__tagline {
        font-size: 0.8rem;
    }

    .welcome-actor {
        gap: 0.75rem;
    }
}

/* ---- Accessibility ---- */
@media (prefers-reduced-motion: reduce) {
    .welcome-overlay.active .welcome-actor {
        animation: none;
        transform: translateX(0);
    }

    .welcome-actor.walking .char-svg,
    .welcome-actor.walking .char-leg--left,
    .welcome-actor.walking .char-leg--right,
    .welcome-actor.walking .char-arm--left,
    .welcome-actor.walking .char-arm--right,
    .welcome-actor.walking .char-shadow,
    .welcome-actor.idle .char-svg,
    .welcome-actor.idle .char-shadow,
    .char-antenna,
    .char-chest-pulse,
    .char-blink,
    .char-visor-shine,
    .welcome-board__screen::before {
        animation: none;
    }

    .welcome-board {
        transition-duration: 0.3s;
    }
}
