import Image from "next/image";
import { getAllPosts } from "@/lib/mdx";

export default function Home() {
  const posts = getAllPosts();
  const latestPost = posts[0];
  const latestPostHref = latestPost ? `/blog/${latestPost.slug}` : '/blog';
  return (
    <div className="min-h-screen flex flex-col items-center p-8 sm:p-20 relative overflow-hidden bg-zinc-50 dark:bg-zinc-950 text-zinc-900 dark:text-zinc-50 font-sans">

      {/* Background decoration */}
      <div className="fixed top-0 left-0 w-full h-full overflow-hidden z-0 pointer-events-none opacity-30 dark:opacity-10">
        <div className="absolute top-[-20%] left-[-10%] w-[50%] h-[50%] rounded-full bg-linear-to-br from-zinc-200 to-transparent blur-3xl dark:from-zinc-800" />
        <div className="absolute bottom-[-20%] right-[-10%] w-[50%] h-[50%] rounded-full bg-linear-to-tl from-zinc-200 to-transparent blur-3xl dark:from-zinc-800" />
      </div>

      <main className="z-10 max-w-5xl w-full animate-fade-in mt-20 sm:mt-32 pb-24 px-6">

        <div className="grid grid-cols-1 md:grid-cols-2 gap-12 md:gap-24 items-start">

          {/* Left Column: Text & Info */}
          <section className="space-y-8 order-2 md:order-1">
            <header className="space-y-4">
              <h1 className="text-4xl sm:text-6xl font-bold tracking-tight text-zinc-900 dark:text-zinc-100 animate-slide-up" style={{ animationDelay: '0.1s' }}>
                Akshay Kolli.
              </h1>
              <p className="text-xl text-zinc-600 dark:text-zinc-300 font-light tracking-wide animate-slide-up" style={{ animationDelay: '0.2s' }}>
                CS PhD Student @ UMass Lowell
              </p>
            </header>

            <div className="space-y-6 text-lg text-zinc-500 dark:text-zinc-400 leading-relaxed font-light animate-slide-up" style={{ animationDelay: '0.3s' }}>
              <p>
                I am a PhD candidate at the University of Massachusetts, Lowell, focusing on <strong>World Models</strong>, <strong>Reinforcement Learning</strong>, and <strong>Multi-Agent Systems</strong>.
              </p>
              <p>
                My work lies in building World Models for autonomous agents that can reason, adapt and learn in complex environments.
                On the weekends I enjoy exercising, playing chess, listening to Jimi Hendrix, and playing video games.
              </p>
            </div>

            <div className="pt-4 border-t border-zinc-200 dark:border-zinc-800 animate-slide-up" style={{ animationDelay: '0.4s' }}>
              <h3 className="text-xs font-bold uppercase tracking-widest text-zinc-900 dark:text-zinc-100 mb-4">Connect</h3>
              <div className="flex gap-6 font-medium text-sm">
                <a href="mailto:akshaykolli@hotmail.com" className="text-zinc-600 dark:text-zinc-400 hover:text-zinc-900 dark:hover:text-zinc-100 transition-colors">
                  Email
                </a>
                <a href="https://github.com/akkolli" target="_blank" rel="noopener noreferrer" className="text-zinc-600 dark:text-zinc-400 hover:text-zinc-900 dark:hover:text-zinc-100 transition-colors">
                  GitHub
                </a>
                <a href="https://x.com/thekolliakshay" target="_blank" rel="noopener noreferrer" className="text-zinc-600 dark:text-zinc-400 hover:text-zinc-900 dark:hover:text-zinc-100 transition-colors">
                  Twitter
                </a>
                <a href="https://www.linkedin.com/in/akshay-kolli-/" target="_blank" rel="noopener noreferrer" className="text-zinc-600 dark:text-zinc-400 hover:text-zinc-900 dark:hover:text-zinc-100 transition-colors">
                  LinkedIn
                </a>
              </div>
            </div>

            {/* "Currently" - Answering "Anything else?" */}
            <div className="pt-2 animate-slide-up" style={{ animationDelay: '0.5s' }}>
              <p className="text-sm text-zinc-400 dark:text-zinc-500 font-mono">
                <span className="text-zinc-900 dark:text-zinc-100 mr-2">Currently:</span>
                Writing about deep learning happenings <a href={latestPostHref} className="text-zinc-600 dark:text-zinc-400 underline decoration-zinc-300 dark:decoration-zinc-700 hover:text-zinc-900 dark:hover:text-zinc-100">Read latest &rarr;</a>
              </p>
            </div>
          </section>

          {/* Right Column: Photo */}
          <div className="order-1 md:order-2 flex justify-center md:justify-end animate-slide-up" style={{ animationDelay: '0.2s' }}>
            <div className="relative w-64 h-64 sm:w-80 sm:h-80 rounded-2xl overflow-hidden bg-zinc-100 dark:bg-zinc-900 shadow-2xl transition-transform duration-500 ease-out">
              <Image src="/profile.jpeg" alt="Akshay Kolli" fill className="object-cover" priority />
            </div>
          </div>

        </div>
      </main>

    </div>
  );
}
