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 CoursesSection = () => {
  const shouldReduceMotion = useReducedMotion();

  if (shouldReduceMotion) {
    return (
      <section className="section-padding bg-nest-light-gray">
        <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
          <div className="bg-white p-8 lg:p-12 rounded-2xl shadow-sm">
            <h3 className="text-3xl font-bold text-nest-dark mb-4">Official NestJS Courses</h3>
            <p className="text-nest-gray mb-8 leading-relaxed max-w-2xl">
              Learn everything you need to master NestJS and tackle modern backend applications at any scale.
            </p>
            <button className="btn-primary">
              See courses
            </button>
          </div>
        </div>
      </section>
    );
  }

  return (
    <motion.section 
      {...fadeUpPreset(0.1, 1.0)}
      className="section-padding bg-nest-light-gray"
    >
      <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
        <motion.div 
          {...fadeUpPreset(0.2, 0.8)}
          className="bg-white p-8 lg:p-12 rounded-2xl shadow-sm"
        >
          <h3 className="text-3xl font-bold text-nest-dark mb-4">Official NestJS Courses</h3>
          <p className="text-nest-gray mb-8 leading-relaxed max-w-2xl">
            Learn everything you need to master NestJS and tackle modern backend applications at any scale.
          </p>
          <button className="btn-primary">
            See courses
          </button>
        </motion.div>
      </div>
    </motion.section>
  );
};

export default CoursesSection;