import { Compass } from "lucide-react";
import { ExperienceGrid } from "@/components/experiences/experience-grid";
import { fetchWebsiteSkills, type WebsiteSkill } from "@/lib/website-skills";

export const dynamic = "force-dynamic";

export default async function ExperiencesPage() {
  let skills: WebsiteSkill[] = [];

  try {
    skills = await fetchWebsiteSkills();
  } catch {
    skills = [];
  }

  return (
    <div className="container mx-auto px-4 pb-10 pt-28 md:pb-14 md:pt-32">
      <div className="mb-8">
        <div className="mb-4 inline-flex items-center gap-2 rounded-full bg-[var(--theme-surface-strong)] px-3 py-1 text-sm font-medium text-[var(--theme-primary)]">
          <Compass className="h-4 w-4" />
          Experiences
        </div>
        <h1 className="mb-3 text-3xl font-black tracking-tight text-foreground lg:text-4xl">
          Explore by Experience
        </h1>
        <p className="max-w-2xl text-lg text-muted-foreground">
          Browse every travel experience and find guides who specialize in the
          journey you want.
        </p>
      </div>

      {skills.length > 0 ? (
        <ExperienceGrid skills={skills} />
      ) : (
        <div className="rounded-3xl border border-[var(--theme-border)] bg-white py-16 text-center shadow-sm">
          <p className="text-lg font-bold text-muted-foreground">
            No experiences found
          </p>
        </div>
      )}
    </div>
  );
}
