/* global React, ReactDOM, TweaksPanel, useTweaks, TweakSection, TweakRadio */
const { useState, useEffect } = React;

const TWEAK_DEFAULTS = /*EDITMODE-BEGIN*/{
  "palette": "ocean",
  "heroImage": "gazebo",
  "showFloatingWA": true
}/*EDITMODE-END*/;

/* ---------- Real info ---------- */
const INFO = {
  phoneDisplay: "(809) 469-7660",
  phoneIntl: "18094697660",
  instagramUrl: "https://www.instagram.com/apibeachhouse/",
  instagramHandle: "@apibeachhouse",
  location: "Cap Cana · La Marina",
  locationFull: "La Marina, Cap Cana, Punta Cana, República Dominicana",
  mapsUrl: "https://maps.google.com/?q=Cap+Cana+La+Marina+Punta+Cana",
};

/* ---------- Translations ---------- */
const TEXTS = {
  es: {
    nav: { home: "Inicio", house: "La Casa", contact: "Contacto", book: "Reservar" },
    hero: {
      subtitle: "El espacio frente al mar. Ven con amigos. Quédate con familia.",
      cta: "Reservar por Instagram",
      explore: "Conocer la casa",
      petFriendly: "Pet friendly",
      family: "Familia y amigos",
    },
    intro: {
      eyebrow: "Bienvenidos",
      title1: "Vístete para impresionar.",
      title2: "Código de vestimenta: “Refinado y Costero”.",
      body1: "Api Beach House es un club social para quienes quieren ir a donde van los locales. Los invitados son bienvenidos y se espera que vistan acorde a la ocasión. Nos reservamos el derecho de admisión.",
      body2: "Por favor, ten en cuenta: No se permiten camisetas sin mangas (singlets) ni altavoces personales de música.",
    },
    cards: {
      eyebrow: "Lo que somos",
      title: "Cuatro cosas, nada más.",
      items: [
        { t: "Familia y amigos", d: "Un lugar relajado para pasar el día acompañado de la gente que quieres." },
        { t: "Frente al mar",    d: "Cap Cana, La Marina. Arena, brisa y vista al Caribe." },
        { t: "Entrada · $25",   d: "Precio de entrada USD, no consumible más impuestos. Reserva por Instagram." },
        { t: "Reservas directas", d: "Sin formularios. Escríbenos por Instagram y te confirmamos." },
      ],
    },
    daypass: {
      eyebrow: "Acceso",
      title: "Entrada",
      price: "$25",
      per: "USD entrada (no consumible + imp.)",
      body: "Incluye acceso a la playa, sombrillas y camastros por el día. Mascotas bienvenidas. Reserva directamente por Instagram.",
      cta: "Reservar por Instagram",
      note: "Mascotas bienvenidas · Cap Cana, La Marina",
    },
    menu: {
      eyebrow: "Lo que servimos",
      title: "Carta",
      food: "Para comer",
      drinks: "Para tomar",
      items: {
        food: [
          { name: "Double Smash Burger / infamous API burger", desc: "Dos Carnes de Res, Tocino, Queso, Lechuga, Tomate, Salsa Secreta Api" },
          { name: "Camarones Costeros y Papas Fritas (A la Parrilla)", desc: "Ajo, Sal, Infusión Cítrica" },
          { name: "Camarones Costeros y Papas Fritas (Empanizados)", desc: "Panko, Salsa Tártara" },
          { name: "Trío de Tacos de Pescado", desc: "Taco de Maíz con Ensalada de Col, Lechuga, Pescado Crujiente, Mayonesa de Cilantro" },
          { name: "Pescado y Papas", desc: "Pescado Rebozado en Cerveza y Papas en Gajos, Salsa Tártara" },
          { name: "Milanesa de Pollo en Tiras", desc: "Milanesa de Pollo Crujiente Empanizada y Condimentada, Papas Fritas" },
          { name: "Sándwich de Pollo Oporto Desmenuzado", desc: "Pechuga de Pollo Desmenuzada Marinada, Lechuga, Queso, 2da Salsa Secreta" },
          { name: "Empanaditas (Queso)", desc: "" },
          { name: "Empanaditas (Pollo)", desc: "" },
          { name: "Tequeños (Queso Derretido)", desc: "" },
          { name: "Tequeños (Queso y Guayaba)", desc: "" },
          { name: "Croquetas (Pollo)", desc: "" },
          { name: "Croquetas (Res)", desc: "" },
          { name: "Quipes de Res", desc: "" },
          { name: "Ensalada Tibia de Pollo", desc: "Lechuga Romana, Tomates Cherry, Pepinos, Maíz, Aceitunas Kalamata, Queso Feta, Aceite de Oliva, Vinagre Balsámico" },
          { name: "Calamares", desc: "" }
        ],
        drinks: [
          { name: "Api Piña Colada", desc: "Cóctel Costero de la Casa" },
          { name: "Mojito de Jardín", desc: "Cóctel Costero de la Casa" },
          { name: "Margarita de Maracuyá", desc: "Cóctel Costero de la Casa" },
          { name: "Daiquiri de Fresa", desc: "Cóctel Costero de la Casa" },
          { name: "Esprit", desc: "Cóctel Costero de la Casa" },
          { name: "Nozimchelada", desc: "Cóctel Costero de la Casa" },
          { name: "Cerveza Nacional", desc: "" },
          { name: "Cerveza Internacional", desc: "" }
        ],
      },
      note: "Menú sujeto a disponibilidad · Consulta opciones por Instagram",
    },
    hours: {
      eyebrow: "Horario",
      days: "Lunes a domingo",
      time: "11:00 AM – 7:00 PM",
      note: "Abierto todos los días",
    },
    quote: { line1: "la playa,", line2: "como debería ser." },
    gallery: { eyebrow: "Galería", title: "Un día por aquí.", more: "Más en Instagram" },
    ig: { tagline: "Beach club familiar", follow: "Seguir" },
    experience: {
      eyebrow: "La casa",
      heroTitle1: "Frente al mar,",
      heroTitle2: "en familia.",
      intro: "Api Beach House es una casa de playa en Cap Cana — un lugar tranquilo para venir a pasar el día con la familia y los amigos. Cocina, bar y mar. Sin más complicación.",
      rows: [
        { t: "Frente al mar",     d: "Playa, sombrillas y camastros para pasar el día. La brisa hace el resto." },
        { t: "Cocina y bar",      d: "Comida sencilla, fresca y rica. Bar con coctelería y bebidas frías para acompañar." },
        { t: "Para los peluditos", d: "Pet friendly. Tu perro es bienvenido — agua fresca, sombra y mucho cariño." },
        { t: "Familia y amigos",  d: "Espacio relajado pensado para grupos. Mesas para compartir, sin ruido innecesario." },
      ],
      ctaEyebrow: "Reservas",
      ctaTitle: "¿Te esperamos?",
      ctaBody: "Escríbenos por Instagram para reservar tu mesa o tu día de playa.",
    },
    contact: {
      eyebrow: "Contacto",
      title1: "Nos vemos",
      title2: "en la playa.",
      subtitle: "Reservas y consultas directamente por Instagram. Te respondemos personalmente.",
      waLabel: "Instagram · Reservas",
      waBody: "Toca para abrir una conversación. Atendemos en horario de la casa.",
      waAction: "Escribir ahora",
      location: "Ubicación",
      phone: "Teléfono",
      phoneBody: "Llámanos o escríbenos",
      igBody: "Síguenos para ver el día a día",
      petBody: "Bienvenidos los peluditos de la casa.",
      directions: "Encuéntranos",
    },
    footer: {
      tagline: "Casa de playa para familia y amigos. Pet friendly. Cap Cana, La Marina.",
      map: "Mapa",
      contact: "Contacto",
      copy: "© 2026 Api Beach House.",
      sub: "Cap Cana · La Marina · Pet friendly",
    },
  },
  en: {
    nav: { home: "Home", house: "The House", contact: "Contact", book: "Book Now" },
    hero: {
      subtitle: "The beachfront space. Come with friends. Stay with family.",
      cta: "Book on Instagram",
      explore: "Explore the house",
      petFriendly: "Pet friendly",
      family: "Family & friends",
    },
    intro: {
      eyebrow: "Welcome",
      title1: "Dress to impress.",
      title2: "We have a dress code, “Refined Coastal Comfort”.",
      body1: "Api Beach House is a social club for those who want to go where the locals go. Guests are welcome, and you’re expected to look the part. We reserve the right to admission.",
      body2: "Kindly note: No singlets and no personal music speakers are permitted.",
    },
    cards: {
      eyebrow: "What we are",
      title: "Four things, nothing more.",
      items: [
        { t: "Family & friends",  d: "A relaxed spot to spend the day with the people you love." },
        { t: "Beachfront",        d: "Cap Cana, La Marina. Sand, breeze and Caribbean views." },
        { t: "Entrance Fee · $25",    d: "USD entrance fee, not consumable plus taxes. Book directly on Instagram." },
        { t: "Direct bookings",   d: "No forms. Write us on Instagram and we'll confirm." },
      ],
    },
    daypass: {
      eyebrow: "Access",
      title: "Entrance Fee",
      price: "$25",
      per: "USD entrance fee (not consumable + taxes)",
      body: "Includes beach access, umbrellas and sun loungers for the day. Pets welcome. Book directly on Instagram.",
      cta: "Book on Instagram",
      note: "Pets welcome · Cap Cana, La Marina",
    },
    menu: {
      eyebrow: "What we serve",
      title: "Menu",
      food: "To eat",
      drinks: "To drink",
      items: {
        food: [
          { name: "Double Smash Burger / infamous API burger", desc: "Two Beef Patties, Bacon, Cheese, Lettuce, Tomato, Secret Api Sauce" },
          { name: "Coastal Shrimp & Fresh Cut Fries (Grilled)", desc: "Garlic, Salt, Citrus Infused" },
          { name: "Coastal Shrimp & Fresh Cut Fries (Crispy Breaded)", desc: "Panko, Tartare" },
          { name: "Trio Fish Taco", desc: "Corn Taco with Coleslaw, Lettuce, Crispy Fish, Cilantro Mayo" },
          { name: "Fish & Wedges", desc: "Beer Battered Fish & Potato Wedges, Tartare" },
          { name: "Stripped Chicken Milanese", desc: "Breaded & Seasoned Crispy Chicken Cutlet, Fries" },
          { name: "Shredded Oporto Sandwich", desc: "Pulled Marinaded Chicken Breast, Lettuce, Cheese, 2nd Secret Sauce" },
          { name: "Empanaditas (Cheese)", desc: "" },
          { name: "Empanaditas (Chicken)", desc: "" },
          { name: "Tequeños (Melted Cheese)", desc: "" },
          { name: "Tequeños (Sweet & Savoury Cheese & Guava)", desc: "" },
          { name: "Croquetas (Chicken)", desc: "" },
          { name: "Croquetas (Beef)", desc: "" },
          { name: "Quipes de Res", desc: "" },
          { name: "Warm Chicken Salad", desc: "Romaine, Cherry Tomatoes, Cucumbers, Corn, Kalamata Olives, Feta Cheese, Olive Oil, Balsamic Vinegar" },
          { name: "Calamari", desc: "" }
        ],
        drinks: [
          { name: "Api Pina Colada", desc: "Signature Coastal Cocktail" },
          { name: "Garden Mojito", desc: "Signature Coastal Cocktail" },
          { name: "Passionfruit Margarita", desc: "Signature Coastal Cocktail" },
          { name: "Strawberry Daiquiri", desc: "Signature Coastal Cocktail" },
          { name: "Esprit", desc: "Signature Coastal Cocktail" },
          { name: "Nozimchelada", desc: "Signature Coastal Cocktail" },
          { name: "Domestic Beer", desc: "" },
          { name: "International Beer", desc: "" }
        ],
      },
      note: "Menu subject to availability · Ask us on Instagram",
    },
    hours: {
      eyebrow: "Hours",
      days: "Monday to Sunday",
      time: "11:00 AM – 7:00 PM",
      note: "Open every day",
    },
    quote: { line1: "the beach,", line2: "as it should be." },
    gallery: { eyebrow: "Gallery", title: "A day here.", more: "More on Instagram" },
    ig: { tagline: "Family beach club", follow: "Follow" },
    experience: {
      eyebrow: "The house",
      heroTitle1: "By the sea,",
      heroTitle2: "with family.",
      intro: "Api Beach House is a beach house in Cap Cana — a quiet spot to spend the day with family and friends. Kitchen, bar and sea. Nothing more complicated than that.",
      rows: [
        { t: "Beachfront",       d: "Beach, umbrellas and sun loungers for the day. The breeze does the rest." },
        { t: "Kitchen & bar",    d: "Simple, fresh, delicious food. Bar with cocktails and cold drinks to go along." },
        { t: "Pet friendly",     d: "Your dog is welcome — fresh water, shade and lots of love." },
        { t: "Family & friends", d: "Relaxed space designed for groups. Tables for sharing, no unnecessary noise." },
      ],
      ctaEyebrow: "Reservations",
      ctaTitle: "Shall we expect you?",
      ctaBody: "Write to us on Instagram to book your table or beach day.",
    },
    contact: {
      eyebrow: "Contact",
      title1: "See you",
      title2: "at the beach.",
      subtitle: "Bookings and inquiries directly via Instagram. We reply personally.",
      waLabel: "Instagram · Bookings",
      waBody: "Tap to open a conversation. We attend during house hours.",
      waAction: "Write now",
      location: "Location",
      phone: "Phone",
      phoneBody: "Call or message us",
      igBody: "Follow us to see day-to-day life",
      petBody: "Furry friends are always welcome.",
      directions: "Come find us",
    },
    footer: {
      tagline: "Beach house for family and friends. Pet friendly. Cap Cana, La Marina.",
      map: "Map",
      contact: "Contact",
      copy: "© 2026 Api Beach House.",
      sub: "Cap Cana · La Marina · Pet friendly",
    },
  },
};

