// shared.jsx — SVG icons, utilities, and BRAND config (edit here for each branch/brand)

/* ─── BRAND CONFIG ─────────────────────────────────────────────────────────
   Change only this block to switch brands across git branches.
   All text, theme colours, images, routes, services, and copy live here.
   ──────────────────────────────────────────────────────────────────────── */
const BRAND = {

  /* ── Identity ─────────────────────────────────────────────── */
  name:     "XE GHÉP VĂN TÙNG",     // all-caps logo mark
  nameFull: "Xe Ghép Văn Tùng",      // body copy / headings
  tagline:  "XE GHÉP MIỀN TRUNG",   // sub-line under logo
  logo:     "uploads/logo.png",
  founded:  2018,

  /* ── Contact ──────────────────────────────────────────────── */
  phone:      "093.193.2244",
  phoneHref:  "tel:+84931932244",
  phoneZalo:  "0931932244",          // for zalo.me/{phoneZalo}
  address:    "7/560 Nguyễn Tất Thành, Thành phố Huế",
  email:      "xeghepvantung@gmail.com",

  /* ── Social ───────────────────────────────────────────────── */
  social: {
    facebook: "https://www.facebook.com/david.rin.58",
    zalo:     "https://zalo.me/0931932244",
    messenger:"https://www.facebook.com/david.rin.58",
  },

  /* ── SEO / <head> metadata ────────────────────────────────── */
  seo: {
    title:       "Xe Ghép Văn Tùng — Xe Ghép Huế · Đà Nẵng · Hội An",
    description: "Đặt xe ghép, xe limousine, đưa đón sân bay tuyến Huế · Đà Nẵng · Hội An. Giá niêm yết, đón tận nơi, hotline 093.193.2244.",
    siteName:    "Xe Ghép Văn Tùng",
    canonical:   "https://www.xeghepvantung.com/",
    ogImage:     "https://www.xeghepvantung.com/uploads/logo.png",
    ogImageAlt:  "Logo Xe Ghép Văn Tùng",
    favicon:     "uploads/logo.png",
  },

  /* ── Navigation links ─────────────────────────────────────── */
  navLinks: [
    { id: "trang-chu", label: "Trang chủ" },
    { id: "dich-vu",   label: "Dịch vụ" },
    { id: "bang-gia",  label: "Bảng giá" },
    { id: "faq",       label: "Liên hệ" },
    { id: "tin-tuc",   label: "Tin tức" },
  ],

  /* ── Hero section copy ────────────────────────────────────── */
  hero: {
    badge:       "Xe ghép · Đưa đón sân bay · Limousine",
    badgeMobile: "Xe ghép · Limousine",
    heading:     "XE GHÉP",
    cities:      ["HUẾ", "ĐÀ NẴNG", "HỘI AN"],
  },

  /* ── Brand intro section ──────────────────────────────────── */
  intro: {
    eyebrow:     "Giới thiệu",
    heading:     "Xe Ghép Văn Tùng",
    sub:         "— Dịch vụ chuyên nghiệp — Giá cả cạnh tranh —",
    description: "Xe Ghép Văn Tùng — Đơn vị xe ghép uy tín tuyến Huế · Đà Nẵng · Hội An. Hơn 6 năm đồng hành cùng hàng nghìn gia đình Việt và du khách quốc tế.",
  },

  /* ── Utility bar (top of page, desktop only) ─────────────── */
  utilityBar: "Dịch vụ chuyên nghiệp — Giá cả cạnh tranh",

  /* ── CTA banner ───────────────────────────────────────────── */
  ctaBanner: {
    eyebrow: "Sẵn sàng cho chuyến đi của bạn?",
    heading: "Một cuộc gọi — và đi.",
  },

  /* ── Footer ───────────────────────────────────────────────── */
  footer: {
    description: "Xe Ghép Văn Tùng chuyên cung cấp dịch vụ xe ghép, xe ké cao cấp tuyến Huế · Đà Nẵng · Hội An. Đáp ứng mọi tiêu chí mà quý khách mong muốn.",
    copyrightEnd: 2026,
  },

  /* ── Booking modal ────────────────────────────────────────── */
  booking: {
    cities:       ["Huế", "Đà Nẵng", "Hội An", "Sân bay Đà Nẵng"],
    defaultFrom:  "Huế",
    defaultTo:    "Đà Nẵng",
    successToast: "Đặt xe thành công! Tổng đài sẽ gọi xác nhận trong 5 phút.",
    errorMsg:     "Không gửi được. Vui lòng gọi 093.193.2244 để đặt trực tiếp.",
    confirmLine:  "Tổng đài sẽ gọi xác nhận tại số",
    confirmTime:  "trong vòng 5 phút",
  },

  /* ── Vehicle types (booking modal step 0) ─────────────────── */
  vehicleTypes: [
    { v: "Xe ghép Limousine",    desc: "Ghế đơn, 9 chỗ" },
    { v: "Xe ghép 7 chỗ",        desc: "Fortuner, Innova" },
    { v: "Bao xe 4 chỗ",         desc: "Sedan riêng" },
    { v: "Bao xe 7 chỗ",         desc: "Đi nhóm, gia đình" },
    { v: "Bao Limousine 9 chỗ",  desc: "VIP đoàn lớn" },
  ],

  /* ── Departure times ──────────────────────────────────────── */
  times: [
    "04:30","05:00","05:30","06:00","06:30","07:00","07:30","08:00","08:30","09:00","09:30",
    "10:00","10:30","11:00","11:30","12:00","12:30","13:00","13:30","14:00","14:30","15:00",
    "15:30","16:00","16:30","17:00","17:30","18:00","18:30","19:00","19:30","20:00","20:30","21:00",
  ],

  /* ── Routes (booking form dropdowns) ─────────────────────── */
  routes: [
    { from: "Huế",       to: "Đà Nẵng", duration: "2h 15p",  km: "95 km",  price: "150.000đ", popular: true },
    { from: "Đà Nẵng",   to: "Hội An",  duration: "45 phút", km: "30 km",  price: "100.000đ" },
    { from: "Huế",       to: "Hội An",  duration: "3h 00p",  km: "125 km", price: "220.000đ" },
    { from: "Sân bay ĐN",to: "Hội An",  duration: "40 phút", km: "28 km",  price: "180.000đ", airport: true },
  ],

  /* ── Fleet ────────────────────────────────────────────────── */
  fleet: [
    { name: "Dcar Limousine 9 chỗ",   seats: 9,  tag: "VIP",          desc: "Ghế da, massage, không gian riêng" },
    { name: "Ford Transit Limousine",  seats: 10, tag: "Phổ thông",    desc: "Rộng rãi, phù hợp nhóm gia đình" },
    { name: "Toyota Hiace 11 chỗ",    seats: 11, tag: "Hành lý lớn",  desc: "Khoang chứa rộng, đi sân bay" },
    { name: "Hyundai Solati Sky",      seats: 9,  tag: "Sky View",     desc: "Trần kính, view rộng dọc đường" },
  ],

  /* ── Why us section ───────────────────────────────────────── */
  whyUs: {
    eyebrow: "Tại sao chọn",
    heading: "Tại sao chọn Xe Ghép Văn Tùng",
    sub:     "Sự hài lòng của quý khách là niềm vui của chúng tôi.",
    items: [
      { icon: "shield", t: "Uy Tín Và Đúng Giờ",       d: "Cam kết mang đến quý khách trải nghiệm an toàn và luôn đúng lịch trình." },
      { icon: "check",  t: "Giá Cả Cạnh Tranh",         d: "Mức giá tối ưu nhất, phù hợp với mọi nhu cầu di chuyển của bạn." },
      { icon: "car",    t: "Xe Mới, Sạch Sẽ, Êm Ái",    d: "Xe đời mới, nội thất sạch sẽ, chạy êm như ru — chỉ cần ngồi và tận hưởng." },
      { icon: "user",   t: "Đội Ngũ Tài Xế",             d: "Đội ngũ tài xế thân thiện, sẵn sàng hỗ trợ khách hàng tận tâm và chu đáo." },
    ],
  },

  /* ── Process steps ────────────────────────────────────────── */
  process: {
    eyebrow: "Quy trình",
    heading: "Quy trình đặt xe đơn giản",
    sub:     "Chỉ 3 bước để có chuyến đi an toàn, đúng giờ.",
    steps: [
      { icon: "car",    t: "Liên hệ: Gọi/Zalo", d: "Đặt xe dễ dàng qua hotline hoặc Zalo. Tổng đài xác nhận ngày giờ đón." },
      { icon: "check",  t: "Xác nhận",            d: "Tài xế Văn Tùng gọi xác nhận trước giờ đón 15–30 phút." },
      { icon: "shield", t: "Thanh toán",           d: "Thanh toán khi xuống xe bằng tiền mặt, QR hoặc chuyển khoản." },
    ],
  },

  /* ── Feature chips ────────────────────────────────────────── */
  features: [
    { icon: "shield", title: "An toàn 5 sao", text: "Tài xế 5+ năm kinh nghiệm, bảo hiểm hành khách trọn chuyến." },
    { icon: "clock",  title: "Đúng giờ",       text: "Đón đúng giờ ±5 phút. Tài xế gọi xác nhận trước 30 phút." },
    { icon: "pin",    title: "Đón tận nơi",     text: "Đón tại địa chỉ trong nội thành. Không phụ phí." },
    { icon: "car",    title: "Xe đời mới",      text: "Toàn bộ xe ≤ 3 năm tuổi. Bảo dưỡng hàng tuần." },
    { icon: "phone",  title: "Hỗ trợ 24/7",     text: "Tổng đài và Zalo trực 24/7. Phản hồi dưới 1 phút." },
    { icon: "user",   title: "Giá niêm yết",    text: "Không phụ thu cuối tuần, không phát sinh chi phí." },
  ],

  /* ── Services ─────────────────────────────────────────────── */
  services: [
    { route: "Huế — Đà Nẵng",    from: "Huế",     to: "Đà Nẵng", type: "Xe ghép 7 chỗ",       desc: "1 vé ghép xe Fortuner",    price: "150.000đ",   tag: "ghep", hot: true },
    { route: "Huế — Đà Nẵng",    from: "Huế",     to: "Đà Nẵng", type: "Xe ghép Limousine",   desc: "1 vé ghép xe Limousine",   price: "180.000đ",   tag: "limo" },
    { route: "Huế — Đà Nẵng",    from: "Huế",     to: "Đà Nẵng", type: "Bao xe 4 chỗ",        desc: "Đi riêng",                 price: "700.000đ",   tag: "bao" },
    { route: "Huế — Đà Nẵng",    from: "Huế",     to: "Đà Nẵng", type: "Bao xe 7 chỗ",        desc: "Đi riêng — Fortuner",      price: "900.000đ",   tag: "bao" },
    { route: "Huế — Đà Nẵng",    from: "Huế",     to: "Đà Nẵng", type: "Bao Limousine 9 chỗ", desc: "Đoàn lớn, VIP",            price: "1.500.000đ", tag: "limo" },
    { route: "Huế — Hội An",     from: "Huế",     to: "Hội An",  type: "Bao xe 4 chỗ",        desc: "Đi riêng",                 price: "900.000đ",   tag: "bao" },
    { route: "Huế — Hội An",     from: "Huế",     to: "Hội An",  type: "Bao xe 7 chỗ",        desc: "Đi riêng — Fortuner",      price: "1.100.000đ", tag: "bao" },
    { route: "Đà Nẵng — Hội An", from: "Đà Nẵng", to: "Hội An",  type: "Bao xe 4 chỗ",        desc: "Sân bay → Phố cổ",         price: "250.000đ",   tag: "bao" },
    { route: "Đà Nẵng — Hội An", from: "Đà Nẵng", to: "Hội An",  type: "Bao xe 7 chỗ",        desc: "Đi nhóm, gia đình",        price: "300.000đ",   tag: "bao" },
  ],

  serviceFilters: [
    { key: "all",  label: "Tất cả" },
    { key: "ghep", label: "Xe ghép" },
    { key: "limo", label: "Limousine" },
    { key: "bao",  label: "Bao xe" },
  ],

  /* ── Gallery labels (must match SITE_IMAGES.gallery order) ── */
  gallery: [
    "Kia Carnival – Đen", "Toyota Fortuner – Trắng", "Kia Carnival – Sau",
    "Fortuner – Hậu", "Fortuner – Trước trắng", "Fortuner – Đen",
    "Limousine Dcar nội thất", "Văn phòng Huế", "Ford Transit limousine",
  ],

  /* ── Reviews ──────────────────────────────────────────────── */
  reviews: [
    { name: "Anh Hoàng Phúc", role: "Kỹ sư, Đà Nẵng",         stars: 5, avatar: "uploads/avatar-hoang-phuc.jpg",
      text: "Hay phải lên Huế họp, từ hồi dùng Văn Tùng thì không còn lo nữa. Nhắn Zalo là có xe, tài xế chưa bao giờ trễ dù mình đặt lúc 5 giờ sáng. Xe sạch, yên tĩnh, ngủ được luôn." },
    { name: "Chị Lan Phương",  role: "Giáo viên, Huế",          stars: 5, avatar: "uploads/avatar-lan-phuong.jpg",
      text: "Dẫn học sinh đi tham quan Hội An, bao nguyên xe 7 chỗ. Anh tài kiên nhẫn chờ cả tiếng đồng hồ không phàn nàn gì. Giá cũng hợp lý hơn thuê xe du lịch nhiều." },
    { name: "Chị Bảo Châu",    role: "Nhân viên văn phòng",     stars: 5, avatar: "uploads/avatar-bao-chau.jpg",
      text: "Mình hay đặt chuyến 5h30 sáng để kịp bay. Văn Tùng nhắn xác nhận tối hôm trước, hôm sau tài xế đã đứng dưới nhà lúc 5h20. Chưa một lần làm mình trễ." },
    { name: "Anh Thanh Bình",  role: "Hướng dẫn viên du lịch",  stars: 5, avatar: "uploads/avatar-thanh-binh.jpg",
      text: "Thường xuyên giới thiệu khách quốc tế đi Văn Tùng vì tài xế lịch sự, xe không có mùi, đúng giờ. Khách của mình toàn hỏi lại số để lần sau tự đặt." },
    { name: "Chị Thu Hà",      role: "Blogger du lịch",          stars: 5, avatar: "uploads/avatar-thu-ha.jpg",
      text: "Đặt Limousine đi Hội An, ngồi như máy bay hạng thương gia. Ghế rộng, có chăn, tài xế không mở nhạc ồn ào. Đến nơi vẫn còn tỉnh táo đi dạo phố cổ ngay." },
  ],

  /* ── News / Blog posts ────────────────────────────────────── */
  news: [
    { tag: "Dịch vụ",    title: "Dịch vụ xe ghép Huế — Đà Nẵng — Hội An | Xe Ghép Văn Tùng",  date: "24.05.2026", time: "8:25", read: "5 phút", excerpt: "Tổng hợp các tuyến và bảng giá mới nhất 2026, mẹo chọn dịch vụ phù hợp cho từng nhu cầu di chuyển." },
    { tag: "Du lịch",    title: "Khám phá hành trình du lịch Huế — Đà Nẵng",                    date: "24.05.2026", time: "8:26", read: "8 phút", excerpt: "Cẩm nang 3 ngày 2 đêm xuyên ba thành phố — điểm đến không thể bỏ qua, quán ăn địa phương và lưu ý đi xe." },
    { tag: "Vận chuyển", title: "Dịch vụ nhận gửi hàng hoá an toàn, nhanh chóng và tiện lợi",  date: "24.05.2026", time: "8:25", read: "4 phút", excerpt: "Văn Tùng mở rộng dịch vụ gửi hàng kèm chuyến — bảng giá theo kích thước, cam kết giao đúng giờ." },
  ],

  /* ── FAQ ─────────────────────────────────────────────────── */
  faq: [
    { q: "Văn Tùng có đến tận địa chỉ đón không?",
      a: "Có. Tài xế đến đúng địa chỉ bạn cung cấp trong nội thành Huế, Đà Nẵng và Quảng Nam — không cần ra điểm tập trung. Ngoại thành vui lòng báo trước để sắp xếp." },
    { q: "Có thể thanh toán bằng chuyển khoản không?",
      a: "Được. Bạn có thể thanh toán tiền mặt khi lên xe, chuyển khoản trước hoặc quét QR qua Momo, ZaloPay, VietQR." },
    { q: "Lỡ cần huỷ chuyến thì sao?",
      a: "Huỷ trước giờ khởi hành là miễn phí hoàn toàn. Báo sớm giúp chúng tôi bố trí lại cho khách khác." },
    { q: "Trẻ nhỏ đi cùng có tính vé riêng không?",
      a: "Trẻ dưới 5 tuổi ngồi cùng ghế với người lớn được miễn phí. Trẻ từ 5 tuổi trở lên tính một vé người lớn để đảm bảo có chỗ ngồi riêng và an toàn hành trình." },
    { q: "Mang nhiều hành lý có được không?",
      a: "Mỗi khách được mang 1 vali ≤ 20kg và 1 balo xách tay. Hành lý quá kích thước hoặc quá số lượng báo trước để tài xế sắp xếp khoang, phụ thu 30.000đ/kiện thêm." },
    { q: "Văn Tùng có nhận chuyển hàng giữa các tỉnh không?",
      a: "Có. Nhận gửi hàng nhỏ theo chuyến giữa Huế, Đà Nẵng và Hội An. Phí từ 80.000đ tuỳ kích thước, giao tận nơi hoặc khách tự lấy tại điểm đến. Nhắn Zalo để báo trước." },
  ],

  /* ── Theme — "Plum & Gold" ─────────────────────────────────── */
  theme: {
    "--c-navy":        "#2D1635",
    "--c-navy-soft":   "#431F50",
    "--c-navy-deep":   "#1A0C20",
    "--c-cream":       "#F8F4F0",
    "--c-cream-2":     "#EDE0D8",
    "--c-paper":       "#FFFFFF",
    "--c-ink":         "#1A0D22",
    "--c-ink-soft":    "#4A3058",
    "--c-mute":        "#8A6898",
    "--c-line":        "rgba(45,22,53,0.10)",
    "--c-line-strong": "rgba(45,22,53,0.18)",
    "--c-accent":      "#D4A840",
    "--c-accent-deep": "#B08820",
    "--c-accent-soft": "#F5E4A8",
    "--c-success":     "#3A6B40",
    "--card-radius":   "16px",
    "--card-radius-sm":"10px",
  },
};

