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 SupportSection() {
  const shouldReduce = useReducedMotion();
  
  const supportOptions = [
    {
      title: "PRINCIPAL SPONSORS",
      items: ["Valor Software", "Adyen", "Sanofi"]
    },
    {
      title: "GOLD SPONSORS",
      items: ["Trilon", "Amplication"]
    },
    {
      title: "SILVER SPONSORS",
      items: ["Nx", "Sentry", "JetBrains"]
    },
    {
      title: "SPONSORS / PARTNERS",
      items: ["Various Partners"]
    }
  ];

  if (shouldReduce) {
    return (
      <section className="section-padding bg-white">
        <div className="container-custom text-center">
          <h2 className="text-4xl md:text-5xl font-bold mb-6">
            Support us
          </h2>
          <p className="text-xl text-nest-gray mb-16 max-w-3xl mx-auto">
            Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.
          </p>
          
          <div className="grid md:grid-cols-2 lg:grid-cols-4 gap-8 mb-12">
            {supportOptions.map((option, index) => (
              <div key={index} className="text-center">
                <h3 className="font-bold text-sm text-nest-red mb-4">
                  {option.title}
                </h3>
                <div className="space-y-2">
                  {option.items.map((item, itemIndex) => (
                    <div key={itemIndex} className="text-nest-gray text-sm">
                      {item}
                    </div>
                  ))}
                </div>
              </div>
            ))}
          </div>
          
          <button className="btn-primary">
            Become a sponsor
          </button>
        </div>
      </section>
    );
  }

  return (
    <motion.section 
      {...fadeUpPreset(0.1, 1.0)}
      className="section-padding bg-white"
    >
      <div className="container-custom text-center">
        <motion.h2 
          {...fadeUpPreset(0.2, 0.8)}
          className="text-4xl md:text-5xl font-bold mb-6"
        >
          Support us
        </motion.h2>
        <motion.p 
          {...fadeUpPreset(0.3, 0.8)}
          className="text-xl text-nest-gray mb-16 max-w-3xl mx-auto"
        >
          Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.
        </motion.p>
        
        <div className="grid md:grid-cols-2 lg:grid-cols-4 gap-8 mb-12">
          {supportOptions.map((option, index) => (
            <motion.div 
              key={index} 
              {...fadeUpPreset(0.4 + (index * 0.1), 0.6)}
              className="text-center"
            >
              <h3 className="font-bold text-sm text-nest-red mb-4">
                {option.title}
              </h3>
              <div className="space-y-2">
                {option.items.map((item, itemIndex) => (
                  <div key={itemIndex} className="text-nest-gray text-sm">
                    {item}
                  </div>
                ))}
              </div>
            </motion.div>
          ))}
        </div>
        
        <motion.button 
          {...fadeUpPreset(0.8, 0.6)}
          className="btn-primary"
        >
          Become a sponsor
        </motion.button>
      </div>
    </motion.section>
  );
}

export default SupportSection;