// Data: neighborhoods across Dubai + Abu Dhabi, properties, guides.
// Images: Unsplash luxury interior/exterior photos (CDN hot-linked).

const U = (id, w=1600) => `https://images.unsplash.com/photo-${id}?auto=format&fit=crop&w=${w}&q=80`;

const NEIGHBORHOODS = [
  // --- DUBAI ---
  {
    id: 'palm',
    emirate: 'Dubai',
    name: 'Palm Jumeirah',
    tag: 'Iconic waterfront',
    blurb: 'The fronds. Private beaches, sea-facing villas, signature skyline views across the bay.',
    // SVG coords on 1600x900 viewBox
    ll: { lat: 25.1124, lng: 55.139 },
    labelSide: 'left',
    labelY: 0,
    accent: '#b89466',
    stats: { listings: 4, avg: 'AED 18.4M' }
  },
  {
    id: 'downtown',
    emirate: 'Dubai',
    name: 'Downtown',
    tag: 'Heart of the city',
    blurb: 'Burj Khalifa views, Opera District, fountain-side penthouses with concierge living.',
    ll: { lat: 25.1972, lng: 55.2744 },
    labelSide: 'right',
    labelY: -10,
    accent: '#8a6a3b',
    stats: { listings: 3, avg: 'AED 12.1M' }
  },
  {
    id: 'marina',
    emirate: 'Dubai',
    name: 'Dubai Marina',
    tag: 'Skyline canal',
    blurb: 'Glass towers along a man-made canal. Yacht berths, rooftop pools, sunset terraces.',
    ll: { lat: 25.0805, lng: 55.1403 },
    labelSide: 'left',
    labelY: 8,
    accent: '#a67a40',
    stats: { listings: 2, avg: 'AED 7.8M' }
  },
  {
    id: 'emirates-hills',
    emirate: 'Dubai',
    name: 'Emirates Hills',
    tag: 'The Beverly Hills of Dubai',
    blurb: 'Gated, golf-fronted mansions. The most exclusive residential address in the emirate.',
    ll: { lat: 25.0567, lng: 55.1745 },
    labelSide: 'left',
    labelY: 26,
    accent: '#6e5531',
    stats: { listings: 2, avg: 'AED 54.0M' }
  },
  {
    id: 'jumeirah-bay',
    emirate: 'Dubai',
    name: 'Jumeirah Bay Island',
    tag: 'Seahorse-shaped sanctuary',
    blurb: 'Bulgari-branded enclave. Private marina, boutique scale, curated residences only.',
    ll: { lat: 25.2078, lng: 55.245 },
    labelSide: 'right',
    labelY: 10,
    accent: '#b85c2c',
    stats: { listings: 2, avg: 'AED 38.0M' }
  },
  {
    id: 'hills-estate',
    emirate: 'Dubai',
    name: 'Dubai Hills Estate',
    tag: 'Park-side villas',
    blurb: 'Family-scale villas around an 18-hole championship course and central park.',
    ll: { lat: 25.105, lng: 55.25 },
    labelSide: 'right',
    labelY: 10,
    accent: '#8a6a3b',
    stats: { listings: 2, avg: 'AED 15.5M' }
  },

  // --- ABU DHABI ---
  {
    id: 'saadiyat',
    emirate: 'Abu Dhabi',
    name: 'Saadiyat Island',
    tag: 'Cultural island',
    blurb: 'Louvre Abu Dhabi, Guggenheim (forthcoming). Beachfront villas with a curator’s eye.',
    ll: { lat: 24.54, lng: 54.4325 },
    labelSide: 'right',
    labelY: -10,
    accent: '#8a6a3b',
    stats: { listings: 2, avg: 'AED 22.0M' }
  },
  {
    id: 'al-reem',
    emirate: 'Abu Dhabi',
    name: 'Al Reem Island',
    tag: 'Urban waterfront',
    blurb: 'Modern towers with creek views and a central-to-capital walkability.',
    ll: { lat: 24.4967, lng: 54.403 },
    labelSide: 'left',
    labelY: 8,
    accent: '#a67a40',
    stats: { listings: 1, avg: 'AED 6.4M' }
  },
  {
    id: 'yas',
    emirate: 'Abu Dhabi',
    name: 'Yas Island',
    tag: 'Resort living',
    blurb: 'Marina-side villas, Yas Links golf, theme-park adjacent but quiet when it counts.',
    ll: { lat: 24.4881, lng: 54.6031 },
    labelSide: 'right',
    labelY: 10,
    accent: '#b89466',
    stats: { listings: 1, avg: 'AED 9.2M' }
  },
];