/* Apply BRAND.theme to CSS custom properties at load time */
(function applyTheme() {
  const root = document.documentElement.style;
  Object.entries(BRAND.theme).forEach(([k, v]) => root.setProperty(k, v));
})();

/* Apply BRAND.seo to <head> meta tags at load time */
(function applySEO() {
  const s = BRAND.seo;
  document.title = s.title;
  const set = (sel, attr, val) => {
    const el = document.querySelector(sel);
    if (el && val) el.setAttribute(attr, val);
  };
  set('meta[name="description"]',         "content", s.description);
  set('link[rel="canonical"]',            "href",    s.canonical);
  set('link[rel="icon"]',                 "href",    s.favicon);
  set('link[rel="apple-touch-icon"]',     "href",    s.favicon);
  set('meta[property="og:title"]',        "content", s.title);
  set('meta[property="og:description"]',  "content", s.description);
  set('meta[property="og:url"]',          "content", s.canonical);
  set('meta[property="og:image"]',        "content", s.ogImage);
  set('meta[property="og:image:alt"]',    "content", s.ogImageAlt);
  set('meta[property="og:site_name"]',    "content", s.siteName);
  set('meta[name="twitter:title"]',       "content", s.title);
  set('meta[name="twitter:description"]', "content", s.description);
  set('meta[name="twitter:image"]',       "content", s.ogImage);
})();

