/**
 * ASLAN4U - Advanced Animations
 * Living, breathing website effects
 */

/* ============================================
   TYPING ANIMATION
   ============================================ */
.typing-text {
    display: inline-block;
    overflow: hidden;
    border-right: 3px solid var(--primary);
    white-space: nowrap;
    animation:
        typing 3.5s 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(--primary); }
}

/* ============================================
   FLOATING ELEMENTS
   ============================================ */
.float {
    animation: float-gentle 6s ease-in-out infinite;
}

.float-delay-1 { animation-delay: 0s; }
.float-delay-2 { animation-delay: 1s; }
.float-delay-3 { animation-delay: 2s; }

@keyframes float-gentle {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

/* ============================================
   PULSE EFFECTS
   ============================================ */
.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

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

.pulse-ring {
    position: relative;
}

.pulse-ring::before {
    content: '';
    position: absolute;
    inset: -4px;
    border: 2px solid var(--primary);
    border-radius: inherit;
    animation: pulse-ring 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse-ring {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.3); opacity: 0; }
}

/* ============================================
   GRADIENT ANIMATIONS
   ============================================ */
.gradient-animate {
    background: linear-gradient(
        -45deg,
        var(--primary),
        var(--primary-dark),
        var(--accent),
        var(--primary-light)
    );
    background-size: 400% 400%;
    animation: gradient-shift 15s ease infinite;
}

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

/* ============================================
   TEXT SHIMMER
   ============================================ */
.shimmer {
    background: linear-gradient(
        90deg,
        var(--gray-900) 0%,
        var(--primary) 50%,
        var(--gray-900) 100%
    );
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 3s linear infinite;
}

@keyframes shimmer {
    to { background-position: 200% center; }
}

/* ============================================
   COUNTER ANIMATION
   ============================================ */
.counter-animate {
    animation: counter-pop 0.5s ease forwards;
}

@keyframes counter-pop {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

/* ============================================
   STAGGER CHILDREN
   ============================================ */
.stagger-children > * {
    opacity: 0;
    animation: stagger-fade 0.5s ease forwards;
}

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

@keyframes stagger-fade {
    to {
        opacity: 1;
        transform: translateY(0);
    }
    from {
        opacity: 0;
        transform: translateY(20px);
    }
}

/* ============================================
   MAGNETIC HOVER
   ============================================ */
.magnetic {
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ============================================
   GLOW EFFECTS
   ============================================ */
.glow {
    box-shadow: 0 0 20px rgba(230, 126, 34, 0.3);
    animation: glow-pulse 2s ease-in-out infinite;
}

@keyframes glow-pulse {
    0%, 100% { box-shadow: 0 0 20px rgba(230, 126, 34, 0.3); }
    50% { box-shadow: 0 0 40px rgba(230, 126, 34, 0.5); }
}

.privat-mode .glow {
    box-shadow: 0 0 20px rgba(156, 163, 175, 0.3);
    animation: none 2s ease-in-out infinite;
}

@keyframes glow-pulse-lab {
    0%, 100% { box-shadow: 0 0 20px rgba(156, 163, 175, 0.3); }
    50% { box-shadow: 0 0 40px rgba(156, 163, 175, 0.5); }
}

/* ============================================
   3D HOVER EFFECTS
   ============================================ */
.tilt-3d {
    transform-style: preserve-3d;
    perspective: 1000px;
}

.tilt-3d:hover {
    transform: rotateY(10deg) rotateX(5deg);
}

/* ============================================
   MORPH SHAPES
   ============================================ */
.morph-blob {
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    animation: morph 8s ease-in-out infinite;
}

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

/* ============================================
   LINE DRAWING
   ============================================ */
.draw-line {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: draw 2s ease forwards;
}

@keyframes draw {
    to { stroke-dashoffset: 0; }
}

/* ============================================
   BOUNCE IN
   ============================================ */
.bounce-in {
    animation: bounce-in 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes bounce-in {
    0% { transform: scale(0); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* ============================================
   SHAKE (for errors/attention)
   ============================================ */
.shake {
    animation: shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes shake {
    10%, 90% { transform: translateX(-1px); }
    20%, 80% { transform: translateX(2px); }
    30%, 50%, 70% { transform: translateX(-4px); }
    40%, 60% { transform: translateX(4px); }
}

/* ============================================
   FLIP CARD
   ============================================ */
.flip-card {
    perspective: 1000px;
}

.flip-card-inner {
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.flip-card:hover .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
    backface-visibility: hidden;
}

.flip-card-back {
    transform: rotateY(180deg);
}

/* ============================================
   PROGRESS LOADING
   ============================================ */
.loading-bar {
    position: relative;
    overflow: hidden;
}

.loading-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: loading-sweep 1.5s infinite;
}

@keyframes loading-sweep {
    100% { left: 100%; }
}

/* ============================================
   SCROLL INDICATOR
   ============================================ */
.scroll-indicator {
    animation: scroll-bounce 2s ease-in-out infinite;
}

@keyframes scroll-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(10px); }
}

/* ============================================
   LAB MODE SPECIFIC ANIMATIONS
   ============================================ */
.privat-mode .hero-text h1 {
    animation: none 5s infinite;
}

@keyframes glitch {
    0%, 90%, 100% { transform: translate(0); }
    91% { transform: translate(-2px, 2px); }
    92% { transform: translate(2px, -2px); }
    93% { transform: translate(-2px, 0); }
    94% { transform: translate(0, 2px); }
}

/* Data stream effect */
.privat-mode .data-stream::before {
    content: '01001010 11010010 00101101';
    position: absolute;
    top: -20px;
    left: 0;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--primary);
    opacity: 0.3;
    animation: none 10s linear infinite;
}

@keyframes data-flow {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Circuit paths */
.privat-mode .circuit-line {
    stroke: var(--primary);
    stroke-width: 1;
    stroke-dasharray: 5 5;
    animation: none 20s linear infinite;
}

@keyframes circuit-dash {
    to { stroke-dashoffset: -1000; }
}

/* Disable animations in privat mode */
.privat-mode .pulse-ring::before {
    animation: none;
    display: none;
}
.privat-mode .pulse {
    animation: none;
}
.privat-mode .float {
    animation: none;
}

