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

const fadeUpPreset = (delay = 0, duration = 0.8) => ({
  initial: { opacity: 0, y: 30 },
  animate: { opacity: 1, y: 0 },
  transition: { delay, duration, ease: "easeOut" }
});

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

  if (shouldReduceMotion) {
    return (
      <section className="min-h-screen bg-nest-dark text-white flex items-center relative overflow-hidden">
        <div className="absolute inset-0 bg-gradient-to-r from-nest-dark via-nest-dark/90 to-transparent z-10"></div>
        <div className="absolute right-0 top-0 w-1/2 h-full opacity-30">
          <div className="w-full h-full bg-gradient-to-l from-gray-800/20 to-transparent"></div>
        </div>
        
        <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 relative z-20 pt-20">
          <div className="max-w-2xl">
            <h1 className="text-5xl md:text-7xl font-bold mb-6">
              Hello, nest!
            </h1>
            <p className="text-xl md:text-2xl text-gray-300 mb-8 leading-relaxed">
              A progressive Node.js framework for building efficient, reliable and scalable server-side applications.
            </p>
            <div className="flex flex-col sm:flex-row gap-4">
              <button className="btn-primary">
                Documentation
              </button>
              <button className="btn-secondary flex items-center justify-center gap-2">
                <Github className="w-5 h-5" />
                Source code
              </button>
            </div>
          </div>
        </div>
      </section>
    );
  }

  return (
    <motion.section 
      {...fadeUpPreset(0.1, 1.0)}
      className="min-h-screen bg-nest-dark text-white flex items-center relative overflow-hidden"
    >
      <div className="absolute inset-0 bg-gradient-to-r from-nest-dark via-nest-dark/90 to-transparent z-10"></div>
      <div className="absolute right-0 top-0 w-1/2 h-full opacity-30">
        <div className="w-full h-full bg-gradient-to-l from-gray-800/20 to-transparent"></div>
      </div>
      
      <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 relative z-20 pt-20">
        <div className="max-w-2xl">
          <motion.h1 
            {...fadeUpPreset(0.2, 0.8)}
            className="text-5xl md:text-7xl font-bold mb-6"
          >
            Hello, nest!
          </motion.h1>
          <motion.p 
            {...fadeUpPreset(0.4, 0.8)}
            className="text-xl md:text-2xl text-gray-300 mb-8 leading-relaxed"
          >
            A progressive Node.js framework for building efficient, reliable and scalable server-side applications.
          </motion.p>
          <motion.div 
            {...fadeUpPreset(0.6, 0.8)}
            className="flex flex-col sm:flex-row gap-4"
          >
            <button className="btn-primary">
              Documentation
            </button>
            <button className="btn-secondary flex items-center justify-center gap-2">
              <Github className="w-5 h-5" />
              Source code
            </button>
          </motion.div>
        </div>
      </div>
    </motion.section>
  );
};

export default Hero;