/* ─── SVG icon library ──────────────────────────────────────────────────── */
const Ico = {
  arrow:     (p={}) => <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round" {...p}><path d="M5 12h14M13 5l7 7-7 7"/></svg>,
  arrowR:    (p={}) => <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round" {...p}><path d="M5 12h14M13 5l7 7-7 7"/></svg>,
  arrowLR:   (p={}) => <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round" {...p}><path d="M3 12h18M7 7l-4 5 4 5M17 7l4 5-4 5"/></svg>,
  pin:       (p={}) => <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round" {...p}><path d="M12 22s-7-7.5-7-13a7 7 0 1 1 14 0c0 5.5-7 13-7 13Z"/><circle cx="12" cy="9" r="2.5"/></svg>,
  cal:       (p={}) => <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round" {...p}><rect x="3.5" y="5" width="17" height="16" rx="2"/><path d="M3.5 10h17M8 3v4M16 3v4"/></svg>,
  phone:     (p={}) => <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round" {...p}><path d="M5 4h4l2 5-2.5 1.5a11 11 0 0 0 5 5L15 13l5 2v4a2 2 0 0 1-2 2A16 16 0 0 1 3 6a2 2 0 0 1 2-2Z"/></svg>,
  shield:    (p={}) => <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round" {...p}><path d="M12 3 4 6v6c0 4.5 3.4 8.4 8 9 4.6-.6 8-4.5 8-9V6l-8-3Z"/><path d="m9 12 2 2 4-4"/></svg>,
  clock:     (p={}) => <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round" {...p}><circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/></svg>,
  star:      (p={}) => <svg viewBox="0 0 24 24" fill="currentColor" {...p}><path d="m12 3 2.7 6 6.3.6-4.8 4.3 1.5 6.1L12 16.9 6.3 20l1.5-6.1L3 9.6 9.3 9 12 3Z"/></svg>,
  user:      (p={}) => <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round" {...p}><circle cx="12" cy="8" r="4"/><path d="M4 21c1.5-4 4.5-6 8-6s6.5 2 8 6"/></svg>,
  car:       (p={}) => <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round" {...p}><path d="M4 14 6 8a3 3 0 0 1 3-2h6a3 3 0 0 1 3 2l2 6"/><path d="M3 14h18v4a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1v-1H7v1a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-4Z"/><circle cx="7.5" cy="17" r=".8"/><circle cx="16.5" cy="17" r=".8"/></svg>,
  wifi:      (p={}) => <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round" {...p}><path d="M5 12.5a10 10 0 0 1 14 0"/><path d="M8.5 15.5a5 5 0 0 1 7 0"/><circle cx="12" cy="18.5" r="1" fill="currentColor"/></svg>,
  snow:      (p={}) => <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round" {...p}><path d="M12 3v18M5 7l14 10M5 17 19 7M3 12h18"/></svg>,
  bag:       (p={}) => <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round" {...p}><rect x="4" y="7" width="16" height="13" rx="2"/><path d="M9 7V5a3 3 0 0 1 6 0v2"/></svg>,
  check:     (p={}) => <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" {...p}><path d="m5 12 4 4 10-10"/></svg>,
  plus:      (p={}) => <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" {...p}><path d="M12 5v14M5 12h14"/></svg>,
  minus:     (p={}) => <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" {...p}><path d="M5 12h14"/></svg>,
  zalo:      (p={}) => (
    <svg viewBox="0 0 48 48" {...p}>
      <path d="M24 6C13 6 4 13.2 4 22c0 4.8 2.6 9 6.8 11.9-.5 1.4-1.4 3.2-2.4 4.6-.5.7.1 1.6 1 1.4 3-.7 6.3-2.1 8.6-3.6 1.9.4 3.9.7 6 .7 11 0 20-7.2 20-16S35 6 24 6Z" fill="currentColor"/>
      <path d="M16.5 18h11l-10 9.5h10" stroke="#0068FF" strokeWidth="2.8" strokeLinecap="round" strokeLinejoin="round" fill="none"/>
    </svg>
  ),
  messenger: (p={}) => (
    <svg viewBox="0 0 48 48" {...p}>
      <path d="M24 4C12.4 4 4 12.6 4 23.3c0 5.6 2.3 10.4 6 13.7v6.7c0 .6.6 1 1.2.7l5.8-3.2c2.2.6 4.5.9 7 .9 11.6 0 20-8.6 20-19.3S35.6 4 24 4Z" fill="currentColor"/>
      <path d="M11.4 28.6 19 16.7c.6-.9 1.8-1.2 2.7-.5l5.6 4.2c.7.5 1.6.5 2.3 0l7-5.6c1-.8 2.3.4 1.6 1.4l-7.6 11.9c-.6.9-1.8 1.2-2.7.5l-5.6-4.2c-.7-.5-1.6-.5-2.3 0l-7 5.6c-1 .8-2.3-.4-1.6-1.4Z" fill="#0084FF"/>
    </svg>
  ),
  facebook:  (p={}) => (
    <svg viewBox="0 0 24 24" fill="currentColor" {...p}>
      <path d="M22 12c0-5.5-4.5-10-10-10S2 6.5 2 12c0 5 3.7 9.1 8.4 9.9v-7H7.9V12h2.5V9.8c0-2.5 1.5-3.9 3.8-3.9 1.1 0 2.2.2 2.2.2v2.5h-1.3c-1.2 0-1.6.8-1.6 1.6V12h2.8l-.4 2.9h-2.3v7C18.3 21.1 22 17 22 12Z"/>
    </svg>
  ),
};

