/* ===================================================
   CORE NETWORKS - Animations & Effects
   =================================================== */

/* ===================================================
   Scroll Reveal Animations
   =================================================== */

/* Base state for reveal elements */
.reveal-up,
.reveal-left,
.reveal-right,
.reveal-scale {
    opacity: 0;
    transition: opacity 0.8s ease, transform 0.8s ease;
    will-change: opacity, transform;
}

.reveal-up {
    transform: translateY(40px);
}

.reveal-left {
    transform: translateX(-40px);
}

.reveal-right {
    transform: translateX(40px);
}

.reveal-scale {
    transform: scale(0.95);
}

/* Revealed state */
.reveal-up.revealed,
.reveal-left.revealed,
.reveal-right.revealed,
.reveal-scale.revealed {
    opacity: 1;
    transform: translate(0) scale(1);
}

/* Staggered delays for grid items */
[data-delay="0"] { transition-delay: 0ms; }
[data-delay="50"] { transition-delay: 50ms; }
[data-delay="100"] { transition-delay: 100ms; }
[data-delay="150"] { transition-delay: 150ms; }
[data-delay="200"] { transition-delay: 200ms; }
[data-delay="250"] { transition-delay: 250ms; }
[data-delay="300"] { transition-delay: 300ms; }
[data-delay="350"] { transition-delay: 350ms; }
[data-delay="400"] { transition-delay: 400ms; }
[data-delay="450"] { transition-delay: 450ms; }
[data-delay="500"] { transition-delay: 500ms; }
[data-delay="600"] { transition-delay: 600ms; }

/* ===================================================
   Parallax Effects
   =================================================== */

.parallax-bg {
    transform: translateY(var(--parallax-offset, 0));
    will-change: transform;
}

/* ===================================================
   Network Animation (Hero)
   =================================================== */

/* Line animation */
.network-line {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    animation: drawLine 2s ease forwards;
}

@keyframes drawLine {
    to {
        stroke-dashoffset: 0;
    }
}

/* Node pulse */
.node {
    animation: nodePulse 3s ease-in-out infinite;
}

.node:nth-child(2) { animation-delay: 0.2s; }
.node:nth-child(3) { animation-delay: 0.4s; }
.node:nth-child(4) { animation-delay: 0.6s; }
.node:nth-child(5) { animation-delay: 0.8s; }
.node:nth-child(6) { animation-delay: 1s; }
.node:nth-child(7) { animation-delay: 1.2s; }
.node:nth-child(8) { animation-delay: 1.4s; }

@keyframes nodePulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.3);
        opacity: 1;
    }
}

.node-center {
    animation: centerPulse 2s ease-in-out infinite;
}

@keyframes centerPulse {
    0%, 100% {
        transform: scale(1);
        filter: drop-shadow(0 0 10px var(--primary-turquoise));
    }
    50% {
        transform: scale(1.1);
        filter: drop-shadow(0 0 20px var(--primary-turquoise));
    }
}

/* Data packets flowing */
.packet-1 {
    animation: packet1 3s linear infinite;
}

.packet-2 {
    animation: packet2 3s linear infinite 0.75s;
}

.packet-3 {
    animation: packet3 3s linear infinite 1.5s;
}

.packet-4 {
    animation: packet4 3s linear infinite 2.25s;
}

@keyframes packet1 {
    0% {
        cx: 200;
        cy: 200;
        opacity: 1;
    }
    50% {
        cx: 100;
        cy: 100;
        opacity: 1;
    }
    51% {
        opacity: 0;
    }
    100% {
        cx: 200;
        cy: 200;
        opacity: 0;
    }
}

@keyframes packet2 {
    0% {
        cx: 200;
        cy: 200;
        opacity: 1;
    }
    50% {
        cx: 300;
        cy: 100;
        opacity: 1;
    }
    51% {
        opacity: 0;
    }
    100% {
        cx: 200;
        cy: 200;
        opacity: 0;
    }
}

@keyframes packet3 {
    0% {
        cx: 200;
        cy: 200;
        opacity: 1;
    }
    50% {
        cx: 100;
        cy: 300;
        opacity: 1;
    }
    51% {
        opacity: 0;
    }
    100% {
        cx: 200;
        cy: 200;
        opacity: 0;
    }
}

@keyframes packet4 {
    0% {
        cx: 200;
        cy: 200;
        opacity: 1;
    }
    50% {
        cx: 300;
        cy: 300;
        opacity: 1;
    }
    51% {
        opacity: 0;
    }
    100% {
        cx: 200;
        cy: 200;
        opacity: 0;
    }
}

