import React from 'react';
import { motion, useReducedMotion } from 'framer-motion';
import { Package } from 'lucide-react';

const fadeUpPreset = (delay = 0, duration = 1.2) => ({
  initial: { opacity: 0, y: 20 },
  whileInView: { opacity: 1, y: 0 },
  viewport: { once: true, amount: 0.2 },
  transition: { delay, duration, ease: "easeOut" }
});

const Hero = () => {
  const shouldReduceMotion = useReducedMotion();

  if (shouldReduceMotion) {
    return (
      <section className="pt-24 pb-16 bg-gradient-to-br from-gray-50 to-gray-100">
        <div className="container-custom">
          <div className="max-w-4xl mx-auto text-center">
            <h1 className="text-4xl md:text-6xl font-bold mb-6">
              <span className="text-gradient">AI-powered</span><br />
              <span className="text-gray-900">web and mobile</span><br />
              <span className="text-gradient">in 12 weeks</span>
            </h1>
            
            <div className="flex items-center justify-center space-x-2 mb-8">
              <span className="text-gray-600">Powered by</span>
              <div className="flex items-center space-x-1">
                <div className="w-6 h-6 bg-red-500 rounded-full"></div>
                <div className="w-6 h-6 bg-red-400 rounded-full -ml-2"></div>
                <div className="w-6 h-6 bg-red-300 rounded-full -ml-2"></div>
                <span className="ml-2 font-semibold text-gray-900">n8n</span>
              </div>
            </div>

            <div className="flex flex-col sm:flex-row gap-4 justify-center mb-12">
              <button className="btn-primary">
                Start Discovery
              </button>
              <button className="btn-secondary flex items-center space-x-2">
                <Package className="w-5 h-5" />
                <span>Portfolio Showcase</span>
              </button>
            </div>

            <div className="flex flex-wrap justify-center items-center gap-6 text-sm text-gray-500">
              <span className="bg-white px-3 py-1 rounded-full">#nestjs</span>
              <span className="bg-white px-3 py-1 rounded-full">#mysql</span>
              <span className="bg-white px-3 py-1 rounded-full">#mongodb</span>
              <span className="bg-white px-3 py-1 rounded-full">#nginx</span>
              <span className="bg-white px-3 py-1 rounded-full">#redis</span>
              <span className="bg-white px-3 py-1 rounded-full">#typescript</span>
            </div>
          </div>
        </div>
      </section>
    );
  }

  return (
    <motion.section 
      {...fadeUpPreset(0.1, 0.8)}
      className="pt-24 pb-16 bg-gradient-to-br from-gray-50 to-gray-100"
    >
      <div className="container-custom">
        <div className="max-w-4xl mx-auto text-center">
          <motion.h1 
            {...fadeUpPreset(0.2, 0.8)}
            className="text-4xl md:text-6xl font-bold mb-6"
          >
            <span className="text-gradient">AI-powered</span><br />
            <span className="text-gray-900">web and mobile</span><br />
            <span className="text-gradient">in 12 weeks</span>
          </motion.h1>
          
          <motion.div 
            {...fadeUpPreset(0.3, 0.8)}
            className="flex items-center justify-center space-x-2 mb-8"
          >
            <span className="text-gray-600">Powered by</span>
            <div className="flex items-center space-x-1">
              <div className="w-6 h-6 bg-red-500 rounded-full"></div>
              <div className="w-6 h-6 bg-red-400 rounded-full -ml-2"></div>
              <div className="w-6 h-6 bg-red-300 rounded-full -ml-2"></div>
              <span className="ml-2 font-semibold text-gray-900">n8n</span>
            </div>
          </motion.div>

          <motion.div 
            {...fadeUpPreset(0.4, 0.8)}
            className="flex flex-col sm:flex-row gap-4 justify-center mb-12"
          >
            <button className="btn-primary">
              Start Discovery
            </button>
            <button className="btn-secondary flex items-center space-x-2">
              <Package className="w-5 h-5" />
              <span>Portfolio Showcase</span>
            </button>
          </motion.div>

          <motion.div 
            {...fadeUpPreset(0.5, 0.8)}
            className="flex flex-wrap justify-center items-center gap-6 text-sm text-gray-500"
          >
            <span className="bg-white px-3 py-1 rounded-full">#nestjs</span>
            <span className="bg-white px-3 py-1 rounded-full">#mysql</span>
            <span className="bg-white px-3 py-1 rounded-full">#mongodb</span>
            <span className="bg-white px-3 py-1 rounded-full">#nginx</span>
            <span className="bg-white px-3 py-1 rounded-full">#redis</span>
            <span className="bg-white px-3 py-1 rounded-full">#typescript</span>
          </motion.div>
        </div>
      </div>
    </motion.section>
  );
};

export default Hero;