/* ─── Image map ─────────────────────────────────────────────────────────── */
const SITE_IMAGES = {
  hero: "uploads/hero-limousine-office.png",
  cta:  "uploads/haivan.jpg",
  services: [
    "uploads/scene-hue-1.jpg",
    "uploads/scene-hue-2.jpg",
    "uploads/scene-hue-3.webp",
    "uploads/scene-danang-1.jpg",
    "uploads/scene-danang-2.jpg",
    "uploads/scene-hoian-1.jpg",
    "uploads/scene-hoian-2.jpg",
    "uploads/scene-danang-3.jpg",
    "uploads/scene-hoian-3.webp",
  ],
  gallery: [
    "uploads/car-1.jpg",
    "uploads/car-2.jpg",
    "uploads/car-3.jpg",
    "uploads/car-4.jpg",
    "uploads/car-5.jpg",
    "uploads/car-6.jpg",
    "uploads/car-7.jpg",
    "uploads/car-8.webp",
    "uploads/car-9.webp",
  ],
  news: [
    "uploads/scene-hue-1.jpg",
    "uploads/scene-hoian-1.jpg",
    "uploads/scene-danang-1.jpg",
  ],
};

/* ─── ImageSlot — image with striped placeholder fallback ───────────────── */
function ImageSlot({ src, alt="", dark=false, fallbackLabel="", style={}, imgStyle={}, children, ...props }) {
  const [failed, setFailed] = React.useState(false);
  React.useEffect(() => setFailed(false), [src]);
  const showImage = src && !failed;
  return (
    <div {...props} className={showImage ? "" : `ph${dark ? " dark" : ""}`} style={{ position: "relative", overflow: "hidden", ...style }}>
      {showImage && (
        <img src={src} alt={alt} onError={() => setFailed(true)}
          style={{ width: "100%", height: "100%", objectFit: "cover", display: "block", ...imgStyle }}/>
      )}
      {showImage ? children : <>{fallbackLabel || null}{children}</>}
    </div>
  );
}

