/* ============================================================
   SPECIAL EVENT — THE ANNIVERSARY AFFAIR
   Saturday September 26, 2026 · 8 PM – 5 AM · 21+
   Route: /anniversary (also #anniversary · #aniversario) — landing with the
   Eventbrite ticket link + table reservations on the shared
   venue floor plan (CKFloorPlan from event-chacal.jsx).
   Bookings persist to PPDB.reservations, mirror to the Hub and
   hand off to WhatsApp exactly like every other flow, carrying
   promoter attribution.
   Lifecycle is automatic via the date engine (PP.eventState):
   upcoming → tonight → past (archived, sales closed).

   NUMBERS — read before editing:
   · Date, hours, venue and 21+ come from the official Eventbrite
     listing (link below). Verified against it.
   · Tickets: the first 30 are free on Eventbrite, then $25 (owner's
     setup, and the listing does show a $0.00 tier). Eventbrite adds
     its service fee at checkout, so the page says so instead of
     pretending the total equals the face value.
   · Table minimums are the owner's decision: the same ones as the
     last special event (MAURO, Aug 27). They live in ANNIV.zones.
     With ANNIV.zones cleared the page falls back to the club's
     Saturday program (PP.tablePrice, nightIdx 5).
   ============================================================ */

const ANNIV = {
  route: "anniversary",
  // its own page inside clubpinkpony.com — a real URL for flyers and QR codes
  // (Firebase rewrites ** → /index.html, so the path reaches the app)
  url: "https://www.clubpinkpony.com/anniversary",
  dateISO: "2026-09-26",
  startISO: "2026-09-26T20:00:00-04:00", // doors 8PM Miami
  timeLabel: "8:00 PM",
  hoursLabel: "8 PM – 5 AM",
  nightIdx: 5, // Saturday — table minimums follow the Saturday program
  nightName: "THE ANNIVERSARY AFFAIR",
  title: "THE ANNIVERSARY AFFAIR",
  // calendar export — the listing's own UTC instants (8 PM–5 AM EDT)
  utcStart: "20260927T000000Z",
  utcEnd: "20260927T090000Z",
  rsvpTel: "+17865032909",
  rsvpTelDisplay: "(786) 503-2909",
  address: "7971 NW 33rd St, Doral, FL 33122",
  // Tickets, as the owner set them up on Eventbrite: the first `free` entries
  // go at $0, and after that a ticket costs `presale`. Verified against the
  // listing: it does carry a $0.00 tier and is on sale (its public data shows
  // lowPrice 0.00 / highPrice 30.52 with Eventbrite's fee already added — the
  // fee is why the checkout total is above the face value, hence the note in
  // the UI). The free allotment and the face value are the owner's numbers.
  // `door` stays null until there is a door price to publish; while it is null
  // no door price is printed anywhere.
  tickets: {
    free: 30,
    presale: 25,
    door: null,
    url: "https://www.eventbrite.com/e/the-anniversary-affair-tickets-2000081536717",
  },
  // Official table minimums for this night, by floor-plan zone. The owner set
  // them equal to the last special event (MAURO, Aug 27) — same numbers, so
  // these two lists must stay in sync if either is ever repriced.
  zones: { top: 2500, vip: 1500, blue: 800, green: 600, red: 600, silver: 1500 },
  // Official artwork, dropped into web/assets/events/. Any missing file
  // falls back to the CSS recreation automatically — the page never shows
  // a broken image and never waits on the export.
  art: {
    desktop: ["assets/events/anniversary-hero-desktop.webp"],
    flyer: ["assets/events/anniversary-flyer.webp", "assets/events/anniversary-hero-desktop.webp"],
  },
};

/* zone → generic tier, so the Saturday program prices every table */
const ANNIV_Z2GEN = { top: "stage", vip: "vip", blue: "regular", green: "regular", red: "regular", silver: "mezz" };

const anFmt = (n) => "$" + Number(n).toLocaleString("en-US");
function anState() { try { return window.PP.eventState(ANNIV.dateISO); } catch (e) { return "upcoming"; } }
function anZonePrice(z) {
  if (ANNIV.zones && ANNIV.zones[z] != null) return ANNIV.zones[z];
  try { return window.PP.tablePrice(ANNIV_Z2GEN[z] || "regular", ANNIV.nightIdx); } catch (e) { return 0; }
}
function anTablePrice(tb) { return anZonePrice(tb && tb.z); }
/* cheapest table on the plan — drives the "tables from $X++" copy */
function anTableFrom() {
  try {
    const all = (window.CK_TABLES || []).map((tb) => anTablePrice(tb)).filter((p) => p > 0);
    return all.length ? Math.min.apply(null, all) : 0;
  } catch (e) { return 0; }
}

/* Meta Pixel — the ad campaign optimises on these. PP.track is a no-op when
   the pixel is not loaded, so nothing here can break a click. */
function anTrack(event, name) {
  try { window.PP && window.PP.track && window.PP.track(event, { content_name: "The Anniversary Affair · " + name }); } catch (e) {}
}

/* "Save the date" — a real calendar entry, from the verified event facts only */
function anCalendar(lang) {
  const es = lang === "es";
  const title = "The Anniversary Affair · Club Pink Pony";
  const where = "Pink Pony Club, " + ANNIV.address;
  const details = (es ? "Aniversario de Club Pink Pony. 8 PM – 5 AM · 21+. Tickets y reservas: "
                      : "Club Pink Pony's anniversary. 8 PM – 5 AM · 21+. Tickets & reservations: ") + ANNIV.url;
  const google = "https://calendar.google.com/calendar/render?action=TEMPLATE"
    + "&text=" + encodeURIComponent(title)
    + "&dates=" + ANNIV.utcStart + "/" + ANNIV.utcEnd
    + "&details=" + encodeURIComponent(details)
    + "&location=" + encodeURIComponent(where);
  // Apple/Outlook get a real file (web/anniversary.ics, generated by
  // tools/make-event-pages.py) — iOS Safari does not reliably honour
  // `download` on a data: URL, a served text/calendar file it does.
  return { google, ics: "anniversary.ics" };
}

/* "Invite your people" — share links from the shared helper, no SDK */
function anShare(lang) {
  try { return window.PP.shareLinks(ANNIV.url, anShareText(lang)); } catch (e) { return null; }
}

/* probe for the real exported artwork (first one that loads wins) */
function useAnnivArtAt(list) {
  const [src, setSrc] = useState("");
  useEffect(() => {
    let live = true;
    const tryAt = (i) => {
      if (!live || i >= list.length) return;
      const url = window.__asset ? window.__asset(list[i]) : list[i];
      const im = new Image();
      im.onload = () => { if (live) setSrc(url); };
      im.onerror = () => tryAt(i + 1);
      im.src = url;
    };
    tryAt(0);
    return () => { live = false; };
  }, []);
  return src;
}
function useAnnivArt() { return useAnnivArtAt(ANNIV.art.desktop); }
function useAnnivFlyer() { return useAnnivArtAt(ANNIV.art.flyer); }

/* ---------- one-time CSS — Luxury Vintage Casino palette ----------
   Working values from the campaign direction: wine #4B101D, oxblood
   #751C2D, ivory #EFE5D2, brass #B89B66, espresso #1D1517. */