/* ---------- Palettes ---------- */
const PALETTES = {
  ocean: { bg: "#f6f2ea", paper: "#fbf8f2", ink: "#13243a", ink2: "#3b4a5e", accent: "#3aa6b9", line: "#e7decf" },
  dusk:  { bg: "#efeae0", paper: "#f7f2e8", ink: "#2a1f3a", ink2: "#52465e", accent: "#c97b5b", line: "#e3d8c4" },
  reef:  { bg: "#eef2f0", paper: "#f6f8f5", ink: "#0f2b2a", ink2: "#3a5454", accent: "#1f7a6b", line: "#dbe4dd" },
};

/* ---------- Icons ---------- */
const I = {
  menu:  (p) => <svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" strokeWidth="1.5" {...p}><path d="M4 7h16M4 12h16M4 17h16"/></svg>,
  x:     (p) => <svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" strokeWidth="1.5" {...p}><path d="M6 6l12 12M18 6L6 18"/></svg>,
  wa:    (p) => <svg viewBox="0 0 24 24" width="20" height="20" fill="currentColor" {...p}><path d="M12.04 2C6.58 2 2.13 6.45 2.13 11.91c0 1.75.46 3.45 1.32 4.95L2 22l5.25-1.38a9.9 9.9 0 0 0 4.79 1.22h.01c5.46 0 9.91-4.45 9.91-9.91 0-2.65-1.03-5.14-2.9-7.01A9.82 9.82 0 0 0 12.04 2zm0 18.15a8.2 8.2 0 0 1-4.17-1.14l-.3-.18-3.11.82.83-3.03-.2-.31a8.2 8.2 0 1 1 15.18-4.4 8.2 8.2 0 0 1-8.23 8.24zm4.7-6.16c-.26-.13-1.52-.75-1.76-.84-.24-.09-.41-.13-.59.13s-.67.84-.82 1.01c-.15.18-.3.2-.56.07-.26-.13-1.08-.4-2.06-1.27-.76-.68-1.28-1.52-1.43-1.78-.15-.26-.02-.4.11-.53.12-.11.26-.3.39-.45.13-.15.18-.26.26-.43.09-.18.04-.33-.02-.46-.07-.13-.59-1.43-.81-1.96-.21-.51-.43-.44-.59-.45h-.5c-.18 0-.46.07-.7.33-.24.26-.92.9-.92 2.2s.94 2.55 1.07 2.73c.13.18 1.86 2.84 4.51 3.98.63.27 1.12.43 1.5.55.63.2 1.21.17 1.66.1.51-.07 1.52-.62 1.74-1.22.21-.6.21-1.11.15-1.22-.06-.11-.24-.17-.5-.3z"/></svg>,
  ig:    (p) => <svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" strokeWidth="1.6" {...p}><rect x="3.5" y="3.5" width="17" height="17" rx="4.5"/><circle cx="12" cy="12" r="3.8"/><circle cx="17.2" cy="6.8" r="0.9" fill="currentColor"/></svg>,
  phone: (p) => <svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" strokeWidth="1.6" {...p}><path d="M5 4h3l2 5-2.5 1.5a11 11 0 0 0 6 6L15 14l5 2v3a2 2 0 0 1-2 2A15 15 0 0 1 3 6a2 2 0 0 1 2-2z"/></svg>,
  pin:   (p) => <svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" strokeWidth="1.6" {...p}><path d="M12 22s7-6.5 7-12a7 7 0 1 0-14 0c0 5.5 7 12 7 12z"/><circle cx="12" cy="10" r="2.6"/></svg>,
  arrow: (p) => <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" strokeWidth="1.6" {...p}><path d="M5 12h14M13 6l6 6-6 6"/></svg>,
  wave:  (p) => <svg viewBox="0 0 80 14" width="80" height="14" fill="none" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round" {...p}><path d="M2 7 Q 10 1, 18 7 T 34 7 T 50 7 T 66 7 T 78 7"/></svg>,
  paw:   (p) => <svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" strokeWidth="1.5" {...p}><circle cx="6" cy="9" r="1.6"/><circle cx="10" cy="6" r="1.6"/><circle cx="14" cy="6" r="1.6"/><circle cx="18" cy="9" r="1.6"/><path d="M8.5 13.5c0-2 1.5-3.5 3.5-3.5s3.5 1.5 3.5 3.5c0 1.6-1.4 2.3-1.4 3.6 0 1-.8 1.9-2.1 1.9s-2.1-.9-2.1-1.9c0-1.3-1.4-2-1.4-3.6z"/></svg>,
  heart: (p) => <svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" strokeWidth="1.6" {...p}><path d="M12 20s-7-4.5-7-10a4 4 0 0 1 7-2.6A4 4 0 0 1 19 10c0 5.5-7 10-7 10z"/></svg>,
  sun:   (p) => <svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" strokeWidth="1.5" {...p}><circle cx="12" cy="12" r="4"/><path d="M12 3v2M12 19v2M3 12h2M19 12h2M5.6 5.6l1.4 1.4M17 17l1.4 1.4M5.6 18.4 7 17M17 7l1.4-1.4"/></svg>,
  family:(p) => <svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" strokeWidth="1.5" {...p}><circle cx="8" cy="7" r="2.4"/><circle cx="16" cy="7" r="2.4"/><path d="M3.5 19c.4-2.8 2.3-4.5 4.5-4.5s4.1 1.7 4.5 4.5M12 19c.3-2.5 2.1-4 4-4s3.7 1.5 4 4"/></svg>,
  verified: (p) => <svg viewBox="0 0 24 24" width="14" height="14" fill="#3aa6b9" {...p}><path d="M12 1l2.4 2.1 3.2-.4.8 3.1 2.8 1.6-1.2 3 1.2 3-2.8 1.6-.8 3.1-3.2-.4L12 20l-2.4-2.1-3.2.4-.8-3.1L2.8 13.6 4 10.5l-1.2-3 2.8-1.6.8-3.1 3.2.4L12 1zm-1.2 14.2l6.4-6.4-1.4-1.4-5 5-2.4-2.4-1.4 1.4 3.8 3.8z"/></svg>,
  mail:     (p) => <svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" strokeWidth="1.6" {...p}><path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"/><path d="M22 6l-10 7L2 6"/></svg>,
};

