const { createElement: h } = React;

const TOKENS = {
  brand: {
    acid: "#DAFF00",
    black: "#0B0C0A",
    white: "#FFFFFF",
    bone: "#F3EFE5",
  },
  calm: {
    ink: "#171813",
    bone: "#F2EEE3",
    acid: "#DAFF00",
    oxblood: "#6E2534",
    forest: "#173D30",
    stone: "#C9C0B0",
    mist: "#DFE4DA",
  },
  pace: {
    ink: "#080907",
    paper: "#F5F1E8",
    acid: "#DAFF00",
    carbon: "#171916",
    cobalt: "#315BFF",
    grey: "#B9B9B1",
  },
  mix: {
    ink: "#191917",
    paper: "#FFF9EA",
    acid: "#DAFF00",
    tangerine: "#FF7147",
    pink: "#FF8FB4",
    teal: "#28B9AE",
    lavender: "#B9A6FF",
  },
  type: {
    sans: "'DM Sans', Arial, sans-serif",
    display: "'Archivo Black', Impact, sans-serif",
    serif: "'DM Serif Display', Georgia, serif",
    mono: "'IBM Plex Mono', monospace",
  },
  radius: {
    sm: 8,
    md: 18,
    lg: 30,
    pill: 999,
  },
};

const COPY = {
  sk: {
    nav: ["MENU", "PROGRAM", "RUNNING CLUB", "O NÁS"],
    shop: "SHOP ↗",
    location: "BRATISLAVA",
    kicker: "LOVE THEM SPACE * BRATISLAVA",
    hero: "Zabehni. Daj si. Zostaň.",
    heroShort: "Zabehni.\nDaj si.\nZostaň.",
    intro: "Komunitný priestor pod hradom. Na ranný croissant, energiu po behu aj večerný drink s ľuďmi, ktorých máš rád.",
    viewMenu: "POZRIEŤ MENU",
    findUs: "NÁJSŤ NÁS",
    openNote: "Floriánska 2 · Vydrica · OTVÁRACIE HODINY TBC",
    nextRun: "NAJBLIŽŠÍ BEH",
    eventDay: "UTOROK",
    eventTime: "18:30 · KONCEPT",
    eventName: "EASY 5K",
    visitLabel: "PRÍĎ NA",
    visits: [
      { n: "01", title: "PRED BEHOM", text: "Niečo ľahké, niečo studené, a ide sa." },
      { n: "02", title: "PO BEHU", text: "Elektrolyty na ľade, flapjack a žiadny zhon." },
      { n: "03", title: "PO PIATEJ", text: "Víno, 0.0 drinky, hudba a dlhšie rozhovory." },
    ],
    signature: "SIGNATURE PICKS",
    menuTitle: "Menu, ktoré drží tempo.",
    menuIntro: "Od prvého dúšku pred behom po posledný pohár pod hradom.",
    program: "TENTO TÝŽDEŇ",
    partners: "ROBENÉ S ĽUĎMI, KTORÝCH MÁME RADI.",
    partnerText: "Dobré produkty, silné príbehy a ľudia, s ktorými má zmysel tvoriť.",
    aboutTitle: "MIESTO, KDE SA POHYB MENÍ NA STRETNUTIE.",
    aboutText: "LTS Bratislava nie je iba run club ani iba gastro. Je to otvorený mestský priestor na pohyb, chuť, hudbu, umenie a ľudí.",
    menuNote: "KONCEPTOVÉ CENY · FINÁLNE CENY, ALERGÉNY A DOSTUPNOSŤ TBC",
    allMenu: "CELÉ MENU",
    footer: "Vydrica, pod Bratislavským hradom",
    newsletter: "BEHY, EVENTY, NOVÉ CHUTE.",
    email: "TVOJ E-MAIL",
    subscribe: "SOM IN",
    prototypePriceNote: "Ceny sú návrh pre dizajnový prototyp. Finálne ceny, alergény a dostupnosť potvrdí LTS pred publikovaním.",
    prototypeProgramNote: "Časy a detaily programu sú konceptové. Komunitné behy LOVE THEM sú bez registrácie a bez poplatku.",
  },
  en: {
    nav: ["MENU", "WHAT'S ON", "RUNNING CLUB", "ABOUT"],
    shop: "SHOP ↗",
    location: "BRATISLAVA",
    kicker: "LOVE THEM SPACE * BRATISLAVA",
    hero: "Run. Eat. Stay.",
    heroShort: "Run.\nEat.\nStay.",
    intro: "A community space under the castle. For a morning croissant, a post-run recharge, or an evening drink with people you love.",
    viewMenu: "VIEW MENU",
    findUs: "FIND US",
    openNote: "Floriánska 2 · Vydrica · OPENING HOURS TBC",
    nextRun: "NEXT RUN",
    eventDay: "TUESDAY",
    eventTime: "18:30 · CONCEPT",
    eventName: "EASY 5K",
    visitLabel: "COME FOR",
    visits: [
      { n: "01", title: "BEFORE THE RUN", text: "A light bite, something cold, then we move." },
      { n: "02", title: "AFTER THE RUN", text: "Electrolytes over ice, a flapjack, and nowhere to rush." },
      { n: "03", title: "AFTER FIVE", text: "Wine, zero-proof drinks, music, and longer conversations." },
    ],
    signature: "SIGNATURE PICKS",
    menuTitle: "A menu that keeps pace.",
    menuIntro: "From the first sip before the run to the last glass beneath the castle.",
    program: "THIS WEEK",
    partners: "MADE WITH PEOPLE WE LOVE.",
    partnerText: "Great products, strong stories, and people worth creating with.",
    aboutTitle: "WHERE MOVEMENT BECOMES A MEETING PLACE.",
    aboutText: "LTS Bratislava is more than a run club and more than a place to eat. It is an open city space for movement, flavour, music, art, and people.",
    menuNote: "PROTOTYPE PRICES · FINAL PRICES, ALLERGENS AND AVAILABILITY TBC",
    allMenu: "FULL MENU",
    footer: "Vydrica, beneath Bratislava Castle",
    newsletter: "RUNS, EVENTS, NEW FLAVOURS.",
    email: "YOUR EMAIL",
    subscribe: "I'M IN",
    prototypePriceNote: "Prices are proposed for this design prototype. LTS will confirm final prices, allergens and availability before publishing.",
    prototypeProgramNote: "Programme times and details are conceptual. LOVE THEM community runs have no registration and no fee.",
  },
};