/* ===================================================
   Particle Background
   =================================================== */

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--primary-turquoise);
    border-radius: 50%;
    opacity: 0.3;
    animation: float 15s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0) translateX(0);
    }
    25% {
        transform: translateY(-30px) translateX(20px);
    }
    50% {
        transform: translateY(-10px) translateX(-20px);
    }
    75% {
        transform: translateY(-40px) translateX(10px);
    }
}

/* ===================================================
   Button Animations
   =================================================== */

.btn {
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.btn:active::after {
    width: 300px;
    height: 300px;
}

/* ===================================================
   Card Hover Effects
   =================================================== */

.servico-card,
.tech-item,
.diferencial-card {
    position: relative;
}

.servico-card::after,
.diferencial-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
        rgba(43, 188, 179, 0.15) 0%,
        transparent 60%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    border-radius: inherit;
}

.servico-card:hover::after,
.diferencial-card:hover::after {
    opacity: 1;
}

/* ===================================================
   Text Typing Effect
   =================================================== */

.typing-text {
    overflow: hidden;
    border-right: 2px solid var(--primary-turquoise);
    white-space: nowrap;
    animation: typing 3s steps(40) forwards, blink-caret 0.75s step-end infinite;
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: var(--primary-turquoise); }
}

/* ===================================================
   Counter Animation
   =================================================== */

.stat-number {
    display: inline-block;
}

.stat-number.counting {
    animation: countPulse 0.1s ease;
}

@keyframes countPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* ===================================================
   Wave Animation
   =================================================== */

.wave-divider svg path,
.wave-top svg path,
.wave-bottom svg path {
    animation: waveMove 10s ease-in-out infinite;
}

@keyframes waveMove {
    0%, 100% {
        d: path("M0,60 C360,120 720,0 1080,60 C1260,90 1380,90 1440,60 L1440,120 L0,120 Z");
    }
    50% {
        d: path("M0,80 C360,20 720,100 1080,40 C1260,60 1380,80 1440,60 L1440,120 L0,120 Z");
    }
}

/* ===================================================
   Glow Effects
   =================================================== */

.glow {
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        box-shadow: 0 0 10px var(--primary-turquoise),
                    0 0 20px var(--primary-turquoise),
                    0 0 30px var(--primary-turquoise);
    }
    to {
        box-shadow: 0 0 20px var(--primary-turquoise),
                    0 0 30px var(--primary-turquoise),
                    0 0 40px var(--primary-turquoise);
    }
}

/* ===================================================
   Chart Bar Animation
   =================================================== */

.chart-bar {
    transform-origin: bottom;
    animation: growBar 1.5s ease forwards;
}

.chart-bar:nth-child(1) { animation-delay: 0.1s; }
.chart-bar:nth-child(2) { animation-delay: 0.2s; }
.chart-bar:nth-child(3) { animation-delay: 0.3s; }
.chart-bar:nth-child(4) { animation-delay: 0.4s; }
.chart-bar:nth-child(5) { animation-delay: 0.5s; }
.chart-bar:nth-child(6) { animation-delay: 0.6s; }
.chart-bar:nth-child(7) { animation-delay: 0.7s; }

@keyframes growBar {
    from {
        transform: scaleY(0);
        opacity: 0;
    }
    to {
        transform: scaleY(1);
        opacity: 1;
    }
}

/* ===================================================
   Loading Shimmer
   =================================================== */

.shimmer {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* ===================================================
   Magnetic Button Effect
   =================================================== */

.magnetic-btn {
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* ===================================================
   Smooth Entrance Animations
   =================================================== */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ===================================================
   Hover Lift Effect
   =================================================== */

.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

/* ===================================================
   Border Gradient Animation
   =================================================== */

.border-gradient {
    position: relative;
    background: var(--white);
    border-radius: var(--radius-xl);
}

.border-gradient::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(
        45deg,
        var(--primary-turquoise),
        var(--primary-navy),
        var(--primary-turquoise),
        var(--primary-navy)
    );
    background-size: 400% 400%;
    border-radius: inherit;
    z-index: -1;
    animation: borderGradient 3s ease infinite;
}

@keyframes borderGradient {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* ===================================================
   Marquee Animation (for tech logos if needed)
   =================================================== */

.marquee {
    overflow: hidden;
    white-space: nowrap;
}

.marquee-content {
    display: inline-block;
    animation: marquee 30s linear infinite;
}

@keyframes marquee {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

/* ===================================================
   Reduced Motion
   =================================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .reveal-up,
    .reveal-left,
    .reveal-right,
    .reveal-scale {
        opacity: 1;
        transform: none;
    }
}