/* ---------- Wordmark ---------- */
function Wordmark({ size = 1, light = false, palette }) {
  const ink = light ? "#fff" : palette.ink;
  return (
    <span style={{ display: "inline-flex", alignItems: "baseline", gap: 8 * size, lineHeight: 1, color: ink }}>
      <span style={{ fontFamily: '"Mrs Saint Delafield", cursive', fontSize: 56 * size, lineHeight: 0.7, letterSpacing: "-0.02em" }}>Api</span>
      <span style={{ fontFamily: '"Outfit", sans-serif', fontSize: 11 * size, letterSpacing: "0.32em", fontWeight: 400, textTransform: "uppercase", opacity: 0.85 }}>Beach&nbsp;House&nbsp;Social&nbsp;Club</span>
    </span>
  );
}

/* ---------- Lang Toggle ---------- */
function LangToggle({ lang, setLang, palette }) {
  return (
    <button
      onClick={() => setLang(lang === "es" ? "en" : "es")}
      style={{
        background: "none", border: `1px solid ${palette.line}`,
        borderRadius: 999, padding: "5px 12px", cursor: "pointer",
        fontFamily: '"Outfit", sans-serif', fontSize: 11,
        letterSpacing: "0.18em", textTransform: "uppercase",
        color: palette.ink, display: "inline-flex", alignItems: "center", gap: 6,
      }}
    >
      {lang === "es" ? "EN" : "ES"}
    </button>
  );
}

/* ---------- Nav ---------- */
function Nav({ page, setPage, palette, lang, setLang, t }) {
  const [open, setOpen] = useState(false);
  const items = [
    { id: "home", label: t.nav.home },
    { id: "experience", label: t.nav.house },
    { id: "contact", label: t.nav.contact },
  ];
  const go = (id) => { setPage(id); setOpen(false); window.scrollTo({ top: 0, behavior: "instant" }); };

  return (
    <header style={{
      position: "sticky", top: 0, zIndex: 40,
      background: "rgba(251,248,242,0.82)",
      backdropFilter: "saturate(140%) blur(14px)",
      WebkitBackdropFilter: "saturate(140%) blur(14px)",
      borderBottom: `1px solid ${palette.line}`,
      color: palette.ink,
    }}>
      <div style={{ maxWidth: 1280, margin: "0 auto", padding: "14px 20px", display: "flex", alignItems: "center", justifyContent: "space-between" }}>
        <button onClick={() => go("home")} style={{ background: "none", border: "none", padding: 0, cursor: "pointer", color: "inherit" }}>
          <Wordmark size={0.55} palette={palette} />
        </button>
        <nav className="desktop-nav" style={{ display: "none", gap: 36 }}>
          {items.map(it => (
            <button key={it.id} onClick={() => go(it.id)} style={{
              background: "none", border: "none", cursor: "pointer",
              fontFamily: '"Outfit", sans-serif', fontSize: 13, letterSpacing: "0.18em",
              textTransform: "uppercase", color: "inherit",
              borderBottom: page === it.id ? `1px solid ${palette.accent}` : "1px solid transparent",
              paddingBottom: 4,
            }}>{it.label}</button>
          ))}
        </nav>
        <div style={{ display: "flex", alignItems: "center", gap: 12 }}>
          <LangToggle lang={lang} setLang={setLang} palette={palette} />
          <a href={INFO.instagramUrl} target="_blank" rel="noreferrer" className="desktop-nav" style={{
            display: "none", alignItems: "center", gap: 8,
            background: palette.ink, color: "#fff",
            padding: "10px 18px", borderRadius: 999,
            fontFamily: '"Outfit", sans-serif', fontSize: 12,
            letterSpacing: "0.18em", textTransform: "uppercase", textDecoration: "none",
          }}>{t.nav.book}</a>
          <button className="mobile-only" onClick={() => setOpen(true)} aria-label="menu" style={{ background: "none", border: "none", color: "inherit", cursor: "pointer", padding: 4 }}><I.menu /></button>
        </div>
      </div>

      {open && (
        <div style={{ position: "fixed", inset: 0, zIndex: 60, background: palette.bg, padding: "24px 24px 40px", display: "flex", flexDirection: "column" }}>
          <div style={{ display: "flex", justifyContent: "space-between", alignItems: "center" }}>
            <Wordmark size={0.55} palette={palette} />
            <div style={{ display: "flex", alignItems: "center", gap: 12 }}>
              <LangToggle lang={lang} setLang={setLang} palette={palette} />
              <button onClick={() => setOpen(false)} aria-label="close" style={{ background: "none", border: "none", color: palette.ink, padding: 4 }}><I.x /></button>
            </div>
          </div>
          <div style={{ marginTop: 56, display: "flex", flexDirection: "column", gap: 28 }}>
            {items.map(it => (
              <button key={it.id} onClick={() => go(it.id)} style={{
                background: "none", border: "none", textAlign: "left", padding: 0, cursor: "pointer",
                fontFamily: '"Cormorant Garamond", serif', fontWeight: 500,
                fontSize: 44, lineHeight: 1, color: palette.ink,
              }}>
                {it.label}{page === it.id && <span style={{ color: palette.accent }}>.</span>}
              </button>
            ))}
          </div>
          <div style={{ marginTop: "auto", display: "flex", flexDirection: "column", gap: 14, color: palette.ink2 }}>
            <a href={INFO.instagramUrl} target="_blank" rel="noreferrer" style={{ color: "inherit", textDecoration: "none", display: "flex", gap: 10, alignItems: "center", fontFamily: '"Outfit", sans-serif', fontSize: 14 }}><I.ig /> {INFO.instagramHandle}</a>
          </div>
        </div>
      )}
    </header>
  );
}

