"use client";

import { useState } from "react";
import { PROFILE } from "@/data/content";
import LinkIcon from "./LinkIcon";
import { useStaggerReveal } from "@/hooks/useAnimations";

export default function Links() {
  const [hovered, setHovered] = useState<number | null>(null);
  const visible = useStaggerReveal(PROFILE.links.length + PROFILE.contactMethods.length, 50);
  return (    
      <div style={{ display: "flex", gap: 12, flexWrap: "wrap" }}>
        {PROFILE.links.map((link, i) => (
          <a key={link.label}
            href={link.url}
            target="_blank"
            rel="noopener noreferrer"
            onMouseEnter={() => setHovered(i)}
            onMouseLeave={() => setHovered(null)}
            style={{
              display: "inline-flex",
              alignItems: "center",
              gap: 8,
              padding: "10px 18px",
              fontFamily: "var(--mono)",
              fontSize: 13,
              fontWeight: 500,
              color: hovered === i ? "var(--accent)" : "var(--fg-secondary)",
              background: hovered === i ? "var(--accent-bg)" : "var(--surface)",
              border: `1px solid ${hovered === i ? "var(--accent)" : "var(--border)"}`,
              borderRadius: 6,
              textDecoration: "none",
              transition: "all var(--duration-slow)",
              transform: hovered === i ? "translateY(-2px)" : "none",
              opacity: visible.has(i) ? 1.0 : 0
            }}
          >
            <LinkIcon type={link.icon} />
            {link.label}
          </a>
        ))}
      </div>
  );
}
