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

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

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

  if (shouldReduceMotion) {
    return (
      <section className="section-padding">
        <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
          <div className="grid lg:grid-cols-2 gap-8">
            {/* Deploy Card */}
            <div className="bg-nest-dark text-white p-8 lg:p-12 rounded-2xl">
              <h3 className="text-3xl font-bold mb-4">Deploy, mau!</h3>
              <p className="text-gray-300 mb-8 leading-relaxed">
                Provision and manage your infrastracture on AWS without the hassle and extra DevOps work.
              </p>
              <button className="btn-primary">
                Start now
              </button>
            </div>

            {/* Explore Graph Card */}
            <div className="bg-nest-red text-white p-8 lg:p-12 rounded-2xl">
              <h3 className="text-3xl font-bold mb-4">Explore your graph</h3>
              <p className="text-red-100 mb-8 leading-relaxed">
                Identify dependencies and connections between modules, and dive deep into the inner workings of your classes.
              </p>
              <button className="bg-white text-nest-red px-8 py-3 rounded-full font-medium hover:bg-gray-100 transition-colors">
                Learn more
              </button>
            </div>
          </div>
        </div>
      </section>
    );
  }

  return (
    <motion.section 
      {...fadeUpPreset(0.1, 1.0)}
      className="section-padding"
    >
      <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
        <div className="grid lg:grid-cols-2 gap-8">
          {/* Deploy Card */}
          <motion.div 
            {...fadeUpPreset(0.2, 0.8)}
            className="bg-nest-dark text-white p-8 lg:p-12 rounded-2xl"
          >
            <h3 className="text-3xl font-bold mb-4">Deploy, mau!</h3>
            <p className="text-gray-300 mb-8 leading-relaxed">
              Provision and manage your infrastracture on AWS without the hassle and extra DevOps work.
            </p>
            <button className="btn-primary">
              Start now
            </button>
          </motion.div>

          {/* Explore Graph Card */}
          <motion.div 
            {...fadeUpPreset(0.4, 0.8)}
            className="bg-nest-red text-white p-8 lg:p-12 rounded-2xl"
          >
            <h3 className="text-3xl font-bold mb-4">Explore your graph</h3>
            <p className="text-red-100 mb-8 leading-relaxed">
              Identify dependencies and connections between modules, and dive deep into the inner workings of your classes.
            </p>
            <button className="bg-white text-nest-red px-8 py-3 rounded-full font-medium hover:bg-gray-100 transition-colors">
              Learn more
            </button>
          </motion.div>
        </div>
      </div>
    </motion.section>
  );
};

export default DeploySection;