/* ---------- Bits ---------- */
function Eyebrow({ children, palette, light }) {
  return (
    <div style={{
      display: "inline-flex", alignItems: "center", gap: 10,
      fontFamily: '"Outfit", sans-serif', fontSize: 11, letterSpacing: "0.32em",
      textTransform: "uppercase", color: light ? "rgba(255,255,255,0.85)" : palette.accent,
    }}>
      <I.wave /><span>{children}</span>
    </div>
  );
}
function Display({ children, palette, style }) {
  return (
    <h2 style={{
      fontFamily: '"Cormorant Garamond", serif', fontWeight: 500,
      fontSize: "clamp(34px, 6vw, 64px)", lineHeight: 1.02, letterSpacing: "-0.01em",
      color: palette.ink, margin: 0, textWrap: "pretty", ...style,
    }}>{children}</h2>
  );
}
function Body({ children, palette, style }) {
  return (
    <p style={{
      fontFamily: '"Outfit", sans-serif', fontSize: 16, lineHeight: 1.65,
      color: palette.ink2, margin: 0, textWrap: "pretty", ...style,
    }}>{children}</p>
  );
}

/* ---------- HOME ---------- */
function HomePage({ palette, tweaks, setPage, t }) {
  const heroSrc = {
    gazebo: "assets/gazebo-day.png",
    interior: "assets/interior.png",
    night: "assets/palms-night.jpg",
    lounge: "assets/lounge-wide.png",
  }[tweaks.heroImage] || "assets/gazebo-day.png";

  return (
    <main>
      {/* Hero */}
      <section style={{ position: "relative", height: "min(90vh, 820px)", minHeight: 560, overflow: "hidden" }}>
        <img src={heroSrc} alt="Api Beach House" style={{ position: "absolute", inset: 0, width: "100%", height: "100%", objectFit: "cover", objectPosition: "center 55%" }}/>
        <div style={{ position: "absolute", inset: 0, background: "linear-gradient(180deg, rgba(8,20,36,0.10) 0%, rgba(8,20,36,0.05) 35%, rgba(8,20,36,0.55) 100%)" }}/>
        <div style={{
          position: "absolute", inset: 0, maxWidth: 1280, margin: "0 auto",
          padding: "0 24px 64px", display: "flex", flexDirection: "column", justifyContent: "flex-end", color: "#fff",
        }}>
          <div style={{ maxWidth: 760 }}>
            <Eyebrow palette={palette} light>{INFO.location}</Eyebrow>
            <h1 style={{
              fontFamily: '"Cormorant Garamond", serif', fontWeight: 400,
              fontSize: "clamp(46px, 8.8vw, 108px)", lineHeight: 0.95, letterSpacing: "-0.02em",
              margin: "16px 0 14px", color: "#fff", textWrap: "balance",
            }}>
              Api Beach House<br/>
              <em style={{ fontFamily: '"Mrs Saint Delafield", cursive', fontStyle: "normal", fontSize: "1.15em", color: "#fff" }}>Social Club.</em>
            </h1>
            <p style={{ fontFamily: '"Outfit", sans-serif', fontSize: 17, lineHeight: 1.6, color: "rgba(255,255,255,0.92)", maxWidth: 520, margin: 0 }}>
              {t.hero.subtitle}
            </p>
            <div style={{ display: "flex", gap: 12, marginTop: 28, flexWrap: "wrap" }}>
              <a href={INFO.instagramUrl} target="_blank" rel="noreferrer" style={{
                background: "#fff", color: palette.ink, textDecoration: "none",
                border: "none", padding: "14px 22px", borderRadius: 999,
                fontFamily: '"Outfit", sans-serif', fontSize: 12, letterSpacing: "0.22em",
                textTransform: "uppercase", display: "inline-flex", alignItems: "center", gap: 10,
              }}>{t.hero.cta} <I.arrow /></a>
              <button onClick={() => setPage("experience")} style={{
                background: "transparent", color: "#fff",
                border: "1px solid rgba(255,255,255,0.6)", padding: "14px 22px", borderRadius: 999, cursor: "pointer",
                fontFamily: '"Outfit", sans-serif', fontSize: 12, letterSpacing: "0.22em", textTransform: "uppercase",
              }}>{t.hero.explore}</button>
            </div>
          </div>
          {/* corner chip */}
          <div style={{ position: "absolute", top: 24, right: 24 }}>
            <div style={{ background: "rgba(255,255,255,0.14)", backdropFilter: "blur(8px)", color: "#fff", padding: "8px 14px", borderRadius: 999, fontFamily: '"Outfit", sans-serif', fontSize: 11, letterSpacing: "0.2em", textTransform: "uppercase", border: "1px solid rgba(255,255,255,0.25)", display: "inline-flex", alignItems: "center", gap: 8 }}>
              <I.family /> {t.hero.family}
            </div>
          </div>
        </div>
      </section>

      {/* Intro band */}
      <section style={{ padding: "clamp(64px, 10vw, 120px) 24px", background: palette.bg }}>
        <div style={{ maxWidth: 1100, margin: "0 auto" }}>
          <div className="intro-grid">
            <div>
              <Eyebrow palette={palette}>{t.intro.eyebrow}</Eyebrow>
              <Display palette={palette} style={{ marginTop: 18 }}>
                {t.intro.title1}<br/>{t.intro.title2}
              </Display>
            </div>
            <div style={{ display: "flex", flexDirection: "column", gap: 20 }}>
              <Body palette={palette}>{t.intro.body1}</Body>
              <Body palette={palette}>{t.intro.body2}</Body>
            </div>
          </div>
        </div>
      </section>

      {/* Value props */}
      <section style={{ padding: "0 24px clamp(64px, 10vw, 120px)", background: palette.bg }}>
        <div style={{ maxWidth: 1280, margin: "0 auto" }}>
          <div style={{ display: "flex", justifyContent: "space-between", alignItems: "flex-end", flexWrap: "wrap", gap: 24, marginBottom: 40 }}>
            <div>
              <Eyebrow palette={palette}>{t.cards.eyebrow}</Eyebrow>
              <Display palette={palette} style={{ marginTop: 14, fontSize: "clamp(28px,4.5vw,46px)" }}>
                {t.cards.title}
              </Display>
            </div>
          </div>
          <div className="cards-grid">
            {t.cards.items.map((s, idx) => {
              const icons = [<I.family />, <I.paw />, <I.sun />, <I.wa />];
              const nums = ["01", "02", "03", "04"];
              return (
                <article key={idx} style={{
                  background: palette.paper, border: `1px solid ${palette.line}`,
                  borderRadius: 4, padding: "26px 24px 28px", display: "flex", flexDirection: "column", gap: 14,
                }}>
                  <div style={{ display: "flex", alignItems: "center", justifyContent: "space-between" }}>
                    <span style={{ color: palette.accent }}>{icons[idx]}</span>
                    <span style={{ fontFamily: '"Outfit", sans-serif', fontSize: 11, letterSpacing: "0.22em", color: palette.ink2 }}>{nums[idx]}</span>
                  </div>
                  <h3 style={{ fontFamily: '"Cormorant Garamond", serif', fontWeight: 500, fontSize: 26, margin: 0, color: palette.ink }}>{s.t}</h3>
                  <p style={{ fontFamily: '"Outfit", sans-serif', fontSize: 14.5, lineHeight: 1.55, color: palette.ink2, margin: 0 }}>{s.d}</p>
                </article>
              );
            })}
          </div>
        </div>
      </section>

      {/* Come find us map */}
      <section style={{ padding: "clamp(64px,10vw,120px) 24px", background: palette.paper }}>
        <div style={{ maxWidth: 1280, margin: "0 auto" }}>
          <div style={{ textAlign: "center", marginBottom: 48 }}>
            <Eyebrow palette={palette}>{t.contact.location}</Eyebrow>
            <Display palette={palette} style={{ marginTop: 14 }}>{t.contact.directions}</Display>
          </div>
          <div style={{ display: "grid", gridTemplateColumns: "repeat(auto-fit, minmax(320px, 1fr))", gap: 24 }}>
            <div style={{ height: 460, borderRadius: 12, overflow: "hidden", border: `1px solid ${palette.line}`, position: "relative" }}>
              <iframe width="100%" height="100%" src="https://maps.google.com/maps?q=Api+Beach,+Punta+Cana,+Dominican+Republic&t=k&z=17&ie=UTF8&iwloc=&output=embed" frameBorder="0" scrolling="no" marginHeight="0" marginWidth="0" style={{ position: "absolute", inset: 0, filter: "contrast(1.1) saturate(1.2)" }}></iframe>
            </div>
            <div style={{ height: 460, display: "flex", flexDirection: "column", gap: 24 }}>
              <div style={{ flex: 1, borderRadius: 12, overflow: "hidden", border: `1px solid ${palette.line}` }}>
                <img src="assets/map-zoomed-out.png" alt="Zoomed Out Map" style={{ width: "100%", height: "100%", objectFit: "cover" }} />
              </div>
              <div style={{ flex: 1, borderRadius: 12, overflow: "hidden", border: `1px solid ${palette.line}` }}>
                <img src="assets/map-zoomed-in.png" alt="Aerial Shot" style={{ width: "100%", height: "100%", objectFit: "cover" }} />
              </div>
            </div>
          </div>
        </div>
      </section>

      {/* Day Pass */}
      <section style={{ padding: "0 24px clamp(64px,10vw,120px)", background: palette.bg }}>
        <div style={{ maxWidth: 1100, margin: "0 auto" }}>
          <div style={{ background: palette.paper, border: `1px solid ${palette.line}`, borderRadius: 6, padding: "clamp(32px,5vw,56px)", display: "flex", gap: 32, justifyContent: "space-between", alignItems: "center", flexWrap: "wrap" }}>
            <div>
              <Eyebrow palette={palette}>{t.daypass.eyebrow}</Eyebrow>
              <div style={{ display: "flex", alignItems: "baseline", gap: 12, marginTop: 14 }}>
                <span style={{ fontFamily: '"Cormorant Garamond", serif', fontWeight: 500, fontSize: "clamp(48px,7vw,80px)", color: palette.ink, lineHeight: 1 }}>{t.daypass.price}</span>
                <span style={{ fontFamily: '"Outfit", sans-serif', fontSize: 14, color: palette.ink2 }}>{t.daypass.per}</span>
              </div>
              <Body palette={palette} style={{ maxWidth: 420, marginTop: 12 }}>{t.daypass.body}</Body>
              <div style={{ fontFamily: '"Outfit", sans-serif', fontSize: 12, color: palette.ink2, marginTop: 10, display: "flex", alignItems: "center", gap: 6 }}>
                <I.paw style={{ width: 14, height: 14 }} /> {t.daypass.note}
              </div>
            </div>
            <a href={INFO.instagramUrl} target="_blank" rel="noreferrer" style={{
              background: palette.ink, color: "#fff", textDecoration: "none",
              padding: "16px 26px", borderRadius: 999,
              fontFamily: '"Outfit", sans-serif', fontSize: 12, letterSpacing: "0.22em",
              textTransform: "uppercase", display: "inline-flex", alignItems: "center", gap: 10, flexShrink: 0,
            }}><I.ig /> {t.daypass.cta}</a>
          </div>
        </div>
      </section>

      {/* Menu */}
      <section style={{ background: palette.ink, padding: "clamp(64px,10vw,120px) 24px" }}>
        <div style={{ maxWidth: 1100, margin: "0 auto" }}>
          <div style={{ marginBottom: 48 }}>
            <Eyebrow palette={palette} light>{t.menu.eyebrow}</Eyebrow>
            <h2 style={{ fontFamily: '"Cormorant Garamond", serif', fontWeight: 500, fontSize: "clamp(34px,6vw,64px)", color: "#fff", margin: "14px 0 0", lineHeight: 1 }}>{t.menu.title}</h2>
          </div>
          <div style={{ display: "grid", gridTemplateColumns: "repeat(auto-fit, minmax(280px, 1fr))", gap: 48 }}>
            {/* Food */}
            <div>
              <div style={{ fontFamily: '"Outfit", sans-serif', fontSize: 11, letterSpacing: "0.28em", textTransform: "uppercase", color: "rgba(255,255,255,0.45)", marginBottom: 24 }}>{t.menu.food}</div>
              <div style={{ display: "flex", flexDirection: "column", gap: 0 }}>
                {t.menu.items.food.map((item, i) => (
                  <div key={i} style={{ padding: "18px 0", borderTop: "1px solid rgba(255,255,255,0.1)", display: "flex", justifyContent: "space-between", alignItems: "baseline", gap: 16 }}>
                    <div>
                      <div style={{ fontFamily: '"Cormorant Garamond", serif', fontWeight: 500, fontSize: 22, color: "#fff", lineHeight: 1.1 }}>{item.name}</div>
                      <div style={{ fontFamily: '"Outfit", sans-serif', fontSize: 13, color: "rgba(255,255,255,0.5)", marginTop: 4 }}>{item.desc}</div>
                    </div>
                  </div>
                ))}
                <div style={{ borderTop: "1px solid rgba(255,255,255,0.1)" }} />
              </div>
            </div>
            {/* Drinks */}
            <div>
              <div style={{ fontFamily: '"Outfit", sans-serif', fontSize: 11, letterSpacing: "0.28em", textTransform: "uppercase", color: "rgba(255,255,255,0.45)", marginBottom: 24 }}>{t.menu.drinks}</div>
              <div style={{ display: "flex", flexDirection: "column", gap: 0 }}>
                {t.menu.items.drinks.map((item, i) => (
                  <div key={i} style={{ padding: "18px 0", borderTop: "1px solid rgba(255,255,255,0.1)", display: "flex", justifyContent: "space-between", alignItems: "baseline", gap: 16 }}>
                    <div>
                      <div style={{ fontFamily: '"Cormorant Garamond", serif', fontWeight: 500, fontSize: 22, color: "#fff", lineHeight: 1.1 }}>{item.name}</div>
                      <div style={{ fontFamily: '"Outfit", sans-serif', fontSize: 13, color: "rgba(255,255,255,0.5)", marginTop: 4 }}>{item.desc}</div>
                    </div>
                  </div>
                ))}
                <div style={{ borderTop: "1px solid rgba(255,255,255,0.1)" }} />
              </div>
            </div>
          </div>
          <div style={{ marginTop: 36, fontFamily: '"Outfit", sans-serif', fontSize: 12, color: "rgba(255,255,255,0.35)", letterSpacing: "0.08em" }}>{t.menu.note}</div>
        </div>
      </section>

      {/* Hours strip */}
      <section style={{ background: palette.accent, padding: "28px 24px" }}>
        <div style={{ maxWidth: 1100, margin: "0 auto", display: "flex", alignItems: "center", justifyContent: "center", gap: 24, flexWrap: "wrap" }}>
          <div style={{ fontFamily: '"Outfit", sans-serif', fontSize: 11, letterSpacing: "0.28em", textTransform: "uppercase", color: "rgba(255,255,255,0.8)" }}>{t.hours.eyebrow}</div>
          <div style={{ width: 1, height: 16, background: "rgba(255,255,255,0.35)" }} />
          <div style={{ fontFamily: '"Cormorant Garamond", serif', fontSize: 22, color: "#fff", fontWeight: 500 }}>{t.hours.days}</div>
          <div style={{ fontFamily: '"Outfit", sans-serif', fontSize: 14, color: "rgba(255,255,255,0.9)", letterSpacing: "0.06em" }}>{t.hours.time}</div>
          <div style={{ width: 1, height: 16, background: "rgba(255,255,255,0.35)" }} />
          <div style={{ fontFamily: '"Outfit", sans-serif', fontSize: 11, letterSpacing: "0.2em", textTransform: "uppercase", color: "rgba(255,255,255,0.7)" }}>{t.hours.note}</div>
        </div>
      </section>

      {/* Image quote band */}
      <section style={{ position: "relative", padding: "clamp(80px, 12vw, 160px) 24px", overflow: "hidden" }}>
        <img src="assets/lounge-wide.png" alt="" style={{ position: "absolute", inset: 0, width: "100%", height: "100%", objectFit: "cover" }}/>
        <div style={{ position: "absolute", inset: 0, background: "rgba(15,40,68,0.45)" }}/>
        <div style={{ position: "relative", maxWidth: 760, margin: "0 auto", textAlign: "center", color: "#fff" }}>
          <div style={{ fontFamily: '"Mrs Saint Delafield", cursive', fontSize: "clamp(56px,9vw,110px)", lineHeight: 0.9, color: "#fff" }}>
            {t.quote.line1}
          </div>
          <div style={{ fontFamily: '"Cormorant Garamond", serif', fontWeight: 400, fontSize: "clamp(34px,5.5vw,58px)", lineHeight: 1.05, letterSpacing: "-0.01em", marginTop: 8 }}>
            {t.quote.line2}
          </div>
        </div>
      </section>

      {/* Gallery strip */}
      <section style={{ background: palette.bg, padding: "clamp(56px,9vw,100px) 0 0" }}>
        <div style={{ maxWidth: 1280, margin: "0 auto", padding: "0 24px 28px" }}>
          <div style={{ display: "flex", justifyContent: "space-between", alignItems: "flex-end", gap: 16, flexWrap: "wrap" }}>
            <div>
              <Eyebrow palette={palette}>{t.gallery.eyebrow}</Eyebrow>
              <Display palette={palette} style={{ marginTop: 14, fontSize: "clamp(28px,4.5vw,46px)" }}>{t.gallery.title}</Display>
            </div>
            <a href={INFO.instagramUrl} target="_blank" rel="noreferrer" style={{
              fontFamily: '"Outfit", sans-serif', fontSize: 11, letterSpacing: "0.22em",
              textTransform: "uppercase", color: palette.ink, textDecoration: "none",
              display: "inline-flex", gap: 8, alignItems: "center",
            }}>{t.gallery.more} <I.arrow /></a>
          </div>
        </div>
        <div className="gallery-strip">
          {["assets/burger.png", "assets/lounge-wide.png", "assets/interior.png", "assets/palms-night.jpg"].map((src, i) => (
            <div key={i} style={{ aspectRatio: "3/4", overflow: "hidden", background: palette.line }}>
              <img src={src} alt="" style={{ width: "100%", height: "100%", objectFit: "cover" }}/>
            </div>
          ))}
        </div>
      </section>

      <InstagramPreview palette={palette} t={t} />
    </main>
  );
}