(function injectAnnivStyles() {
  if (document.getElementById("anniv-css")) return;
  const s = document.createElement("style");
  s.id = "anniv-css";
  s.textContent = `
  .an-card{background:
    radial-gradient(120% 80% at 50% 0%, rgba(184,155,102,.10), transparent 62%),
    linear-gradient(168deg,#F5EDDD 0%,#EFE5D2 46%,#E6D9C1 100%)}
  .an-bg{background:
    radial-gradient(58% 90% at 50% 0%, rgba(184,155,102,.10), transparent 60%),
    radial-gradient(45% 70% at 12% 100%, rgba(117,28,45,.35), transparent 66%),
    radial-gradient(45% 70% at 88% 100%, rgba(117,28,45,.35), transparent 66%),
    linear-gradient(180deg,#0a0a0b 0%,#1a0910 55%,#4B101D 100%)}
  .an-rule{height:1px;background:linear-gradient(90deg,transparent,rgba(184,155,102,.85),transparent)}
  .an-rule-dark{height:1px;background:linear-gradient(90deg,transparent,rgba(117,28,45,.7),transparent)}
  .an-btn{background:linear-gradient(90deg,#751C2D,#4B101D);box-shadow:0 8px 30px rgba(117,28,45,.45)}
  .an-btn:hover{filter:brightness(1.14)}
  .an-brass,.label.an-brass{color:#B89B66}
  .an-serif{font-family:'Cormorant Garamond',serif}
  /* the shared venue map is drawn in the site's pink; on this page it wears
     the campaign's wine and brass. Attribute selectors match Tailwind's
     literal class names without escaping. Zone dots keep their colours —
     they are the legend's meaning. */
  #anniv-floorplan [class~="border-[#FF2E88]/35"]{border-color:rgba(184,155,102,.30)}
  #anniv-floorplan [class~="border-[#FF2E88]/40"]{border-color:rgba(117,28,45,.8)}
  #anniv-floorplan [class~="bg-[#FF2E88]/10"]{background:rgba(117,28,45,.22)}
  #anniv-floorplan [class~="text-[#FF2E88]/80"]{color:#B89B66}
  #anniv-floorplan .ck-table.ck-sel{box-shadow:0 0 0 2px #EFE5D2,0 0 24px rgba(184,155,102,.8)}
  /* phones/tablets: the second-floor panel is nine identical tables — cap it
     instead of letting it run 500px+ tall; and give every table ~10px more
     hit area without moving the layout */
  @media (max-width:1023px){#anniv-floorplan .grid>div:nth-child(2){max-width:260px;width:100%;margin:0 auto}}
  @media (max-width:767px){#anniv-floorplan .ck-table::after{content:"";position:absolute;inset:-5px}}
  `;
  document.head.appendChild(s);
})();

/* ---------- the composed banner (CSS recreation) ----------
   Used until the real export lands in web/assets/events/. It carries the
   same information the official piece carries: title, date, save-the-date
   and the footer block — nothing invented. */
function AnnivBannerContent({ compact }) {
  const t = useT();
  const pad = compact ? "px-6 py-8 md:py-10" : "px-6 py-7 md:px-7 md:py-14";
  const suit = (ch, pos) => (
    <span aria-hidden="true" className={"absolute text-[#751C2D]/70 text-lg md:text-2xl " + pos}>{ch}</span>
  );
  return (
    <div className={"relative w-full an-card rounded-2xl border border-[#751C2D]/35 overflow-hidden " + pad}>
      {/* double frame + corner suits, like the official piece */}
      <div className="absolute inset-2 md:inset-3 border border-[#751C2D]/45 rounded-xl pointer-events-none"></div>
      <div className="absolute inset-[10px] md:inset-[15px] border border-[#B89B66]/40 rounded-lg pointer-events-none"></div>
      {suit("♥", "left-4 top-3 md:left-6 md:top-5")}
      {suit("♣", "right-4 top-3 md:right-6 md:top-5")}
      {suit("♣", "left-4 bottom-3 md:left-6 md:bottom-5")}
      {suit("♥", "right-4 bottom-3 md:right-6 md:bottom-5")}

      <div className="relative text-center">
        <img src={window.__asset ? window.__asset("assets/logo-pink-trimmed.png") : "assets/logo-pink-trimmed.png"}
          alt="Pink Pony Club" loading="eager"
          className={"mx-auto object-contain " + (compact ? "h-7 md:h-9" : "h-9 md:h-12")} />

        <div className={"an-serif text-[#4B101D] tracking-[0.3em] font-semibold " + (compact ? "text-[10px] mt-6" : "text-xs mt-8")}>THE</div>
        <div className={"an-serif font-bold text-[#4B101D] uppercase leading-[0.86] " + (compact ? "text-[clamp(2rem,8vw,3.4rem)]" : "text-[clamp(2.4rem,9vw,5rem)]")}>Anniversary</div>
        <div className={"serif-it text-[#751C2D] leading-[0.9] " + (compact ? "text-[clamp(1.8rem,7vw,3rem)]" : "text-[clamp(2.2rem,8vw,4.2rem)]")}>Affair</div>

        <div className="flex items-center justify-center gap-3 mt-5">
          <span className="an-rule-dark w-12 md:w-24"></span>
          <span aria-hidden="true" className="text-[#751C2D]/70 text-sm">♣</span>
          <span className="an-rule-dark w-12 md:w-24"></span>
        </div>

        <div className={"an-serif font-semibold text-[#4B101D] tracking-[0.14em] uppercase " + (compact ? "text-sm mt-4" : "text-base md:text-xl mt-5")}>
          {t("Saturday, September 26, 2026", "Sábado 26 de septiembre de 2026")}
        </div>
        <div className="inline-block border border-[#751C2D]/55 rounded-sm px-5 py-2 mt-4">
          <span className="an-serif text-[#751C2D] tracking-[0.24em] text-[10px] md:text-xs font-semibold uppercase">
            {t("Save the date", "Guarda la fecha")}
          </span>
        </div>

        {!compact && (
          <div className="hidden sm:block mt-7 pt-5 border-t border-[#751C2D]/25 text-[#4B101D]/80 an-serif text-[10px] md:text-xs leading-relaxed">
            <div>{ANNIV.address}</div>
            <div>{ANNIV.rsvpTelDisplay} · clubpinkpony.com</div>
            <div className="mt-1 tracking-[0.2em]">21+</div>
          </div>
        )}
      </div>
    </div>
  );
}