/* ─── Logo — reads path from BRAND ─────────────────────────────────────── */
function Logo({ size=36 }) {
  return (
    <img src={BRAND.logo} alt={BRAND.nameFull} width={size} height={size}
      style={{ display: "block", width: size, height: size, objectFit: "contain" }}/>
  );
}

/* ─── useIsMobile ───────────────────────────────────────────────────────── */
function useIsMobile(breakpoint = 768) {
  const [isMobile, setIsMobile] = React.useState(
    typeof window !== "undefined" ? window.innerWidth < breakpoint : false
  );
  React.useEffect(() => {
    const onResize = () => setIsMobile(window.innerWidth < breakpoint);
    window.addEventListener("resize", onResize);
    return () => window.removeEventListener("resize", onResize);
  }, [breakpoint]);
  return isMobile;
}

/* ─── Reveal — fade + slide-up on scroll ───────────────────────────────── */
function Reveal({ children, delay=0, y=28, duration=0.6, threshold=0.15, style={}, ...rest }) {
  const ref = React.useRef(null);
  const [visible, setVisible] = React.useState(false);
  React.useEffect(() => {
    const el = ref.current;
    if (!el) return;
    if (typeof IntersectionObserver === "undefined") { setVisible(true); return; }
    const io = new IntersectionObserver((entries) => {
      entries.forEach(e => { if (e.isIntersecting) { setVisible(true); io.unobserve(el); } });
    }, { threshold, rootMargin: "0px 0px -60px 0px" });
    io.observe(el);
    return () => io.disconnect();
  }, [threshold]);
  return (
    <div ref={ref} {...rest} style={{
      opacity: visible ? 1 : 0,
      transform: visible ? "translateY(0)" : `translateY(${y}px)`,
      transition: `opacity ${duration}s cubic-bezier(.2,.7,.2,1) ${delay}s, transform ${duration}s cubic-bezier(.2,.7,.2,1) ${delay}s`,
      willChange: "opacity, transform",
      ...style,
    }}>{children}</div>
  );
}

