/* =============================================================================
   ISSU321 Linux Installation Tools - Animation Keyframes
   ============================================================================= */

/* --- Reveal Animations --- */
.reveal-up {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal-up.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Glitch Effect --- */
.glitch {
    position: relative;
}

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

.glitch::before {
    animation: glitch-1 2s infinite linear alternate-reverse;
    color: #00ff88;
    z-index: -1;
}

.glitch::after {
    animation: glitch-2 2s infinite linear alternate-reverse;
    color: #00d4ff;
    z-index: -2;
}

@keyframes glitch-1 {
    0%, 100% { clip-path: inset(0 0 0 0); transform: translate(0); }
    20% { clip-path: inset(20% 0 60% 0); transform: translate(-3px, 2px); }
    40% { clip-path: inset(40% 0 40% 0); transform: translate(3px, -2px); }
    60% { clip-path: inset(60% 0 20% 0); transform: translate(-2px, 1px); }
    80% { clip-path: inset(80% 0 0% 0); transform: translate(2px, -1px); }
}

@keyframes glitch-2 {
    0%, 100% { clip-path: inset(0 0 0 0); transform: translate(0); }
    20% { clip-path: inset(60% 0 20% 0); transform: translate(3px, -2px); }
    40% { clip-path: inset(40% 0 40% 0); transform: translate(-3px, 2px); }
    60% { clip-path: inset(20% 0 60% 0); transform: translate(2px, -1px); }
    80% { clip-path: inset(0% 0 80% 0); transform: translate(-2px, 1px); }
}

/* --- Pulse --- */
@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); opacity: 0.5; }
}

/* --- Blink --- */
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* --- Scroll Wheel --- */
@keyframes scroll-wheel {
    0% { transform: translateY(0); opacity: 1; }
    100% { transform: translateY(12px); opacity: 0; }
}

/* --- Dots --- */
@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* --- Spin --- */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- Pulse Ring --- */
@keyframes pulse-ring {
    0% { transform: scale(1); opacity: 0.3; }
    50% { transform: scale(1.1); opacity: 0.1; }
    100% { transform: scale(1); opacity: 0.3; }
}

/* --- Shimmer --- */
@keyframes shimmer {
    0% { transform: translateX(-100%) rotate(45deg); }
    100% { transform: translateX(100%) rotate(45deg); }
}

/* --- Fade In --- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Float --- */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* --- Glow Pulse --- */
@keyframes glow-pulse {
    0%, 100% { box-shadow: 0 0 5px rgba(0, 255, 136, 0.3); }
    50% { box-shadow: 0 0 20px rgba(0, 255, 136, 0.6), 0 0 40px rgba(0, 255, 136, 0.2); }
}

/* --- Matrix Rain (handled in JS, but base styles) --- */
.matrix-char {
    font-family: var(--font-mono);
    font-size: 14px;
    color: #00ff88;
    opacity: 0.8;
}

/* --- Particle --- */
.particle {
    position: absolute;
    border-radius: 50%;
    background: var(--text-accent);
    pointer-events: none;
}

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

/* --- Card Hover Glow --- */
.card-glow:hover {
    animation: glow-pulse 2s infinite;
}

/* --- Gradient Border Animation --- */
.gradient-border {
    position: relative;
    background: var(--bg-card);
    border-radius: 12px;
}

.gradient-border::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 14px;
    background: linear-gradient(45deg, #00ff88, #00d4ff, #ff6b6b, #ffd93d);
    background-size: 400% 400%;
    animation: gradient-shift 3s ease infinite;
    z-index: -1;
}

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

/* --- Loading Bar --- */
.loading-bar {
    height: 4px;
    background: var(--bg-secondary);
    border-radius: 2px;
    overflow: hidden;
}

.loading-bar-fill {
    height: 100%;
    background: var(--gradient-1);
    border-radius: 2px;
    animation: loading-progress 2s ease-in-out infinite;
}

@keyframes loading-progress {
    0% { width: 0%; margin-left: 0%; }
    50% { width: 50%; margin-left: 25%; }
    100% { width: 0%; margin-left: 100%; }
}

/* --- Shake --- */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.shake {
    animation: shake 0.5s ease-in-out;
}

/* --- Bounce In --- */
@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); opacity: 1; }
}

.bounce-in {
    animation: bounceIn 0.6s ease-out;
}

