// LUXOMES — Stays / About / Contact pages

// ---------- Location Detail Page (Bright-style structure, LUXOMES CI) ----------
// `aptId` (optional) selects which apartment category is initially active and
// scrolls the page to the apartments section — used by deep links like
// /standorte/nuernberg/nue-design for per-apartment SEO landing pages.
function LocationDetailPage({ locationKey, aptId, lang, setPage }) {
  const loc = LOCATIONS.find(l => l.key === locationKey);
  if (!loc) return <section style={{ padding: 96 }}><div className="container">Not found.</div></section>;

  // Resolve initial active category from aptId (if provided and valid)
  const initialCat = aptId
    ? Math.max(0, loc.categories.findIndex(c => c.id === aptId))
    : 0;

  const [galleryIdx, setGalleryIdx] = useState(0);
  const [activeCat, setActiveCat] = useState(initialCat);
  const cat = loc.categories[activeCat];
  const [catImg, setCatImg] = useState(0);
  useEffect(() => { setCatImg(0); }, [activeCat]);

  // When arriving with an apartment-specific URL, scroll to the apartments
  // section once the layout is laid out so the deep-linked apartment is the
  // first thing the user sees.
  useEffect(() => {
    if (!aptId) return;
    const t = setTimeout(() => {
      const el = document.getElementById("apartments");
      if (el) el.scrollIntoView({ behavior: "smooth", block: "start" });
    }, 150);
    return () => clearTimeout(t);
  }, [aptId]);

  const tx = {
    de: {
      ourStay: "Unser Standort", aboutHeading: "Über diesen Standort", whatToExpect: "Was Dich erwartet",
      reachable: "Erreichbarkeit", apartmentsHere: "Apartments an diesem Standort", chooseCat: "Wähle Deine Kategorie",
      rooms: "Zimmer", guests: "Gäste", baths: "Bad", size: "Größe", beds: "Schlafsituation",
      perNight: "pro Nacht", checkAvail: "Verfügbarkeit prüfen", bookNow: "Jetzt buchen",
      amen: "Ausstattung", amenWifi: "Highspeed WiFi", amenTv: "Smart-TV", amenKitchen: "Voll ausgestattete Küche", amenCheckin: "Self check-in", amenWasher: "Waschmaschine", amenWorkspace: "Arbeitsbereich", amenLinens: "Bettwäsche & Handtücher", amenCleaning: "Reinigungsservice",
    },
    en: {
      ourStay: "Our location", aboutHeading: "About this location", whatToExpect: "What to expect",
      reachable: "Connections", apartmentsHere: "Apartments at this location", chooseCat: "Pick your category",
      rooms: "rooms", guests: "guests", baths: "bath", size: "size", beds: "Beds",
      perNight: "per night", checkAvail: "Check availability", bookNow: "Book now",
      amen: "Amenities", amenWifi: "Highspeed WiFi", amenTv: "Smart TV", amenKitchen: "Fully equipped kitchen", amenCheckin: "Self check-in", amenWasher: "Washer", amenWorkspace: "Workspace", amenLinens: "Linens & towels", amenCleaning: "Cleaning service",
    },
  }[lang];

  const amenities = [
    { icon: "wifi", label: tx.amenWifi },
    { icon: "tv", label: tx.amenTv },
    { icon: "kitchen", label: tx.amenKitchen },
    { icon: "lock", label: tx.amenCheckin },
    { icon: "home", label: tx.amenWasher },
    { icon: "sparkle", label: tx.amenWorkspace },
    { icon: "bed", label: tx.amenLinens },
    { icon: "check", label: tx.amenCleaning },
  ];

  return (
    <>
      {/* HERO with gallery */}
      <section style={{ paddingTop: 64, paddingBottom: 48 }}>
        <div className="container">
          <div style={{ fontSize: 12, letterSpacing: "0.2em", textTransform: "uppercase", color: "var(--accent)", marginBottom: 16 }}>
            <button onClick={() => { setPage("home"); window.scrollTo(0,0); }} style={{ color: "var(--muted)", letterSpacing: "0.2em" }}>LUXOMES</button>
            <span style={{ margin: "0 10px", color: "var(--muted)" }}>/</span>
            <span>{tx.ourStay}</span>
          </div>
          <h1 className="h-display" style={{ marginBottom: 18 }}>
            {lang === "de" ? "Serviced Apartments in " : "Serviced apartments in "}
            <em style={{ fontStyle: "italic", color: "var(--accent)" }}>{loc.city}</em>
          </h1>
          <div style={{ fontSize: 14, color: "var(--muted)", marginBottom: 32, display: "flex", alignItems: "center", gap: 10 }}>
            <Icon name="pin" size={16}/> {loc.address[lang]} · {loc.region[lang]}
          </div>
          <p className="body-lg" style={{ maxWidth: 760, marginBottom: 48 }}>{loc.heroLead[lang]}</p>

          {/* Gallery: 1 large + 4 small */}
          <div className="loc-hero-gallery" style={{ display: "grid", gridTemplateColumns: "2fr 1fr 1fr", gridTemplateRows: "repeat(2, 240px)", gap: 8, borderRadius: 6, overflow: "hidden" }}>
            <div className="ph" style={{ gridRow: "1 / 3", backgroundImage: `url(${loc.heroImages[galleryIdx]})`, cursor: "pointer", borderRadius: 4 }}>
              <SEOImg src={loc.heroImages[galleryIdx]} alt={(lang === "de" ? "Serviced Apartment in " : "Serviced apartment in ") + loc.city + " — " + loc.address[lang]}/>
            </div>
            {[1,2,3,4].map(i => (
              <div key={i} className="ph" onClick={() => setGalleryIdx(i)} style={{ backgroundImage: `url(${loc.heroImages[i] || loc.heroImages[0]})`, cursor: "pointer", borderRadius: 4 }}>
                <SEOImg src={loc.heroImages[i] || loc.heroImages[0]} alt={(lang === "de" ? "LUXOMES Apartment " : "LUXOMES apartment ") + loc.city + " — Eindruck " + (i+1)}/>
              </div>
            ))}
          </div>

          {/* Quick stats strip */}
          <div style={{ marginTop: 32, padding: "24px 32px", background: "var(--surface)", borderRadius: 6, display: "flex", justifyContent: "space-between", alignItems: "center", gap: 24, flexWrap: "wrap" }}>
            <div style={{ display: "flex", gap: 40, flexWrap: "wrap" }}>
              <div>
                <div style={{ fontFamily: "var(--font-display)", fontSize: 28, lineHeight: 1, color: "var(--accent)" }}>{loc.categories.length}</div>
                <div style={{ fontSize: 11, letterSpacing: "0.15em", textTransform: "uppercase", color: "var(--muted)", marginTop: 6 }}>{lang === "de" ? "Kategorien" : "categories"}</div>
              </div>
              <div>
                <div style={{ fontFamily: "var(--font-display)", fontSize: 28, lineHeight: 1, color: "var(--accent)" }}>
                  {Math.max(...loc.categories.map(c => c.guests))}
                </div>
                <div style={{ fontSize: 11, letterSpacing: "0.15em", textTransform: "uppercase", color: "var(--muted)", marginTop: 6 }}>{lang === "de" ? "max. Gäste" : "max guests"}</div>
              </div>
              <div>
                <div style={{ fontFamily: "var(--font-display)", fontSize: 28, lineHeight: 1, color: "var(--accent)" }}>
                  {Math.max(...loc.categories.map(c => c.size))} m²
                </div>
                <div style={{ fontSize: 11, letterSpacing: "0.15em", textTransform: "uppercase", color: "var(--muted)", marginTop: 6 }}>{lang === "de" ? "größtes Apt." : "largest apt."}</div>
              </div>
            </div>
            <a href="https://luxomes.holidayfuture.com/" target="_blank" rel="noreferrer" className="btn btn-primary">
              {tx.checkAvail} <Icon name="arrow" size={16}/>
            </a>
          </div>
        </div>
      </section>

      {/* About + connections */}
      <section style={{ paddingTop: 32, paddingBottom: 80 }}>
        <div className="container">
          <div style={{ display: "grid", gridTemplateColumns: "1.3fr 1fr", gap: 64, alignItems: "flex-start" }}>
            <div>
              <div className="eyebrow">{tx.aboutHeading}</div>
              <h2 className="h-xl" style={{ marginTop: 18, marginBottom: 28 }}>
                {lang === "de" ? `${loc.city} — `: `${loc.city} — `}
                <em style={{ fontStyle: "italic", color: "var(--accent)" }}>
                  {lang === "de" ? "Dein Zuhause auf Zeit." : "your home away from home."}
                </em>
              </h2>
              <p className="body-lg" style={{ marginBottom: 24 }}>{loc.about[lang]}</p>

              <h3 style={{ fontFamily: "var(--font-display)", fontSize: 22, marginTop: 40, marginBottom: 20 }}>{tx.whatToExpect}</h3>
              <div className="grid" style={{ gridTemplateColumns: "repeat(2, 1fr)", gap: 14 }}>
                {amenities.map(a => (
                  <div key={a.label} style={{ display: "flex", alignItems: "center", gap: 12, padding: "12px 0", borderBottom: "1px solid var(--line)", fontSize: 14 }}>
                    <span style={{ color: "var(--accent)", display: "flex" }}><Icon name={a.icon} size={18}/></span>
                    {a.label}
                  </div>
                ))}
              </div>
            </div>

            <aside className="mobile-static-aside" style={{ background: "var(--surface)", padding: 32, borderRadius: 6, position: "sticky", top: 96 }}>
              <div className="eyebrow" style={{ marginBottom: 16 }}>{tx.reachable}</div>
              <h3 style={{ fontFamily: "var(--font-display)", fontSize: 24, marginBottom: 24, lineHeight: 1.2 }}>
                {lang === "de" ? "Bestens angebunden." : "Excellently connected."}
              </h3>
              <div style={{ display: "grid", gap: 0 }}>
                {loc.distances.map((d, i) => (
                  <div key={i} style={{ display: "flex", justifyContent: "space-between", alignItems: "center", padding: "14px 0", borderBottom: i < loc.distances.length - 1 ? "1px solid var(--line)" : "none", fontSize: 14 }}>
                    <span style={{ display: "flex", alignItems: "center", gap: 10, color: "var(--ink-soft)" }}>
                      <Icon name="pin" size={14}/> {d[lang]}
                    </span>
                    <span style={{ fontWeight: 600, fontFamily: "var(--font-display)" }}>{d.val}</span>
                  </div>
                ))}
              </div>
            </aside>
          </div>
        </div>
      </section>

      {/* Apartment categories — vertical list with image switcher (Bright-style) */}
      <section id="apartments" style={{ background: "var(--ink)", color: "oklch(0.95 0.005 110)", paddingTop: 96, paddingBottom: 96 }}>
        <div className="container">
          <div style={{ marginBottom: 56, maxWidth: 720 }}>
            <div className="eyebrow" style={{ color: "var(--accent)" }}>{tx.apartmentsHere}</div>
            <h2 className="h-xl" style={{ color: "#fff", marginTop: 18, marginBottom: 22 }}>{tx.chooseCat}</h2>
            <p className="body-lg" style={{ color: "oklch(0.78 0.005 110)" }}>
              {lang === "de"
                ? `Wir bieten in ${loc.city} ${loc.categories.length} unterschiedliche Kategorien — wähle das Apartment, das zu Deinem Aufenthalt passt.`
                : `In ${loc.city} we offer ${loc.categories.length} distinct categories — pick the apartment that fits your stay.`}
            </p>
          </div>

          <div style={{ display: "grid", gridTemplateColumns: "1fr 1.2fr", gap: 56 }}>
            {/* Category list */}
            <div>
              {loc.categories.map((c, i) => (
                <button key={c.id}
                  onClick={() => setActiveCat(i)}
                  style={{
                    display: "block", width: "100%", textAlign: "left",
                    padding: "26px 28px",
                    background: activeCat === i ? "oklch(0.32 0.012 150)" : "transparent",
                    borderLeft: "3px solid " + (activeCat === i ? "var(--accent)" : "oklch(1 0 0 / 0.15)"),
                    transition: "all .25s",
                    marginBottom: 4,
                  }}
                >
                  <div style={{ display: "flex", justifyContent: "space-between", alignItems: "flex-start", gap: 16, marginBottom: 8 }}>
                    <div style={{ fontFamily: "var(--font-display)", fontSize: 15, color: activeCat === i ? "var(--accent)" : "oklch(0.6 0 0)", letterSpacing: "0.12em" }}>
                      {String(i+1).padStart(2,"0")}
                    </div>
                  </div>
                  <div style={{ fontFamily: "var(--font-display)", fontSize: 30, lineHeight: 1.1, color: "#fff", marginBottom: 10 }}>
                    {c.title[lang]}
                  </div>
                  <div style={{ fontSize: 13, color: "oklch(0.78 0.005 110)", display: "flex", gap: 16, flexWrap: "wrap" }}>
                    <span style={{ display: "inline-flex", alignItems: "center", gap: 6 }}><Icon name="home" size={13}/> {c.rooms} {tx.rooms}</span>
                    <span style={{ display: "inline-flex", alignItems: "center", gap: 6 }}><Icon name="users" size={13}/> {c.guests} {tx.guests}</span>
                    <span style={{ display: "inline-flex", alignItems: "center", gap: 6 }}><Icon name="bed" size={13}/> {c.size} m²</span>
                  </div>
                </button>
              ))}
            </div>

            {/* Active category preview */}
            <div>
              <div className="ph" style={{ aspectRatio: "4/3", backgroundImage: `url(${cat.images[catImg]})`, borderRadius: 4, marginBottom: 14 }}/>
              <div style={{ display: "flex", gap: 8, marginBottom: 32 }}>
                {cat.images.slice(0, 4).map((im, i) => (
                  <button key={i} onClick={() => setCatImg(i)}
                    className="ph"
                    style={{
                      flex: 1, aspectRatio: "1/1", backgroundImage: `url(${im})`,
                      borderRadius: 3, cursor: "pointer",
                      outline: catImg === i ? "2px solid var(--accent)" : "none",
                      outlineOffset: 2,
                      opacity: catImg === i ? 1 : 0.65,
                      transition: "opacity .2s",
                    }}
                  />
                ))}
              </div>

              <h3 className="h-lg" style={{ color: "#fff", marginBottom: 12 }}>{cat.title[lang]}</h3>

              {/* Spec grid */}
              <div className="loc-spec-grid" style={{ display: "grid", gridTemplateColumns: "repeat(4, 1fr)", gap: 0, padding: "20px 0", borderTop: "1px solid oklch(1 0 0 / 0.15)", borderBottom: "1px solid oklch(1 0 0 / 0.15)", marginBottom: 24 }}>
                <SpecCell label={tx.rooms} value={cat.rooms}/>
                <SpecCell label={tx.guests} value={cat.guests}/>
                <SpecCell label={tx.baths} value={cat.baths}/>
                <SpecCell label={tx.size} value={cat.size + " m²"}/>
              </div>

              <p style={{ fontSize: 16, lineHeight: 1.65, color: "oklch(0.85 0.005 110)", marginBottom: 24 }}>{cat.body[lang]}</p>

              <div style={{ fontSize: 13, color: "oklch(0.7 0.005 110)", marginBottom: 28 }}>
                <span style={{ letterSpacing: "0.15em", textTransform: "uppercase", marginRight: 10 }}>{tx.beds}</span>
                {cat.bed[lang]}
              </div>

              <div style={{ display: "flex", justifyContent: "space-between", alignItems: "center", gap: 24, paddingTop: 24, borderTop: "1px solid oklch(1 0 0 / 0.15)", flexWrap: "wrap" }}>
                <div>
                  <div style={{ fontSize: 11, letterSpacing: "0.15em", textTransform: "uppercase", color: "oklch(0.7 0 0)", marginBottom: 4 }}>{lang === "de" ? "Preis" : "Price"}</div>
                  <div style={{ fontFamily: "var(--font-display)", fontSize: 28, color: "#fff" }}>
                    {lang === "de" ? cat.price : cat.priceEn}
                  </div>
                </div>
                <a href={cat.link || "https://luxomes.holidayfuture.com/"} target="_blank" rel="noreferrer" className="btn btn-primary">
                  {tx.bookNow} <Icon name="arrow" size={16}/>
                </a>
              </div>
            </div>
          </div>
        </div>
      </section>

      {/* Common areas (only renders if location has a commonAreas object — currently Humboldt only) */}
      {loc.commonAreas && (
        <section style={{ paddingTop: 80, paddingBottom: 80 }}>
          <div className="container">
            <div className="section-head">
              <div className="section-head-text">
                <div className="eyebrow">{lang === "de" ? "Gemeinschaftsbereiche" : "Shared areas"}</div>
                <h2 className="h-xl" style={{ marginTop: 18, marginBottom: 22 }}>{loc.commonAreas.title[lang]}</h2>
                <p className="body-lg" style={{ maxWidth: 700 }}>{loc.commonAreas.intro[lang]}</p>
              </div>
            </div>
            {/* Asymmetric mosaic: 1 large left + 2x2 small right, then row of 4 */}
            <div className="loc-common-mosaic" style={{ display: "grid", gridTemplateColumns: "1.4fr 1fr 1fr", gridTemplateRows: "repeat(2, 220px)", gap: 12, marginBottom: 12 }}>
              <div className="ph" style={{ gridRow: "1 / 3", backgroundImage: `url(${loc.commonAreas.images[0]})`, borderRadius: 4 }}/>
              {[1, 2, 3, 4].map(i => (
                <div key={i} className="ph" style={{ backgroundImage: `url(${loc.commonAreas.images[i] || loc.commonAreas.images[0]})`, borderRadius: 4 }}/>
              ))}
            </div>
            {loc.commonAreas.images.length > 5 && (
              <div className="grid" style={{ gridTemplateColumns: "repeat(4, 1fr)", gap: 12 }}>
                {loc.commonAreas.images.slice(5, 9).map((img, i) => (
                  <div key={i} className="ph" style={{ aspectRatio: "4/3", backgroundImage: `url(${img})`, borderRadius: 4 }}/>
                ))}
              </div>
            )}
          </div>
        </section>
      )}

      {/* CTA Banner */}
      <section style={{ paddingTop: 80, paddingBottom: 80 }}>
        <div className="container">
          <div style={{ display: "grid", gridTemplateColumns: "1.3fr 1fr", gap: 48, alignItems: "center" }}>
            <div>
              <div className="eyebrow">{lang === "de" ? "Bereit zu buchen?" : "Ready to book?"}</div>
              <h2 className="h-xl" style={{ marginTop: 18, marginBottom: 22, whiteSpace: "pre-line" }}>
                {lang === "de" ? `Komm nach\n${loc.city}.` : `Come to\n${loc.city}.`}
              </h2>
              <p className="body-lg" style={{ maxWidth: 520, marginBottom: 32 }}>
                {lang === "de"
                  ? "Kontaktloser Self-Check-in, persönlicher Support per WhatsApp und Apartments, in denen Du Dich sofort zuhause fühlst."
                  : "Contactless self-check-in, personal support via WhatsApp, and apartments where you'll feel at home from minute one."}
              </p>
              <div style={{ display: "flex", gap: 14, flexWrap: "wrap" }}>
                <a href="https://luxomes.holidayfuture.com/" target="_blank" rel="noreferrer" className="btn btn-primary">{tx.checkAvail} <Icon name="arrow" size={16}/></a>
                <button onClick={() => { setPage("contact"); window.scrollTo(0,0); }} className="btn btn-ghost">
                  {lang === "de" ? "Frage stellen" : "Ask a question"} <Icon name="arrow" size={16}/>
                </button>
              </div>
            </div>
            <div className="ph" style={{ aspectRatio: "4/3", backgroundImage: `url(${loc.heroImages[2] || loc.heroImages[0]})`, borderRadius: 4 }}/>
          </div>
        </div>
      </section>
    </>
  );
}

