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 DeploySection = () => {
  const shouldReduce = useReducedMotion();

  if (shouldReduce) {
    return (
      <section className="section-padding bg-nest-gray">
        <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
          <div className="grid grid-cols-1 lg:grid-cols-2 gap-8">
            {/* Deploy Now Card */}
            <div className="bg-nest-dark rounded-lg p-8 text-white">
              <h3 className="text-2xl font-bold mb-4">Deploy, now!</h3>
              <p className="text-gray-300 mb-6 leading-relaxed">
                Deploy your NestJS application to any cloud platform with ease. Get started in minutes with our deployment guides.
              </p>
              <button className="bg-white text-nest-dark px-6 py-3 rounded-lg font-medium hover:bg-gray-100 transition-colors">
                Get started
              </button>
            </div>

            {/* Explore Your Graph Card */}
            <div className="bg-nest-red rounded-lg p-8 text-white">
              <h3 className="text-2xl font-bold mb-4">Explore your graph</h3>
              <p className="text-red-100 mb-6 leading-relaxed">
                Visualize your application's dependency graph and understand the relationships between your modules.
              </p>
              <button className="bg-white text-nest-red px-6 py-3 rounded-lg font-medium hover:bg-gray-100 transition-colors">
                Explore
              </button>
            </div>
          </div>
        </div>
      </section>
    );
  }

  return (
    <motion.section 
      {...fadeUpPreset(0.1, 1.0)}
      className="section-padding bg-nest-gray"
    >
      <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
        <div className="grid grid-cols-1 lg:grid-cols-2 gap-8">
          {/* Deploy Now Card */}
          <motion.div 
            {...fadeUpPreset(0.2, 0.8)}
            className="bg-nest-dark rounded-lg p-8 text-white"
          >
            <h3 className="text-2xl font-bold mb-4">Deploy, now!</h3>
            <p className="text-gray-300 mb-6 leading-relaxed">
              Deploy your NestJS application to any cloud platform with ease. Get started in minutes with our deployment guides.
            </p>
            <button className="bg-white text-nest-dark px-6 py-3 rounded-lg font-medium hover:bg-gray-100 transition-colors">
              Get started
            </button>
          </motion.div>

          {/* Explore Your Graph Card */}
          <motion.div 
            {...fadeUpPreset(0.3, 0.8)}
            className="bg-nest-red rounded-lg p-8 text-white"
          >
            <h3 className="text-2xl font-bold mb-4">Explore your graph</h3>
            <p className="text-red-100 mb-6 leading-relaxed">
              Visualize your application's dependency graph and understand the relationships between your modules.
            </p>
            <button className="bg-white text-nest-red px-6 py-3 rounded-lg font-medium hover:bg-gray-100 transition-colors">
              Explore
            </button>
          </motion.div>
        </div>
      </div>
    </motion.section>
  );
};

export default DeploySection;