// i18n.jsx — ES/EN translations + tiny lang state hook.
// Loaded after shared.jsx; exposes window.COPY_ES, window.COPY_EN, window.useLang.

const COPY_ES = COPY; // Spanish copy already lives in shared.jsx

const COPY_EN = {
  hero: {
    eyebrow: 'TULUM · PROPERTY MANAGEMENT · SINCE 2015',
    title: 'Your Tulum home,\ncared for like\nour own.',
    sub: 'Full-service operation with Superhost standards. 10 years of experience.',
    cta: 'Manage my property',
    ctaSub: 'Talk to an advisor · response in minutes',
  },
  stats: [
    { v: '10+', l: 'Years of experience' },
    { v: '93%', l: 'Satisfied guests' },
    { v: '4.9', l: 'Airbnb rating' },
  ],
  services: [
    { n: '01', t: 'Marketing',          d: 'Listings, photos and sync across all channels.', proof: '',
      bullets: ['Listings on Airbnb, web and social media', 'Calendar synced in real time', 'Professional photography and copywriting'] },
    { n: '02', t: 'Dynamic pricing',    d: 'Rates that adapt to market and seasonality.', proof: 'Daily optimization',
      bullets: ['Constant competition analysis', 'Adjustments by season and local events', 'Maximize income without losing occupancy'] },
    { n: '03', t: '24/7 hospitality',   d: 'Bilingual guest care throughout every stay.', proof: 'ES · EN',
      bullets: ['Response in under 5 minutes', 'Coordinated check-in and check-out', 'Bilingual concierge (ES · EN)'] },
    { n: '04', t: 'Cleaning & upkeep',  d: 'In-house staff with auditable checklist and vendor network.', proof: 'In-house · Preventive',
      bullets: ['Reliable cleaning team', 'Auditable post-stay checklist', 'Scheduled preventive maintenance'] },
    { n: '05', t: 'Accounting',         d: 'Deposits, utilities and supplier payments with traceability.', proof: 'Transparent',
      bullets: ['Direct deposits to your account', 'Utilities and tax payments', 'Full traceability of every movement'] },
    { n: '06', t: 'Monthly reports',    d: 'Operation and profit of your property, clear every month.', proof: 'Monthly',
      bullets: ['Detailed account statement', 'Occupancy and rating KPIs', 'Continuous improvement recommendations'] },
  ],
  benefits: [
    { n: '01', t: 'Asset value',       d: 'Your property keeps its value. No wear and tear.' },
    { n: '02', t: 'Consistent income', d: 'Maximized profitability with transparent revenue.' },
    { n: '03', t: 'Free time',         d: 'You enjoy. We operate.' },
  ],
  steps: [
    { n: '01', t: 'Conversation', d: 'We learn about your property and goals.' },
    { n: '02', t: 'Audit',        d: 'On-site visit, photography and pricing proposal.' },
    { n: '03', t: 'Launch',       d: 'We list and start receiving bookings.' },
    { n: '04', t: 'Operation',    d: 'We manage everything. You get the reports.' },
  ],
  kpis: [
    { v: '4.8',     l: 'Overall rating',         b: 'Benchmark: 4.8' },
    { v: '100%',    l: 'Response rate',          b: 'Benchmark: 90%' },
    { v: '0%',      l: 'Cancellations',          b: 'Benchmark: <1%' },
    { v: '4.8',  l: 'More occupancy vs peers', b: 'Above sector average' },
  ],
  decade: [
    { v: '10+',     l: 'Years' },
    { v: '87',      l: 'Properties' },
    { v: '10,000+', l: 'Guests' },
    { v: '2019',    l: 'Superhost since' },
  ],
  properties: [
    { id: 'mistiq-temple',   name: 'Mistiq Temple',   tag: 'Luxury Condo · 2 BR',           info: '4 pax · 2 BR · 2 beds · 2.5 baths · Private plunge pool',           rating: '4.64', reviews: 14, img: 'redesign/img/properties/mistiq-temple.jpg',   url: 'https://airbnb.com/h/mistiqtemple2b303' },
    { id: 'botanic',         name: 'Botanic',     tag: 'Rooftop Pool · 2 BR',           info: '6 pax · 2 BR · 3 beds · 2 baths · Plunge pool · 5 min beach',       rating: '4.81', reviews: 42, img: 'redesign/img/properties/botanic.jpg?v=2',     url: 'https://airbnb.com/h/botanic409' },
    { id: 'jungle-houses',   name: 'Jungle House',    tag: 'Private House · 3 BR',          info: '11 pax · 3 BR · 6 beds · 3.5 baths · Private pool · Parking',       rating: '4.81', reviews: 52, img: 'redesign/img/properties/jungle-houses.jpg?v=2',   url: 'https://airbnb.com/h/junglehouses1' },
    { id: 'mistiq-gardens',  name: 'Mistiq Gardens',  tag: 'Modern Loft · Guest Favorite',  info: '6 pax · 1 BR · 4 beds · 1 bath · 6 pools · Sky Pool',               rating: '5.0',  reviews: 8,  img: 'redesign/img/properties/mistiq-gardens.jpg',  url: 'https://airbnb.com/h/mistiqgardens128' },
  ],
  contact: {
    wa: '+52 998 148 2146',
    waHref: 'https://wa.me/529981482146',
    email: 'info@amtulum.com',
    emailHref: 'mailto:info@amtulum.com',
    instagram: '@am_tulum',
    instagramHref: 'https://www.instagram.com/am_tulum/',
    facebook: 'AM Tulum',
    facebookHref: 'https://www.facebook.com/profile.php?id=61578880155653',
  },
};