const MENU = [
  { category: "BAKERY & SMALL BITES", name: "Classic Croissant", detail: "crisp · fresh · uncomplicated", price: "€2.90" },
  { category: "BAKERY & SMALL BITES", name: "KRUH Flapjack Cookie", detail: "oats · honey · pistachios · cranberries · chocolate", price: "€2.90" },
  { category: "FROZEN & SWEET", name: "Madonan Scoop", detail: "flavour of the day", price: "€3.20" },
  { category: "FROZEN & SWEET", name: "Flapjack + Scoop", detail: "KRUH cookie · Madonan ice cream", price: "€5.90" },
  { category: "HYDRATE", name: "Voxberg Electrolytes on Ice", detail: "serving concept · flavour of the day", price: "€3.90" },
  { category: "HYDRATE", name: "Eliksir Kombucha", detail: "served chilled", price: "€4.50" },
  { category: "HOUSE DRINKS", name: "Vlčie House Lemonade", detail: "seasonal flavour", price: "€4.20" },
  { category: "HOUSE DRINKS", name: "Zero Mojito", detail: "mint · lime · bubbles", price: "€5.50" },
  { category: "AFTER HOURS", name: "Sparkling 0.0", detail: "by the glass", price: "€4.50" },
  { category: "AFTER HOURS", name: "Wine or Prosecco", detail: "by the glass", price: "from €5" },
];

const EVENTS = [
  { day: "TUE / UT", time: "18:30 · CONCEPT", title: "EASY 5K", text: "Five easy kilometres through the city." },
  { day: "THU / ŠT", time: "18:30 · CONCEPT", title: "LOVE THEM RUN", text: "Several pace groups. One finish back at LTS." },
  { day: "SAT / SO", time: "17:00 · CONCEPT", title: "SOBER RUN & PARTY", text: "Warm-up, 5K, DJ set and a zero-proof finish." },
];

