import { createFileRoute } from "@tanstack/react-router";
import { Clock, ExternalLink, Mail, MapPin, MessageCircle, Store } from "lucide-react";
import { site } from "@/lib/site";
import { Reveal } from "@/components/brand/Reveal";
import { ContactForm } from "@/components/brand/ContactForm";
import { LeafShadow, MonogramWatermark } from "@/components/brand/decor";
import { Button } from "@/components/ui/button";

export const Route = createFileRoute("/contact")({
  head: () => ({
    meta: [
      { title: "Contact Eva Shii Jason — Speaking, Books, Mentorship" },
      {
        name: "description",
        content:
          "Get in touch about speaking engagements, book orders, mentorship and vocal coaching, or collaborations. Based in Nairobi, Kenya.",
      },
      { property: "og:title", content: "Contact Eva Shii Jason" },
      {
        property: "og:description",
        content: "Speaking, book orders, mentorship and collaborations — start the conversation.",
      },
      { property: "og:type", content: "website" },
      { name: "twitter:card", content: "summary_large_image" },
    ],
  }),
  component: ContactPage,
});

function ContactPage() {
  return (
    <>
      <section className="relative overflow-hidden bg-jungle pb-20 pt-32 text-ivory sm:pt-36">
        <LeafShadow className="opacity-[0.07]" />
        <MonogramWatermark className="absolute -right-8 top-10 text-[16rem]" />
        <div className="relative mx-auto max-w-6xl px-4 text-center sm:px-6">
          <Reveal>
            <p className="eyebrow text-[0.65rem] text-gold-light">Contact</p>
            <h1 className="mx-auto mt-5 max-w-3xl font-display text-5xl leading-[1.05] sm:text-6xl">
              Start the <span className="gold-text">conversation.</span>
            </h1>
            <p className="mx-auto mt-6 max-w-xl text-base leading-relaxed text-ivory/80">
              Speaking engagements, book orders, mentorship and vocal coaching, collaborations —
              every message finds its way to Eva.
            </p>
          </Reveal>
        </div>
      </section>

      <section className="section-pad">
        <div className="mx-auto grid max-w-6xl gap-12 px-4 sm:px-6 lg:grid-cols-5">
          <Reveal className="lg:col-span-3">
            <div className="rounded-2xl border border-gold/25 bg-card p-8 sm:p-10">
              <h2 className="font-display text-3xl text-jungle">Send a message</h2>
              <p className="mt-2 text-sm text-muted-foreground">
                Choose a subject so your message lands in the right basket.
              </p>
              <div className="mt-8">
                <ContactForm />
              </div>
            </div>
          </Reveal>
          <Reveal delayMs={140} className="lg:col-span-2">
            <div className="grid content-start gap-5">
              <div className="rounded-2xl border border-gold/25 bg-jungle p-7 text-ivory">
                <MessageCircle className="h-6 w-6 text-gold-light" />
                <h3 className="mt-3 font-display text-xl">Prefer to chat?</h3>
                <p className="mt-2 text-sm text-ivory/75">
                  Reach out directly on WhatsApp for quick questions and orders.
                </p>
                <Button asChild variant="gold" size="lg" className="mt-5 rounded-full">
                  <a href={site.whatsapp} target="_blank" rel="noreferrer">
                    {site.whatsappLabel}
                  </a>
                </Button>
              </div>
              <div className="rounded-2xl border border-gold/25 bg-card p-7">
                <ul className="grid gap-5">
                  <li className="flex gap-3">
                    <Mail className="mt-0.5 h-5 w-5 shrink-0 text-gold" />
                    <div>
                      <p className="eyebrow text-[0.55rem] text-terra">Email</p>
                      {site.emails.map((e) => (
                        <a
                          key={e}
                          href={`mailto:${e}`}
                          className="block text-sm font-medium hover:text-jungle"
                        >
                          {e}
                        </a>
                      ))}
                    </div>
                  </li>
                  <li className="flex gap-3">
                    <MapPin className="mt-0.5 h-5 w-5 shrink-0 text-gold" />
                    <div>
                      <p className="eyebrow text-[0.55rem] text-terra">Location</p>
                      <p className="text-sm font-medium">{site.location}</p>
                    </div>
                  </li>
                  <li className="flex gap-3">
                    <Clock className="mt-0.5 h-5 w-5 shrink-0 text-gold" />
                    <div>
                      <p className="eyebrow text-[0.55rem] text-terra">Response time</p>
                      <p className="text-sm font-medium">Within 2–3 working days</p>
                    </div>
                  </li>
                </ul>
                <div className="mt-6 border-t border-gold/20 pt-5">
                  <p className="eyebrow text-[0.55rem] text-terra">Follow along</p>
                  <div className="mt-3 flex flex-wrap gap-2">
                    {site.socials.map((s) => (
                      <a
                        key={s.label}
                        href={s.href}
                        target="_blank"
                        rel="noreferrer"
                        className="rounded-full border border-gold/40 px-4 py-1.5 text-xs font-semibold transition-colors hover:bg-gold hover:text-jungle-deep"
                      >
                        {s.label}
                      </a>
                    ))}
                  </div>
                </div>
              </div>
            </div>
          </Reveal>
        </div>
      </section>

      <section className="section-pad bg-secondary">
        <div className="mx-auto max-w-6xl px-4 sm:px-6">
          <Reveal className="text-center">
            <p className="eyebrow text-[0.62rem] text-terra">In person</p>
            <h2 className="mt-4 font-display text-4xl text-jungle sm:text-5xl">
              Bookshops &amp; <span className="gold-text">stockists.</span>
            </h2>
            <p className="mx-auto mt-5 max-w-xl text-sm leading-relaxed text-muted-foreground">
              Eva's titles are kept on the shelves at these shops — or ask them to order a copy
              for you.
            </p>
          </Reveal>
          <div className="mt-12 grid gap-5 sm:grid-cols-2 lg:grid-cols-3">
            {site.shops.map((shop, i) => (
              <Reveal key={shop.name + (shop.where ?? "")} delayMs={(i % 3) * 110}>
                <div className="flex h-full items-start gap-4 rounded-2xl border border-gold/25 bg-card p-6">
                  <Store className="mt-0.5 h-5 w-5 shrink-0 text-gold" />
                  <div>
                    <p className="font-display text-xl leading-snug text-jungle">{shop.name}</p>
                    {shop.where ? (
                      <p className="mt-1 text-sm text-muted-foreground">{shop.where}</p>
                    ) : null}
                  </div>
                </div>
              </Reveal>
            ))}
          </div>
          <Reveal delayMs={120} className="mt-12">
            <p className="eyebrow text-center text-[0.55rem] text-terra">Or buy online</p>
            <div className="mt-5 grid gap-5 sm:grid-cols-2">
              {site.onlineShops.map((shop) => (
                <a
                  key={shop.name}
                  href={shop.href}
                  target="_blank"
                  rel="noreferrer"
                  className="card-lift flex items-center justify-between gap-4 rounded-2xl border border-gold/25 bg-card p-6"
                >
                  <span>
                    <span className="block font-display text-xl leading-snug text-jungle">
                      {shop.name}
                    </span>
                    {shop.where ? (
                      <span className="mt-1 block text-sm text-muted-foreground">
                        {shop.where}
                      </span>
                    ) : null}
                  </span>
                  <ExternalLink className="h-4 w-4 shrink-0 text-gold" />
                </a>
              ))}
            </div>
          </Reveal>
        </div>
      </section>
    </>
  );
}
