
import React from 'react';
import { Link } from 'react-router-dom';
import { Terminal, Newspaper } from 'lucide-react';
import { useCTF } from './CTFContext';
import { Button } from './UIComponents';

export const Home: React.FC = () => {
  const { currentUser, state } = useCTF();
  return (
    <div className="max-w-4xl mx-auto py-20 px-4 text-center">
      <div className="mb-12">
        {state.config.logoData ? (
          <img src={state.config.logoData} className="max-h-60 mx-auto mb-4 drop-shadow-[0_0_15px_rgba(255,0,0,0.3)]" />
        ) : (
          <Terminal size={120} className="text-[#ff0000] mx-auto mb-4 animate-pulse" />
        )}
        <h1 className="text-8xl font-black italic text-white tracking-tighter">{state.config.conferenceName}</h1>
      </div>
      
      <div className="hxp-border p-8 mb-10 max-w-2xl mx-auto bg-black">
        <p className="text-xl font-bold uppercase tracking-tight">{state.config.landingText}</p>
      </div>

      <div className="flex flex-col items-center gap-6">
        {!currentUser ? (
          <>
            {/* Pyramid Peak */}
            <div className="w-full flex justify-center">
              <Link to="/blog">
                <Button variant="secondary" className="text-xl px-16 flex items-center gap-3">
                  <Newspaper size={20} /> BLOG
                </Button>
              </Link>
            </div>
            {/* Pyramid Base */}
            <div className="flex flex-wrap justify-center gap-6">
              <Link to="/register">
                <Button className="text-xl px-12">REGISTER</Button>
              </Link>
              <Link to="/login">
                <Button variant="secondary" className="text-xl px-12">LOGIN</Button>
              </Link>
            </div>
          </>
        ) : (
          <div className="flex flex-wrap justify-center gap-6">
            <Link to="/challenges">
              <Button className="text-xl px-10">CHALLENGES</Button>
            </Link>
            <Link to="/blog">
              <Button variant="secondary" className="text-xl px-10">BLOG</Button>
            </Link>
          </div>
        )}
      </div>
    </div>
  );
};
