/* =============================================================================
   Webxcell Digital — animations.css
   Motion design system: reveal classes, floats, glows, loader, transitions,
   dashboard, chat, metric bars. Paired with animations.js (GSAP 3).
   ============================================================================= */

/* ── 1. Reveal Initial States ──────────────────────────────────────────────── */
/* GSAP overrides these with inline styles; CSS provides the no-JS/pre-init state */

.reveal-up,
.reveal-left,
.reveal-right,
.reveal-scale,
.stagger-children > * {
    opacity: 0;
    will-change: transform, opacity;
}

.reveal-up    { transform: translateY(30px); }
.reveal-left  { transform: translateX(-30px); }
.reveal-right { transform: translateX(30px); }
.reveal-scale { transform: scale(0.95); }

/* State after GSAP resolves (also used as CSS fallback via .is-revealed) */
.is-revealed,
.reveal-up.is-revealed,
.reveal-left.is-revealed,
.reveal-right.is-revealed,
.reveal-scale.is-revealed {
    opacity: 1;
    transform: none;
    transition: opacity 0.7s cubic-bezier(.16,1,.3,1), transform 0.7s cubic-bezier(.16,1,.3,1);
}

/* ── 2. Float Animation ─────────────────────────────────────────────────────── */

.float-gentle {
    animation: float-gentle 4s ease-in-out infinite alternate;
    will-change: transform;
}

.float-gentle--slow  { animation-duration: 6s; }
.float-gentle--fast  { animation-duration: 2.5s; }
.float-gentle--delay-1 { animation-delay: -1.3s; }
.float-gentle--delay-2 { animation-delay: -2.6s; }
.float-gentle--delay-3 { animation-delay: -0.8s; }

@keyframes float-gentle {
    from { transform: translateY(-8px); }
    to   { transform: translateY( 8px); }
}

/* ── 3. Glow Blob Drift ─────────────────────────────────────────────────────── */

.glow-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    pointer-events: none;
    z-index: 0;
    will-change: transform;
    animation: glow-drift 10s ease-in-out infinite alternate;
}

.glow-blob--2 { animation-delay: -3.5s; animation-duration: 13s; }
.glow-blob--3 { animation-delay: -7s;   animation-duration: 8s;  }

@keyframes glow-drift {
    0%   { transform: translate( 0px,  0px) scale(1); }
    25%  { transform: translate(20px,-15px) scale(1.04); }
    50%  { transform: translate(-10px,18px) scale(0.97); }
    75%  { transform: translate(14px, 8px)  scale(1.02); }
    100% { transform: translate(-18px,-6px) scale(0.98); }
}

/* ── 4. Loading Screen ──────────────────────────────────────────────────────── */

.wxcl-loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #05070F;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 2rem;
}

.wxcl-loader-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.wxcl-loader-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.wxcl-loader-logo svg {
    overflow: visible;
}

.loader-ring {
    stroke-dasharray: 226;
    stroke-dashoffset: 226;
}

.wxcl-loader-brand {
    font-family: 'Syne', system-ui, sans-serif;
    font-size: 1.25rem;
    font-weight: 900;
    color: #ffffff;
    letter-spacing: -0.01em;
    opacity: 0;
}

.wxcl-loader-brand span {
    color: #00D4FF;
}

.wxcl-loader-bar-wrap {
    width: 200px;
    height: 2px;
    background: rgba(255,255,255,0.08);
    border-radius: 2px;
    overflow: hidden;
}

.wxcl-loader-bar {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #00D4FF, #7B5EA7, #00FF9D);
    border-radius: 2px;
    transform-origin: left;
}

/* ── 5. Page Transition Overlay ─────────────────────────────────────────────── */

#page-transition-overlay {
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: #05070F;
    transform: scaleY(0);
    transform-origin: top center;
    display: none;
    pointer-events: none;
}

.page-transition-line {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #00D4FF, #7B5EA7, #00FF9D);
    transform: scaleX(0);
    transform-origin: left center;
}

/* ── 6. Nav Underline Micro-interaction ─────────────────────────────────────── */

.nav-links > li > a {
    position: relative;
}