/* ---------- hero slide (used inside the home HeroSlides carousel) ---------- */
function AnnivHeroSlide({ active, go }) {
  const t = useT();
  const art = useAnnivArt();
  const anim = "transition-all duration-700 " + (active ? "opacity-100 translate-y-0" : "opacity-0 translate-y-4");
  return (
    <div className="absolute inset-0">
      {/* The banner is 16:9 and its copy is burned in, so it is never cropped:
          a blurred, saturated echo of itself paints the frame and the piece
          sits whole inside it at every width. */}
      {art ? (
        <React.Fragment>
          <img src={art} alt="" aria-hidden="true" className="absolute inset-0 w-full h-full object-cover" style={{ filter: "blur(40px) brightness(.5) saturate(1.35)", transform: "scale(1.35)" }} />
          <div className="absolute inset-0" style={{ background: "radial-gradient(120% 70% at 50% 40%, rgba(184,155,102,.16), transparent 62%)" }}></div>
          <img src={art} alt={"The Anniversary Affair — " + t("September 26, 2026", "26 de septiembre de 2026") + " · Pink Pony Club"}
            className="absolute inset-0 w-full h-full object-contain hidden sm:block" style={{ filter: "brightness(.94)" }} />
        </React.Fragment>
      ) : <div className="absolute inset-0 an-bg" aria-hidden="true"></div>}
      <div className="absolute inset-0" style={{ background: "linear-gradient(to top,#0B0B0C 4%,rgba(11,11,12,.25) 30%,transparent 55%)" }}></div>

      <div className={"relative z-10 h-full container flex flex-col items-center px-6 " + (art ? "justify-center sm:justify-end pb-24 sm:pb-16" : "justify-center")}>
        {/* mobile (and the no-art fallback): the piece itself, complete */}
        <div className={"w-full max-w-md " + (art ? "sm:hidden " : "") + anim} style={{ transitionDelay: active ? "220ms" : "0ms" }}>
          {art ? (
            <img src={art} alt="" aria-hidden="true" className="w-full h-auto rounded-2xl border border-white/10" style={{ boxShadow: "0 26px 70px -18px rgba(0,0,0,.9)" }} />
          ) : <AnnivBannerContent compact />}
        </div>

        <div className={"flex flex-col sm:flex-row gap-4 justify-center mt-7 sm:mt-8 " + anim} style={{ transitionDelay: active ? "380ms" : "0ms" }}>
          <button onClick={() => { window.__annivSection = "floorplan"; go(ANNIV.route); }} className="gbtn an-btn inline-flex items-center justify-center gap-2.5 px-9 py-4 rounded-full text-white text-[12px] font-bold uppercase tracking-[0.18em] transition-all">
            {t("Reserve for Sep 26", "Reservar para el 26")} <Icon name="arrow-up-right" className="w-4 h-4" />
          </button>
          <button onClick={() => { window.__annivSection = "tickets"; go(ANNIV.route); }} className="gbtn inline-flex items-center justify-center gap-2.5 px-9 py-4 rounded-full border border-white/25 bg-white/5 backdrop-blur text-white text-[12px] font-bold uppercase tracking-[0.18em] hover:bg-white/12 transition-all">
            <Icon name="ticket" className="w-4 h-4" /> {ANNIV.tickets.free ? t("First " + ANNIV.tickets.free + " free", "Primeras " + ANNIV.tickets.free + " gratis") : t("Tickets", "Tickets")}
          </button>
        </div>
      </div>
    </div>
  );
}

/* ---------- site-wide highlight strip ---------- */
function AnnivStrip({ go }) {
  const t = useT();
  const nav = go || window.__ppGo || (() => {});
  if (anState() === "past") return null;
  const badge = window.PP.eventBadge ? window.PP.eventBadge(ANNIV.dateISO, t("en", "es")) : "SEP 26";
  const from = anTableFrom();
  return (
    <button onClick={() => nav(ANNIV.route)}
      className="w-full group relative overflow-hidden rounded-2xl border border-[#B89B66]/45 bg-gradient-to-r from-[#2a0c15] via-[#17060e] to-[#2a0c15] px-5 py-4 flex flex-wrap items-center justify-center gap-x-4 gap-y-2 text-left hover:border-[#B89B66]/85 transition-all">
      <span className="inline-flex items-center gap-2">
        <span className="w-2 h-2 rounded-full bg-[#B89B66] ck-pulse"></span>
        <span className="label text-[#B89B66] text-[10px]">{t("Special Event", "Evento Especial")} · {badge}</span>
      </span>
      <span className="font-black uppercase tracking-tight text-white text-sm md:text-base">THE ANNIVERSARY AFFAIR</span>
      <span className="text-white/55 text-xs hidden md:inline">{t("Saturday, September 26 · 8 PM – 5 AM · 21+", "Sábado 26 de septiembre · 8 PM – 5 AM · 21+")}</span>
      <span className="text-white/55 text-xs">
        {ANNIV.tickets.free
          ? t("First " + ANNIV.tickets.free + " tickets free · then " + anFmt(ANNIV.tickets.presale), "Primeras " + ANNIV.tickets.free + " entradas gratis · luego " + anFmt(ANNIV.tickets.presale))
          : t("Tickets on Eventbrite", "Tickets por Eventbrite")}
        {from > 0 ? t(" · tables from ", " · mesas desde ") + anFmt(from) + "++" : ""}
      </span>
      <span className="inline-flex items-center gap-1.5 text-[#B89B66] text-[11px] font-bold uppercase tracking-[0.16em] group-hover:gap-2.5 transition-all">
        {t("See the night", "Ver la noche")} <Icon name="arrow-right" className="w-3.5 h-3.5" />
      </span>
    </button>
  );
}

/* ---------- featured banner card (Events page · Special tab) ---------- */
function AnnivEventBanner({ go }) {
  const t = useT();
  const art = useAnnivFlyer();
  const past = anState() === "past";
  return (
    <div className="relative rounded-2xl overflow-hidden border border-[#B89B66]/40 mb-6 group cursor-pointer" onClick={() => go(ANNIV.route)}>
      {art ? (
        <div className="relative">
          <img src={art} alt={"The Anniversary Affair · " + t("September 26, 2026", "26 de septiembre de 2026")} loading="lazy" className="w-full h-auto block" style={past ? { filter: "grayscale(.85) brightness(.75)" } : undefined} />
          {past && <span className="absolute top-3 left-3 rounded-full bg-black/70 backdrop-blur border border-white/25 px-3.5 py-1.5 label text-white/80 text-[10px]">{t("Past event", "Evento pasado")}</span>}
        </div>
      ) : (
        <div className="relative flex items-center justify-center p-4 md:p-7 an-bg">
          <div className="w-full max-w-2xl"><AnnivBannerContent compact /></div>
        </div>
      )}
      <div className="relative z-10 pt-5 pb-7 flex flex-wrap items-center justify-center gap-3 px-6">
        {past ? (
          <span className="px-6 py-3 rounded-full border border-white/20 text-white/55 text-[11px] font-bold uppercase tracking-[0.14em]">{t("Event ended", "Evento finalizado")}</span>
        ) : (
          <React.Fragment>
            <button onClick={(e) => { e.stopPropagation(); window.__annivSection = "floorplan"; go(ANNIV.route); }} className="gbtn an-btn px-6 py-3 rounded-full text-white text-[11px] font-bold uppercase tracking-[0.14em]">
              <span className="inline-flex items-center gap-2"><Icon name="map-pin" className="w-4 h-4" />{t("Reserve a table", "Reservar mesa")}</span>
            </button>
            <button onClick={(e) => { e.stopPropagation(); window.__annivSection = "tickets"; go(ANNIV.route); }} className="gbtn px-6 py-3 rounded-full border border-white/25 bg-white/5 text-white text-[11px] font-bold uppercase tracking-[0.14em] hover:bg-white/12">
              <span className="inline-flex items-center gap-2"><Icon name="ticket" className="w-4 h-4" />{ANNIV.tickets.free ? t("First " + ANNIV.tickets.free + " free", "Primeras " + ANNIV.tickets.free + " gratis") : t("Tickets", "Tickets")}</span>
            </button>
          </React.Fragment>
        )}
      </div>
    </div>
  );
}