function SpecCell({ label, value }) {
  return (
    <div style={{ textAlign: "center", padding: "0 8px", borderRight: "1px solid oklch(1 0 0 / 0.15)" }}>
      <div style={{ fontFamily: "var(--font-display)", fontSize: 22, color: "#fff", lineHeight: 1.1 }}>{value}</div>
      <div style={{ fontSize: 10, letterSpacing: "0.18em", textTransform: "uppercase", color: "oklch(0.7 0 0)", marginTop: 6 }}>{label}</div>
    </div>
  );
}

// ---------- About ----------
const TEAM = [
  {
    name: "Maksat Munal",
    role: { de: "Co-Founder / CEO", en: "Co-Founder / CEO" },
    bio: {
      de: "Mitgründer und Geschäftsführer — verantwortlich für Vision, Strategie und Wachstum von LUXOMES. Hat das Unternehmen 2020 mit dem Anspruch gestartet, Wohnen auf Zeit grundlegend neu zu denken.",
      en: "Co-founder and CEO — responsible for LUXOMES' vision, strategy and growth. Launched the company in 2020 with the ambition to rethink extended stays from the ground up.",
    },
    img: PHOTO.team_maksat,
  },
  {
    name: "Santore Talipova",
    role: { de: "Mitgründerin / Managerin", en: "Co-Founder / Manager" },
    bio: {
      de: "Gründerin und Manager — verantwortlich für die operative Umsetzung, das Tagesgeschäft und die Qualität in allen Apartments. Sorgt dafür, dass Gäste sich wirklich wie zuhause fühlen.",
      en: "Founder and manager — running day-to-day operations and quality across all apartments. Makes sure guests genuinely feel at home.",
    },
    img: PHOTO.team_santore,
  },
  {
    name: "Phillip Neugebauer",
    role: { de: "Partner / Head of Finance", en: "Partner / Head of Finance" },
    bio: {
      de: "Partner und Leitung Finanzen — verantwortlich für Controlling, Strukturierung und solide Wirtschaftlichkeit jedes Standorts. Bringt LUXOMES profitabel und nachhaltig in die nächste Wachstumsstufe.",
      en: "Partner and Head of Finance — owning controlling, structuring and sound economics at every location. Drives LUXOMES into its next growth stage — profitably and sustainably.",
    },
    img: PHOTO.team_phillip,
  },
  {
    name: "Azamat Munal",
    role: { de: "Consulting", en: "Consulting" },
    bio: {
      de: "Berater an der Schnittstelle zwischen Technologie, Operations und Wachstum. Treibt Digitalisierung, Prozessautomatisierung und neue Geschäftsmodelle innerhalb von LUXOMES voran.",
      en: "Advisor at the intersection of technology, operations and growth. Drives digital transformation, process automation and new business models inside LUXOMES.",
    },
    img: PHOTO.team_azamat,
  },
];