.nav-links > li > a::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    right: 50%;
    height: 2px;
    background: #00D4FF;
    border-radius: 2px;
    transition: left 0.2s cubic-bezier(.16,1,.3,1), right 0.2s cubic-bezier(.16,1,.3,1);
}

.nav-links > li > a:hover::after,
.nav-links > li.current-menu-item > a::after,
.nav-links > li.current-menu-ancestor > a::after {
    left: 0.75rem;
    right: 0.75rem;
}

/* ── 7. Hero Dashboard ──────────────────────────────────────────────────────── */

#hero-dashboard {
    position: relative;
}

.hero-dash-card {
    background: rgba(12, 15, 30, 0.8);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    backdrop-filter: blur(20px) saturate(160%);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    overflow: hidden;
    box-shadow:
        0 0 0 1px rgba(0,212,255,0.08),
        0 24px 64px rgba(0,0,0,0.6),
        0 0 80px rgba(0,212,255,0.05);
    width: 100%;
    max-width: 480px;
}

.hero-dash-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    background: rgba(255,255,255,0.03);
    border-bottom: 1px solid rgba(255,255,255,0.07);
}

.dash-traffic-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dash-dot--red   { background: #FF5F57; }
.dash-dot--amber { background: #FFBD2E; }
.dash-dot--green { background: #28C840; }

.dash-header-title {
    flex: 1;
    font-family: 'Syne', sans-serif;
    font-size: 0.7rem;
    font-weight: 700;
    color: rgba(255,255,255,0.4);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-left: 8px;
}

.dash-header-badge {
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    color: #00FF9D;
    border: 1px solid rgba(0,255,157,0.3);
    background: rgba(0,255,157,0.07);
    padding: 2px 8px;
    border-radius: 99px;
    animation: badge-pulse 2s ease-in-out infinite;
}

@keyframes badge-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.65; }
}

.hero-dash-body {
    padding: 12px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 10px;
}

/* ── 7a. Dashboard Panels ───────────────────────────────────────────────────── */

.dash-panel {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 12px;
    padding: 12px;
    overflow: hidden;
}

.dash-panel--identity {
    grid-column: 1 / -1;
}

.dash-panel-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.35);
    margin-bottom: 10px;
}

/* Identity Graph */
.identity-graph-wrap {
    display: flex;
    justify-content: center;
}

.identity-graph-svg {
    width: 100%;
    height: auto;
    max-height: 110px;
}

.id-node {
    transition: opacity 0.3s;
}

.id-line {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    animation: draw-line 1s ease-out forwards;
}

.id-line:nth-child(2) { animation-delay: 0.1s; }
.id-line:nth-child(3) { animation-delay: 0.2s; }
.id-line:nth-child(4) { animation-delay: 0.15s; }
.id-line:nth-child(5) { animation-delay: 0.25s; }
.id-line:nth-child(6) { animation-delay: 0.35s; }

@keyframes draw-line {
    to { stroke-dashoffset: 0; }
}

/* ── 8. Chat Bubbles ────────────────────────────────────────────────────────── */

.chat-bubbles {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 100px;
    overflow: hidden;
}

.chat-bubble {
    max-width: 90%;
    padding: 6px 10px;
    border-radius: 10px;
    font-size: 0.7rem;
    line-height: 1.4;
}

.chat-bubble--user {
    background: rgba(0,212,255,0.15);
    border: 1px solid rgba(0,212,255,0.2);
    color: #00D4FF;
    align-self: flex-end;
    border-bottom-right-radius: 3px;
}

.chat-bubble--ai {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.8);
    align-self: flex-start;
    border-bottom-left-radius: 3px;
}

/* Typing indicator */
.chat-typing {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 2px 0;
}

.chat-typing span {
    width: 5px;
    height: 5px;
    background: rgba(255,255,255,0.4);
    border-radius: 50%;
    animation: typing-bounce 0.9s ease-in-out infinite;
}

.chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing span:nth-child(3) { animation-delay: 0.30s; }

@keyframes typing-bounce {
    0%, 100% { transform: translateY(0); opacity: 0.4; }
    40%       { transform: translateY(-4px); opacity: 1; }
}

/* ── 9. Cloud Metric Bars ───────────────────────────────────────────────────── */