/* ---------- countdown ---------- */
function AnnivCountdown() {
  const t = useT();
  const [now, setNow] = useState(() => new Date());
  useEffect(() => { const id = setInterval(() => setNow(new Date()), 1000); return () => clearInterval(id); }, []);
  const diff = new Date(ANNIV.startISO) - now;
  // from doors until the 9 AM cutoff archives the event, the hero says so
  if (diff <= 0) return (
    <span className="inline-flex items-center gap-2.5 rounded-full border border-[#B89B66]/40 bg-black/40 backdrop-blur px-6 py-2.5">
      <span className="w-2 h-2 rounded-full bg-[#B89B66] ck-pulse"></span>
      <span className="label an-brass text-[11px]">{t("Tonight · doors 8 PM – 5 AM", "Esta noche · puertas 8 PM – 5 AM")}</span>
    </span>
  );
  const dd = Math.floor(diff / 86400e3), hh = Math.floor(diff / 3600e3) % 24, mm = Math.floor(diff / 60e3) % 60, ss = Math.floor(diff / 1e3) % 60;
  const cell = (v, lbl) => (
    <div className="text-center min-w-[64px] md:min-w-[80px]">
      <div className="font-black tabular-nums leading-none text-3xl md:text-5xl">{String(v).padStart(2, "0")}</div>
      <div className="label text-white/50 text-[10px] mt-1.5">{lbl}</div>
    </div>
  );
  return (
    <div className="inline-flex items-center gap-2 md:gap-4 rounded-2xl border border-[#B89B66]/25 bg-black/40 backdrop-blur-md px-4 py-3 md:px-7 md:py-4">
      {cell(dd, t("Days", "Días"))}<span className="text-white/25 text-xl md:text-3xl font-light pb-4">:</span>
      {cell(hh, t("Hrs", "Hrs"))}<span className="text-white/25 text-xl md:text-3xl font-light pb-4">:</span>
      {cell(mm, t("Min", "Min"))}<span className="text-white/25 text-xl md:text-3xl font-light pb-4">:</span>
      {cell(ss, t("Sec", "Seg"))}
    </div>
  );
}

/* ---------- save the date (calendar) ----------
   The banner says "Guarda la fecha" — this makes it a one-tap action. */
function AnnivSaveTheDate() {
  const t = useT(); const { lang } = useLang();
  const cal = anCalendar(lang);
  const pill = "inline-flex items-center gap-2 rounded-full border border-white/15 bg-black/30 backdrop-blur px-4 py-3.5 text-[10.5px] font-bold uppercase tracking-[0.14em] text-white/75 hover:border-[#B89B66]/70 hover:text-white transition-colors";
  return (
    <div className="mt-6 flex flex-wrap items-center justify-center gap-2.5">
      <span className="label text-white/55 text-[10px] basis-full sm:basis-auto text-center sm:mr-1">{t("Save the date", "Guarda la fecha")}</span>
      <a href={cal.google} target="_blank" rel="noopener noreferrer" className={pill}><Icon name="calendar-plus" className="w-3.5 h-3.5" />Google Calendar</a>
      <a href={cal.ics} download="the-anniversary-affair.ics" className={pill}><Icon name="calendar-plus" className="w-3.5 h-3.5" />{t("Apple · Outlook", "Apple · Outlook")}</a>
    </div>
  );
}

/* ---------- the story ----------
   Copy approved in the campaign handoff (§14). It celebrates the club's
   history and the team; it claims no artist, no programme and no number. */
function AnnivStory() {
  const t = useT();
  return (
    <section className="py-14 md:py-20 bg-[#0d0d10] border-y border-white/5">
      <div className="container max-w-3xl text-center">
        <Eyebrow className="an-brass">{t("The Night", "La Noche")}</Eyebrow>
        <h3 className="text-3xl md:text-5xl font-black uppercase mt-4">
          {t(<>Every card has <span className="serif-it font-normal an-brass lowercase">a story</span></>,
             <>Cada carta tiene <span className="serif-it font-normal an-brass lowercase">una historia</span></>)}
        </h3>
        <p className="text-white/60 text-sm md:text-base mt-5 leading-relaxed">
          {t("Behind every Pink Pony night there are people who give it character, energy and their own way of welcoming you. Meet The Royal Team, our anniversary collection. On Saturday, September 26, the night is celebrated with you.",
             "Detrás de cada noche de Pink Pony hay personas que le dan carácter, energía y una forma propia de recibirte. Conoce a The Royal Team, nuestra colección de aniversario. El sábado 26 de septiembre, la noche se celebra contigo.")}
        </p>
        <div className="flex items-center justify-center gap-3 mt-8">
          <span className="an-rule w-14 md:w-24"></span>
          <span aria-hidden="true" className="an-brass text-sm">♠ ♥ ♣ ♦</span>
          <span className="an-rule w-14 md:w-24"></span>
        </div>
        <p className="serif-it text-white/75 text-xl md:text-2xl mt-7">
          {t("“The next story we write with you.”", "«La próxima la escribimos contigo.»")}
        </p>
        <AnnivShareRow />
      </div>
    </section>
  );
}

/* ---------- invite your people (share) ---------- */
function AnnivShareRow() {
  const t = useT(); const { lang } = useLang();
  const links = anShare(lang);
  const [copied, setCopied] = useState(false);
  if (!links) return null;
  const pill = "inline-flex items-center gap-2 rounded-full border border-white/15 bg-white/[.04] px-4 py-3.5 text-[11px] font-bold uppercase tracking-[0.14em] text-white/80 hover:border-[#B89B66]/70 hover:text-white transition-colors";
  const canShare = typeof navigator !== "undefined" && !!navigator.share;
  const copy = () => {
    const done = () => { setCopied(true); setTimeout(() => setCopied(false), 1800); };
    try {
      if (navigator.share) { navigator.share({ title: "The Anniversary Affair", text: anShareText(lang), url: ANNIV.url }).catch(() => {}); return; }
      if (navigator.clipboard && navigator.clipboard.writeText) {
        navigator.clipboard.writeText(ANNIV.url).then(done).catch(() => { window.prompt(t("Copy this link", "Copia este enlace"), ANNIV.url); });
        return;
      }
    } catch (e) {}
    window.prompt(t("Copy this link", "Copia este enlace"), ANNIV.url);
  };
  return (
    <div className="mt-9">
      <div className="label text-white/40 text-[9.5px] mb-3.5">{t("Invite your people", "Invita a tu gente")}</div>
      <div className="flex flex-wrap justify-center gap-2.5">
        <a href={links.whatsapp} target="_blank" rel="noopener noreferrer" className={pill}><Icon name="message-circle" className="w-3.5 h-3.5" />WhatsApp</a>
        <a href={links.facebook} target="_blank" rel="noopener noreferrer" className={pill}><Icon name="share-2" className="w-3.5 h-3.5" />Facebook</a>
        <button type="button" onClick={copy} className={pill}><Icon name={copied ? "check" : canShare ? "share-2" : "link"} className="w-3.5 h-3.5" />{copied ? t("Copied", "Copiado") : canShare ? t("Share", "Compartir") : t("Copy link", "Copiar enlace")}</button>
      </div>
    </div>
  );
}
function anShareText(lang) {
  return lang === "es"
    ? "Te invito a The Anniversary Affair — el aniversario de Club Pink Pony, sábado 26 de septiembre."
    : "You're invited to The Anniversary Affair — Club Pink Pony's anniversary, Saturday September 26.";
}

/* ---------- tickets ----------
   Two tiers: the free allotment first, then the paid ticket. Eventbrite is
   the only place to get either, and it adds its service fee at checkout —
   the page says so rather than letting the total surprise anyone. Any tier
   left null in ANNIV.tickets simply does not render. */