function AboutPage({ t, lang }) {
  return (
    <>
      <section style={{ paddingTop: 72, paddingBottom: 72 }}>
        <div className="container">
          <div style={{ maxWidth: 1000, marginBottom: 72 }}>
            <div className="eyebrow">{t.about.heroEyebrow}</div>
            <h1 className="h-display" style={{ marginTop: 28, marginBottom: 28, whiteSpace: "pre-line" }}>{t.about.heroTitle}</h1>
            <p className="body-lg" style={{ maxWidth: 680 }}>{t.about.heroLead}</p>
          </div>
          <div className="ph" style={{ aspectRatio: "21/9", backgroundImage: `url(${IMG.lobby})`, borderRadius: 4 }}/>
        </div>
      </section>
      <section style={{ paddingTop: 48 }}>
        <div className="container">
          <div style={{ display: "grid", gridTemplateColumns: "1fr 1.4fr", gap: 80 }}>
            <div>
              <div className="eyebrow">{lang === "de" ? "Unsere Geschichte" : "Our story"}</div>
              <h2 className="h-xl" style={{ marginTop: 18 }}>{t.about.storyTitle}</h2>
            </div>
            <div>
              <p className="body-lg" style={{ marginBottom: 24 }}>{t.about.storyBody1}</p>
              <p className="body-lg">{t.about.storyBody2}</p>
              <div style={{ display: "grid", gridTemplateColumns: "repeat(3, 1fr)", gap: 32, marginTop: 48, paddingTop: 32, borderTop: "1px solid var(--line)" }}>
                <div><div style={{ fontFamily: "var(--font-display)", fontSize: 48, color: "var(--accent)" }}>2020</div><div style={{ fontSize: 13, color: "var(--muted)", textTransform: "uppercase", letterSpacing: "0.12em" }}>{lang === "de" ? "Gegründet" : "Founded"}</div></div>
                <div><div style={{ fontFamily: "var(--font-display)", fontSize: 48, color: "var(--accent)" }}>4</div><div style={{ fontSize: 13, color: "var(--muted)", textTransform: "uppercase", letterSpacing: "0.12em" }}>{lang === "de" ? "Städte" : "Cities"}</div></div>
                <div><div style={{ fontFamily: "var(--font-display)", fontSize: 48, color: "var(--accent)" }}>40+</div><div style={{ fontSize: 13, color: "var(--muted)", textTransform: "uppercase", letterSpacing: "0.12em" }}>Apartments</div></div>
              </div>
            </div>
          </div>
        </div>
      </section>
      <section style={{ background: "var(--surface)" }}>
        <div className="container">
          <div className="section-head">
            <div className="section-head-text">
              <div className="eyebrow">{lang === "de" ? "Werte" : "Values"}</div>
              <h2 className="h-xl" style={{ marginTop: 18 }}>{t.about.valuesTitle}</h2>
            </div>
          </div>
          <div className="grid" style={{ gridTemplateColumns: "repeat(3, 1fr)", gap: 24 }}>
            {ABOUT_VALUES.map((v, i) => (
              <div key={i} style={{ padding: "36px 28px", background: "var(--bg)", border: "1px solid var(--line)", minHeight: 250 }}>
                <div style={{ fontFamily: "var(--font-display)", fontSize: 48, color: "var(--accent)", lineHeight: 1, marginBottom: 18 }}>0{i+1}</div>
                <h3 className="h-md" style={{ marginBottom: 12 }}>{v.title[lang]}</h3>
                <p className="body-md">{v.body[lang]}</p>
              </div>
            ))}
          </div>
        </div>
      </section>

      <section>
        <div className="container">
          <div className="section-head">
            <div className="section-head-text">
              <div className="eyebrow">{lang === "de" ? "Das Team" : "The team"}</div>
              <h2 className="h-xl" style={{ marginTop: 18, marginBottom: 22 }}>
                {lang === "de" ? "Die Menschen hinter LUXOMES." : "The people behind LUXOMES."}
              </h2>
              <p className="body-lg" style={{ maxWidth: 620 }}>
                {lang === "de"
                  ? "Ein kleines, fokussiertes Team — tief in Hospitality, Design und Technologie zuhause. Jede Person hier trägt persönliche Verantwortung für das, was Du als Gast oder Partner erlebst."
                  : "A small, focused team — deep in hospitality, design and technology. Every person here carries personal responsibility for what you experience as a guest or partner."}
              </p>
            </div>
          </div>
          <div className="grid" style={{ gridTemplateColumns: "repeat(4, 1fr)", gap: 24 }}>
            {TEAM.map((p, i) => (
              <div key={i}>
                <div className="ph" style={{ aspectRatio: "4/5", backgroundImage: `url(${p.img})`, marginBottom: 16, borderRadius: 4, filter: "grayscale(0.2)" }}/>
                <div style={{ fontFamily: "var(--font-display)", fontSize: 22, lineHeight: 1.2, marginBottom: 4 }}>{p.name}</div>
                <div style={{ fontSize: 12, letterSpacing: "0.15em", textTransform: "uppercase", color: "var(--accent)", marginBottom: 12 }}>{p.role[lang]}</div>
                <p style={{ fontSize: 14, lineHeight: 1.6, color: "var(--ink-soft)" }}>{p.bio[lang]}</p>
              </div>
            ))}
          </div>
        </div>
      </section>

      {/* Case Studies — proof points before contact CTA. Mirrors Arbio-style portfolio showcase. */}
      <section style={{ background: "var(--surface)" }}>
        <div className="container">
          <div className="section-head">
            <div className="section-head-text">
              <div className="eyebrow">{lang === "de" ? "Aus der Praxis" : "From the field"}</div>
              <h2 className="h-xl" style={{ marginTop: 18, marginBottom: 22 }}>
                {lang === "de" ? "Was wir gemacht haben." : "What we've done."}
              </h2>
              <p className="body-lg" style={{ maxWidth: 640 }}>
                {lang === "de"
                  ? "Zwei konkrete Beispiele, wie aus einer Idee bei LUXOMES ein laufender Betrieb wird — von der ausgelasteten Pension bis zum ersten Aparthotel einer Kleinstadt."
                  : "Two concrete examples of how an idea turns into a running operation at LUXOMES — from a fully-booked guesthouse to the first aparthotel of a small town."}
              </p>
            </div>
          </div>
          {(() => {
            const setPage = window.__setPage || (() => {});
            const Card = window.BlogCard;
            const posts = (window.BLOG_POSTS || []).slice(0, 2);
            if (!Card) return null;
            return (
              <div className="grid" style={{ gridTemplateColumns: "repeat(2, 1fr)", gap: 32 }}>
                {posts.map(post => (
                  <Card key={post.slug} post={post} lang={lang} setPage={setPage}/>
                ))}
              </div>
            );
          })()}
          <div style={{ marginTop: 40, textAlign: "center" }}>
            <a onClick={() => { (window.__setPage || (() => {}))("blog"); window.scrollTo(0, 0); }}
               className="btn btn-secondary"
               style={{ cursor: "pointer", display: "inline-flex" }}>
              {lang === "de" ? "Alle Beiträge ansehen" : "View all posts"}
              <Icon name="arrow" size={14}/>
            </a>
          </div>
        </div>
      </section>
    </>
  );
}