/* ─── RouteLine SVG ─────────────────────────────────────────────────────── */
function RouteLine({ width=600, height=280, label="HUẾ → ĐÀ NẴNG → HỘI AN", color="rgba(255,255,255,.5)", dot="#E89B4A", labelColor="rgba(255,255,255,.7)" }) {
  return (
    <svg viewBox={`0 0 ${width} ${height}`} width="100%" height="100%" preserveAspectRatio="xMidYMid meet">
      <defs>
        <pattern id="g" width="32" height="32" patternUnits="userSpaceOnUse">
          <path d="M32 0H0V32" fill="none" stroke="rgba(255,255,255,0.05)" strokeWidth="1"/>
        </pattern>
      </defs>
      <rect width={width} height={height} fill="url(#g)"/>
      <path d={`M40 ${height-60} C ${width*0.3} ${height-160}, ${width*0.55} ${height-30}, ${width-40} 70`}
        fill="none" stroke={color} strokeWidth="2" strokeDasharray="5 6" strokeLinecap="round"/>
      <g>
        <circle cx="40" cy={height-60} r="6" fill={dot}/>
        <circle cx={width*0.5} cy={height*0.5} r="5" fill={dot}/>
        <circle cx={width-40} cy="70" r="6" fill={dot}/>
      </g>
      <text x="50" y={height-72} fill={labelColor} fontSize="11" fontFamily="JetBrains Mono, monospace" letterSpacing="1.5">HUẾ</text>
      <text x={width*0.5+10} y={height*0.5-10} fill={labelColor} fontSize="11" fontFamily="JetBrains Mono, monospace" letterSpacing="1.5">ĐÀ NẴNG</text>
      <text x={width-90} y="62" fill={labelColor} fontSize="11" fontFamily="JetBrains Mono, monospace" letterSpacing="1.5">HỘI AN</text>
    </svg>
  );
}