/* ---------- Instagram preview card ---------- */
function InstagramPreview({ palette, t }) {
  const grid = [
    "assets/gazebo-day.png", "assets/lounge-wide.png", "assets/burger.png",
    "assets/interior.png", "assets/palms-night.jpg", "assets/gazebo-day.png",
  ];
  return (
    <section style={{ background: palette.bg, padding: "clamp(64px,10vw,120px) 24px" }}>
      <div style={{ maxWidth: 1100, margin: "0 auto" }}>
        <div style={{ background: palette.paper, border: `1px solid ${palette.line}`, borderRadius: 8, overflow: "hidden" }}>
          <div style={{ padding: "clamp(22px,3vw,32px)", display: "flex", gap: "clamp(18px,3vw,32px)", flexWrap: "wrap", alignItems: "center", borderBottom: `1px solid ${palette.line}` }}>
            <div style={{ width: 84, height: 84, borderRadius: 999, background: `conic-gradient(from 210deg, #fdb74e, #d6356a, #8e2de2, #fdb74e)`, padding: 3, flexShrink: 0 }}>
              <div style={{ width: "100%", height: "100%", borderRadius: 999, background: "#fff", display: "flex", alignItems: "center", justifyContent: "center", overflow: "hidden" }}>
                <span style={{ fontFamily: '"Mrs Saint Delafield", cursive', fontSize: 56, color: palette.ink, lineHeight: 0.7, transform: "translateY(2px)" }}>Api</span>
              </div>
            </div>
            <div style={{ flex: 1, minWidth: 220 }}>
              <div style={{ display: "flex", alignItems: "center", gap: 8, flexWrap: "wrap" }}>
                <span style={{ fontFamily: '"Outfit", sans-serif', fontSize: 20, fontWeight: 500, color: palette.ink }}>apibeachhouse</span>
                <I.verified />
              </div>
              <div style={{ fontFamily: '"Outfit", sans-serif', fontSize: 14, color: palette.ink2, marginTop: 4 }}>Api Beach House · {t.ig.tagline}</div>
              <div style={{ fontFamily: '"Outfit", sans-serif', fontSize: 14, color: palette.ink2, marginTop: 2 }}>Cap Cana · La Marina · {t.hero.petFriendly}</div>
            </div>
            <a href={INFO.instagramUrl} target="_blank" rel="noreferrer" style={{
              background: palette.ink, color: "#fff", textDecoration: "none",
              padding: "12px 22px", borderRadius: 999,
              fontFamily: '"Outfit", sans-serif', fontSize: 12, letterSpacing: "0.22em", textTransform: "uppercase",
              display: "inline-flex", alignItems: "center", gap: 10,
            }}><I.ig /> {t.ig.follow}</a>
          </div>
          <div className="ig-grid">
            {grid.map((src, i) => (
              <a key={i} href={INFO.instagramUrl} target="_blank" rel="noreferrer" style={{ display: "block", aspectRatio: "1/1", overflow: "hidden", background: palette.line, position: "relative" }}>
                <img src={src} alt="" style={{ width: "100%", height: "100%", objectFit: "cover", transition: "transform .4s ease" }} onMouseEnter={e => e.currentTarget.style.transform = "scale(1.04)"} onMouseLeave={e => e.currentTarget.style.transform = "scale(1)"} />
              </a>
            ))}
          </div>
        </div>
      </div>
    </section>
  );
}

