/* BRUTALIST ANIMATIONS - LARGE SCREENS ONLY */

/* Only enable animations on screens wider than 1200px */
@media (min-width: 1200px) {

/* CRT SCREEN EFFECT */
@keyframes crt-flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.98; }
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(20, 241, 149, 0.03) 0px,
        rgba(20, 241, 149, 0.03) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    z-index: 2;
    animation: crt-flicker 0.15s infinite;
}

/* GLITCH TEXT EFFECT */
@keyframes glitch-1 {
    0%, 90%, 100% {
        transform: translate(0);
    }
    92% {
        transform: translate(-2px, 2px);
    }
    94% {
        transform: translate(2px, -2px);
    }
    96% {
        transform: translate(-2px, -2px);
    }
}

@keyframes glitch-2 {
    0%, 85%, 100% {
        transform: translate(0);
        opacity: 1;
    }
    88% {
        transform: translate(3px, 0);
        opacity: 0.8;
    }
    90% {
        transform: translate(-3px, 0);
        opacity: 0.8;
    }
}

@keyframes glitch-color {
    0%, 80%, 100% {
        text-shadow: none;
    }
    85% {
        text-shadow:
            -2px 0 var(--primary-purple),
            2px 0 var(--primary-green);
    }
    90% {
        text-shadow:
            2px 0 var(--primary-purple),
            -2px 0 var(--primary-green);
    }
}

.hero h1 {
    position: relative;
    animation: glitch-color 5s infinite;
}

.hero h1::before,
.hero h1::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.hero h1::before {
    animation: glitch-1 3s infinite;
    color: var(--primary-purple);
    z-index: -1;
    opacity: 0.7;
}

.hero h1::after {
    animation: glitch-2 4s infinite;
    color: var(--primary-green);
    z-index: -2;
    opacity: 0.5;
}

/* TERMINAL CURSOR BLINK */
@keyframes cursor-blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

.hero-badge::after {
    content: '_';
    animation: cursor-blink 1s infinite;
    color: var(--primary-green);
}

/* GRID OVERLAY ANIMATION */
@keyframes grid-scan {
    0% {
        transform: translateY(-100%);
    }
    100% {
        transform: translateY(100vh);
    }
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 200vh;
    background:
        linear-gradient(90deg, transparent 49%, var(--primary-green) 49%, var(--primary-green) 51%, transparent 51%),
        linear-gradient(0deg, transparent 49%, var(--primary-green) 49%, var(--primary-green) 51%, transparent 51%);
    background-size: 100px 100px;
    opacity: 0.02;
    pointer-events: none;
    z-index: 1;
    animation: grid-scan 20s linear infinite;
}

/* SCAN LINE EFFECT */
@keyframes scanline {
    0% {
        transform: translateY(-100%);
    }
    100% {
        transform: translateY(100vh);
    }
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100px;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        var(--primary-green) 50%,
        transparent 100%
    );
    opacity: 0.05;
    pointer-events: none;
    z-index: 9998;
    animation: scanline 8s linear infinite;
}

/* DATA STREAM ANIMATION */
@keyframes data-stream {
    0% {
        transform: translateY(-100%);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(100vh);
        opacity: 0;
    }
}

.section::before {
    content: '01010011 01001111 01001100 00100000 01000001 01001110 01000001';
    position: absolute;
    top: 0;
    right: 5%;
    font-family: 'Space Mono', monospace;
    font-size: 0.7rem;
    color: var(--primary-green);
    opacity: 0.1;
    white-space: nowrap;
    animation: data-stream 15s linear infinite;
    pointer-events: none;
}

.section:nth-child(even)::before {
    content: '01010111 01000101 01000010 00110011 00100000 01000001 01010000 01001001';
    right: auto;
    left: 5%;
    color: var(--primary-purple);
    animation-delay: 5s;
}

