/* ========================================
   PSYCLOX PORTFOLIO - ANIMATIONS
   ======================================== */

/* ========================================
   GSAP ANIMATION HELPERS
   ======================================== */

/* Initial states for GSAP animations */
.gsap-hidden {
    opacity: 0;
    visibility: hidden;
}

.gsap-fade-up {
    opacity: 0;
    transform: translateY(60px);
}

.gsap-fade-left {
    opacity: 0;
    transform: translateX(-60px);
}

.gsap-fade-right {
    opacity: 0;
    transform: translateX(60px);
}

.gsap-scale-in {
    opacity: 0;
    transform: scale(0.9);
}

/* ========================================
   PARTICLE BACKGROUND
   ======================================== */

.hero-particles {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--accent-primary);
    border-radius: 50%;
    opacity: 0;
    animation: particleFloat 8s ease-in-out infinite;
}

/* ========================================
   HERO SCROLL ILLUSION
   ======================================== */
.hero-scroll-illusion {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 15rem;
    font-weight: 900;
    font-family: 'Orbitron', monospace;
    white-space: nowrap;
    color: transparent;
    -webkit-text-stroke: 2px rgba(255, 255, 255, 0.12);
    /* Increased from 0.03 for visibility */
    pointer-events: none;
    z-index: 1;
    /* Below the hero content but above video */
    text-transform: uppercase;
    letter-spacing: -5px;
}

@keyframes particleFloat {
    0% {
        opacity: 0;
        transform: translateY(100vh) scale(0);
    }

    10% {
        opacity: 0.8;
    }

    90% {
        opacity: 0.8;
    }

    100% {
        opacity: 0;
        transform: translateY(-100vh) scale(1);
    }
}

/* ========================================
   MATRIX RAIN EFFECT
   ======================================== */

.matrix-container {
    position: absolute;
    inset: 0;
    overflow: hidden;
    opacity: 0.1;
    pointer-events: none;
}

.matrix-column {
    position: absolute;
    top: -100%;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    color: var(--accent-primary);
    writing-mode: vertical-rl;
    text-orientation: upright;
    animation: matrixRain 10s linear infinite;
}

@keyframes matrixRain {
    0% {
        transform: translateY(-100%);
    }

    100% {
        transform: translateY(300%);
    }
}

/* ========================================
   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: glitchTop 2s infinite steps(1);
    clip-path: polygon(0 0, 100% 0, 100% 35%, 0 35%);
    -webkit-clip-path: polygon(0 0, 100% 0, 100% 35%, 0 35%);
}

.glitch::after {
    animation: glitchBottom 2s infinite steps(1);
    clip-path: polygon(0 65%, 100% 65%, 100% 100%, 0 100%);
    -webkit-clip-path: polygon(0 65%, 100% 65%, 100% 100%, 0 100%);
}

@keyframes glitchTop {

    0%,
    100% {
        transform: translate(0);
        opacity: 1;
    }

    2% {
        transform: translate(-3px, -1px);
        color: #ff00ff;
    }

    4% {
        transform: translate(3px, 1px);
        color: #00ffff;
    }

    6% {
        transform: translate(0);
    }
}

@keyframes glitchBottom {

    0%,
    100% {
        transform: translate(0);
        opacity: 1;
    }

    3% {
        transform: translate(3px, 1px);
        color: #00ffff;
    }

    5% {
        transform: translate(-3px, -1px);
        color: #ff00ff;
    }

    7% {
        transform: translate(0);
    }
}

/* ========================================
   TYPEWRITER CURSOR
   ======================================== */

.typing-cursor {
    display: inline-block;
    width: 3px;
    height: 1.2em;
    background-color: var(--accent-primary);
    margin-left: 2px;
    animation: cursorBlink 1s step-end infinite;
}

@keyframes cursorBlink {

    0%,
    50% {
        opacity: 1;
    }

    51%,
    100% {
        opacity: 0;
    }
}

/* ========================================
   HOVER EFFECTS
   ======================================== */

/* Magnetic button effect container */
.magnetic-btn {
    position: relative;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.shine-effect::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.2),
            transparent);
    transition: left 0.5s ease;
}

.shine-effect:hover::before {
    left: 100%;
}

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

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

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

/* ========================================
   CARD TILT EFFECT
   ======================================== */

[data-tilt] {
    transform-style: preserve-3d;
    transform: perspective(1000px);
}

[data-tilt] .project-content {
    transform: translateZ(30px);
}

[data-tilt] .project-image {
    transform: translateZ(20px);
}

/* ========================================
   FLOATING ANIMATION
   ======================================== */

.float-animation {
    animation: floatY 4s ease-in-out infinite;
}

.float-animation-delayed {
    animation: floatY 4s ease-in-out infinite;
    animation-delay: 1s;
}

@keyframes floatY {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-15px);
    }
}

.float-x-animation {
    animation: floatX 5s ease-in-out infinite;
}

@keyframes floatX {

    0%,
    100% {
        transform: translateX(0);
    }

    50% {
        transform: translateX(10px);
    }
}

/* ========================================
   GLOW ANIMATIONS
   ======================================== */

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

@keyframes glowPulse {

    0%,
    100% {
        box-shadow: 0 0 20px var(--accent-glow);
    }

    50% {
        box-shadow: 0 0 40px var(--accent-glow), 0 0 60px var(--accent-glow);
    }
}

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

@keyframes textGlow {

    0%,
    100% {
        text-shadow: 0 0 10px var(--accent-glow);
    }

    50% {
        text-shadow: 0 0 20px var(--accent-glow), 0 0 30px var(--accent-glow);
    }
}