function Icon({ name, size = 20, stroke = "currentColor" }) {
  const common = { fill: "none", stroke, strokeWidth: 1.8, strokeLinecap: "round", strokeLinejoin: "round" };
  const shapes = {
    arrow: <><path {...common} d="M5 12h13M13 7l5 5-5 5" /></>,
    pin: <><path {...common} d="M12 21s6-5.5 6-12a6 6 0 1 0-12 0c0 6.5 6 12 6 12Z" /><circle {...common} cx="12" cy="9" r="2" /></>,
    bolt: <path fill={stroke} d="M13.2 1 4 13h6.1L9 23l9.3-13h-6.1L13.2 1Z" />,
    clock: <><circle {...common} cx="12" cy="12" r="9" /><path {...common} d="M12 7v5l3 2" /></>,
    instagram: <><rect {...common} x="3" y="3" width="18" height="18" rx="5" /><circle {...common} cx="12" cy="12" r="4" /><circle fill={stroke} cx="17.5" cy="6.5" r="1" /></>,
    menu: <><path {...common} d="M4 7h16M4 12h16M4 17h16" /></>,
  };
  return <svg aria-hidden="true" width={size} height={size} viewBox="0 0 24 24">{shapes[name]}</svg>;
}

function BoltMark({ dark = false, compact = false }) {
  return (
    <div className={`bolt-mark ${dark ? "bolt-dark" : ""} ${compact ? "bolt-compact" : ""}`} aria-label="Love Them lightning mark">
      <Icon name="bolt" size={compact ? 18 : 28} stroke={dark ? TOKENS.brand.black : TOKENS.brand.acid} />
      {!compact && <span>LOVE THEM</span>}
    </div>
  );
}

function Btn({ children, kind = "solid", icon = true, className = "", href, external = false, onClick }) {
  const content = <><span>{children}</span>{icon && <Icon name="arrow" size={17} />}</>;
  if (href) return <a className={`ui-btn ui-btn-${kind} ${className}`} href={href} target={external ? "_blank" : undefined} rel={external ? "noreferrer" : undefined}>{content}</a>;
  return <button className={`ui-btn ui-btn-${kind} ${className}`} type="button" onClick={onClick}>{content}</button>;
}

function Chip({ children, tone = "light" }) {
  return <span className={`ui-chip ui-chip-${tone}`}>{children}</span>;
}

function Photo({ label, tone = "night", className = "" }) {
  return (
    <div className={`photo-placeholder photo-${tone} ${className}`} role="img" aria-label={`Photo placeholder: ${label}`}>
      <span>PHOTO DIRECTION</span>
      <strong>{label}</strong>
    </div>
  );
}

function MenuRow({ item, number, compact = false }) {
  return (
    <div className={`menu-row ${compact ? "menu-row-compact" : ""}`}>
      <span className="menu-number">{String(number + 1).padStart(2, "0")}</span>
      <div className="menu-copy">
        <strong>{item.name}</strong>
        <small>{item.detail}</small>
      </div>
      <span className="menu-price">{item.price}</span>
    </div>
  );
}

function EventCard({ event, index }) {
  return (
    <article className="event-card">
      <div className="event-meta"><span>{event.day}</span><span>{event.time}</span></div>
      <div className="event-index">0{index + 1}</div>
      <h4>{event.title}</h4>
      <p>{event.text}</p>
    </article>
  );
}

function LanguageBadge({ lang }) {
  return <span className="language-badge"><b>{lang.toUpperCase()}</b> / {lang === "sk" ? "EN" : "SK"}</span>;
}

window.LTSTokens = TOKENS;
window.LTSCopy = COPY;
window.LTSMenu = MENU;
window.LTSEvents = EVENTS;
window.LTSKit = { Icon, BoltMark, Btn, Chip, Photo, MenuRow, EventCard, LanguageBadge };