/* PRODUCT CARD HOVER EFFECTS */
@keyframes card-glitch {
    0%, 90%, 100% {
        transform: translate(0, 0);
    }
    92% {
        transform: translate(-3px, 3px);
    }
    94% {
        transform: translate(3px, -3px);
    }
    96% {
        transform: translate(-3px, -3px);
    }
    98% {
        transform: translate(3px, 3px);
    }
}

.product-card:hover {
    animation: card-glitch 0.3s;
}

.product-card:hover .product-icon {
    animation: icon-pulse 0.5s;
}

@keyframes icon-pulse {
    0%, 100% {
        transform: scale(1);
    }
    25% {
        transform: scale(1.3);
    }
    50% {
        transform: scale(0.9);
    }
    75% {
        transform: scale(1.2);
    }
}

/* STATS COUNTER ANIMATION */
@keyframes stat-flash {
    0%, 80%, 100% {
        border-color: var(--primary-green);
        background: var(--bg-card);
    }
    85%, 95% {
        border-color: var(--primary-purple);
        background: rgba(153, 69, 255, 0.1);
    }
}

.stat.visible {
    animation: stat-flash 2s ease-in-out;
}

/* BORDER PULSE ANIMATION */
@keyframes border-pulse {
    0%, 100% {
        box-shadow:
            0 0 0 0 var(--primary-green),
            inset 0 0 0 0 var(--primary-green);
    }
    50% {
        box-shadow:
            0 0 20px 0 var(--primary-green),
            inset 0 0 20px 0 var(--primary-green);
    }
}

.btn-primary:hover {
    animation: border-pulse 1s infinite;
}

/* NOISE TEXTURE OVERLAY */
@keyframes noise {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-5%, -5%); }
    20% { transform: translate(-10%, 5%); }
    30% { transform: translate(5%, -10%); }
    40% { transform: translate(-5%, 15%); }
    50% { transform: translate(-10%, 5%); }
    60% { transform: translate(15%, 0); }
    70% { transform: translate(0, 10%); }
    80% { transform: translate(-15%, 0); }
    90% { transform: translate(10%, 5%); }
}

.hero::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"><filter id="noise"><feTurbulence type="fractalNoise" baseFrequency="0.9" numOctaves="4" stitchTiles="stitch"/></filter><rect width="100%" height="100%" filter="url(%23noise)" opacity="0.05"/></svg>');
    opacity: 0.3;
    pointer-events: none;
    z-index: 1;
    animation: noise 8s steps(10) infinite;
}

/* GEOMETRIC SHAPES ANIMATION */
@keyframes shape-float-1 {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
    }
    25% {
        transform: translate(100px, -50px) rotate(90deg);
    }
    50% {
        transform: translate(200px, 0) rotate(180deg);
    }
    75% {
        transform: translate(100px, 50px) rotate(270deg);
    }
}

@keyframes shape-float-2 {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg) scale(1);
    }
    33% {
        transform: translate(-80px, 60px) rotate(120deg) scale(1.2);
    }
    66% {
        transform: translate(80px, -60px) rotate(240deg) scale(0.8);
    }
}

.section:nth-child(odd)::after {
    content: '';
    position: absolute;
    top: 20%;
    right: 10%;
    width: 150px;
    height: 150px;
    border: 4px solid var(--primary-green);
    opacity: 0.1;
    pointer-events: none;
    animation: shape-float-1 20s linear infinite;
}

.section:nth-child(even)::after {
    content: '';
    position: absolute;
    bottom: 20%;
    left: 10%;
    width: 100px;
    height: 100px;
    border: 4px solid var(--primary-purple);
    transform: rotate(45deg);
    opacity: 0.1;
    pointer-events: none;
    animation: shape-float-2 15s linear infinite;
}

/* TICKER TAPE ANIMATION */
@keyframes ticker {
    0% {
        transform: translateX(100%);
    }
    100% {
        transform: translateX(-100%);
    }
}

.pricing-preview {
    overflow: hidden;
    position: relative;
}