/* ---------- LA CASA (Experience) ---------- */
function ExperiencePage({ palette, t }) {
  return (
    <main style={{ background: palette.bg, color: palette.ink }}>
      <section style={{ position: "relative", height: "min(60vh, 520px)", minHeight: 360, overflow: "hidden" }}>
        <img src="assets/interior.png" alt="" style={{ position: "absolute", inset: 0, width: "100%", height: "100%", objectFit: "cover" }}/>
        <div style={{ position: "absolute", inset: 0, background: "linear-gradient(180deg, rgba(8,20,36,0) 30%, rgba(8,20,36,0.55) 100%)" }}/>
        <div style={{ position: "absolute", inset: 0, maxWidth: 1280, margin: "0 auto", padding: "0 24px 48px", display: "flex", flexDirection: "column", justifyContent: "flex-end", color: "#fff" }}>
          <Eyebrow palette={palette} light>{t.experience.eyebrow}</Eyebrow>
          <h1 style={{ fontFamily: '"Cormorant Garamond", serif', fontWeight: 400, fontSize: "clamp(40px,7vw,80px)", lineHeight: 0.98, letterSpacing: "-0.02em", margin: "12px 0 0", color: "#fff" }}>
            {t.experience.heroTitle1} <em style={{ fontFamily: '"Mrs Saint Delafield", cursive', fontStyle: "normal", fontSize: "1.1em" }}>{t.experience.heroTitle2}</em>
          </h1>
        </div>
      </section>

      <section style={{ padding: "clamp(64px,10vw,120px) 24px 0" }}>
        <div style={{ maxWidth: 880, margin: "0 auto", textAlign: "center" }}>
          <Body palette={palette} style={{ fontSize: 19, lineHeight: 1.7 }}>{t.experience.intro}</Body>
        </div>
      </section>

      <section style={{ padding: "clamp(56px,9vw,100px) 24px" }}>
        <div style={{ maxWidth: 1100, margin: "0 auto", display: "flex", flexDirection: "column", gap: "clamp(48px,7vw,80px)" }}>
          {t.experience.rows.map((row, i) => {
            const imgs = ["assets/lounge-wide.png", "assets/burger.png", "assets/palms-night.jpg", "assets/interior.png"];
            return (
              <div key={i} className="alt-row" style={{ flexDirection: i % 2 ? "row-reverse" : "row" }}>
                <div style={{ flex: "1 1 380px" }}>
                  <div style={{ aspectRatio: "5/4", overflow: "hidden", borderRadius: 4, background: palette.line }}>
                    <img src={imgs[i]} alt="" style={{ width: "100%", height: "100%", objectFit: "cover" }}/>
                  </div>
                </div>
                <div style={{ flex: "1 1 340px", display: "flex", flexDirection: "column", gap: 16, justifyContent: "center" }}>
                  <div style={{ fontFamily: '"Outfit", sans-serif', fontSize: 11, letterSpacing: "0.22em", textTransform: "uppercase", color: palette.accent }}>0{i+1}</div>
                  <h3 style={{ fontFamily: '"Cormorant Garamond", serif', fontWeight: 500, fontSize: "clamp(28px,4.5vw,44px)", margin: 0, color: palette.ink, lineHeight: 1.05 }}>{row.t}</h3>
                  <Body palette={palette}>{row.d}</Body>
                </div>
              </div>
            );
          })}
        </div>
      </section>

      <section style={{ padding: "0 24px clamp(64px,10vw,120px)" }}>
        <div style={{ maxWidth: 1100, margin: "0 auto", background: palette.ink, color: "#fff", borderRadius: 6, padding: "clamp(36px,5vw,60px)", display: "flex", gap: 28, justifyContent: "space-between", alignItems: "center", flexWrap: "wrap" }}>
          <div style={{ maxWidth: 560 }}>
            <Eyebrow palette={palette} light>{t.experience.ctaEyebrow}</Eyebrow>
            <h3 style={{ fontFamily: '"Cormorant Garamond", serif', fontWeight: 500, fontSize: "clamp(28px,4.5vw,44px)", margin: "12px 0 8px", color: "#fff" }}>{t.experience.ctaTitle}</h3>
            <p style={{ fontFamily: '"Outfit", sans-serif', fontSize: 15, color: "rgba(255,255,255,0.78)", margin: 0 }}>{t.experience.ctaBody}</p>
          </div>
          <a href={INFO.instagramUrl} target="_blank" rel="noreferrer" style={{
            background: "#fff", color: palette.ink, textDecoration: "none",
            padding: "16px 26px", borderRadius: 999,
            fontFamily: '"Outfit", sans-serif', fontSize: 12, letterSpacing: "0.22em",
            textTransform: "uppercase", display: "inline-flex", alignItems: "center", gap: 10,
          }}><I.ig /> {INFO.instagramHandle}</a>
        </div>
      </section>

      <InstagramPreview palette={palette} t={t} />
    </main>
  );
}