// UI strings (nav, buttons, labels) keyed by lang.
const UI = {
  es: {
    nav: { servicios: 'Servicios', beneficios: 'Beneficios', proceso: 'Proceso', portafolio: 'Portafolio', contacto: 'Contacto', cta: 'Gestionar mi propiedad' },
    hero: { howItWorks: 'Cómo funciona', scroll: 'Scroll', tag: 'PROPERTY MANAGEMENT · TULUM · DESDE 2015' },
    intro: { eyebrow: 'PARA PROPIETARIOS', title: ['Tu segunda casa', 'no debe ser', 'carga de trabajo'], titleItalic: 'carga de trabajo', body: 'Convertimos tu propiedad en una operación profesional — sin que pierdas el control, sin maltrato, sin sorpresas. Tú disfrutas; nosotros operamos.', pills: ['Pricing dinámico', 'Atención 24/7', 'Reporte mensual', 'Staff propio', 'Multi-canal', 'Sin sorpresas'] },
    services: { eyebrow: 'OPERACIÓN INTEGRAL', title: '6 áreas.', titleItalic: 'Un solo equipo', body: 'Cubrimos todo lo que tu propiedad necesita.' },
    benefits: { eyebrow: 'POR QUÉ AM TULUM', title: ['Un modelo', 'que'], titleItalic: 'trabaja para ti', body: '' },
    process:  { eyebrow: 'EL PROCESO', title: '4 pasos hasta tu', titleItalic: 'primera reserva' },
    portfolio:{ eyebrow: 'PORTAFOLIO', title: 'Hogares que', titleItalic: 'cuidamos', body: 'Propiedades activas en gestión con 4.9+ en Airbnb.', active: 'Activa', detail: 'Ver detalle →' },
    kpis:     { eyebrow: 'RESULTADOS VS INDUSTRIA', title: 'Datos verificables.', titleItalic: 'No promesas', highlightPre: 'de huéspedes nos califican', highlightStrong: '«Altamente Satisfechos»', highlightPost: 'en su estancia.', source: 'FUENTE: AIRBNB · JUL 2025', decade: 'Una década en números' },
    contact:  { eyebrow: 'HABLA CON UN ASESOR', title: 'Cuéntanos de', titleItalic: 'tu propiedad', body: 'Respuesta en menos de 30 minutos. Auditoría gratuita y sin compromiso.', wa: 'WhatsApp directo', email: 'Enviar email', auditTitle: 'QUÉ INCLUYE LA AUDITORÍA', audit: ['Visita y propuesta de mejoras', 'Inventario y equipamiento', 'Fotografías profesionales', 'Plan de lanzamiento en 30 días'] },
    footer:   { tagline: 'Property management boutique en Tulum. Operando desde 2015. Superhost desde 2019.', cols: [ { t: 'Servicios', l: ['Comercialización', 'Hospitalidad', 'Limpieza', 'Mantenimiento'] }, { t: 'Empresa', l: ['Sobre nosotros', 'Portafolio', 'Resultados', 'Proceso'] }, { t: 'Contacto', l: [] } ], legal: ['Privacidad'], rights: '© 2026 AM TULUM · TODOS LOS DERECHOS RESERVADOS', loc: 'Tulum, México' },
    misc: { propertiesInOp: 'Propiedades en operación' },
  },
  en: {
    nav: { servicios: 'Services', beneficios: 'Benefits', proceso: 'Process', portafolio: 'Portfolio', contacto: 'Contact', cta: 'Manage my property' },
    hero: { howItWorks: 'How it works', scroll: 'Scroll', tag: 'PROPERTY MANAGEMENT · TULUM · SINCE 2015' },
    intro: { eyebrow: 'FOR OWNERS', title: ['Your second home', 'shouldn\u2019t be', 'a job'], titleItalic: 'a job', body: 'We turn your property into a professional operation — without you losing control, without wear and tear, without surprises. You enjoy; we operate.', pills: ['Dynamic pricing', '24/7 care', 'Monthly reports', 'In-house staff', 'Multi-channel', 'No surprises'] },
    services: { eyebrow: 'INTEGRATED OPERATION', title: '6 areas.', titleItalic: 'One team', body: 'We cover everything your property needs.' },
    benefits: { eyebrow: 'WHY AM TULUM', title: ['A model', 'that'], titleItalic: 'works for you', body: '' },
    process:  { eyebrow: 'THE PROCESS', title: '4 steps to your', titleItalic: 'first booking' },
    portfolio:{ eyebrow: 'PORTFOLIO', title: 'Homes we', titleItalic: 'care for', body: 'Active properties under management with 4.9+ on Airbnb.', active: 'Active', detail: 'View detail →' },
    kpis:     { eyebrow: 'RESULTS VS INDUSTRY', title: 'Verifiable data.', titleItalic: 'No promises', highlightPre: 'of guests rate us', highlightStrong: '\u201CHighly Satisfied\u201D', highlightPost: 'on their stay.', source: 'SOURCE: AIRBNB · JUL 2025', decade: 'A decade in numbers' },
    contact:  { eyebrow: 'TALK TO AN ADVISOR', title: 'Tell us about', titleItalic: 'your property', body: 'Response in under 30 minutes. Free, no-commitment audit.', wa: 'WhatsApp direct', email: 'Send email', auditTitle: 'WHAT THE AUDIT INCLUDES', audit: ['Visit and improvement proposal', 'Inventory and furnishing', 'Professional photography', '30-day launch plan'] },
    footer:   { tagline: 'Boutique property management in Tulum. Operating since 2015. Superhost since 2019.', cols: [ { t: 'Services', l: ['Marketing', 'Hospitality', 'Cleaning', 'Maintenance'] }, { t: 'Company', l: ['About us', 'Portfolio', 'Results', 'Process'] }, { t: 'Contact', l: [] } ], legal: ['Privacy'], rights: '© 2026 AM TULUM · ALL RIGHTS RESERVED', loc: 'Tulum, Mexico' },
    misc: { propertiesInOp: 'Properties under management' },
  },
};

// Tiny hook: returns [lang, setLang]; persists to localStorage.
function useLang() {
  const [lang, setLangState] = React.useState(() => {
    try { return localStorage.getItem('amtulum.lang') || 'es'; } catch (e) { return 'es'; }
  });
  const setLang = (l) => {
    setLangState(l);
    try { localStorage.setItem('amtulum.lang', l); } catch (e) {}
  };
  return [lang, setLang];
}

// Convenience getter — returns the right COPY + UI bag for a lang.
function getContent(lang) {
  return {
    copy: lang === 'en' ? COPY_EN : COPY_ES,
    ui: UI[lang],
  };
}

Object.assign(window, { COPY_ES, COPY_EN, UI, useLang, getContent });
