import Image from "next/image";
import Link from "next/link";
import { getAllPosts } from "@/lib/mdx";
import profileImage from "@/public/profile.jpeg";

export default function Home() {
  const posts = getAllPosts();
  const latestPost = posts[0];
  const latestPostHref = latestPost ? `/blog/${latestPost.slug}` : "/blog";

  return (
    <div className="page-frame py-16 sm:py-20">
      <section className="mx-auto grid min-h-[calc(100vh-11rem)] max-w-[64rem] gap-6 lg:grid-cols-[minmax(0,39rem)_15rem] lg:items-center lg:gap-4">
        <div className="max-w-[39rem] space-y-6">
          <p className="eyebrow">Akshay Kolli / UMass Lowell</p>

          <div className="space-y-4">
            <h1 className="max-w-[34rem] text-balance font-sans text-5xl font-medium leading-[0.96] text-ink sm:text-6xl lg:text-7xl">
              World models for RL.
            </h1>

            <div className="max-w-[32rem] space-y-3 text-[1.04rem] leading-8 text-ink-soft sm:text-[1.1rem]">
              <p>
                I&apos;m a CS PhD student working on world models for reinforcement learning,
                ML hardware, GPUs, and deep learning systems.
              </p>
            </div>
          </div>

          <div className="flex flex-wrap gap-x-6 gap-y-3 text-[0.96rem] text-ink">
            <Link href={latestPostHref} className="transition-colors hover:text-accent">
              Latest essay
            </Link>
            <Link href="/projects" className="transition-colors hover:text-accent">
              Projects
            </Link>
            <Link href="/blog" className="transition-colors hover:text-accent">
              Writing
            </Link>
            <Link href="/resume" className="transition-colors hover:text-accent">
              Resume
            </Link>
            <a href="mailto:akshaykolli@hotmail.com" className="transition-colors hover:text-accent">
              Email
            </a>
          </div>
        </div>

        <aside className="w-full max-w-[12rem] lg:max-w-[15rem] lg:justify-self-start">
          <div className="relative aspect-square overflow-hidden rounded-full border border-line bg-paper-strong">
            <Image
              src={profileImage}
              alt="Akshay Kolli"
              fill
              priority
              sizes="(min-width: 1024px) 15rem, 12rem"
              className="object-cover object-center"
            />
          </div>
        </aside>
      </section>
    </div>
  );
}