/* ========================================
   BORDER ANIMATIONS
   ======================================== */

.animated-border {
    position: relative;
}

.animated-border::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 2px;
    background: linear-gradient(90deg,
            var(--accent-primary),
            var(--accent-secondary),
            var(--accent-primary));
    background-size: 200% 100%;
    animation: borderGradient 3s linear infinite;
    -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;
}

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

    100% {
        background-position: 200% 50%;
    }
}

/* ========================================
   ROTATING ELEMENTS
   ======================================== */

.rotate-slow {
    animation: rotateSlow 20s linear infinite;
}

@keyframes rotateSlow {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.rotate-reverse {
    animation: rotateReverse 15s linear infinite;
}

@keyframes rotateReverse {
    from {
        transform: rotate(360deg);
    }

    to {
        transform: rotate(0deg);
    }
}

/* ========================================
   SCALE ANIMATIONS
   ======================================== */

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

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

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.scale-bounce {
    animation: scaleBounce 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

@keyframes scaleBounce {
    from {
        opacity: 0;
        transform: scale(0.3);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ========================================
   COUNTER ANIMATION
   ======================================== */

.counter {
    display: inline-block;
}

/* ========================================
   STAGGER ANIMATION DELAYS
   ======================================== */

.stagger-1 {
    animation-delay: 0.1s;
}

.stagger-2 {
    animation-delay: 0.2s;
}

.stagger-3 {
    animation-delay: 0.3s;
}

.stagger-4 {
    animation-delay: 0.4s;
}

.stagger-5 {
    animation-delay: 0.5s;
}

.stagger-6 {
    animation-delay: 0.6s;
}

.stagger-7 {
    animation-delay: 0.7s;
}

.stagger-8 {
    animation-delay: 0.8s;
}

/* ========================================
   SKILL BAR ANIMATION
   ======================================== */

.skill-bar-animated .skill-progress {
    animation: skillFill 1.5s ease-out forwards;
}

@keyframes skillFill {
    from {
        width: 0;
    }
}

/* ========================================
   TEXT REVEAL ANIMATION
   ======================================== */

.text-reveal {
    overflow: hidden;
}

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

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

/* ========================================
   FADE ANIMATIONS
   ======================================== */

.fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out forwards;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-down {
    animation: fadeInDown 0.6s ease-out forwards;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-left {
    animation: fadeInLeft 0.6s ease-out forwards;
}

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

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.fade-in-right {
    animation: fadeInRight 0.6s ease-out forwards;
}

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

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ========================================
   3D CUBE ANIMATION
   ======================================== */

.cube-container {
    perspective: 1000px;
    width: 200px;
    height: 200px;
}

.cube {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    animation: cubeRotate 10s ease-in-out infinite;
}

.cube-face {
    position: absolute;
    width: 200px;
    height: 200px;
    border: 2px solid var(--accent-primary);
    background: rgba(255, 107, 107, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--accent-primary);
    backdrop-filter: blur(5px);
}

.cube-face-front {
    transform: translateZ(100px);
}

.cube-face-back {
    transform: rotateY(180deg) translateZ(100px);
}

.cube-face-right {
    transform: rotateY(90deg) translateZ(100px);
}

.cube-face-left {
    transform: rotateY(-90deg) translateZ(100px);
}

.cube-face-top {
    transform: rotateX(90deg) translateZ(100px);
}

.cube-face-bottom {
    transform: rotateX(-90deg) translateZ(100px);
}

@keyframes cubeRotate {
    0% {
        transform: rotateX(0deg) rotateY(0deg);
    }

    25% {
        transform: rotateX(90deg) rotateY(90deg);
    }

    50% {
        transform: rotateX(180deg) rotateY(180deg);
    }

    75% {
        transform: rotateX(270deg) rotateY(270deg);
    }

    100% {
        transform: rotateX(360deg) rotateY(360deg);
    }
}

/* ========================================
   CYBER GRID ANIMATION
   ======================================== */

.cyber-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(var(--accent-primary) 1px, transparent 1px),
        linear-gradient(90deg, var(--accent-primary) 1px, transparent 1px);
    background-size: 50px 50px;
    opacity: 0.05;
    animation: gridMove 20s linear infinite;
}

@keyframes gridMove {
    0% {
        transform: perspective(500px) rotateX(60deg) translateY(0);
    }

    100% {
        transform: perspective(500px) rotateX(60deg) translateY(50px);
    }
}

/* ========================================
   SCAN LINE EFFECT
   ======================================== */

.scan-lines {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(0deg,
            rgba(0, 0, 0, 0.1),
            rgba(0, 0, 0, 0.1) 1px,
            transparent 1px,
            transparent 2px);
    pointer-events: none;
    animation: scanMove 8s linear infinite;
}

@keyframes scanMove {
    0% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(10px);
    }
}

/* ========================================
   HEXAGON ANIMATION
   ======================================== */

.hexagon {
    width: 100px;
    height: 115px;
    background: var(--gradient-primary);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    animation: hexPulse 3s ease-in-out infinite;
}

@keyframes hexPulse {

    0%,
    100% {
        transform: scale(1) rotate(0deg);
    }

    50% {
        transform: scale(1.05) rotate(30deg);
    }
}

/* ========================================
   PAGE LOAD ANIMATION
   ======================================== */

.page-loaded .hero-content {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
    transition-delay: 0.3s;
}

.page-loading .hero-content {
    opacity: 0;
    transform: translateY(30px);
}

/* ========================================
   REDUCED MOTION
   ======================================== */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .hero-glow,
    .hero-orbit,
    .floating-badge,
    .orbit-dot {
        animation: none !important;
    }
}