"use client";

import { useTranslation } from "@/i18n/navigation";

const featureKeys = ["location", "skill", "balance"] as const;

export default function Features() {
  const { t } = useTranslation("features");
  const features = featureKeys.map((key) => ({
    icon: key === "location" ? "🌏" : key === "skill" ? "⚡" : "🔄",
    key,
  }));
  return (
    <section id="features" className="py-20 sm:py-28 dark:bg-slate-950">
      <div className="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8">
        <div className="text-center">
          <h2 className="text-3xl font-bold tracking-tight text-slate-900 dark:text-slate-100 sm:text-4xl">
            {t("title")} <span className="gradient-text">{t("titleHighlight")}</span>{t("titleSuffix")}
          </h2>
          <p className="mx-auto mt-4 max-w-2xl text-lg text-slate-600 dark:text-slate-400">
            {t("subtitle")}
            <br className="hidden sm:block" />
            {t("subtitle2")}
          </p>
        </div>

        <div className="mt-16 grid gap-6 sm:grid-cols-2 lg:grid-cols-3">
          {features.map((f) => (
            <div
              key={f.key}
              className="card-hover rounded-2xl border border-slate-100 bg-white p-8 shadow-sm dark:border-slate-800 dark:bg-slate-900"
            >
              <div className="mb-4 flex h-14 w-14 items-center justify-center rounded-2xl bg-sky-50 text-3xl dark:bg-sky-900/50">
                {f.icon}
              </div>
              <h3 className="mb-3 text-xl font-bold text-slate-900 dark:text-slate-100">
                {t(`items.${f.key}.title`)}
              </h3>
              <p className="leading-relaxed text-slate-600 dark:text-slate-400">{t(`items.${f.key}.desc`)}</p>
            </div>
          ))}
        </div>

        <div className="mt-12 text-center">
          <div className="inline-flex items-center gap-2 rounded-full border border-amber-200 bg-amber-50 px-5 py-2 text-sm font-medium text-amber-700 dark:border-amber-800 dark:bg-amber-900/50 dark:text-amber-300">
            <span>🔥</span>
            {t("stat")} <span className="font-bold">{t("statCount")}</span> {t("statSuffix")}
          </div>
        </div>
      </div>
    </section>
  );
}