.metric-bars {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.metric-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.metric-label {
    font-size: 0.62rem;
    color: rgba(255,255,255,0.45);
    white-space: nowrap;
    min-width: 72px;
}

.metric-track {
    flex: 1;
    height: 4px;
    background: rgba(255,255,255,0.06);
    border-radius: 4px;
    overflow: hidden;
}

.metric-fill {
    height: 100%;
    width: 0;
    border-radius: 4px;
    transition: width 1.2s cubic-bezier(.16,1,.3,1);
}

.metric-fill--green {
    background: linear-gradient(90deg, #00FF9D, #00D4A8);
    box-shadow: 0 0 8px rgba(0,255,157,0.4);
}

.metric-fill--cyan {
    background: linear-gradient(90deg, #00D4FF, #0099CC);
    box-shadow: 0 0 8px rgba(0,212,255,0.4);
}

.metric-val {
    font-size: 0.65rem;
    font-weight: 700;
    color: #00FF9D;
    min-width: 30px;
    text-align: right;
}

/* ── 10. Stat Counter Suffix ────────────────────────────────────────────────── */

.stat-plus {
    display: inline-block;
    color: #00D4FF;
    font-weight: 700;
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity 0.3s, transform 0.3s;
}

.stat-plus.visible {
    opacity: 1;
    transform: translateX(0);
}

/* ── 11. Service Card (GSAP-enhanced, CSS baseline) ─────────────────────────── */

.service-card {
    border: 1px solid rgba(255,255,255,0.06);
    transition: border-color 0.25s, box-shadow 0.25s;
    will-change: transform;
}

/* ── 12. Canvas Particle Network ────────────────────────────────────────────── */

#hero-particles {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.hero-particles-fallback {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(0,212,255,0.04) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(123,94,167,0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 60% 80%, rgba(0,255,157,0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* Allow the hero to capture mouse events for particle interaction */
.hero-particles-active {
    position: relative;
}

/* ── 13. Tilt Card 3-D ──────────────────────────────────────────────────────── */

.tilt-card {
    transform-style: preserve-3d;
    will-change: transform;
    transition: transform 0.4s cubic-bezier(.16,1,.3,1);
}

/* ── 14. Reduced Motion Overrides ───────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    .reveal-up,
    .reveal-left,
    .reveal-right,
    .reveal-scale,
    .stagger-children > * {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    .float-gentle,
    .float-gentle-gsap {
        animation: none !important;
    }

    .glow-blob {
        animation: none !important;
    }

    .wxcl-loader {
        display: none !important;
    }

    #page-transition-overlay {
        display: none !important;
    }

    .id-line {
        animation: none !important;
        stroke-dashoffset: 0 !important;
    }

    .chat-typing span {
        animation: none !important;
    }

    .dash-header-badge {
        animation: none !important;
    }

    .metric-fill {
        transition: none !important;
    }

    .tilt-card {
        transform: none !important;
        transition: none !important;
    }
}

/* ── 15. Mobile Particle Fallback ───────────────────────────────────────────── */

@media (max-width: 767px) {
    #hero-particles {
        display: none;
    }

    .hero-particles-fallback {
        display: block;
    }

    .tilt-card {
        transform: none !important;
        transition: none;
    }

    .float-gentle {
        animation-duration: 6s;
    }

    .reveal,
    .reveal-up,
    .reveal-left,
    .reveal-right,
    .reveal-scale,
    .stagger-children > * {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    .hero-grid {
        animation: none !important;
        display: none !important;
    }
}

@media (min-width: 768px) {
    .hero-particles-fallback {
        display: none;
    }
}

/* -- Mobile Scroll Performance Overrides -- */
@media (max-width: 768px) {
    .glow-blob {
        display: none !important;
    }
    .float-gentle,
    .float-gentle-gsap {
        animation: none !important;
        transform: none !important;
        will-change: auto !important;
        transition: none !important;
    }
    .reveal,
    .reveal-up,
    .reveal-left,
    .reveal-right,
    .reveal-scale,
    .stagger-children > * {
        opacity: 1 !important;
        transform: none !important;
        will-change: auto !important;
        transition: none !important;
    }
}
