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

  if (shouldReduceMotion) {
    return (
      <section className="section-padding bg-nest-dark text-white">
        <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 text-center">
          <h2 className="text-4xl font-bold mb-4">Live preview</h2>
          <p className="text-xl text-gray-300 max-w-2xl mx-auto">
            See how your application may potentially look like without leaving your personal browser.
          </p>
        </div>
      </section>
    );
  }

  return (
    <motion.section 
      {...fadeUpPreset(0.1, 1.0)}
      className="section-padding bg-nest-dark text-white"
    >
      <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 text-center">
        <motion.h2 
          {...fadeUpPreset(0.2, 0.8)}
          className="text-4xl font-bold mb-4"
        >
          Live preview
        </motion.h2>
        <motion.p 
          {...fadeUpPreset(0.4, 0.8)}
          className="text-xl text-gray-300 max-w-2xl mx-auto"
        >
          See how your application may potentially look like without leaving your personal browser.
        </motion.p>
      </div>
    </motion.section>
  );
};

export default LivePreview;