function AnnivTickets() {
  const t = useT();
  const eb = (ANNIV.tickets.url || "").trim();
  const { free, presale, door } = ANNIV.tickets;
  const tier = (label, big, note, hi) => (
    <div className={"rounded-2xl border px-6 py-7 text-center " + (hi ? "border-[#B89B66]/60 bg-[#B89B66]/[.07]" : "border-white/12 bg-[#0d0d10]")}>
      <div className={"label text-[10px] " + (hi ? "an-brass" : "text-white/45")}>{label}</div>
      <div className="font-black text-4xl md:text-5xl mt-2.5 tabular-nums">{big}</div>
      <div className="text-white/45 text-[11.5px] mt-2">{note}</div>
    </div>
  );
  const tiers = [];
  if (free) tiers.push(tier(t("First " + free, "Primeras " + free), t("FREE", "GRATIS"), t("On Eventbrite — while they last", "Por Eventbrite — hasta agotar"), true));
  if (presale != null) tiers.push(tier(free ? t("After that", "Después") : t("Ticket", "Entrada"), anFmt(presale), t("Per ticket + Eventbrite fee at checkout", "Por entrada + cargo de Eventbrite al pagar")));
  if (door != null) tiers.push(tier(t("At the door", "En puerta"), anFmt(door), t("Sep 26 · subject to capacity", "26 Sep · sujeto a capacidad")));

  return (
    <section id="anniv-tickets" className="py-16 md:py-20 scroll-mt-24">
      <div className="container max-w-3xl">
        <div className="text-center mb-9 reveal">
          <Eyebrow className="an-brass">{t("Tickets", "Tickets")}</Eyebrow>
          <h3 className="text-3xl md:text-5xl font-black uppercase mt-4">
            {t(<>Get <span className="serif-it font-normal an-brass">your entry</span></>, <>Consigue <span className="serif-it font-normal an-brass">tu entrada</span></>)}
          </h3>
          {free ? (
            <p className="text-white/50 text-sm mt-3">
              {t("The first " + free + " entries are free on Eventbrite. Once they are gone, a ticket is " + anFmt(presale) + ".",
                 "Las primeras " + free + " entradas son gratis por Eventbrite. Cuando se agoten, la entrada cuesta " + anFmt(presale) + ".")}
            </p>
          ) : (
            <p className="text-white/50 text-sm mt-3">
              {t("Entry is ticketed on Eventbrite — current prices and availability are on the official listing.",
                 "La entrada se vende por Eventbrite — los precios vigentes y la disponibilidad están en el listado oficial.")}
            </p>
          )}
        </div>
        {tiers.length > 0 && (
          <div className={"grid gap-4 reveal " + (tiers.length > 2 ? "grid-cols-1 sm:grid-cols-3" : "grid-cols-2")} data-d="1">
            {tiers.map((el, i) => <React.Fragment key={i}>{el}</React.Fragment>)}
          </div>
        )}
        <div className="flex flex-col sm:flex-row gap-3 justify-center mt-8 reveal" data-d="2">
          <a href={eb} target="_blank" rel="noopener noreferrer" onClick={() => anTrack("InitiateCheckout", "Eventbrite")} className="gbtn an-btn inline-flex items-center justify-center gap-2.5 px-8 py-4 rounded-full text-white text-[12px] font-bold uppercase tracking-[0.16em]">
            <Icon name="ticket" className="w-4 h-4" />
            {free ? t("Get my free ticket", "Conseguir mi entrada gratis") : t("Tickets on Eventbrite", "Tickets por Eventbrite")}
          </a>
          <a href={"tel:" + ANNIV.rsvpTel} onClick={() => anTrack("Contact", "call")} className="gbtn inline-flex items-center justify-center gap-2.5 px-8 py-4 rounded-full border border-white/25 bg-white/5 text-white text-[12px] font-bold uppercase tracking-[0.16em] hover:bg-white/12">
            <Icon name="phone" className="w-4 h-4" />{ANNIV.rsvpTelDisplay}
          </a>
        </div>
        <p className="text-center text-white/55 text-[12px] mt-5 max-w-xl mx-auto">
          {t("Eventbrite adds its service fee at checkout. A ticket is entry only — for a guaranteed spot and bottle service, reserve a table below.",
             "Eventbrite suma su cargo de servicio al pagar. La entrada es solo el acceso: para lugar garantizado y servicio de botella, reserva una mesa abajo.")}
        </p>
      </div>
    </section>
  );
}