/* ---------- CONTACT ---------- */
function ContactPage({ palette, t }) {
  return (
    <main style={{ background: palette.bg, color: palette.ink }}>
      <section style={{ padding: "clamp(64px,10vw,120px) 24px 24px" }}>
        <div style={{ maxWidth: 1100, margin: "0 auto", textAlign: "center" }}>
          <Eyebrow palette={palette}>{t.contact.eyebrow}</Eyebrow>
          <Display palette={palette} style={{ marginTop: 18 }}>
            {t.contact.title1}<br/>
            <em style={{ fontFamily: '"Mrs Saint Delafield", cursive', fontStyle: "normal", color: palette.accent }}>{t.contact.title2}</em>
          </Display>
          <Body palette={palette} style={{ maxWidth: 520, margin: "20px auto 0", textAlign: "center" }}>{t.contact.subtitle}</Body>
        </div>
      </section>

      <section style={{ padding: "32px 24px clamp(48px,8vw,80px)" }}>
        <div style={{ maxWidth: 1100, margin: "0 auto" }}>
          <div className="contact-grid">
            <a href={INFO.instagramUrl} target="_blank" rel="noreferrer" style={{ textDecoration: "none", color: "inherit", background: palette.paper, border: `1px solid ${palette.line}`, borderRadius: 6, padding: "clamp(28px,4vw,44px)", display: "flex", flexDirection: "column", gap: 20 }}>
              <div style={{ width: 56, height: 56, borderRadius: 999, background: "conic-gradient(from 210deg, #fdb74e, #d6356a, #8e2de2, #fdb74e)", color: "#fff", display: "inline-flex", alignItems: "center", justifyContent: "center" }}><I.ig /></div>
              <div>
                <div style={{ fontFamily: '"Outfit", sans-serif', fontSize: 11, letterSpacing: "0.22em", textTransform: "uppercase", color: palette.ink2 }}>{t.contact.waLabel}</div>
                <div style={{ fontFamily: '"Cormorant Garamond", serif', fontSize: "clamp(34px,5vw,52px)", color: palette.ink, marginTop: 6, lineHeight: 1 }}>{INFO.instagramHandle}</div>
              </div>
              <div style={{ fontFamily: '"Outfit", sans-serif', fontSize: 14.5, color: palette.ink2, lineHeight: 1.5 }}>{t.contact.waBody}</div>
              <div style={{ marginTop: "auto", display: "inline-flex", alignItems: "center", gap: 10, color: palette.accent, fontFamily: '"Outfit", sans-serif', fontSize: 12, letterSpacing: "0.22em", textTransform: "uppercase" }}>
                {t.contact.waAction} <I.arrow />
              </div>
            </a>

            <div style={{ display: "flex", flexDirection: "column", gap: 26 }}>
              <InfoBlock palette={palette} icon={<I.pin />} title={t.contact.location} lines={[INFO.locationFull]} link={{ href: INFO.mapsUrl, label: t.contact.directions }} />
              <InfoBlock palette={palette} icon={<I.mail />} title="Email" lines={[]} link={{ href: `mailto:reserva@apibeach.com`, label: "reserva@apibeach.com" }} />
              <InfoBlock palette={palette} icon={<I.ig />} title="Instagram" lines={[t.contact.igBody]} link={{ href: INFO.instagramUrl, label: INFO.instagramHandle }} />
              <InfoBlock palette={palette} icon={<I.paw />} title="Pet friendly" lines={[t.contact.petBody]} />
            </div>
          </div>
        </div>
      </section>

      <section style={{ position: "relative", height: "min(50vh, 460px)", overflow: "hidden" }}>
        <div style={{ position: "absolute", inset: 0, background: `radial-gradient(circle at 70% 60%, #2b6a7a 0%, #194a5a 40%, #0c2030 70%), #0c2030` }}/>
        <svg viewBox="0 0 800 460" preserveAspectRatio="none" style={{ position: "absolute", inset: 0, width: "100%", height: "100%" }}>
          <defs><pattern id="dots" x="0" y="0" width="14" height="14" patternUnits="userSpaceOnUse"><circle cx="1" cy="1" r="0.6" fill="rgba(255,255,255,0.06)"/></pattern></defs>
          <rect width="800" height="460" fill="url(#dots)"/>
          <path d="M0,0 L520,0 C500,80 460,140 470,210 C480,280 440,330 380,360 C320,390 230,420 120,440 L0,460 Z" fill="rgba(214,202,176,0.18)" stroke="rgba(255,255,255,0.18)" strokeWidth="1"/>
          <path d="M120,80 C220,150 320,180 460,220 M260,40 C290,160 320,240 380,360" stroke="rgba(255,255,255,0.25)" strokeWidth="1" fill="none" strokeDasharray="4 6"/>
        </svg>
        <div style={{ position: "absolute", left: "55%", top: "58%", transform: "translate(-50%,-100%)", display: "flex", flexDirection: "column", alignItems: "center", gap: 6 }}>
          <div style={{ background: palette.accent, color: "#fff", width: 48, height: 48, borderRadius: 999, display: "flex", alignItems: "center", justifyContent: "center", boxShadow: "0 8px 20px rgba(0,0,0,0.4)" }}><I.pin /></div>
          <div style={{ background: "#fff", color: palette.ink, padding: "6px 12px", borderRadius: 4, fontFamily: '"Outfit", sans-serif', fontSize: 12, letterSpacing: "0.12em", textTransform: "uppercase", fontWeight: 500 }}>Api Beach House</div>
        </div>
        <div style={{ position: "absolute", left: 24, bottom: 24, background: palette.paper, padding: "20px 22px", borderRadius: 4, border: `1px solid ${palette.line}`, maxWidth: 320 }}>
          <div style={{ color: palette.accent, marginBottom: 8 }}><I.pin /></div>
          <div style={{ fontFamily: '"Cormorant Garamond", serif', fontSize: 22, color: palette.ink, lineHeight: 1.1 }}>Cap Cana, La Marina</div>
          <div style={{ fontFamily: '"Outfit", sans-serif', fontSize: 13, color: palette.ink2, marginTop: 4 }}>Punta Cana, República Dominicana</div>
          <a href={INFO.mapsUrl} target="_blank" rel="noreferrer" style={{ display: "inline-flex", alignItems: "center", gap: 8, marginTop: 12, color: palette.ink, textDecoration: "none", fontFamily: '"Outfit", sans-serif', fontSize: 11, letterSpacing: "0.22em", textTransform: "uppercase", borderBottom: `1px solid ${palette.ink}`, paddingBottom: 2 }}>
            {t.contact.directions} <I.arrow />
          </a>
        </div>
      </section>
    </main>
  );
}

