'use client';

import { useLocale } from 'next-intl';

import { ArrowUpRight } from 'lucide-react';

import { linkFocusRing } from '@/components/ui/app-link';
import { RouteLink } from '@/components/ui/route-link';
import { cn } from '@/lib/utils';

/**
 * A desktop tab on the right edge leading to the Hungarian discovery story. The ink border with a
 * light halo keeps it readable over both light and dark page sections.
 */
export default function DiscoveryFlag() {
  const locale = useLocale();
  if (locale !== 'hu') return null;

  return (
    <aside
      className="fixed right-0 top-1/2 z-40 hidden -translate-y-1/2 lg:block"
      aria-label="Felfedezés"
    >
      <RouteLink
        href="/felfedezes"
        className={cn(
          linkFocusRing,
          'group flex w-11 flex-col items-center gap-3 border border-r-0 border-[#151720] bg-mma-yellow py-4 text-[#151720] shadow-[0_0_0_1px_rgba(255,255,255,0.75),0_10px_24px_-10px_rgba(21,23,32,0.6)] transition-[width,background-color,color] duration-200 hover:w-12 hover:bg-[#151720] hover:text-mma-yellow focus-visible:ring-inset'
        )}
        title="Felfedezés – történetek, összefüggések és játékok"
      >
        <ArrowUpRight
          aria-hidden="true"
          className="size-4 transition-transform motion-safe:group-hover:-translate-y-0.5 motion-safe:group-hover:translate-x-0.5"
          strokeWidth={2}
        />
        <span className="text-xs font-bold uppercase tracking-[0.14em] [writing-mode:vertical-rl]">
          Felfedezés
        </span>
        <span
          aria-hidden="true"
          className="bg-[#151720] px-1 py-1.5 text-[9px] font-bold uppercase tracking-[0.1em] text-mma-yellow [writing-mode:vertical-rl] group-hover:bg-mma-yellow group-hover:text-[#151720]"
        >
          Új
        </span>
      </RouteLink>
    </aside>
  );
}
