/* ============================================
   SIETCH - Animations & Effects
   ============================================ */

/* ============================================
   Hero Headline Animation
   ============================================ */
.hero-headline-wrapper {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1.2s ease, transform 1.2s ease;
}

.hero-headline-wrapper.visible {
    opacity: 1;
    transform: translateY(0);
}

.hero-headline .line {
    display: block;
    opacity: 1;
}

.hero-headline .char {
    display: inline;
}

/* Video fade in */
.hero-video-bg video {
    opacity: 0;
    transition: opacity 1s ease;
}

.hero-video-bg video.loaded {
    opacity: 1;
}

/* ============================================
   Scroll-based Reveal Animations
   ============================================ */

/* Base state for animated elements */
[data-animate] {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

[data-animate].animated {
    opacity: 1;
    transform: translateY(0);
}

/* Fade variations */
[data-animate="fade-up"] {
    transform: translateY(40px);
}

[data-animate="fade-down"] {
    transform: translateY(-40px);
}

[data-animate="fade-left"] {
    transform: translateX(40px);
}

[data-animate="fade-right"] {
    transform: translateX(-40px);
}

[data-animate="fade-up"].animated,
[data-animate="fade-down"].animated,
[data-animate="fade-left"].animated,
[data-animate="fade-right"].animated {
    transform: translate(0);
}

/* Scale animations */
[data-animate="scale-up"] {
    transform: scale(0.9);
}

[data-animate="scale-up"].animated {
    transform: scale(1);
}

/* Stagger delays for children */
[data-stagger] > *:nth-child(1) { transition-delay: 0s; }
[data-stagger] > *:nth-child(2) { transition-delay: 0.1s; }
[data-stagger] > *:nth-child(3) { transition-delay: 0.2s; }
[data-stagger] > *:nth-child(4) { transition-delay: 0.3s; }
[data-stagger] > *:nth-child(5) { transition-delay: 0.4s; }
[data-stagger] > *:nth-child(6) { transition-delay: 0.5s; }

/* ============================================
   Text Animations
   ============================================ */

/* Glitch effect for headlines */
.glitch {
    position: relative;
}

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

.glitch:hover::before {
    animation: glitch-1 0.3s linear infinite;
    color: var(--color-accent-primary);
    opacity: 0.8;
}

.glitch:hover::after {
    animation: glitch-2 0.3s linear infinite;
    color: var(--color-error);
    opacity: 0.8;
}

@keyframes glitch-1 {
    0% { clip-path: inset(20% 0 60% 0); transform: translateX(-3px); }
    20% { clip-path: inset(80% 0 10% 0); transform: translateX(3px); }
    40% { clip-path: inset(10% 0 70% 0); transform: translateX(-3px); }
    60% { clip-path: inset(50% 0 30% 0); transform: translateX(3px); }
    80% { clip-path: inset(30% 0 50% 0); transform: translateX(-3px); }
    100% { clip-path: inset(70% 0 20% 0); transform: translateX(3px); }
}

@keyframes glitch-2 {
    0% { clip-path: inset(60% 0 20% 0); transform: translateX(3px); }
    20% { clip-path: inset(10% 0 80% 0); transform: translateX(-3px); }
    40% { clip-path: inset(70% 0 10% 0); transform: translateX(3px); }
    60% { clip-path: inset(30% 0 50% 0); transform: translateX(-3px); }
    80% { clip-path: inset(50% 0 30% 0); transform: translateX(3px); }
    100% { clip-path: inset(20% 0 70% 0); transform: translateX(-3px); }
}

/* Typewriter effect */
.typewriter {
    overflow: hidden;
    border-right: 2px solid var(--color-accent-primary);
    white-space: nowrap;
    animation: typing 3s steps(40, end), 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(--color-accent-primary); }
}

/* Text reveal */
.text-reveal {
    display: inline-block;
    overflow: hidden;
}

.text-reveal span {
    display: inline-block;
    transform: translateY(100%);
    animation: textReveal 0.8s ease forwards;
}

@keyframes textReveal {
    to { transform: translateY(0); }
}

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

/* 3D tilt effect */
.card-3d {
    transform-style: preserve-3d;
    perspective: 1000px;
}

.card-3d:hover {
    transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
}

/* Shine effect on hover */
.card-shine {
    position: relative;
    overflow: hidden;
}

.card-shine::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.05) 50%,
        transparent 70%
    );
    transform: rotate(45deg) translateX(-100%);
    transition: transform 0.6s ease;
}

.card-shine:hover::after {
    transform: rotate(45deg) translateX(100%);
}

/* Border flow effect */
.border-flow {
    position: relative;
}