.pricing-preview::before {
    content: 'RPC • ANALYTICS • WHALE TRACKING • WEB3 INFRASTRUCTURE • SOLANA APIs • ';
    position: absolute;
    top: 0;
    left: 0;
    white-space: nowrap;
    animation: ticker 30s linear infinite;
    color: var(--primary-green);
    opacity: 0.3;
    font-size: 0.8rem;
}

/* MATRIX RAIN EFFECT */
@keyframes matrix-rain {
    0% {
        transform: translateY(-100%);
    }
    100% {
        transform: translateY(100vh);
    }
}

.cta-section::before {
    content: '█ ▓ ▒ ░ █ ▓ ▒ ░ █ ▓ ▒ ░ █ ▓ ▒ ░';
    position: absolute;
    top: -100%;
    left: 20%;
    font-family: 'Space Mono', monospace;
    font-size: 1.5rem;
    color: #000;
    opacity: 0.1;
    white-space: nowrap;
    transform: rotate(90deg);
    animation: matrix-rain 10s linear infinite;
    pointer-events: none;
    z-index: 0;
}

/* SCROLL PROGRESS GLITCH */
@keyframes progress-glitch {
    0%, 90%, 100% {
        height: 6px;
    }
    92%, 96% {
        height: 12px;
    }
    94%, 98% {
        height: 3px;
    }
}

.scroll-progress {
    animation: progress-glitch 3s infinite;
}

/* LINK HOVER DIGITAL FLICKER */
@keyframes link-flicker {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

.nav-links a:hover {
    animation: link-flicker 0.1s steps(2) 3;
}

/* BRUTAL STEP ANIMATION FOR CARDS */
@keyframes brutal-step-in {
    0% {
        transform: translateY(40px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

.product-card.visible {
    animation: brutal-step-in 0.3s steps(3) both;
}

.product-card:nth-child(2).visible {
    animation-delay: 0.1s;
}

.product-card:nth-child(3).visible {
    animation-delay: 0.2s;
}

/* BADGE SLIDE ANIMATION */
@keyframes badge-slide {
    0% {
        transform: translateX(-100px);
        opacity: 0;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

.hero-badge {
    animation: badge-slide 0.4s steps(4);
}

/* FAQ ITEM SNAP ANIMATION */
@keyframes faq-snap {
    0% {
        transform: translateX(-20px);
        opacity: 0;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

.faq-item {
    animation: faq-snap 0.3s steps(2);
}

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

/* TERMINAL BOOT SEQUENCE */
@keyframes terminal-boot {
    0% {
        opacity: 0;
    }
    50% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

.hero-content > * {
    animation: terminal-boot 0.1s steps(1);
}

.hero-content h1 {
    animation-delay: 0.1s;
}

.hero-content p {
    animation-delay: 0.3s;
}

.hero-cta {
    animation-delay: 0.5s;
}

/* NETWORK NODE CONNECTIONS */
@keyframes node-pulse {
    0%, 100% {
        opacity: 0.2;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.1);
    }
}

.how-it-works .step::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -1.5rem;
    width: 3rem;
    height: 3px;
    background: var(--primary-green);
    opacity: 0.3;
    animation: node-pulse 2s infinite;
}

.how-it-works .step:last-child::after {
    display: none;
}

/* BRUTAL TYPING EFFECT */
@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

.section-title {
    overflow: hidden;
    white-space: nowrap;
    animation: typing 1s steps(40) both;
}

/* GLITCH BORDERS */
@keyframes glitch-border {
    0%, 90%, 100% {
        border-color: var(--primary-green);
    }
    92%, 96% {
        border-color: var(--primary-purple);
    }
    94%, 98% {
        border-color: #FFF;
    }
}

nav {
    animation: glitch-border 5s infinite;
}

/* SCANLINE INTENSITY */
@keyframes scanline-intensity {
    0%, 100% {
        opacity: 0.05;
    }
    50% {
        opacity: 0.1;
    }
}

body::before {
    animation: scanline 8s linear infinite, scanline-intensity 2s ease-in-out infinite;
}

} /* End of large screen media query */

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