function InfoBlock({ icon, title, lines, link, palette }) {
  return (
    <div style={{ display: "flex", gap: 16 }}>
      <div style={{ width: 40, height: 40, borderRadius: 999, border: `1px solid ${palette.line}`, background: palette.paper, display: "flex", alignItems: "center", justifyContent: "center", color: palette.accent, flexShrink: 0 }}>{icon}</div>
      <div>
        <div style={{ fontFamily: '"Outfit", sans-serif', fontSize: 11, letterSpacing: "0.22em", textTransform: "uppercase", color: palette.ink2 }}>{title}</div>
        <div style={{ fontFamily: '"Outfit", sans-serif', fontSize: 15, color: palette.ink, marginTop: 6, lineHeight: 1.5 }}>
          {lines.map((l, i) => <div key={i}>{l}</div>)}
          {link && (
            <a href={link.href} target="_blank" rel="noreferrer" style={{ color: palette.accent, textDecoration: "none", display: "inline-flex", alignItems: "center", gap: 6, marginTop: 6, borderBottom: `1px solid ${palette.accent}` }}>{link.label}</a>
          )}
        </div>
      </div>
    </div>
  );
}

/* ---------- Footer ---------- */
function Footer({ palette, setPage, t }) {
  return (
    <footer style={{ background: palette.ink, color: "rgba(255,255,255,0.85)", padding: "clamp(48px,7vw,80px) 24px 32px" }}>
      <div style={{ maxWidth: 1280, margin: "0 auto" }}>
        <div className="footer-grid">
          <div>
            <Wordmark size={0.8} light palette={palette} />
            <p style={{ fontFamily: '"Outfit", sans-serif', fontSize: 14, lineHeight: 1.6, marginTop: 18, maxWidth: 300, color: "rgba(255,255,255,0.65)" }}>{t.footer.tagline}</p>
          </div>
          <div>
            <div style={{ fontFamily: '"Outfit", sans-serif', fontSize: 11, letterSpacing: "0.22em", textTransform: "uppercase", color: "rgba(255,255,255,0.6)" }}>{t.footer.map}</div>
            <div style={{ display: "flex", flexDirection: "column", gap: 10, marginTop: 16 }}>
              {[["home", t.nav.home], ["experience", t.nav.house], ["contact", t.nav.contact]].map(([id, l]) => (
                <button key={id} onClick={() => { setPage(id); window.scrollTo({ top: 0 }); }} style={{ background: "none", border: "none", padding: 0, cursor: "pointer", color: "#fff", textAlign: "left", fontFamily: '"Outfit", sans-serif', fontSize: 15 }}>{l}</button>
              ))}
            </div>
          </div>
          <div>
            <div style={{ fontFamily: '"Outfit", sans-serif', fontSize: 11, letterSpacing: "0.22em", textTransform: "uppercase", color: "rgba(255,255,255,0.6)" }}>{t.footer.contact}</div>
            <div style={{ display: "flex", flexDirection: "column", gap: 10, marginTop: 16, fontFamily: '"Outfit", sans-serif', fontSize: 15 }}>
              <a href={`https://wa.me/${INFO.phoneIntl}`} style={{ color: "#fff", textDecoration: "none", display: "flex", gap: 10, alignItems: "center" }}><I.wa /> {INFO.phoneDisplay}</a>
              <a href={INFO.instagramUrl} style={{ color: "#fff", textDecoration: "none", display: "flex", gap: 10, alignItems: "center" }}><I.ig /> {INFO.instagramHandle}</a>
              <a href={INFO.mapsUrl} style={{ color: "rgba(255,255,255,0.85)", textDecoration: "none", display: "flex", gap: 10, alignItems: "center" }}><I.pin /> Cap Cana, La Marina</a>
            </div>
          </div>
        </div>
        <div style={{ marginTop: 56, paddingTop: 24, borderTop: "1px solid rgba(255,255,255,0.12)", display: "flex", justifyContent: "space-between", flexWrap: "wrap", gap: 12, fontFamily: '"Outfit", sans-serif', fontSize: 12, color: "rgba(255,255,255,0.55)" }}>
          <span>{t.footer.copy}</span>
          <span>{t.footer.sub}</span>
        </div>
      </div>
    </footer>
  );
}

/* ---------- Floating Instagram ---------- */
function FloatingWA({ palette, t }) {
  return (
    <a href={INFO.instagramUrl} target="_blank" rel="noreferrer" aria-label="Instagram" style={{
      position: "fixed", right: 24, bottom: 24, zIndex: 50,
      width: 56, height: 56, borderRadius: 999,
      background: "conic-gradient(from 210deg, #fdb74e, #d6356a, #8e2de2, #fdb74e)", color: "#fff",
      display: "flex", alignItems: "center", justifyContent: "center",
      boxShadow: "0 8px 24px rgba(0,0,0,0.18)", transition: "transform .3s ease",
    }} onMouseEnter={e => e.currentTarget.style.transform = "scale(1.08)"} onMouseLeave={e => e.currentTarget.style.transform = "scale(1)"}>
      <I.ig style={{ width: 26, height: 26 }} />
    </a>
  );
}

/* ---------- App ---------- */
function App() {
  const [tweaks, setTweak] = useTweaks(TWEAK_DEFAULTS);
  const [page, setPage] = useState("home");
  const [lang, setLang] = useState("en");
  const palette = PALETTES[tweaks.palette] || PALETTES.ocean;
  const t = TEXTS[lang];

  useEffect(() => {
    document.body.style.background = palette.bg;
    document.body.style.color = palette.ink;
  }, [palette]);

  return (
    <div data-screen-label={page === "home" ? "01 Inicio" : page === "experience" ? "02 La Casa" : "03 Contacto"}>
      <Nav page={page} setPage={setPage} palette={palette} lang={lang} setLang={setLang} t={t} />
      {page === "home" && <HomePage palette={palette} tweaks={tweaks} setPage={setPage} t={t} />}
      {page === "experience" && <ExperiencePage palette={palette} t={t} />}
      {page === "contact" && <ContactPage palette={palette} t={t} />}
      <Footer palette={palette} setPage={setPage} t={t} />
      {tweaks.showFloatingWA && <FloatingWA />}

      <TweaksPanel>
        <TweakSection label="Paleta">
          <TweakRadio label="Tono" value={tweaks.palette} onChange={v => setTweak("palette", v)}
            options={[
              { value: "ocean", label: "Ocean" },
              { value: "dusk", label: "Dusk" },
              { value: "reef", label: "Reef" },
            ]}/>
        </TweakSection>
        <TweakSection label="Portada">
          <TweakRadio label="Imagen" value={tweaks.heroImage} onChange={v => setTweak("heroImage", v)}
            options={[
              { value: "gazebo", label: "Gazebo" },
              { value: "interior", label: "Interior" },
              { value: "lounge", label: "Lounge" },
              { value: "night", label: "Noche" },
            ]}/>
        </TweakSection>
      </TweaksPanel>
    </div>
  );
}

ReactDOM.createRoot(document.getElementById("root")).render(<App />);