// Properties keyed to neighborhoods.
const PROPERTIES = [
  // Palm Jumeirah
  {
    id: 'p1',
    nh: 'palm',
    title: 'Signature Villa, Frond K',
    type: 'Villa',
    price: 'AED 32,500,000',
    beds: 6, baths: 7, sqft: '8,400', plot: '11,200',
    view: 'Atlantis & open sea',
    tenure: 'Freehold',
    summary: 'A renovated signature villa on the outer frond, with direct beach access, a 20-metre infinity pool, and full floor-to-ceiling glazing facing the sea.',
    highlights: ['Private beach, 24m frontage', 'Infinity pool & sunken lounge', 'Staff quarters + 4-car garage', 'Custom millwork throughout', 'Smart-home (Crestron)'],
    gallery: [
      U('1613490493576-7fde63acd811'), // villa exterior
      U('1600585154340-be6161a56a0c'), // modern living
      U('1600566753190-17f0baa2a6c8'), // bedroom
      U('1600607687939-ce8a6c25118c'), // kitchen
      U('1600566753086-00f18fe6ba68'), // pool
    ]
  },
  {
    id: 'p2', nh: 'palm',
    title: 'Penthouse, One at Palm',
    type: 'Penthouse',
    price: 'AED 24,000,000',
    beds: 4, baths: 5, sqft: '6,100', plot: '—',
    view: 'Marina skyline & sunset',
    tenure: 'Freehold',
    summary: 'A corner full-floor residence at Dorchester Collection’s One at Palm. Italian stone, private pool on terrace, double-height living.',
    highlights: ['Dorchester-managed', 'Private terrace pool', 'Imported Italian stone', '2 parking + storage', '24-hour butler'],
    gallery: [
      U('1600596542815-ffad4c1539a9'),
      U('1600210492486-724fe5c67fb0'),
      U('1600585154526-990dced4db0d'),
      U('1600573472550-8090b5e0745e'),
    ]
  },
  {
    id: 'p3', nh: 'palm',
    title: 'Garden Home, Frond D',
    type: 'Villa',
    price: 'AED 12,800,000',
    beds: 4, baths: 5, sqft: '5,200', plot: '7,800',
    view: 'Garden & partial sea',
    tenure: 'Freehold',
    summary: 'Original layout garden home, vacant on transfer. Opportunity to renovate on one of the sought-after middle fronds.',
    highlights: ['Middle frond location', 'Vacant on transfer', 'Original layout', 'Renovation potential', 'Near The Pointe'],
    gallery: [
      U('1600585152220-90363fe7e115'),
      U('1600566753376-12c8ab7fb75b'),
      U('1615529182904-14819c35db37'),
      U('1600607687644-aac76f0e23ec'),
    ]
  },
  {
    id: 'p4', nh: 'palm',
    title: 'Beachfront Apartment, Alef',
    type: 'Apartment',
    price: 'AED 9,200,000',
    beds: 3, baths: 4, sqft: '3,400', plot: '—',
    view: 'Beach & sea',
    tenure: 'Freehold',
    summary: 'Low-rise beachfront with lift direct to residence. Wrap terrace and private plunge pool.',
    highlights: ['Direct lift access', 'Wrap terrace', 'Plunge pool', 'Beach club included', '2 parking'],
    gallery: [
      U('1600210491892-03d54c0aaf87'),
      U('1613977257363-707ba9348227'),
      U('1600607688969-a5bfcd646154'),
    ]
  },

  // Downtown
  {
    id: 'p5', nh: 'downtown',
    title: 'Penthouse, Burj Residences',
    type: 'Penthouse',
    price: 'AED 22,500,000',
    beds: 4, baths: 5, sqft: '5,800', plot: '—',
    view: 'Burj Khalifa & Fountain',
    tenure: 'Freehold',
    summary: 'A duplex penthouse facing the fountain. Full-height glazing, private cinema, and a rare fountain-side terrace.',
    highlights: ['Duplex layout', 'Fountain-side terrace', 'Private cinema', 'Chef’s kitchen', '3 parking'],
    gallery: [
      U('1600585154340-be6161a56a0c'),
      U('1600566753190-17f0baa2a6c8'),
      U('1600607687939-ce8a6c25118c'),
      U('1600585152220-90363fe7e115'),
    ]
  },
  {
    id: 'p6', nh: 'downtown',
    title: 'Residence, Armani Hotel',
    type: 'Apartment',
    price: 'AED 11,900,000',
    beds: 2, baths: 3, sqft: '2,400', plot: '—',
    view: 'Opera & Dubai Canal',
    tenure: 'Freehold',
    summary: 'Giorgio Armani’s personally curated residence interiors. Hotel services, signature “Armani/Casa” fit-out.',
    highlights: ['Armani interiors', 'Hotel services', 'Opera views', 'Tower amenities', 'Valet'],
    gallery: [
      U('1600596542815-ffad4c1539a9'),
      U('1600210492486-724fe5c67fb0'),
      U('1615529182904-14819c35db37'),
    ]
  },
  {
    id: 'p7', nh: 'downtown',
    title: 'Loft, Opera District',
    type: 'Apartment',
    price: 'AED 4,850,000',
    beds: 3, baths: 3, sqft: '2,100', plot: '—',
    view: 'Boulevard',
    tenure: 'Freehold',
    summary: 'Double-height loft with exposed steelwork. Walkable to Opera, Dubai Mall, and Boulevard cafés.',
    highlights: ['Double-height', 'Exposed steel', 'Walk to Opera', 'Allocated parking', 'Vacant'],
    gallery: [
      U('1600566753086-00f18fe6ba68'),
      U('1600573472550-8090b5e0745e'),
      U('1600607687939-ce8a6c25118c'),
    ]
  },

  // Marina
  {
    id: 'p8', nh: 'marina',
    title: 'Sky Residence, Cayan Tower',
    type: 'Apartment',
    price: 'AED 8,400,000',
    beds: 3, baths: 4, sqft: '2,900', plot: '—',
    view: 'Marina & Palm',
    tenure: 'Freehold',
    summary: 'Curved tower residence with panoramic dual-aspect views. Recently renovated with bespoke joinery.',
    highlights: ['Dual aspect', 'Bespoke joinery', 'Tower pool & gym', '2 parking', 'Walk to JBR'],
    gallery: [
      U('1600596542815-ffad4c1539a9'),
      U('1600585154340-be6161a56a0c'),
      U('1600210491892-03d54c0aaf87'),
    ]
  },
  {
    id: 'p9', nh: 'marina',
    title: 'Yacht-Berth Penthouse',
    type: 'Penthouse',
    price: 'AED 7,200,000',
    beds: 3, baths: 4, sqft: '3,200', plot: '—',
    view: 'Marina promenade',
    tenure: 'Freehold',
    summary: 'Lower-level penthouse with private roof terrace and berth for 60-foot yacht (by separate arrangement).',
    highlights: ['Private roof terrace', 'Yacht berth option', 'Direct promenade', 'Chef’s kitchen'],
    gallery: [
      U('1600607687644-aac76f0e23ec'),
      U('1613977257363-707ba9348227'),
      U('1600566753086-00f18fe6ba68'),
    ]
  },

  // Emirates Hills
  {
    id: 'p10', nh: 'emirates-hills',
    title: 'Mansion on Sector E',
    type: 'Villa',
    price: 'AED 72,000,000',
    beds: 8, baths: 11, sqft: '24,500', plot: '38,000',
    view: 'Montgomerie fairway',
    tenure: 'Freehold',
    summary: 'A complete ground-up rebuild on a premier sector. Limestone, walnut, and a 25m indoor pool.',
    highlights: ['Ground-up rebuild', '25m indoor pool', 'Spa & hammam', 'Staff wing (5)', 'Car showroom (10)'],
    gallery: [
      U('1613490493576-7fde63acd811'),
      U('1600585154526-990dced4db0d'),
      U('1600566753190-17f0baa2a6c8'),
      U('1600585154340-be6161a56a0c'),
    ]
  },
  {
    id: 'p11', nh: 'emirates-hills',
    title: 'Renovated Villa, Sector W',
    type: 'Villa',
    price: 'AED 36,000,000',
    beds: 6, baths: 8, sqft: '14,000', plot: '21,500',
    view: 'Lake & course',
    tenure: 'Freehold',
    summary: 'Recently renovated contemporary villa with lake views and a quiet cul-de-sac position.',
    highlights: ['Lake frontage', 'Contemporary renovation', 'Home cinema', 'Staff + driver', 'Vacant'],
    gallery: [
      U('1600585152220-90363fe7e115'),
      U('1615529182904-14819c35db37'),
      U('1600607688969-a5bfcd646154'),
    ]
  },

  // Jumeirah Bay Island
  {
    id: 'p12', nh: 'jumeirah-bay',
    title: 'Bulgari Villa, Island East',
    type: 'Villa',
    price: 'AED 56,000,000',
    beds: 6, baths: 8, sqft: '11,800', plot: '14,200',
    view: 'Sea & skyline',
    tenure: 'Freehold',
    summary: 'An Antonio Citterio-designed beachfront villa within the Bulgari resort enclave. Private jetty.',
    highlights: ['Antonio Citterio', 'Private jetty', 'Bulgari services', '25m lap pool', 'Beach frontage'],
    gallery: [
      U('1600210492486-724fe5c67fb0'),
      U('1613490493576-7fde63acd811'),
      U('1600573472550-8090b5e0745e'),
    ]
  },
  {
    id: 'p13', nh: 'jumeirah-bay',
    title: 'Residence, Bulgari Lighthouse',
    type: 'Apartment',
    price: 'AED 20,000,000',
    beds: 4, baths: 5, sqft: '5,500', plot: '—',
    view: 'Lighthouse & sea',
    tenure: 'Freehold',
    summary: 'An early-release residence in the forthcoming Lighthouse tower. Bulgari-appointed interiors.',
    highlights: ['Off-plan (2027)', 'Bulgari interiors', 'Private pool', 'Exclusive marina', 'Unit 04'],
    gallery: [
      U('1600596542815-ffad4c1539a9'),
      U('1600210491892-03d54c0aaf87'),
      U('1615529182904-14819c35db37'),
    ]
  },

  // Dubai Hills Estate
  {
    id: 'p14', nh: 'hills-estate',
    title: 'Fairway Villa, Golf Place',
    type: 'Villa',
    price: 'AED 18,500,000',
    beds: 5, baths: 6, sqft: '7,200', plot: '9,500',
    view: 'Fairway & park',
    tenure: 'Freehold',
    summary: 'Modern fairway villa with pool and rooftop terrace. Walk to the clubhouse.',
    highlights: ['Fairway frontage', 'Rooftop terrace', 'Pool + garden', 'Walk to clubhouse'],
    gallery: [
      U('1600585152220-90363fe7e115'),
      U('1600566753376-12c8ab7fb75b'),
      U('1613977257363-707ba9348227'),
    ]
  },
  {
    id: 'p15', nh: 'hills-estate',
    title: 'Townhouse, Maple',
    type: 'Villa',
    price: 'AED 12,500,000',
    beds: 4, baths: 5, sqft: '3,400', plot: '3,900',
    view: 'Park',
    tenure: 'Freehold',
    summary: 'End-unit townhouse backing onto the central park. Family-scale and immediate possession.',
    highlights: ['End unit', 'Park-backing', 'Vacant on transfer', 'Community pool'],
    gallery: [
      U('1600607687644-aac76f0e23ec'),
      U('1600210491892-03d54c0aaf87'),
    ]
  },

  // Saadiyat
  {
    id: 'p16', nh: 'saadiyat',
    title: 'Beach Villa, Saadiyat Reserve',
    type: 'Villa',
    price: 'AED 28,000,000',
    beds: 5, baths: 6, sqft: '9,800', plot: '13,500',
    view: 'Beach & Louvre',
    tenure: 'Freehold',
    summary: 'A low, long beach villa by the Cultural District. Native planting, passive cooling, and a museum-grade art wall.',
    highlights: ['Beach frontage', 'Passive-cool design', 'Art wall', 'Near Louvre', 'Staff quarters'],
    gallery: [
      U('1613490493576-7fde63acd811'),
      U('1600585154526-990dced4db0d'),
      U('1600210492486-724fe5c67fb0'),
    ]
  },
  {
    id: 'p17', nh: 'saadiyat',
    title: 'Mamsha Al Saadiyat Residence',
    type: 'Apartment',
    price: 'AED 15,500,000',
    beds: 4, baths: 5, sqft: '4,100', plot: '—',
    view: 'Promenade & sea',
    tenure: 'Freehold',
    summary: 'Full-floor residence on the beachfront promenade. Private pool, direct beach lift.',
    highlights: ['Full floor', 'Private pool', 'Beach lift', 'Mamsha promenade'],
    gallery: [
      U('1600596542815-ffad4c1539a9'),
      U('1600566753086-00f18fe6ba68'),
      U('1600607687939-ce8a6c25118c'),
    ]
  },

  // Al Reem
  {
    id: 'p18', nh: 'al-reem',
    title: 'Penthouse, Sun & Sky Towers',
    type: 'Penthouse',
    price: 'AED 6,400,000',
    beds: 4, baths: 5, sqft: '4,800', plot: '—',
    view: 'Skyline & creek',
    tenure: 'Freehold',
    summary: 'Double-height penthouse with wrap-around terrace. Recently refurbished.',
    highlights: ['Wrap terrace', 'Double-height', '3 parking', 'Vacant'],
    gallery: [
      U('1600585154340-be6161a56a0c'),
      U('1600210491892-03d54c0aaf87'),
      U('1613977257363-707ba9348227'),
    ]
  },

  // Yas
  {
    id: 'p19', nh: 'yas',
    title: 'Marina Villa, West Yas',
    type: 'Villa',
    price: 'AED 9,200,000',
    beds: 5, baths: 6, sqft: '5,800', plot: '8,100',
    view: 'Marina',
    tenure: 'Freehold',
    summary: 'Contemporary villa with marina mooring and private pool. Quiet end of the island.',
    highlights: ['Marina mooring', 'Private pool', 'Yas Links adjacent', 'Vacant on transfer'],
    gallery: [
      U('1600585152220-90363fe7e115'),
      U('1600566753376-12c8ab7fb75b'),
      U('1615529182904-14819c35db37'),
    ]
  },
];