/* ---------- booking (table reservation → PPDB + Hub + WhatsApp) ---------- */
function AnnivBooking({ sel }) {
  const t = useT();
  const [f, setF] = useState({
    name: "", phone: "", email: "", guests: 4, notes: "",
    age21: false, // atestación 21+ (AG-06) — el ID igual se verifica en puerta
  });
  const [done, setDone] = useState(null);
  const [tried, setTried] = useState(false); // after the first submit, fields show their own state
  const [promoter] = useState(() => { try { return window.PP.activePromoter ? window.PP.activePromoter() : null; } catch (e) { return null; } });
  const set = (k, v) => setF((p) => ({ ...p, [k]: v }));
  const phoneDigits = f.phone.replace(/\D/g, "");
  const okName = !!f.name.trim(), okPhone = phoneDigits.length >= 10, okMail = /.+@.+\..+/.test(f.email);
  // AG-06: sin atestación 21+ no se envía — la puerta igual verifica ID.
  const valid = okName && okPhone && okMail && f.age21 === true;
  const bad = (ok) => (tried && !ok ? " border-red-400/80" : "");
  const total = sel ? anTablePrice(sel) : 0;
  const toPlan = () => { const el = document.getElementById("anniv-floorplan"); if (el) el.scrollIntoView({ behavior: "smooth" }); };

  const submit = (e) => {
    e.preventDefault();
    setTried(true);
    if (!valid) {
      window.toast && window.toast(
        !(okName && okPhone && okMail) ? t("Please complete your name, phone and email.", "Completa tu nombre, teléfono y correo.")
                                       : t("Please confirm your party is 21 or older.", "Confirma que tu grupo es mayor de 21 años."), "error");
      return;
    }
    const phone = "+1" + phoneDigits.slice(-10);
    const what = sel ? (t("Table", "Mesa") + " " + sel.id + " · " + anFmt(total) + "++") : t("RSVP · host assigns", "RSVP · el host asigna");
    const r = window.PPDB.reservations.add({
      fullName: f.name.trim(), phone, email: f.email.trim(),
      date: ANNIV.dateISO, time: ANNIV.timeLabel, guests: f.guests,
      experienceId: "anniversary-table",
      experienceType: t("Special Event · ", "Evento Especial · ") + ANNIV.title,
      night: ANNIV.nightIdx, nightName: ANNIV.nightName,
      tableId: sel ? sel.id : "",
      price: total, notes: f.notes.trim(), contactPref: "whatsapp",
      promoter: promoter ? promoter.name : "", promoterId: promoter ? promoter.id : "",
      promoterSlug: promoter && window.PP.promoterSlug ? window.PP.promoterSlug(promoter) : "",
      server: "",
      age21: true, // atestación 21+ (AG-06) — el envío exige el check
    });
    try {
      window.PPHub && window.PPHub.submitReservation && window.PPHub.submitReservation({
        name: f.name.trim(), phone, email: f.email.trim(),
        night: ANNIV.nightIdx, date: ANNIV.dateISO, time: ANNIV.timeLabel, guests: f.guests,
        tableId: sel ? sel.id : "", zone: ANNIV.nightName, occasion: what,
        requests: [f.notes.trim(), "Ref " + r.code, "ANNIVERSARY SEP 26", promoter ? ("Promotor: " + promoter.name) : ""].filter(Boolean).join(" · "),
        priceCents: total * 100,
        // Ref propio + atestación 21+ (AG-06). El bridge de hoy no los reenvía
        // (payload cerrado); el PR #86 los agrega — hasta entonces el Ref viaja
        // dentro de `requests` y la atestación queda en el registro local.
        code: r.code, age21: f.age21 === true,
      });
    } catch (err) {}
    try {
      window.PP.waOpen(
        t("The Anniversary Affair · Sep 26 — reservation request", "The Anniversary Affair · 26 Sep — solicitud de reserva"),
        [[t("Name", "Nombre"), f.name.trim()], [t("Phone", "Teléfono"), phone], [t("Email", "Correo"), f.email.trim()],
         [t("Guests", "Personas"), String(f.guests)], [t("Request", "Solicitud"), what], [t("Ref", "Ref"), r.code]],
        t("Sent from clubpinkpony.com", "Enviado desde clubpinkpony.com"),
      );
    } catch (err) {}
    setDone({ r, what });
  };

  if (done) return (
    <div className="text-center fade-view">
      <div className="w-16 h-16 rounded-full mx-auto mb-5 flex items-center justify-center bg-[#B89B66]/15 border border-[#B89B66]"><Icon name="check" className="w-8 h-8 an-brass" /></div>
      <div className="label an-brass mb-2">{t("Request sent", "Solicitud enviada")} · {done.r.code}</div>
      <h3 className="text-3xl font-black uppercase mb-3">{t("You're on the list", "Estás en la lista")}</h3>
      <p className="text-white/55 text-sm max-w-md mx-auto">{done.what} · {t("Our VIP team confirms your spot by WhatsApp shortly.", "Nuestro equipo VIP confirma tu lugar por WhatsApp en breve.")}</p>
      <a href={"tel:" + ANNIV.rsvpTel} className="inline-flex items-center gap-2 mt-6 px-7 py-3.5 rounded-full border border-white/25 bg-white/5 text-white text-[12px] font-bold uppercase tracking-[0.16em] hover:bg-white/12">
        <Icon name="phone" className="w-4 h-4" />{t("Call", "Llamar")} {ANNIV.rsvpTelDisplay}
      </a>
      {/* the natural moment to bring the group along */}
      <AnnivShareRow />
    </div>
  );

  const inp = "w-full bg-[#0d0d10] border border-white/12 rounded-xl px-4 py-3 text-sm text-white focus:outline-none focus:border-[#B89B66] transition-colors";
  return (
    <form onSubmit={submit} className="space-y-3.5">
      <div className="rounded-xl border border-white/12 bg-[#0d0d10] px-4 py-3 flex items-center justify-between gap-3">
        <span className="text-white/60 text-[12px]">{sel ? t("Table", "Mesa") + " " + sel.id : t("No table selected — host assigns", "Sin mesa — el host asigna")}</span>
        <span className="inline-flex items-center gap-3 shrink-0">
          {sel && <span className="font-black an-brass">{anFmt(total)}++</span>}
          <button type="button" onClick={toPlan} className="an-brass text-[11px] font-bold uppercase tracking-[0.14em] py-2 -my-2 hover:underline underline-offset-4">
            {sel ? t("Change", "Cambiar") : t("Pick a table", "Elegir mesa")}
          </button>
        </span>
      </div>
      <input value={f.name} onChange={(e) => set("name", e.target.value)} placeholder={t("Full name", "Nombre completo")}
        aria-label={t("Full name", "Nombre completo")} autoComplete="name" aria-invalid={tried && !okName} className={inp + bad(okName)} />
      <div className="grid grid-cols-2 gap-3">
        <input value={f.phone} onChange={(e) => set("phone", e.target.value)} placeholder={t("Phone", "Teléfono")} type="tel" inputMode="tel"
          aria-label={t("Phone", "Teléfono")} autoComplete="tel" aria-invalid={tried && !okPhone} className={inp + bad(okPhone)} />
        <input value={f.email} onChange={(e) => set("email", e.target.value)} placeholder={t("Email", "Correo")} type="email" inputMode="email"
          aria-label={t("Email", "Correo")} autoComplete="email" aria-invalid={tried && !okMail} className={inp + bad(okMail)} />
      </div>
      <div className="flex items-center gap-3">
        <span className="label text-white/50 text-[10px] shrink-0">{t("Guests", "Personas")}</span>
        <button type="button" aria-label={t("Fewer guests", "Menos personas")} onClick={() => set("guests", Math.max(1, f.guests - 1))} className="w-11 h-11 rounded-xl bg-[#0d0d10] border border-white/12 text-white active:scale-90 transition-transform">−</button>
        <span className="serif text-2xl w-10 text-center" aria-live="polite">{f.guests}</span>
        <button type="button" aria-label={t("More guests", "Más personas")} onClick={() => set("guests", Math.min(30, f.guests + 1))} className="w-11 h-11 rounded-xl bg-[#0d0d10] border border-white/12 text-white active:scale-90 transition-transform">+</button>
      </div>
      <textarea value={f.notes} onChange={(e) => set("notes", e.target.value)} rows="2" placeholder={t("Anything we should know?", "¿Algo que debamos saber?")}
        aria-label={t("Anything we should know?", "¿Algo que debamos saber?")} className={inp}></textarea>
      <label className="flex items-start gap-3 rounded-xl border border-white/12 bg-[#0d0d10] px-4 py-3.5 cursor-pointer">
        <input type="checkbox" checked={f.age21} onChange={(e) => set("age21", e.target.checked)} className="mt-0.5 w-4 h-4 accent-[#B89B66]" />
        <span className="text-white/70 text-[12.5px] leading-relaxed">{t("I confirm everyone in my party is 21 or older with a valid government-issued photo ID. ID is checked at the door — no exceptions.", "Confirmo que todos en mi grupo son mayores de 21 con identificación oficial vigente. El ID se verifica en la puerta — sin excepciones.")}</span>
      </label>
      <button type="submit" className="gbtn an-btn w-full py-4 rounded-full text-white text-[12px] font-bold uppercase tracking-[0.16em] flex items-center justify-center gap-2.5">
        <Icon name="sparkles" className="w-4 h-4" />{t("Send my request", "Enviar mi solicitud")}
      </button>
      <p className="text-center text-white/55 text-[12px]">{t("No charge today — our team confirms availability first.", "Sin cargo hoy — nuestro equipo confirma disponibilidad primero.")}</p>
    </form>
  );
}

