/* ============================================
   BakeOS Landing Page - Animations
   ============================================ */

/* Animate on Scroll - Base States */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
    transition-delay: var(--delay, 0s);
}

.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Fade Up Animation */
.animate-fade-up {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeUp 0.8s ease forwards;
    animation-delay: var(--delay, 0s);
}

@keyframes fadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade In Animation */
.animate-fade-in {
    opacity: 0;
    animation: fadeIn 0.8s ease forwards;
    animation-delay: var(--delay, 0s);
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

/* Scale In Animation */
.animate-scale-in {
    opacity: 0;
    transform: scale(0.9);
    animation: scaleIn 0.6s ease forwards;
    animation-delay: var(--delay, 0s);
}

@keyframes scaleIn {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Slide In from Left */
.animate-slide-left {
    opacity: 0;
    transform: translateX(-50px);
    animation: slideLeft 0.8s ease forwards;
    animation-delay: var(--delay, 0s);
}

@keyframes slideLeft {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Slide In from Right */
.animate-slide-right {
    opacity: 0;
    transform: translateX(50px);
    animation: slideRight 0.8s ease forwards;
    animation-delay: var(--delay, 0s);
}

@keyframes slideRight {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Stagger Children Animation */
.stagger-children > * {
    opacity: 0;
    transform: translateY(20px);
}

.stagger-children.visible > *:nth-child(1) { animation: fadeUp 0.6s ease 0.1s forwards; }
.stagger-children.visible > *:nth-child(2) { animation: fadeUp 0.6s ease 0.2s forwards; }
.stagger-children.visible > *:nth-child(3) { animation: fadeUp 0.6s ease 0.3s forwards; }
.stagger-children.visible > *:nth-child(4) { animation: fadeUp 0.6s ease 0.4s forwards; }
.stagger-children.visible > *:nth-child(5) { animation: fadeUp 0.6s ease 0.5s forwards; }
.stagger-children.visible > *:nth-child(6) { animation: fadeUp 0.6s ease 0.6s forwards; }

/* Pulse Animation */
.animate-pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Glow Animation */
.animate-glow {
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        box-shadow: 0 0 20px rgba(245, 158, 11, 0.2);
    }
    to {
        box-shadow: 0 0 40px rgba(245, 158, 11, 0.4);
    }
}

/* Shake Animation */
.animate-shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Bounce Animation */
.animate-bounce {
    animation: bounceAnim 1s ease infinite;
}

@keyframes bounceAnim {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-15px);
    }
    60% {
        transform: translateY(-7px);
    }
}

/* Rotate Animation */
.animate-rotate {
    animation: rotate 20s linear infinite;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Gradient Text Animation */
.animate-gradient-text {
    background: linear-gradient(90deg, #f59e0b, #ea580c, #f59e0b);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientFlow 3s linear infinite;
}

@keyframes gradientFlow {
    0% { background-position: 0% center; }
    100% { background-position: 200% center; }
}

/* Border Glow Animation */
.animate-border-glow {
    position: relative;
}

.animate-border-glow::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(45deg, #f59e0b, #ea580c, #f59e0b, #ea580c);
    background-size: 400% 400%;
    border-radius: inherit;
    z-index: -1;
    animation: borderGlow 3s ease infinite;
    opacity: 0.7;
}

@keyframes borderGlow {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Float Animation */
.animate-float {
    animation: floatAnim 6s ease-in-out infinite;
}

@keyframes floatAnim {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    33% {
        transform: translateY(-10px) rotate(1deg);
    }
    66% {
        transform: translateY(5px) rotate(-1deg);
    }
}

/* Typewriter Effect */
.typewriter {
    overflow: hidden;
    border-right: 2px solid var(--color-primary);
    white-space: nowrap;
    animation: typing 3s steps(40, end), blink 0.75s step-end infinite;
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink {
    from, to { border-color: transparent; }
    50% { border-color: var(--color-primary); }
}

/* Ripple Effect */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    background-image: radial-gradient(circle, rgba(255, 255, 255, 0.3) 10%, transparent 10.01%);
    background-repeat: no-repeat;
    background-position: 50%;
    transform: scale(10, 10);
    opacity: 0;
    transition: transform 0.5s, opacity 1s;
}

.ripple:active::after {
    transform: scale(0, 0);
    opacity: 0.3;
    transition: 0s;
}

/* Parallax Effect Helper */
.parallax {
    will-change: transform;
}

/* Smooth Reveal */
.reveal {
    position: relative;
    overflow: hidden;
}

.reveal::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--color-dark);
    z-index: 1;
    transform: scaleX(1);
    transform-origin: right;
    animation: reveal 0.8s ease forwards;
    animation-delay: var(--delay, 0s);
}

@keyframes reveal {
    to {
        transform: scaleX(0);
    }
}

/* Counter Animation Helper */
.counter {
    display: inline-block;
    font-variant-numeric: tabular-nums;
}

/* Magnetic Button Effect */
.magnetic {
    transition: transform 0.3s cubic-bezier(0.215, 0.610, 0.355, 1.000);
}

/* Tilt Card Effect */
.tilt-card {
    transform-style: preserve-3d;
    transition: transform 0.3s ease;
}

.tilt-card:hover {
    transform: perspective(1000px) rotateX(5deg) rotateY(5deg);
}

/* Marquee Animation */
.marquee {
    display: flex;
    overflow: hidden;
}

.marquee-content {
    display: flex;
    animation: marquee 30s linear infinite;
}

@keyframes marquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* Noise Effect */
.noise::before {
    content: '';
    position: absolute;
    inset: 0;
    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.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.03;
    pointer-events: none;
}

/* Loading Skeleton */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--color-dark-2) 25%,
        var(--color-dark-3) 50%,
        var(--color-dark-2) 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; }
}

/* Success Checkmark Animation */
.checkmark {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: block;
    stroke-width: 3;
    stroke: #22c55e;
    stroke-miterlimit: 10;
    box-shadow: inset 0 0 0 #22c55e;
    animation: fill 0.4s ease-in-out 0.4s forwards, scale 0.3s ease-in-out 0.9s both;
}

.checkmark-circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    stroke-width: 3;
    stroke-miterlimit: 10;
    stroke: #22c55e;
    fill: none;
    animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.checkmark-check {
    transform-origin: 50% 50%;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards;
}

@keyframes stroke {
    100% { stroke-dashoffset: 0; }
}

@keyframes fill {
    100% { box-shadow: inset 0 0 0 30px rgba(34, 197, 94, 0.1); }
}

@keyframes scale {
    0%, 100% { transform: none; }
    50% { transform: scale3d(1.1, 1.1, 1); }
}

/* Hover Lift Effect */
.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.3);
}

/* Text Blur In */
.blur-in {
    animation: blurIn 0.8s ease forwards;
}

@keyframes blurIn {
    from {
        filter: blur(10px);
        opacity: 0;
    }
    to {
        filter: blur(0);
        opacity: 1;
    }
}

/* Morphing Shape */
.morph {
    animation: morph 8s ease-in-out infinite;
}

@keyframes morph {
    0%, 100% {
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    }
    50% {
        border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .animate-on-scroll {
        opacity: 1;
        transform: none;
    }
}
