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" }
});

function DeploySection() {
  const shouldReduce = useReducedMotion();
  
  if (shouldReduce) {
    return (
      <section className="section-padding">
        <div className="container-custom">
          <div className="grid md:grid-cols-2 gap-8">
            {/* Deploy Card */}
            <div className="bg-nest-dark text-white p-12 rounded-lg">
              <h3 className="text-3xl font-bold mb-6">
                Deploy, now!
              </h3>
              <p className="text-gray-300 mb-8 leading-relaxed">
                Deploy your Nest application to the cloud with a single command using our official deployment tools.
              </p>
              <button className="btn-primary">
                Get started
              </button>
            </div>

            {/* Explore Card */}
            <div className="bg-nest-red text-white p-12 rounded-lg">
              <h3 className="text-3xl font-bold mb-6">
                Explore your graph
              </h3>
              <p className="text-red-100 mb-8 leading-relaxed">
                Visualize your application's dependency graph and understand the relationships between 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"
    >
      <div className="container-custom">
        <div className="grid md:grid-cols-2 gap-8">
          {/* Deploy Card */}
          <motion.div 
            {...fadeUpPreset(0.2, 0.8)}
            className="bg-nest-dark text-white p-12 rounded-lg"
          >
            <h3 className="text-3xl font-bold mb-6">
              Deploy, now!
            </h3>
            <p className="text-gray-300 mb-8 leading-relaxed">
              Deploy your Nest application to the cloud with a single command using our official deployment tools.
            </p>
            <button className="btn-primary">
              Get started
            </button>
          </motion.div>

          {/* Explore Card */}
          <motion.div 
            {...fadeUpPreset(0.4, 0.8)}
            className="bg-nest-red text-white p-12 rounded-lg"
          >
            <h3 className="text-3xl font-bold mb-6">
              Explore your graph
            </h3>
            <p className="text-red-100 mb-8 leading-relaxed">
              Visualize your application's dependency graph and understand the relationships between 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;