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

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-white">
        <div className="container-custom">
          <div className="max-w-4xl mx-auto text-center">
            <h1 className="text-5xl md:text-7xl font-bold text-gray-900 mb-8">
              <span className="text-blue-600">AI-powered</span>
              <br />
              web and mobile
              <br />
              <span className="text-blue-600">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"></div>
                <span className="font-semibold text-gray-900">n8n</span>
              </div>
            </div>
            
            <div className="flex flex-col sm:flex-row gap-4 justify-center mb-16">
              <button className="btn-primary">Start Discovery</button>
              <button className="btn-secondary flex items-center space-x-2">
                <span>📁</span>
                <span>Portfolio Showcase</span>
              </button>
            </div>
            
            <div className="bg-white rounded-2xl p-8 shadow-lg">
              <p className="text-gray-600 mb-6">We use only modern technologies</p>
              <div className="flex flex-wrap justify-center items-center gap-8">
                <div className="flex items-center space-x-2">
                  <div className="w-8 h-8 bg-blue-600 rounded"></div>
                  <span className="text-gray-700">#react</span>
                </div>
                <div className="flex items-center space-x-2">
                  <div className="w-8 h-8 bg-red-500 rounded"></div>
                  <span className="text-gray-700">#nestjs</span>
                </div>
                <div className="flex items-center space-x-2">
                  <div className="w-8 h-8 bg-blue-400 rounded"></div>
                  <span className="text-gray-700">#mysql</span>
                </div>
                <div className="flex items-center space-x-2">
                  <div className="w-8 h-8 bg-green-600 rounded"></div>
                  <span className="text-gray-700">#mongodb</span>
                </div>
                <div className="flex items-center space-x-2">
                  <div className="w-8 h-8 bg-green-500 rounded"></div>
                  <span className="text-gray-700">#nginx</span>
                </div>
                <div className="flex items-center space-x-2">
                  <div className="w-8 h-8 bg-red-600 rounded"></div>
                  <span className="text-gray-700">#redis</span>
                </div>
                <div className="flex items-center space-x-2">
                  <div className="w-8 h-8 bg-blue-700 rounded"></div>
                  <span className="text-gray-700">#typescript</span>
                </div>
              </div>
            </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-white"
    >
      <div className="container-custom">
        <div className="max-w-4xl mx-auto text-center">
          <motion.h1 
            {...fadeUpPreset(0.2, 0.8)}
            className="text-5xl md:text-7xl font-bold text-gray-900 mb-8"
          >
            <span className="text-blue-600">AI-powered</span>
            <br />
            web and mobile
            <br />
            <span className="text-blue-600">in 12 weeks</span>
          </motion.h1>
          
          <motion.div 
            {...fadeUpPreset(0.3, 0.6)}
            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"></div>
              <span className="font-semibold text-gray-900">n8n</span>
            </div>
          </motion.div>
          
          <motion.div 
            {...fadeUpPreset(0.4, 0.6)}
            className="flex flex-col sm:flex-row gap-4 justify-center mb-16"
          >
            <button className="btn-primary">Start Discovery</button>
            <button className="btn-secondary flex items-center space-x-2">
              <span>📁</span>
              <span>Portfolio Showcase</span>
            </button>
          </motion.div>
          
          <motion.div 
            {...fadeUpPreset(0.5, 0.8)}
            className="bg-white rounded-2xl p-8 shadow-lg"
          >
            <p className="text-gray-600 mb-6">We use only modern technologies</p>
            <div className="flex flex-wrap justify-center items-center gap-8">
              <div className="flex items-center space-x-2">
                <div className="w-8 h-8 bg-blue-600 rounded"></div>
                <span className="text-gray-700">#react</span>
              </div>
              <div className="flex items-center space-x-2">
                <div className="w-8 h-8 bg-red-500 rounded"></div>
                <span className="text-gray-700">#nestjs</span>
              </div>
              <div className="flex items-center space-x-2">
                <div className="w-8 h-8 bg-blue-400 rounded"></div>
                <span className="text-gray-700">#mysql</span>
              </div>
              <div className="flex items-center space-x-2">
                <div className="w-8 h-8 bg-green-600 rounded"></div>
                <span className="text-gray-700">#mongodb</span>
              </div>
              <div className="flex items-center space-x-2">
                <div className="w-8 h-8 bg-green-500 rounded"></div>
                <span className="text-gray-700">#nginx</span>
              </div>
              <div className="flex items-center space-x-2">
                <div className="w-8 h-8 bg-red-600 rounded"></div>
                <span className="text-gray-700">#redis</span>
              </div>
              <div className="flex items-center space-x-2">
                <div className="w-8 h-8 bg-blue-700 rounded"></div>
                <span className="text-gray-700">#typescript</span>
              </div>
            </div>
          </motion.div>
        </div>
      </div>
    </motion.section>
  );
};

export default Hero;