/* ========================================
   CraftFix - Scroll & Advanced Animations
   ======================================== */

/* ---- Scroll Reveal Animations ---- */
.scroll-reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

.scroll-reveal.slide-right {
    transform: translateX(-60px);
}

.scroll-reveal.slide-right.revealed {
    transform: translateX(0);
}

.scroll-reveal.slide-left {
    transform: translateX(60px);
}

.scroll-reveal.slide-left.revealed {
    transform: translateX(0);
}

.scroll-reveal.scale-up {
    transform: scale(0.8);
}

.scroll-reveal.scale-up.revealed {
    transform: scale(1);
}

.scroll-reveal.rotate-in {
    transform: rotate(-5deg) translateY(40px);
}

.scroll-reveal.rotate-in.revealed {
    transform: rotate(0deg) translateY(0);
}

/* Delay Classes */
.delay-1 { transition-delay: 0.1s; }
.delay-2 { transition-delay: 0.2s; }
.delay-3 { transition-delay: 0.3s; }
.delay-4 { transition-delay: 0.4s; }
.delay-5 { transition-delay: 0.5s; }
.delay-6 { transition-delay: 0.6s; }

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

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

.glitch-text::before {
    left: 2px;
    text-shadow: -2px 0 #ff00ff;
    clip-path: inset(0 0 0 0);
    animation: glitch-1 2s infinite linear alternate-reverse;
}

.glitch-text::after {
    left: -2px;
    text-shadow: 2px 0 #00ffff;
    clip-path: inset(0 0 0 0);
    animation: glitch-2 2s infinite linear alternate-reverse;
}

@keyframes glitch-1 {
    0% { clip-path: inset(40% 0 61% 0); }
    20% { clip-path: inset(92% 0 1% 0); }
    40% { clip-path: inset(43% 0 1% 0); }
    60% { clip-path: inset(25% 0 58% 0); }
    80% { clip-path: inset(54% 0 7% 0); }
    100% { clip-path: inset(58% 0 43% 0); }
}

@keyframes glitch-2 {
    0% { clip-path: inset(65% 0 13% 0); }
    20% { clip-path: inset(79% 0 14% 0); }
    40% { clip-path: inset(17% 0 71% 0); }
    60% { clip-path: inset(65% 0 28% 0); }
    80% { clip-path: inset(20% 0 64% 0); }
    100% { clip-path: inset(15% 0 55% 0); }
}

/* ---- Hover Glow Effects ---- */
@keyframes glow-pulse {
    0%, 100% { box-shadow: 0 0 5px rgba(108, 92, 231, 0.2); }
    50% { box-shadow: 0 0 20px rgba(108, 92, 231, 0.4), 0 0 40px rgba(108, 92, 231, 0.1); }
}

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

/* ---- Parallax Layers ---- */
.parallax-layer {
    transition: transform 0.1s ease-out;
    will-change: transform;
}

/* ---- Magnetic Button Effect ---- */
.magnetic-btn {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Stagger Children Animation ---- */
.stagger-container .stagger-item {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.stagger-container.revealed .stagger-item {
    opacity: 1;
    transform: translateY(0);
}

/* ---- Text Reveal Animation ---- */
.text-reveal {
    overflow: hidden;
}

.text-reveal span {
    display: inline-block;
    transform: translateY(100%);
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.text-reveal.revealed span {
    transform: translateY(0);
}

/* ---- Card Tilt 3D ---- */
.tilt-card {
    transform-style: preserve-3d;
    transition: transform 0.3s ease;
}

.tilt-card .tilt-content {
    transform: translateZ(30px);
}

/* ---- Morphing Blob ---- */
.morph-blob {
    animation: morph 8s ease-in-out infinite;
}

@keyframes morph {
    0%, 100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
    25% { border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%; }
    50% { border-radius: 50% 60% 30% 60% / 30% 50% 70% 60%; }
    75% { border-radius: 60% 40% 60% 30% / 70% 30% 50% 60%; }
}

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

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

/* ---- Neon Glow Text ---- */
.neon-text {
    text-shadow: 
        0 0 7px rgba(108, 92, 231, 0.5),
        0 0 10px rgba(108, 92, 231, 0.3),
        0 0 21px rgba(108, 92, 231, 0.2);
    animation: neon-flicker 3s infinite alternate;
}

@keyframes neon-flicker {
    0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% {
        text-shadow: 
            0 0 7px rgba(108, 92, 231, 0.5),
            0 0 10px rgba(108, 92, 231, 0.3),
            0 0 21px rgba(108, 92, 231, 0.2);
    }
    20%, 24%, 55% {
        text-shadow: none;
    }
}

/* ---- Particle Trail ---- */
.particle-trail {
    position: fixed;
    pointer-events: none;
    z-index: 99997;
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    animation: particle-fade 1s ease-out forwards;
}

@keyframes particle-fade {
    0% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(0); }
}

/* ---- Code Syntax Colors ---- */
.code-keyword { color: #c678dd; }
.code-string { color: #98c379; }
.code-function { color: #61afef; }
.code-variable { color: #e06c75; }
.code-comment { color: #5c6370; font-style: italic; }
.code-number { color: #d19a66; }
.code-operator { color: #56b6c2; }
.code-bracket { color: #c678dd; }
.code-property { color: #e5c07b; }

/* ---- Project Card Filter Animation ---- */
.project-card.hidden {
    opacity: 0;
    transform: scale(0.8);
    position: absolute;
    pointer-events: none;
}

.project-card.show {
    opacity: 1;
    transform: scale(1);
    position: relative;
    pointer-events: auto;
}

.projects-grid {
    position: relative;
    transition: all 0.5s ease;
}

/* ---- Success/Error Messages ---- */
.form-message {
    padding: 15px 20px;
    border-radius: var(--radius-sm);
    margin-top: 15px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slide-in-message 0.5s ease;
}

.form-message.success {
    background: rgba(39, 202, 64, 0.1);
    color: #27ca40;
    border: 1px solid rgba(39, 202, 64, 0.3);
}

.form-message.error {
    background: rgba(255, 95, 86, 0.1);
    color: #ff5f56;
    border: 1px solid rgba(255, 95, 86, 0.3);
}

@keyframes slide-in-message {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---- Loading Skeleton ---- */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-card) 25%,
        var(--bg-card-hover) 50%,
        var(--bg-card) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

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

/* ---- Matrix Rain Effect (subtle background) ---- */
.matrix-rain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.03;
}