// ---------- Contact ----------
function ContactPage({ t, lang }) {
  const [state, setState] = useState("idle"); // idle | sending | sent | error
  const onSubmit = async (e) => {
    e.preventDefault();
    setState("sending");
    const result = await window.submitContact(e.target, { _subject: "LUXOMES Kontaktanfrage", source: "contact-page" });
    if (result.ok) {
      setState("sent");
      e.target.reset();
    } else {
      setState("error");
    }
  };
  return (
    <>
      <section style={{ paddingTop: 72, paddingBottom: 64 }}>
        <div className="container">
          <div style={{ maxWidth: 840, marginBottom: 48 }}>
            <div className="eyebrow">{t.contact.heroEyebrow}</div>
            <h1 className="h-display" style={{ marginTop: 28, marginBottom: 28, whiteSpace: "pre-line" }}>{t.contact.heroTitle}</h1>
            <p className="body-lg" style={{ maxWidth: 600 }}>{t.contact.heroLead}</p>
          </div>
        </div>
      </section>
      <section style={{ paddingTop: 32 }}>
        <div className="container">
          <div style={{ display: "grid", gridTemplateColumns: "1fr 1.3fr", gap: 80 }}>
            <div>
              <div style={{ fontFamily: "var(--font-display)", fontSize: 32, marginBottom: 32 }}>
                {lang === "de" ? "Direkter Kontakt" : "Direct contact"}
              </div>
              <div style={{ display: "grid", gap: 28 }}>
                <ContactLine icon="pin" title={lang === "de" ? "Adresse" : "Address"} lines={["LUXOMES GmbH", "An der Burg 5", "85716 Unterschleißheim", "Deutschland"]}/>
                <ContactLine icon="phone" title={lang === "de" ? "Telefon" : "Phone"} lines={["+49 89 693378930"]}/>
                <ContactLine icon="mail" title="Email" lines={["info@luxomes.com"]}/>
                <ContactLine icon="linkedin" title="LinkedIn" lines={["linkedin.com/company/lxomes"]}/>
              </div>
              <div className="ph" style={{ aspectRatio: "4/3", backgroundImage: `url(${IMG.city2})`, marginTop: 48, borderRadius: 4 }}/>
            </div>
            <div style={{ background: "var(--surface)", padding: 48, borderRadius: 4, border: "1px solid var(--line)" }}>
              <form onSubmit={onSubmit} style={{ display: "grid", gap: 20 }}>
                <div style={{ fontFamily: "var(--font-display)", fontSize: 28, marginBottom: 12 }}>
                  {lang === "de" ? "Schreib uns eine Nachricht" : "Send us a message"}
                </div>
                <Input label={t.contact.formName} name="name" required/>
                <div style={{ display: "grid", gridTemplateColumns: "1fr 1fr", gap: 16 }}>
                  <Input label={t.contact.formEmail} name="email" type="email" required/>
                  <Input label={t.contact.formPhone} name="phone" type="tel"/>
                </div>
                <Select label={t.contact.formTopic} name="topic" options={t.contact.topics}/>
                <Textarea label={t.contact.formMessage} name="message" required/>
                {/* Honeypot — bots fill this, humans don't */}
                <input type="text" name="_gotcha" tabIndex="-1" autoComplete="off" style={{ position: "absolute", left: "-9999px", opacity: 0 }}/>
                <div style={{ display: "flex", gap: 12, alignItems: "center", fontSize: 13, color: "var(--muted)" }}>
                  <input type="checkbox" required style={{ marginRight: 4 }}/>
                  {lang === "de" ? <>Ich stimme der Datenverarbeitung gemäß <a onClick={() => window.__setPage?.("legal-privacy")} style={{ color: "var(--accent)", cursor: "pointer", borderBottom: "1px solid var(--accent)" }}>Datenschutzerklärung</a> zu.</> : <>I agree to data processing per <a onClick={() => window.__setPage?.("legal-privacy")} style={{ color: "var(--accent)", cursor: "pointer", borderBottom: "1px solid var(--accent)" }}>privacy policy</a>.</>}
                </div>
                <button type="submit" className="btn btn-primary" style={{ justifyContent: "center", marginTop: 8 }} disabled={state === "sending"}>
                  {state === "sent" ? <><Icon name="check" size={16}/> {lang === "de" ? "Gesendet – wir melden uns!" : "Sent – we'll be in touch!"}</>
                    : state === "sending" ? (lang === "de" ? "Wird gesendet…" : "Sending…")
                    : state === "error" ? (lang === "de" ? "Fehler — bitte erneut versuchen" : "Error — please try again")
                    : <>{t.contact.formSubmit} <Icon name="arrow" size={16}/></>}
                </button>
                {state === "sent" && (
                  <div style={{ fontSize: 13, color: "var(--accent)", textAlign: "center", marginTop: -8 }}>
                    {lang === "de" ? "Wir melden uns innerhalb von 24 Stunden." : "We'll reply within 24 hours."}
                  </div>
                )}
              </form>
            </div>
          </div>
        </div>
      </section>
    </>
  );
}

function ContactLine({ icon, title, lines }) {
  return (
    <div style={{ display: "flex", gap: 16, alignItems: "flex-start" }}>
      <div style={{ width: 44, height: 44, borderRadius: "50%", background: "var(--accent-soft)", color: "var(--accent)", display: "flex", alignItems: "center", justifyContent: "center", flexShrink: 0 }}>
        <Icon name={icon} size={18}/>
      </div>
      <div>
        <div style={{ fontSize: 12, letterSpacing: "0.15em", textTransform: "uppercase", color: "var(--muted)", marginBottom: 6 }}>{title}</div>
        {lines.map((l, i) => <div key={i} style={{ fontSize: 16, lineHeight: 1.5 }}>{l}</div>)}
      </div>
    </div>
  );
}

Object.assign(window, { LocationDetailPage, AboutPage, ContactPage });