/* ─── IMAGE_MANIFEST ────────────────────────────────────────────────────── */
const IMAGE_MANIFEST = [
  { file: "hero-limousine-office.jpg", where: "Hero",        purpose: "Ảnh nền hero — limousine trước văn phòng. Overlay tối để đè chữ trắng.", size: "1920×900",  ratio: "16:7.5" },
  { file: "cta-hai-van-limousine.jpg", where: "CTA Banner",  purpose: "Ảnh nền CTA — xe trên đèo Hải Vân hoặc cảnh ven biển. Overlay tối.",    size: "1920×600",  ratio: "16:5" },
  { file: "scene-hue.jpg",    where: "Services — Huế—ĐN",   purpose: "Phong cảnh Huế — Đại Nội / Sông Hương.",        size: "800×600", ratio: "4:3" },
  { file: "scene-hoian.jpg",  where: "Services — Huế—HA",   purpose: "Phong cảnh Hội An — Phố cổ, đèn lồng.",         size: "800×600", ratio: "4:3" },
  { file: "scene-danang.jpg", where: "Services — ĐN—HA",    purpose: "Phong cảnh Đà Nẵng — Cầu Rồng, bãi biển.",      size: "800×600", ratio: "4:3" },
  { file: "gallery-01.jpg", where: "Gallery #1", purpose: "Kia Carnival màu đen — toàn cảnh bên hông.", size: "1000×750", ratio: "4:3" },
  { file: "gallery-02.jpg", where: "Gallery #2", purpose: "Toyota Fortuner trắng — góc 3/4.",            size: "1000×750", ratio: "4:3" },
  { file: "gallery-03.jpg", where: "Gallery #3", purpose: "Kia Carnival phía sau.",                       size: "1000×750", ratio: "4:3" },
  { file: "gallery-04.jpg", where: "Gallery #4", purpose: "Fortuner hậu.",                                size: "1000×750", ratio: "4:3" },
  { file: "gallery-05.jpg", where: "Gallery #5", purpose: "Fortuner trắng — chính diện.",                 size: "1000×750", ratio: "4:3" },
  { file: "gallery-06.jpg", where: "Gallery #6", purpose: "Fortuner đen.",                                size: "1000×750", ratio: "4:3" },
  { file: "gallery-07.jpg", where: "Gallery #7", purpose: "Nội thất Dcar Limousine — ghế da, gối VIP.",   size: "1000×750", ratio: "4:3" },
  { file: "gallery-08.jpg", where: "Gallery #8", purpose: "Văn phòng Huế — biển hiệu, mặt tiền.",         size: "1000×750", ratio: "4:3" },
  { file: "gallery-09.jpg", where: "Gallery #9", purpose: "Ford Transit limousine.",                       size: "1000×750", ratio: "4:3" },
];

Object.assign(window, { BRAND, Ico, SITE_IMAGES, IMAGE_MANIFEST, ImageSlot, Logo, Reveal, useIsMobile, RouteLine });