const GUIDES = [
  {
    id: 'fees',
    title: 'The real cost of buying in the UAE',
    summary: 'Every fee, itemized. A typical buyer pays 6–8% on top of the asking price. Here’s where it goes.',
    items: [
      { label: 'Dubai Land Department (DLD) transfer fee', value: '4% of purchase price', note: 'Split 2% / 2% by custom, paid in full at transfer.' },
      { label: 'Abu Dhabi municipality transfer fee', value: '2% of purchase price', note: 'Notably lower than Dubai, one of Abu Dhabi’s quiet advantages.' },
      { label: 'Trustee / registration fee', value: 'AED 4,000 (under 500k) or 4,200', note: 'Paid to the registration trustee office on the day of transfer.' },
      { label: 'Agency fee', value: '2% + 5% VAT', note: 'Paid by the buyer in Dubai, customary.' },
      { label: 'Mortgage registration (if financed)', value: '0.25% of loan + 290', note: 'Only if you’re financing.' },
      { label: 'NOC from developer', value: 'AED 500–5,000', note: 'Varies by developer. I handle this for you.' },
      { label: 'Conveyancing (optional)', value: 'AED 6,000–12,000', note: 'I recommend it for off-plan or complex transfers.' },
    ]
  },
  {
    id: 'process',
    title: 'From first viewing to keys in hand',
    summary: 'A typical cash transaction closes in 14–30 days. A mortgaged one, 30–60. Here’s the week-by-week.',
    items: [
      { label: 'Week 0, brief & shortlist', value: '1–3 days', note: 'We define budget, areas, and non-negotiables. I send a curated shortlist, usually 5 to 8 properties.' },
      { label: 'Week 1, private viewings', value: '2–5 days', note: 'I arrange all viewings back-to-back. No public tours. I drive.' },
      { label: 'Week 1–2, offer & MoU (Form F)', value: '1–2 days', note: '10% deposit cheque to the seller. MoU signed by both parties.' },
      { label: 'Week 2–4, NOC + bank (if financed)', value: '7–21 days', note: 'Developer NOC issued. If mortgaging, final bank offer letter.' },
      { label: 'Transfer day, trustee office', value: '1–2 hours', note: 'Both parties sign. Manager’s cheques exchanged. Title deed issued same day.' },
      { label: 'Handover', value: 'Same day', note: 'Keys, access cards, DEWA transfer initiated. Welcome home.' },
    ]
  },
  {
    id: 'areas',
    title: 'How to choose between neighborhoods',
    summary: 'A quick taxonomy I use with every client. Start here, then we refine in person.',
    items: [
      { label: 'If you want rental yield', value: 'Marina, JVC, Business Bay', note: 'Typical gross yields 6–8%. Smaller, turnkey units.' },
      { label: 'If you want a trophy home', value: 'Palm, Emirates Hills, Jumeirah Bay', note: 'Yields drop (2–4%) but capital appreciation has been strongest here.' },
      { label: 'If you want family life', value: 'Dubai Hills, Arabian Ranches, Saadiyat', note: 'Schools within 10 minutes, parks, family compounds.' },
      { label: 'If you’re moving from abroad', value: 'Downtown, DIFC, Al Reem', note: 'Turnkey, serviced, walkable. Easy first chapter.' },
      { label: 'If you want quiet', value: 'Al Barari, Saadiyat Reserve, Yas', note: 'Density drops. Mature planting. Measured, slower pace.' },
      { label: 'If you want off-plan upside', value: 'Dubai Islands, Ramhan Island, Yas South', note: 'Higher risk, 2026–2028 handovers. I only recommend developers I have transacted with twice.' },
    ]
  },
  {
    id: 'offplan',
    title: 'Off-plan vs. ready, how I advise',
    summary: 'A checklist I run through before placing a deposit on anything off-plan.',
    items: [
      { label: 'Developer track record', value: 'Minimum 3 delivered projects', note: 'I keep a private list of developers who have hit their handover dates within 90 days, twice.' },
      { label: 'Escrow account', value: 'Must be RERA-registered', note: 'I verify escrow status and see the bank letter before you sign.' },
      { label: 'Payment plan', value: 'Avoid front-loaded', note: '30/70 or 40/60 on handover is sensible. Anything 60/40 against you is a red flag.' },
      { label: 'Specification sheet', value: 'Read every page', note: 'Finish grades, appliance brands, ceiling heights. I translate this into English.' },
      { label: 'Exit strategy', value: 'Know before you buy', note: 'At what milestone will you exit if plans change? I price this into the decision.' },
    ]
  },
  {
    id: 'foreign',
    title: 'Buying as a foreigner, residency & visas',
    summary: 'The 2022 changes made UAE property one of the most straightforward paths to long-term residency in the region.',
    items: [
      { label: 'Freehold eligibility', value: 'Any nationality', note: 'In designated freehold zones, which covers effectively every area I sell.' },
      { label: '2-year Investor Visa', value: 'AED 750,000+', note: 'Property must be completed. Renewable.' },
      { label: '10-year Golden Visa', value: 'AED 2,000,000+', note: 'Single property or portfolio. Sponsors family.' },
      { label: 'Mortgage cap (non-resident)', value: '50–65% LTV', note: 'Rates from ~4.5% fixed. I connect you with a private banker.' },
      { label: 'Tax', value: '0% on rental income & capital gains', note: 'No income tax on individuals. VAT (5%) only applies to commercial.' },
    ]
  },
];

window.DATA = { NEIGHBORHOODS, PROPERTIES, GUIDES };