/* --- Slide In Left --- */
@keyframes slideInLeft {
    from { transform: translateX(-100px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.slide-in-left {
    animation: slideInLeft 0.6s ease-out;
}

/* --- Slide In Right --- */
@keyframes slideInRight {
    from { transform: translateX(100px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.slide-in-right {
    animation: slideInRight 0.6s ease-out;
}

/* --- Rotate In --- */
@keyframes rotateIn {
    from { transform: rotate(-180deg) scale(0); opacity: 0; }
    to { transform: rotate(0) scale(1); opacity: 1; }
}

.rotate-in {
    animation: rotateIn 0.6s ease-out;
}

/* --- Scale In --- */
@keyframes scaleIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.scale-in {
    animation: scaleIn 0.4s ease-out;
}

/* --- Neon Flicker --- */
@keyframes neon-flicker {
    0%, 100% { opacity: 1; }
    41% { opacity: 1; }
    42% { opacity: 0.4; }
    43% { opacity: 1; }
    45% { opacity: 1; }
    46% { opacity: 0.4; }
    47% { opacity: 1; }
}

.neon-flicker {
    animation: neon-flicker 3s infinite;
}

/* --- Wave --- */
@keyframes wave {
    0%, 100% { transform: translateY(0); }
    25% { transform: translateY(-5px); }
    75% { transform: translateY(5px); }
}

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

/* --- Counter Animation --- */
@keyframes count-up {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.count-up {
    animation: count-up 0.5s ease-out;
}

/* --- Ripple --- */
@keyframes ripple {
    0% { transform: scale(0); opacity: 1; }
    100% { transform: scale(4); opacity: 0; }
}

.ripple-effect {
    position: relative;
    overflow: hidden;
}

.ripple-effect::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background: radial-gradient(circle, rgba(0, 255, 136, 0.3) 0%, transparent 70%);
    transform: scale(0);
    opacity: 0;
}

.ripple-effect:active::after {
    animation: ripple 0.6s ease-out;
}

/* --- Hover Lift --- */
.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.4);
}

/* --- Gradient Text Animation --- */
@keyframes gradient-text {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.animated-gradient-text {
    background: linear-gradient(90deg, #00ff88, #00d4ff, #ff6b6b, #ffd93d, #00ff88);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradient-text 3s linear infinite;
}

/* --- Stagger Children --- */
.stagger-children > * {
    opacity: 0;
    transform: translateY(20px);
}

.stagger-children.visible > *:nth-child(1) { animation: fadeIn 0.5s ease forwards 0.1s; }
.stagger-children.visible > *:nth-child(2) { animation: fadeIn 0.5s ease forwards 0.2s; }
.stagger-children.visible > *:nth-child(3) { animation: fadeIn 0.5s ease forwards 0.3s; }
.stagger-children.visible > *:nth-child(4) { animation: fadeIn 0.5s ease forwards 0.4s; }
.stagger-children.visible > *:nth-child(5) { animation: fadeIn 0.5s ease forwards 0.5s; }
.stagger-children.visible > *:nth-child(6) { animation: fadeIn 0.5s ease forwards 0.6s; }

/* --- Border Glow --- */
@keyframes border-glow {
    0%, 100% { border-color: rgba(0, 255, 136, 0.3); }
    50% { border-color: rgba(0, 255, 136, 0.8); }
}

.border-glow {
    animation: border-glow 2s ease infinite;
}

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

.scanline-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(180deg, transparent, rgba(0, 255, 136, 0.1), transparent);
    animation: scanline 8s linear infinite;
    pointer-events: none;
    z-index: 9999;
}

/* --- CRT Flicker --- */
@keyframes crt-flicker {
    0% { opacity: 0.97; }
    5% { opacity: 0.95; }
    10% { opacity: 0.98; }
    15% { opacity: 0.96; }
    20% { opacity: 0.99; }
    50% { opacity: 0.95; }
    80% { opacity: 0.98; }
    100% { opacity: 0.97; }
}

.crt-flicker {
    animation: crt-flicker 0.15s infinite;
}

/* --- Typing Cursor --- */
.typing-cursor::after {
    content: '|';
    animation: blink 1s infinite;
    color: var(--text-accent);
    margin-left: 2px;
}

/* --- Progress Ring --- */
@keyframes progress-ring {
    0% { stroke-dashoffset: 100; }
    100% { stroke-dashoffset: 0; }
}

.progress-ring-circle {
    animation: progress-ring 2s ease-in-out forwards;
}

/* --- Magnetic Button --- */
.magnetic-btn {
    transition: transform 0.2s ease;
}

/* --- Parallax Layer --- */
.parallax-layer {
    will-change: transform;
}

/* --- Noise Texture --- */
.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* --- Smooth Scrollbar --- */
html {
    scroll-behavior: smooth;
}

/* --- Focus Styles --- */
*:focus-visible {
    outline: 2px solid var(--text-accent);
    outline-offset: 2px;
}

/* --- 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 {
        opacity: 1;
        transform: none;
    }

    #matrix-canvas,
    #particles-canvas {
        display: none;
    }
}
