"use client";

import Link from "next/link";
import { MapPin, BookOpen, Crown } from "lucide-react";
import { motion } from "framer-motion";
import { HERO_TAGS } from "~/lib/data";
import { Button } from "~/components/ui/button";

const HERO_CARDS = [
  {
    title: "探索城市",
    desc: "找到适合远程生活的地方",
    icon: MapPin,
    href: "https://meetup.hackrobot.cn",
  },
  {
    title: "学习专题",
    desc: "从零搭建你的技能与收入结构",
    icon: BookOpen,
    href: "https://digital.hackrobot.cn",
  },
  {
    title: "会员社区",
    desc: "进入更高密度的人脉与资源网络",
    icon: Crown,
    href: "https://vip.hackrobot.cn",
  },
];

export function Hero() {
  return (
    <section className="relative overflow-hidden bg-white">
      <div className="container mx-auto px-4 py-16 md:px-6 md:py-24 lg:py-32">
        <div className="grid gap-12 lg:grid-cols-2 lg:gap-16">
          <div className="flex flex-col justify-center">
            <motion.div
              initial={{ opacity: 0, y: 16 }}
              animate={{ opacity: 1, y: 0 }}
              transition={{ duration: 0.5 }}
            >
              <h1 className="text-3xl font-semibold tracking-tight text-neutral-900 sm:text-4xl md:text-5xl">
                中文数字游民操作系统
              </h1>
              <p className="mt-4 text-lg text-neutral-600 md:text-xl">
                从城市、技能、工具到社群，一站开始
              </p>
              <p className="mt-2 text-base text-neutral-500">
                帮你从固定工位，走向自由生活与自由收入
              </p>
            </motion.div>

            <motion.p
              initial={{ opacity: 0 }}
              animate={{ opacity: 1 }}
              transition={{ delay: 0.2, duration: 0.4 }}
              className="mt-6 max-w-lg text-sm text-neutral-500"
            >
              数字游民不只是旅行，而是「地点自由 + 收入结构 + 系统工具 + 社群连接」的组合。
            </motion.p>

            <motion.div
              initial={{ opacity: 0, y: 12 }}
              animate={{ opacity: 1, y: 0 }}
              transition={{ delay: 0.3, duration: 0.4 }}
              className="mt-8 flex flex-wrap gap-3"
            >
              <Link
                href="https://meetup.hackrobot.cn"
                target="_blank"
                rel="noopener noreferrer"
              >
                <Button size="lg" className="min-w-[180px]">
                  开始你的数字游民路径
                </Button>
              </Link>
              <Link
                href="https://meetup.hackrobot.cn"
                target="_blank"
                rel="noopener noreferrer"
              >
                <Button variant="outline" size="lg">
                  探索适合你的城市
                </Button>
              </Link>
              <Link
                href="https://digital.hackrobot.cn"
                target="_blank"
                rel="noopener noreferrer"
              >
                <Button variant="ghost" size="lg">
                  查看学习专题
                </Button>
              </Link>
            </motion.div>

            <motion.div
              initial={{ opacity: 0 }}
              animate={{ opacity: 1 }}
              transition={{ delay: 0.5 }}
              className="mt-10 flex flex-wrap gap-2"
            >
              {HERO_TAGS.map((tag, i) => (
                <span
                  key={tag}
                  className="rounded-full border border-neutral-200 bg-neutral-50 px-3 py-1 text-xs text-neutral-600"
                >
                  {tag}
                </span>
              ))}
            </motion.div>
          </div>

          <motion.div
            initial={{ opacity: 0, x: 24 }}
            animate={{ opacity: 1, x: 0 }}
            transition={{ delay: 0.4, duration: 0.5 }}
            className="flex flex-col gap-4 lg:justify-center"
          >
            <div className="grid gap-4 sm:grid-cols-3">
              {HERO_CARDS.map((card, i) => (
                <Link
                  key={card.title}
                  href={card.href}
                  target="_blank"
                  rel="noopener noreferrer"
                  className="group flex flex-col rounded-xl border border-neutral-200 bg-white p-5 shadow-sm transition-all hover:-translate-y-1 hover:shadow-md"
                >
                  <card.icon className="h-8 w-8 text-neutral-400 transition-colors group-hover:text-neutral-700" />
                  <h3 className="mt-3 font-medium text-neutral-900">
                    {card.title}
                  </h3>
                  <p className="mt-1 text-sm text-neutral-500">{card.desc}</p>
                </Link>
              ))}
            </div>
          </motion.div>
        </div>
      </div>
    </section>
  );
}