/* ---------- landing page (route #anniversary) ---------- */
function AnniversaryLandingPage({ go }) {
  const t = useT(); const { lang } = useLang();
  const past = anState() === "past";
  const art = useAnnivFlyer();
  const [sel, setSel] = useState(null);
  useReveal(lang + "-" + (sel ? sel.id : ""));

  /* deep-link from the hero / strip buttons → scroll to the right module */
  useEffect(() => {
    const target = window.__annivSection; delete window.__annivSection;
    if (!target || past) return;
    const id = target === "floorplan" ? "anniv-floorplan" : target === "tickets" ? "anniv-tickets" : "anniv-booking";
    const tm = setTimeout(() => {
      const el = document.getElementById(id);
      if (el) el.scrollIntoView({ behavior: "smooth", block: "start" });
    }, 320);
    return () => clearTimeout(tm);
  }, [past]);

  useEffect(() => {
    // Site defaults (index.html). Used when the "previous" values were already
    // this event's — which is the case when the visitor entered through the
    // generated anniversary.html — so leaving the page never keeps our title.
    const SITE_TITLE = "Club Pink Pony · Miami — An Evening, Elevated";
    const SITE_URL = "https://www.clubpinkpony.com/";
    const ours = (v) => typeof v === "string" && /Anniversary Affair/i.test(v);
    const prev = document.title;
    document.title = lang === "es"
      ? "The Anniversary Affair — Sábado 26 de septiembre · Club Pink Pony, Doral"
      : "The Anniversary Affair — Saturday, September 26 · Club Pink Pony, Doral";
    // this page has its own URL (clubpinkpony.com/anniversary), so it carries
    // its own canonical — the site-wide one in index.html points at the root
    const canon = document.querySelector('link[rel="canonical"]');
    const prevCanon = canon ? canon.getAttribute("href") : null;
    if (canon) canon.setAttribute("href", ANNIV.url);
    // anniversary.html (generated, see tools/make-event-pages.py) ships this
    // Event JSON-LD statically for crawlers; only add it when it is missing
    const hasStatic = !!document.querySelector('script[type="application/ld+json"][data-event="anniversary"]');
    const ld = document.createElement("script");
    ld.type = "application/ld+json";
    ld.text = hasStatic ? "" : JSON.stringify({
      "@context": "https://schema.org", "@type": "Event", name: ANNIV.title,
      startDate: ANNIV.startISO, endDate: "2026-09-27T05:00:00-04:00",
      eventStatus: "https://schema.org/EventScheduled",
      eventAttendanceMode: "https://schema.org/OfflineEventAttendanceMode",
      location: { "@type": "Place", name: "Pink Pony Club", address: { "@type": "PostalAddress", streetAddress: "7971 NW 33rd St", addressLocality: "Doral", addressRegion: "FL", postalCode: "33122", addressCountry: "US" } },
      organizer: { "@type": "Organization", name: "Pink Pony Club", url: "https://www.clubpinkpony.com/" },
      offers: { "@type": "Offer", url: ANNIV.tickets.url, availability: "https://schema.org/InStock" },
      typicalAgeRange: "21+",
      url: ANNIV.url,
    });
    if (!hasStatic) document.head.appendChild(ld);
    return () => {
      document.title = ours(prev) ? SITE_TITLE : prev;
      if (canon) canon.setAttribute("href", prevCanon && prevCanon !== ANNIV.url ? prevCanon : SITE_URL);
      try { document.head.removeChild(ld); } catch (e) {}
    };
  }, [lang]);

  // a chip with an href is a real link (maps / call); without one it is plain text
  const infoChip = (ic, top, sub, href) => {
    const cls = "flex items-center gap-3.5 rounded-2xl border border-white/12 bg-black/40 backdrop-blur px-5 py-4" + (href ? " hover:border-[#B89B66]/60 transition-colors" : "");
    const inner = (
      <React.Fragment>
        <span className="w-10 h-10 rounded-full bg-[#B89B66]/15 border border-[#B89B66]/40 flex items-center justify-center shrink-0"><Icon name={ic} className="an-brass" style={{ width: 18, height: 18 }} /></span>
        <div className="text-left"><div className="font-bold text-sm leading-tight">{top}</div><div className="text-white/50 text-xs mt-0.5">{sub}</div></div>
      </React.Fragment>
    );
    return href
      ? <a href={href} target={/^https?:/.test(href) ? "_blank" : undefined} rel={/^https?:/.test(href) ? "noopener noreferrer" : undefined} className={cls}>{inner}</a>
      : <div className={cls}>{inner}</div>;
  };
  const mapsUrl = "https://maps.google.com/?q=" + encodeURIComponent("Pink Pony Club, " + ANNIV.address);

  return (
    <div className="pb-24">
      <h1 className="sr-only">The Anniversary Affair — Club Pink Pony · {t("Saturday, September 26, 2026", "Sábado 26 de septiembre de 2026")}</h1>
      {/* ============ HERO ============ */}
      <section className="relative flex flex-col items-center overflow-hidden pt-24 pb-14 an-bg">
        <div className="relative z-10 w-full container flex flex-col items-center text-center">
          {/* sized so the countdown AND the two CTAs fit a laptop's first screen */}
          <div className="w-full max-w-md md:max-w-3xl mb-7">
            {art ? (
              <img src={art} alt={"The Anniversary Affair · " + t("September 26, 2026", "26 de septiembre de 2026") + " · Pink Pony Club"}
                className="block w-full h-auto rounded-2xl border border-white/10 shadow-2xl" />
            ) : <AnnivBannerContent />}
          </div>

          {past ? (
            <span className="inline-flex items-center gap-2.5 rounded-full border border-white/20 bg-white/5 backdrop-blur px-6 py-2.5">
              <Icon name="calendar-days" className="w-4 h-4 text-white/45" />
              <span className="label text-white/70 text-[11px]">{t("PAST EVENT", "EVENTO PASADO")} · {t("Saturday Sep 26, 2026", "Sábado 26 Sep 2026")}</span>
            </span>
          ) : <AnnivCountdown />}

          <div className="flex flex-col sm:flex-row gap-4 justify-center mt-7">
            {past ? (
              <React.Fragment>
                <button onClick={() => go("events")} className="gbtn an-btn inline-flex items-center justify-center gap-2.5 px-9 py-4 rounded-full text-white text-[12px] font-bold uppercase tracking-[0.18em]">
                  <Icon name="calendar-days" className="w-4 h-4" /> {t("See what's next", "Mira lo que viene")}
                </button>
                <button onClick={() => go("reserve")} className="gbtn inline-flex items-center justify-center gap-2.5 px-9 py-4 rounded-full border border-white/25 bg-white/5 backdrop-blur text-white text-[12px] font-bold uppercase tracking-[0.18em] hover:bg-white/12">
                  <Icon name="map-pin" className="w-4 h-4" /> {t("Reserve a table", "Reservar mesa")}
                </button>
              </React.Fragment>
            ) : (
              <React.Fragment>
                <button onClick={() => { const el = document.getElementById("anniv-floorplan"); if (el) el.scrollIntoView({ behavior: "smooth" }); }} className="gbtn an-btn inline-flex items-center justify-center gap-2.5 px-9 py-4 rounded-full text-white text-[12px] font-bold uppercase tracking-[0.18em]">
                  <Icon name="sparkles" className="w-4 h-4" /> {t("Reserve a table", "Reservar mesa")}
                </button>
                <button onClick={() => { const el = document.getElementById("anniv-tickets"); if (el) el.scrollIntoView({ behavior: "smooth" }); }} className="gbtn inline-flex items-center justify-center gap-2.5 px-9 py-4 rounded-full border border-white/25 bg-white/5 backdrop-blur text-white text-[12px] font-bold uppercase tracking-[0.18em] hover:bg-white/12">
                  <Icon name="ticket" className="w-4 h-4" /> {ANNIV.tickets.free ? t("First " + ANNIV.tickets.free + " free", "Primeras " + ANNIV.tickets.free + " gratis") : t("Tickets", "Tickets")}
                </button>
              </React.Fragment>
            )}
          </div>
          {!past && <AnnivSaveTheDate />}

          <div className="grid sm:grid-cols-3 gap-3 mt-10 w-full max-w-3xl">
            {infoChip("calendar-days", t("Saturday, September 26", "Sábado 26 de septiembre"), ANNIV.hoursLabel + " · " + t("21+ with valid ID", "21+ con ID vigente"))}
            {infoChip("map-pin", "Pink Pony Club", ANNIV.address + " · " + t("Open in Maps", "Abrir en Maps"), mapsUrl)}
            {infoChip("phone", "RSVP " + ANNIV.rsvpTelDisplay, t("Tap to call", "Toca para llamar"), "tel:" + ANNIV.rsvpTel)}
          </div>
        </div>
      </section>

      {/* ============ ticker ============ */}
      <div className="relative border-y border-[#B89B66]/25 bg-[#17060e] py-4 overflow-hidden">
        <div className="marquee">
          {["a", "b"].map((key) => (
            <div key={key} className="flex shrink-0 items-center">
              {["THE ANNIVERSARY AFFAIR", t("SEPTEMBER 26", "26 DE SEPTIEMBRE"), "THE ROYAL TEAM", t("THE NIGHT IS CELEBRATED WITH YOU", "LA NOCHE SE CELEBRA CONTIGO")].map((it, i) => (
                <span key={i} className="flex items-center">
                  <span className="px-7 text-base font-bold uppercase tracking-[0.2em] text-white/75">{it}</span>
                  <span className="an-brass">✦</span>
                </span>
              ))}
            </div>
          ))}
        </div>
      </div>

      {past ? (
        <section className="py-16 md:py-20 bg-[#0d0d10] border-y border-white/5">
          <div className="container max-w-2xl text-center">
            <Icon name="calendar-check" className="w-8 h-8 mx-auto mb-4 text-white/30" />
            <h2 className="text-2xl md:text-3xl font-black uppercase mb-3">{t("This event already happened", "Este evento ya pasó")}</h2>
            <p className="text-white/55 mb-7">{t("Thank you for celebrating our history with us. Tickets and table reservations for this night are closed — see what's coming or lock a table for any night.", "Gracias por celebrar nuestra historia con nosotros. Los tickets y las reservas de mesa para esta noche están cerrados — mira lo que viene o asegura tu mesa cualquier noche.")}</p>
            <div className="flex flex-col sm:flex-row gap-3 justify-center">
              <button onClick={() => go("events")} className="gbtn an-btn px-7 py-3.5 rounded-full text-white text-[12px] font-bold uppercase tracking-[0.16em]">{t("Upcoming events", "Próximos eventos")}</button>
              <button onClick={() => go("reserve")} className="gbtn px-7 py-3.5 rounded-full border border-white/25 bg-white/5 text-white text-[12px] font-bold uppercase tracking-[0.16em] hover:bg-white/12">{t("Reserve a table", "Reservar mesa")}</button>
            </div>
          </div>
        </section>
      ) : (
        <React.Fragment>
          {/* ============ THE STORY ============ */}
          <AnnivStory />

          {/* ============ TICKETS ============ */}
          <AnnivTickets />

          {/* ============ FLOOR PLAN (shared venue map) ============ */}
          <section id="anniv-floorplan" className="py-16 md:py-24 bg-[#0d0d10] border-y border-white/5 scroll-mt-24">
            {/* wider side gutters below 2xl: the floating chat button lives at
                bottom-left and must never sit on a table (site rule) */}
            <div className="container sm:px-16 2xl:px-6">
              <div className="text-center mb-10 reveal">
                <Eyebrow className="an-brass">{t("Event Floor Plan", "Plano del Evento")}</Eyebrow>
                <h3 className="text-3xl md:text-5xl font-black uppercase mt-4">
                  {t(<>Pick <span className="serif-it font-normal an-brass">your table</span></>, <>Elige <span className="serif-it font-normal an-brass">tu mesa</span></>)}
                </h3>
                <p className="text-white/50 text-sm mt-3 max-w-xl mx-auto">
                  {t("Tap a table to see its minimum spend — then confirm your details right below.", "Toca una mesa para ver su consumo mínimo — y confirma tus datos justo abajo.")}
                </p>
              </div>
              {window.CKFloorPlan && (
                <window.CKFloorPlan sel={sel} onPick={(tb) => { setSel(tb); const el = document.getElementById("anniv-booking"); if (el) el.scrollIntoView({ behavior: "smooth" }); }}
                  priceOf={anTablePrice} soldOf={() => false} zoneFrom={anZonePrice} hideSoldLegend
                  zoneName={(id, z) => (id === "red" ? { en: "Red", es: "Red" } : z.name)} />
              )}
              <div className="text-center mt-6 text-white/45 text-xs max-w-2xl mx-auto">
                {t("Prices are minimum spend ++ (tax & service). The table includes express entry for your group — our host confirms details.",
                   "Los precios son consumo mínimo ++ (impuestos y servicio). La mesa incluye entrada express para tu grupo — el host confirma los detalles.")}
              </div>
            </div>
          </section>

          {/* ============ BOOKING ============ */}
          <section id="anniv-booking" className="py-16 md:py-20 scroll-mt-24">
            <div className="container">
              <div className="text-center mb-10 reveal">
                <Eyebrow className="an-brass">{t("RSVP", "RSVP")}</Eyebrow>
                <h3 className="text-3xl md:text-5xl font-black uppercase mt-4">
                  {t(<>Lock in <span className="serif-it font-normal an-brass">your night</span></>, <>Asegura <span className="serif-it font-normal an-brass">tu noche</span></>)}
                </h3>
                <p className="text-white/50 text-sm mt-3 max-w-xl mx-auto">
                  {t("Send your request and our VIP team confirms by WhatsApp. Pick a table above or let the host assign the best spot for your group.",
                     "Envía tu solicitud y nuestro equipo VIP confirma por WhatsApp. Elige una mesa arriba o deja que el host asigne el mejor lugar para tu grupo.")}
                </p>
              </div>
              <div className="max-w-2xl mx-auto"><AnnivBooking sel={sel} /></div>
            </div>
          </section>

          {/* ============ PRACTICAL INFO ============ */}
          <section className="pb-8">
            <div className="container max-w-3xl">
              <div className="rounded-2xl border border-[#B89B66]/25 bg-[#0d0d10] px-6 py-7 text-center">
                <div className="label an-brass text-[10px] mb-3">{t("Good to know", "Para tener en cuenta")}</div>
                <div className="grid sm:grid-cols-3 gap-5 text-sm">
                  <div><div className="font-bold">{t("Doors", "Puertas")}</div><div className="text-white/50 mt-1">{ANNIV.hoursLabel}</div></div>
                  <div><div className="font-bold">{t("Age", "Edad")}</div><div className="text-white/50 mt-1">{t("21+ with valid ID", "21+ con ID vigente")}</div></div>
                  <div><div className="font-bold">{t("Where", "Dónde")}</div><div className="text-white/50 mt-1">{ANNIV.address}</div></div>
                </div>
                <div className="an-rule my-6"></div>
                <p className="text-white/45 text-[12px]">
                  {t("Reservation inquiries: ", "Consulta disponibilidad: ")}
                  <a href={"tel:" + ANNIV.rsvpTel} className="an-brass font-bold hover:underline">{ANNIV.rsvpTelDisplay}</a>
                  {" · clubpinkpony.com"}
                </p>
              </div>
            </div>
          </section>
        </React.Fragment>
      )}
    </div>
  );
}

Object.assign(window, {
  ANNIV, AnnivHeroSlide, AnnivStrip, AnnivEventBanner, AnnivStory,
  AnnivTickets, AnnivBooking, AnniversaryLandingPage, anTableFrom,
});