.border-flow::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(
        90deg,
        transparent,
        var(--color-accent-primary),
        transparent
    );
    -webkit-mask: 
        linear-gradient(#fff 0 0) content-box, 
        linear-gradient(#fff 0 0);
    mask: 
        linear-gradient(#fff 0 0) content-box, 
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: borderFlow 3s linear infinite;
}

@keyframes borderFlow {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================
   Button Effects
   ============================================ */

/* Ripple effect */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple .ripple {
    position: absolute;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.3);
    transform: scale(0);
    animation: ripple 0.6s linear;
    pointer-events: none;
}

@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Magnetic button */
.btn-magnetic {
    transition: transform 0.3s ease;
}

/* ============================================
   Loading States
   ============================================ */

/* Skeleton loading */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--color-bg-tertiary) 25%,
        var(--color-bg-elevated) 50%,
        var(--color-bg-tertiary) 75%
    );
    background-size: 200% 100%;
    animation: skeleton 1.5s ease-in-out infinite;
}

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

/* Pulse loading */
.pulse {
    animation: pulse-animation 2s ease-in-out infinite;
}

@keyframes pulse-animation {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-border-primary);
    border-top-color: var(--color-accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   Background Animations
   ============================================ */

/* Gradient shift */
.gradient-shift {
    background: linear-gradient(
        -45deg,
        var(--color-bg-primary),
        var(--color-bg-secondary),
        var(--color-accent-glow),
        var(--color-bg-primary)
    );
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

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

/* Floating particles */
.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background-color: var(--color-accent-primary);
    border-radius: 50%;
    opacity: 0.6;
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0) translateX(0);
        opacity: 0.6;
    }
    50% {
        transform: translateY(-20px) translateX(10px);
        opacity: 0.3;
    }
}

/* Grid pulse */
.grid-pulse {
    animation: gridPulse 4s ease-in-out infinite;
}

@keyframes gridPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.6; }
}

/* ============================================
   Icon Animations
   ============================================ */

/* Bounce */
.icon-bounce {
    animation: bounce 2s ease infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

/* Shake */
.icon-shake:hover {
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Rotate */
.icon-rotate {
    transition: transform 0.3s ease;
}

.icon-rotate:hover {
    transform: rotate(180deg);
}

/* ============================================
   Page Transitions
   ============================================ */

.page-transition-enter {
    opacity: 0;
    transform: translateY(20px);
}

.page-transition-enter-active {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.page-transition-exit {
    opacity: 1;
    transform: translateY(0);
}

.page-transition-exit-active {
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

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

.counter-animate {
    display: inline-block;
}

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

.parallax-slow {
    will-change: transform;
}

.parallax-fast {
    will-change: transform;
}

/* ============================================
   Accessibility - Reduced Motion
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .scroll-indicator,
    .scan-line,
    .data-streams {
        display: none;
    }
}

/* ============================================
   Special Effects
   ============================================ */

/* Neon glow text */
.neon-glow {
    text-shadow: 
        0 0 5px var(--color-accent-primary),
        0 0 10px var(--color-accent-primary),
        0 0 20px var(--color-accent-primary),
        0 0 40px var(--color-accent-primary);
}

/* Hologram effect */
.hologram {
    position: relative;
    background: linear-gradient(
        135deg,
        rgba(0, 212, 255, 0.1),
        transparent 50%,
        rgba(0, 212, 255, 0.1)
    );
    animation: hologram 3s ease-in-out infinite;
}

@keyframes hologram {
    0%, 100% {
        filter: hue-rotate(0deg);
        opacity: 1;
    }
    50% {
        filter: hue-rotate(30deg);
        opacity: 0.9;
    }
}

/* Scan lines overlay */
.scanlines::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.1) 2px,
        rgba(0, 0, 0, 0.1) 4px
    );
    pointer-events: none;
}

/* CRT flicker */
.crt-flicker {
    animation: crtFlicker 0.15s infinite;
}

@keyframes crtFlicker {
    0% { opacity: 0.97; }
    50% { opacity: 1; }
    100% { opacity: 0.98; }
}

/* Data stream effect */
.data-flow {
    background: linear-gradient(
        180deg,
        transparent 0%,
        var(--color-accent-primary) 50%,
        transparent 100%
    );
    background-size: 100% 200%;
    animation: dataFlow 2s linear infinite;
}

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

/* Matrix rain effect container */
.matrix-bg {
    position: relative;
    overflow: hidden;
}

.matrix-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        repeating-linear-gradient(
            0deg,
            transparent,
            rgba(0, 212, 255, 0.03) 2px,
            transparent 4px
        );
    animation: matrixScroll 20s linear infinite;
    pointer-events: none;
}

@keyframes matrixScroll {
    0% { transform: translateY(0); }
    100% { transform: translateY(100px); }
}
