/* home-live.jsx, full-screen scrollable Combined 02 home with rise-on-scroll + parallax */
const { useEffect, useRef, useState } = React;

const A = {
  ink: "#282828", soft: "#7d7669", faint: "#ada595",
  paper: "#ebeae4", paper2: "#d6d1c4", line: "#cdc7b9", clay: "#818F9B",
};
const Avars = { "--ink": A.ink, color: A.ink, background: A.paper };
const PAD = 84;

/* intensity → rise distance (px) + parallax travel (px, total peak-to-peak) */
const LEVELS = {
  Subtle:     { rise: 28, par: 14 },
  Medium:     { rise: 44, par: 28 },
  Pronounced: { rise: 64, par: 46 },
};

/* visible replace affordance for home-page slots (editor only) */
const HCAN_EDIT = !!(window.omelette && window.omelette.writeFile);
function HReplace({ slot, small }) {
  if (!HCAN_EDIT) return null;
  const onClick = (e) => { e.preventDefault(); e.stopPropagation(); const el = document.getElementById(slot); const b = el && el.shadowRoot && el.shadowRoot.querySelector('[data-act="replace"]'); if (b) b.click(); };
  return <button onClick={onClick} className="label" style={{ position: "absolute", top: small ? 6 : 14, right: small ? 6 : 14, zIndex: 6, border: "none", cursor: "pointer", fontSize: small ? 11 : 10, letterSpacing: small ? 0 : "0.14em", padding: small ? "4px 7px" : "8px 14px", borderRadius: 30, background: "rgba(20,18,15,0.5)", backdropFilter: "blur(10px)", WebkitBackdropFilter: "blur(10px)", color: "#f4efe5" }}>{small ? "↻" : "Replace ↻"}</button>;
}

/* image with internal parallax drift (frame clips; inner is taller and translates) */
function ParallaxImage({ slot, src, tone, cap, placeholder }) {
  return (
    <div style={{ position: "absolute", inset: 0, overflow: "hidden" }}>
      <div className="par-inner" data-par style={{ position: "absolute", left: 0, right: 0, top: "-7%", height: "114%", willChange: "transform" }}>
        <Plate slot={slot} src={src} tone={tone} cap={cap} style={{ position: "absolute", inset: 0 }} placeholder={placeholder} />
      </div>
    </div>
  );
}

/* full-bleed cross-fading slideshow with parallax drift (reuses canvas hero slots) */
function HeroSlides({ slots, tones, srcs = [], interval = 4200 }) {
  const [i, setI] = React.useState(0);
  const [prev, setPrev] = React.useState(-1);
  const [paused, setPaused] = React.useState(false);
  const [armed, setArmed] = React.useState(false);
  const canEdit = !!(window.omelette && window.omelette.writeFile);
  const iRef = React.useRef(0);
  const go = React.useCallback((n) => { setPrev(iRef.current); iRef.current = n; setI(n); }, []);
  // hold on the first (dark) slide until the Enter overlay is dismissed
  React.useEffect(() => {
    const ov = document.getElementById("enter-overlay");
    if (!ov) { setArmed(true); return; }
    let done = false;
    const arm = () => { if (!done) { done = true; setI(0); iRef.current = 0; setArmed(true); } };
    ov.addEventListener("click", () => setTimeout(arm, 200), { once: true });
    const mo = new MutationObserver(() => { if (!document.getElementById("enter-overlay")) arm(); });
    mo.observe(document.body, { childList: true });
    return () => mo.disconnect();
  }, []);
  React.useEffect(() => {
    if (paused || !armed) return;
    const t = setInterval(() => go((iRef.current + 1) % slots.length), interval);
    return () => clearInterval(t);
  }, [paused, armed, go, interval, slots.length]);
  const replaceActive = () => {
    const el = document.getElementById(slots[i]);
    const b = el && el.shadowRoot && el.shadowRoot.querySelector('[data-act="replace"]');
    if (b) b.click();
  };
  return (
    <div onClick={() => go((iRef.current + 1) % slots.length)}
      style={{ position: "absolute", inset: 0, overflow: "hidden", cursor: "pointer" }}
      onDragEnter={() => setPaused(true)} onDragOver={() => setPaused(true)}>
      <div className="par-inner" data-par style={{ position: "absolute", left: 0, right: 0, top: "-7%", height: "114%", willChange: "transform" }}>
        {slots.map((id, n) => {
          const active = n === i, leaving = n === prev;
          const visible = active || leaving;
          const tf = active ? "translateX(0) scale(1)" : leaving ? "translateX(-4%) scale(1.04)" : "translateX(4%) scale(1.04)";
          return (
          <div key={id}
            style={{ position: "absolute", inset: 0, opacity: visible ? 1 : 0, transform: tf,
            transition: visible ? "opacity 2s ease-in-out, transform 2.4s cubic-bezier(.4,0,.2,1)" : "opacity 2s ease-in-out",
            zIndex: active ? 2 : (leaving ? 1 : 0) }}>
            <Plate slot={id} src={srcs[n]} tone={tones[n]} style={{ position: "absolute", inset: 0 }} placeholder="Drop hero photo" />
          </div>
        );})}
      </div>
      {/* which slide you're on + replace it directly (editor only) */}
      {canEdit && (
        <div style={{ position: "absolute", bottom: "clamp(88px,12vh,128px)", right: "clamp(28px,5vw,72px)", zIndex: 6, display: "flex", alignItems: "center", gap: 10 }}>
          <span className="label" style={{ fontSize: 11, letterSpacing: "0.2em", color: "rgba(244,239,229,0.9)", textShadow: "0 1px 12px rgba(0,0,0,0.5)" }}>
            {String(i + 1).padStart(2, "0")} / {String(slots.length).padStart(2, "0")}
          </span>
          <button onClick={(e) => { e.stopPropagation(); replaceActive(); }} className="label" style={{ border: "none", cursor: "pointer", fontSize: 10, letterSpacing: "0.14em",
            padding: "8px 14px", borderRadius: 30, background: "rgba(255,255,255,0.18)", backdropFilter: "blur(14px)", WebkitBackdropFilter: "blur(14px)",
            border: "1px solid rgba(255,255,255,0.35)", color: "#f4efe5" }}>Replace this photo ↻</button>
        </div>
      )}
      {/* nav dots — click to view & replace each slide (hovering pauses rotation) */}
      <div style={{ position: "absolute", left: 34, bottom: 36, zIndex: 5, display: "flex", justifyContent: "flex-start", gap: 10 }}>
        {slots.map((id, n) => (
          <button key={id} onClick={(e) => { e.stopPropagation(); go(n); setPaused(true); }} aria-label={`Hero slide ${n + 1}`}
            style={{ width: n === i ? 26 : 8, height: 8, borderRadius: 8, border: "none", padding: 0, cursor: "pointer",
              background: n === i ? "rgba(244,239,229,0.95)" : "rgba(244,239,229,0.45)", transition: "all .5s ease" }}></button>
        ))}
      </div>
    </div>
  );
}

/* "essence" band, faded project photos (parallax) behind centered Spatial Sensory Intelligence */
function SensoryBand({ slots, tones, interval = 3200 }) {
  const [i, setI] = React.useState(0);
  React.useEffect(() => {
    const t = setInterval(() => setI(n => (n + 1) % slots.length), interval);
    return () => clearInterval(t);
  }, []);
  return (
    <section className="sensory vh-full" style={{ position: "relative", height: "100vh", background: A.ink, overflow: "hidden" }}>
      {/* cross-fading slideshow (with gentle parallax drift) */}
      <div data-par style={{ position: "absolute", left: 0, right: 0, top: "-12%", height: "124%", willChange: "transform" }}>
        {slots.map((id, n) => (
          <div key={id} style={{ position: "absolute", inset: 0, opacity: n === i ? 1 : 0,
            transition: "opacity 1.6s ease-in-out", zIndex: n === i ? 1 : 0 }}>
            <Plate slot={id} tone={tones[n]} style={{ position: "absolute", inset: 0 }} placeholder=" " />
          </div>
        ))}
      </div>
      <div className="sensory-veil" style={{ position: "absolute", inset: 0, background: "rgba(235,234,228,0.62)", zIndex: 2 }} />
      <div style={{ position: "absolute", inset: 0, background: "radial-gradient(120% 100% at 50% 50%, transparent 26%, rgba(235,234,228,0.55) 100%)", zIndex: 2 }} />
      <div style={{ position: "absolute", inset: 0, zIndex: 3, display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", textAlign: "center", pointerEvents: "none", padding: "0 6vw" }}>
        <div className="sensory-over label" style={{ fontSize: 13, color: A.clay, marginBottom: 30, letterSpacing: "0.24em" }}>The Essence</div>
        <h2 className="sensory-title serif" style={{ fontSize: "clamp(36px,5.2vw,76px)", fontWeight: 400, lineHeight: 0.98, margin: 0, color: A.ink }}>
          Spatial Sensory<br /><span className="ital">Intelligence</span>
        </h2>
        <div className="sensory-over" style={{ width: 44, height: 1, background: A.clay, marginTop: 38 }} />
      </div>
      {/* slideshow dots */}
      <div style={{ position: "absolute", left: 0, right: 0, bottom: 40, zIndex: 3, display: "flex", justifyContent: "center", gap: 9 }}>
        {slots.map((id, n) => (
          <span key={id} style={{ width: n === i ? 20 : 6, height: 6, borderRadius: 6,
            background: n === i ? A.clay : "rgba(125,118,105,0.4)", transition: "all 0.6s ease" }} />
        ))}
      </div>
    </section>
  );
}

/* a "world", full-bleed image PINS (sticky) while the paper panel slides up over it */
/* full-bleed cross-fading slideshow with parallax drift (reuses canvas hero slots) */
function WorldHero({ slots, srcs, tone, placeholder }) {
  const [i, setI] = React.useState(0);
  React.useEffect(() => {
    if (!srcs || srcs.length < 2) return;
    const t = setInterval(() => setI(p => (p + 1) % srcs.length), 4500);
    return () => clearInterval(t);
  }, [srcs && srcs.length]);
  return (
    <div style={{ position: "absolute", inset: 0, overflow: "hidden" }}>
      <div className="par-inner" data-par style={{ position: "absolute", left: 0, right: 0, top: "-7%", height: "114%", willChange: "transform" }}>
        {srcs.map((src, n) => (
          <div key={n} style={{ position: "absolute", inset: 0, opacity: n === i ? 1 : 0, transition: "opacity 1.8s ease-in-out", zIndex: n === i ? 1 : 0 }}>
            <Plate slot={slots[n]} src={src} tone={tone} style={{ position: "absolute", inset: 0 }} placeholder={n === 0 ? placeholder : " "} />
          </div>
        ))}
      </div>
    </div>
  );
}

function World({ heroSlot, heroSlots, heroSrc, heroSrcs, tone, idx, title, project, blurb, thumbs, thumbTones, thumbSrcs = [], location, href }) {
  const slides = heroSrcs && heroSrcs.length ? heroSrcs : null;
  const slideSlots = heroSlots && heroSlots.length ? heroSlots : [heroSlot];
  return (
    <section style={{ position: "relative" }}>
      {/* sticky image panel, stays pinned as you scroll, next panel rises over it */}
      <div className="vh-full" style={{ position: "sticky", top: 0, height: "100vh", overflow: "hidden", zIndex: 0 }}>
        {slides
          ? <WorldHero slots={slideSlots} srcs={slides} tone={tone} placeholder={`Drop ${title} image`} />
          : <ParallaxImage slot={heroSlot} src={heroSrc} tone={tone} placeholder={`Drop ${title} image`} />}
        <div style={{ position: "absolute", inset: 0, background: "linear-gradient(180deg, rgba(20,18,15,0.18) 0%, rgba(20,18,15,0) 42%, rgba(20,18,15,0.55) 100%)", zIndex: 2, pointerEvents: "none" }} />
        {href && <a href={href} aria-label={`View ${project || title}`} style={{ position: "absolute", inset: 0, zIndex: 3, cursor: "pointer" }}></a>}
        <HReplace slot={slideSlots[0]} />
        <div className="reveal" style={{ position: "absolute", inset: 0, zIndex: 4, display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", textAlign: "center", color: "#f4efe5", pointerEvents: "none" }}>
          <div className="label" style={{ fontSize: 13, letterSpacing: "0.24em", marginBottom: 18, color: "rgba(244,239,229,0.82)" }}>{`(${idx}) · ${title}`}</div>
          <h2 className="serif" style={{ fontSize: "clamp(30px,3.8vw,54px)", fontWeight: 300, margin: 0, letterSpacing: "-0.01em" }}>{project || title}</h2>
          {location && <div className="label" style={{ fontSize: 15, letterSpacing: "0.22em", marginTop: 20, color: "rgba(244,239,229,0.78)" }}>{location}</div>}
        </div>
      </div>
      {/* paper panel rises up over the pinned image — frosted so the photo shows softly through */}
      <div style={{ position: "relative", zIndex: 1, background: "rgba(235,234,228,0.6)", backdropFilter: "blur(30px) saturate(1.1)", WebkitBackdropFilter: "blur(30px) saturate(1.1)", minHeight: "88vh", display: "flex", flexDirection: "column", justifyContent: "center", padding: "clamp(56px,8vw,96px) 6vw", textAlign: "center" }}>
        <div className="stag">
          <p className="serif" style={{ fontSize: "clamp(20px,2vw,26px)", fontWeight: 300, color: A.soft, margin: "0 auto 38px", maxWidth: 640, lineHeight: 1.45 }}>{blurb}</p>
          <div style={{ display: "flex", justifyContent: "center", flexWrap: "wrap", gap: 18, marginBottom: 40 }}>
            {thumbs.map((id, n) => (
              <div key={id} style={{ position: "relative" }}>
                <a href={href || undefined} style={{ display: "block", cursor: href ? "pointer" : "default" }}>
                  <Plate slot={id} src={thumbSrcs[n]} tone={thumbTones[n]} style={{ width: 172, height: 214 }} placeholder=" " />
                </a>
                <HReplace slot={id} small={true} />
              </div>
            ))}
          </div>
          <a href={href || undefined} className="label" style={{ fontSize: 13, borderBottom: `1px solid ${A.ink}`, paddingBottom: 5, letterSpacing: "0.22em", color: A.ink, textDecoration: "none", cursor: "pointer" }}>Explore the World →</a>
        </div>
      </div>
    </section>
  );
}

/* celestial diagram of the four movements — crafted, Co-Star-flavoured (hover a body to reveal it) */
function ApproachPillars() {
  const pillars = [
    ["I", "Sense", "The body reads a room before the mind does.", "sense", "locked/hotel-materials.jpg", "#8a8272"],
    ["II", "Shape", "Order in the space becomes order in the head.", "shape", "locked/destino-akari.jpg", "#b1a48c"],
    ["III", "Regulate", "Light, air and materials tuned to your nervous system.", "regulate", "locked/hero-candles.jpg", "#a99b86"],
    ["IV", "Restore", "A space that gives energy back, not takes it.", "restore", "locked/hotel-tea.jpg", "#6f6a60"],
  ];

  return (
    <div style={{ maxWidth: 1280, margin: "0 auto", color: A.ink }}>
      <div style={{ textAlign: "center", maxWidth: 1000, margin: "0 auto" }}>
        <div className="label" style={{ fontSize: 13, letterSpacing: "0.34em", color: "#7d7669", marginBottom: "clamp(24px,3vw,38px)" }}>The Approach</div>
        <h2 className="serif" style={{ fontSize: "clamp(28px,3.4vw,52px)", fontWeight: 300, lineHeight: 1.05, margin: "0 auto", letterSpacing: "-0.02em", maxWidth: "15ch" }}>
          We design how a space <span className="ital" style={{ color: "#7d7669" }}>makes you feel.</span>
        </h2>
        <p className="journal" style={{ fontSize: "clamp(16px,1.7vw,21px)", color: A.soft, margin: "clamp(24px,3vw,38px) auto 0", maxWidth: 560, lineHeight: 1.5, fontWeight: 200 }}>
          Four movements behind every Monics space, from the first sense of a room to its lasting restoration.
        </p>
      </div>

      <div style={{ display: "grid", gridTemplateColumns: "repeat(auto-fit, minmax(220px, 1fr))", gap: "clamp(24px,3vw,46px)", marginTop: "clamp(50px,6.5vw,88px)" }}>
        {pillars.map(([n, t, d, slot, src, tone]) => (
          <figure key={n} className="flash" style={{ margin: 0 }}>
            <div style={{ background: A.paper, padding: "clamp(8px,0.9vw,13px)", border: "1px solid " + A.line, boxShadow: "0 22px 54px rgba(40,38,33,0.12)" }}>
              <div style={{ position: "relative", width: "100%", height: "clamp(300px,31vw,430px)", overflow: "hidden" }}>
                <Plate slot={"appr-" + slot} src={src} tone={tone} style={{ position: "absolute", inset: 0 }} placeholder=" " />
              </div>
            </div>
            <div style={{ display: "flex", alignItems: "baseline", gap: 12, marginTop: "clamp(16px,1.6vw,22px)" }}>
              <span className="serif ital" style={{ fontSize: "clamp(19px,1.8vw,26px)", color: A.faint, lineHeight: 0.9 }}>{n}</span>
              <span className="serif" style={{ fontSize: "clamp(22px,2.1vw,30px)", fontWeight: 300, letterSpacing: "-0.01em" }}>{t}</span>
            </div>
            <p style={{ fontSize: "clamp(14px,1.05vw,15.5px)", lineHeight: 1.55, color: A.soft, margin: "10px 0 0" }}>{d}</p>
          </figure>
        ))}
      </div>

      <div style={{ textAlign: "center", marginTop: "clamp(48px,6vw,78px)" }}>
        <a href="method.html" className="arrowlink" style={{ display: "inline-block", fontFamily: "'Redonda Compressed','Hanken Grotesk',sans-serif", textTransform: "uppercase", fontSize: 13, letterSpacing: "0.24em", color: A.ink, textDecoration: "none", borderBottom: "1px solid " + A.ink, paddingBottom: 6 }}>Read our method <span className="arw">→</span></a>
      </div>
    </div>
  );
}

/* booking steps — editorial numbered index */
function BookSteps() {
  const steps = [
    ["01", "Tell us about your space"],
    ["02", "We talk it through"],
    ["03", "A path forward"],
  ];
  return (
    <div style={{ marginBottom: 44, borderBottom: `1px solid ${A.line}` }}>
      {steps.map(([n, t]) => (
        <div key={n} style={{ display: "grid", gridTemplateColumns: "auto 1fr", columnGap: "clamp(20px,2.4vw,36px)", alignItems: "center", padding: "clamp(16px,1.9vw,24px) 0", borderTop: `1px solid ${A.line}` }}>
          <span className="serif ital" style={{ fontSize: "clamp(34px,3.6vw,52px)", fontWeight: 300, color: A.clay, lineHeight: 1, minWidth: "1.5em" }}>{n}</span>
          <span className="serif" style={{ fontSize: "clamp(21px,2.1vw,28px)", fontWeight: 300, color: A.ink, letterSpacing: "-0.01em" }}>{t}</span>
        </div>
      ))}
    </div>
  );
}

function HomeLive() {
  const [level, setLevel] = useState("Subtle");

  // apply rise distance as CSS var
  useEffect(() => {
    document.documentElement.style.setProperty("--rise", LEVELS[level].rise + "px");
  }, [level]);

  // reveal-on-scroll
  useEffect(() => {
    const els = document.querySelectorAll(".reveal, .stag, .sensory");
    const io = new IntersectionObserver((entries) => {
      entries.forEach(e => { if (e.isIntersecting) { e.target.classList.add("in"); io.unobserve(e.target); } });
    }, { threshold: 0.18, rootMargin: "0px 0px -8% 0px" });
    els.forEach(el => io.observe(el));
    return () => io.disconnect();
  }, []);

  // parallax drift
  useEffect(() => {
    let raf = null;
    const update = () => {
      raf = null;
      const range = LEVELS[level].par;
      const wh = window.innerHeight;
      document.querySelectorAll("[data-par]").forEach(el => {
        const frame = el.parentElement;
        const r = frame.getBoundingClientRect();
        if (r.bottom < -300 || r.top > wh + 300) return;
        // progress: 0 when frame just enters from bottom, 1 when it just leaves at top
        const progress = (wh - r.top) / (wh + r.height);
        const t = (0.5 - progress) * range; // +range/2 (low) → -range/2 (high) as we scroll down
        el.style.transform = `translate3d(0, ${t.toFixed(1)}px, 0)`;
      });
    };
    const onScroll = () => { if (!raf) raf = requestAnimationFrame(update); };
    update();
    window.addEventListener("scroll", onScroll, { passive: true });
    window.addEventListener("resize", onScroll, { passive: true });
    return () => { window.removeEventListener("scroll", onScroll); window.removeEventListener("resize", onScroll); if (raf) cancelAnimationFrame(raf); };
  }, [level]);

  return (
    <div className="mk" style={{ ...Avars, width: "100%", overflowX: "clip" }}>
      {/* ---- HERO ---- */}
      <div className="vh-full" style={{ position: "relative", height: "100vh", overflow: "hidden", background: A.ink }}>
        <HeroSlides slots={["hero-living-s", "hero-candles-s", "hero-bedroom-s", "hero-arches-s"]} srcs={["locked/hero-living.jpg", "locked/hero-candles.jpg", "locked/hero-bedroom.jpg", "locked/hero-arches.jpg"]} tones={["#6f6a60", "#c2b8a6", "#a99b86", "#b6a079"]} interval={5200} />
        <div style={{ position: "absolute", inset: 0, background: "linear-gradient(180deg, rgba(20,18,15,0.42) 0%, rgba(20,18,15,0) 28%, rgba(20,18,15,0) 58%, rgba(20,18,15,0.55) 100%)", zIndex: 2, pointerEvents: "none" }} />
        <div style={{ position: "absolute", top: 0, left: 0, right: 0, zIndex: 3, padding: `clamp(22px,4vw,40px) clamp(22px,6vw,${PAD}px) 0`, display: "flex", justifyContent: "space-between", alignItems: "flex-start", color: "#f4efe5" }}>
          <HoverMenuLeft color="#f4efe5" logoSize={30} items={["Projects", "Services", "About"]} showBack={false} />
          <HoverMenu color="#f4efe5" items={["Method", "Schedule a call"]} />
        </div>
        <div style={{ position: "absolute", inset: 0, zIndex: 3, display: "flex", alignItems: "center", justifyContent: "center", textAlign: "center", color: "#f4efe5", opacity: 0.72, pointerEvents: "none" }}>
          <a href="method.html" style={{ pointerEvents: "auto", cursor: "pointer", color: "inherit", textDecoration: "none" }}>
            <h1 style={{ fontFamily: "'Redonda Compressed', sans-serif", fontWeight: 400, fontSize: "clamp(15px,2vw,25px)", lineHeight: 1, margin: 0, letterSpacing: "0.34em", textTransform: "uppercase" }}>
              Spatial Sensory Intelligence<sup style={{ fontSize: "0.42em", letterSpacing: 0, verticalAlign: "super", marginLeft: "0.15em" }}>™</sup>
            </h1>
          </a>
        </div>
        <div style={{ position: "absolute", left: 0, right: 0, bottom: 26, zIndex: 3, display: "flex", flexDirection: "column", alignItems: "center", gap: 10, pointerEvents: "none" }}>
          <span className="label" style={{ fontSize: 12, color: "rgba(244,239,229,0.85)" }}>Scroll</span>
          <span style={{ width: 1, height: 30, background: "rgba(244,239,229,0.5)" }} />
        </div>
      </div>

      {/* ---- INTRO ---- */}
      <div style={{ position: "relative", zIndex: 1, padding: "clamp(72px,10vw,128px) 6vw", textAlign: "center", background: A.paper }}>
        <div className="reveal">
          <div className="label" style={{ fontSize: 13, color: A.clay, marginBottom: 26, letterSpacing: "0.24em" }}>Interior &amp; Spatial Design · Milano / Dubai</div>
          <p className="serif" style={{ fontSize: "clamp(21px,2.3vw,30px)", lineHeight: 1.34, margin: "0 auto", maxWidth: 900, fontWeight: 300, letterSpacing: "-0.005em" }}>
            We design residences, hospitality and private sanctuaries through the senses, light, texture, sound and stillness.
          </p>
        </div>
      </div>

      {/* ---- WORLDS ---- */}
      <div id="worlds" style={{ scrollMarginTop: 0 }}></div>
      <World heroSlot="live-w1" heroSrc="locked/residential-main2.jpg" tone="#9aa091" idx="01" title="Residential" href="projects.html?cat=residential"
        blurb="Homes that restore, calm and deeply personal."
        thumbs={["live-w1t1", "live-w1t2", "live-w1t3", "live-w1t4", "live-w1t5"]}
        thumbSrcs={["res-explore-1.jpg", "res-explore-2.jpg", "res-explore-3.jpg", "res-explore-4.jpg", "res-explore-5.jpg"]}
        thumbTones={["#aeb0a0", "#c2b39c", "#9aa091", "#b6a78f", "#a79b86"]} />
      <World heroSlot="live-w2" heroSrc="locked/commercial-main.jpg" tone="#b48d6f" idx="02" title="Commercial" href="projects.html?cat=commercial"
        blurb="Hotels, restaurants and retail with an atmosphere people carry home."
        thumbs={["live-w2t1", "live-w2t2", "live-w2t3", "live-w2t4", "live-w2t5"]}
        thumbSrcs={["locked/hotel-lounge.jpg", "locked/hotel-suite.jpg", "locked/hotel-bath.jpg", "locked/hotel-tea.jpg", "locked/hotel-quiet.jpg"]}
        thumbTones={["#bf9b7e", "#b48d6f", "#caa988", "#a9785f", "#c0a98f"]} />

      {/* ---- QUOTE + BOOK A CALL ---- */}
      <div style={{ background: A.paper2, padding: "clamp(64px,8vw,110px) 6vw", textAlign: "center" }}>
        <div className="reveal" style={{ maxWidth: 980, margin: "0 auto", display: "flex", flexDirection: "column", alignItems: "center" }}>
          <Seal size={44} stroke={A.ink} />
          <p className="serif" style={{ fontSize: "clamp(28px,3.6vw,52px)", margin: "clamp(22px,2.8vw,32px) auto 0", maxWidth: "22ch", lineHeight: 1.16, color: A.ink, fontWeight: 300, letterSpacing: "-0.015em" }}>
            “Design is a technology for our <span className="ital" style={{ color: A.clay }}>biology.”</span>
          </p>
          <div style={{ display: "grid", gridTemplateColumns: "minmax(30px,72px) auto minmax(30px,72px)", alignItems: "center", gap: 18, marginTop: "clamp(22px,2.8vw,32px)" }}>
            <span style={{ height: 1, background: A.line }}></span>
            <span className="label" style={{ fontSize: 12, color: A.soft, letterSpacing: "0.26em", whiteSpace: "nowrap" }}>Tania Monics, Founder</span>
            <span style={{ height: 1, background: A.line }}></span>
          </div>
          <div style={{ marginTop: "clamp(28px,3.4vw,40px)" }}>
            <a href="mailto:hello@monics.studio" className="arrowlink" style={{ display: "inline-block", fontFamily: "'Redonda Compressed','Hanken Grotesk',sans-serif", textTransform: "uppercase", fontSize: "clamp(12px,1.1vw,14px)", letterSpacing: "0.22em", color: A.ink, textDecoration: "none", padding: "14px 36px", borderRadius: 44, background: "rgba(255,255,255,0.28)", backdropFilter: "blur(16px) saturate(1.3)", WebkitBackdropFilter: "blur(16px) saturate(1.3)", border: "1px solid rgba(255,255,255,0.6)", boxShadow: "0 12px 44px rgba(40,38,33,0.10)" }}>Connect <span className="arw">→</span></a>
          </div>
        </div>
      </div>

      {/* ---- APPROACH (catalogue of the four movements) ---- */}
      <div style={{ background: A.paper, padding: "clamp(72px,9vw,150px) clamp(28px,6vw,84px)", borderTop: `1px solid ${A.line}` }}>
        <div className="reveal">
          <ApproachPillars />
        </div>
      </div>

      {/* ---- CLOSING CTA (dark band, final invitation) ---- */}
      <div id="book" style={{ scrollMarginTop: 0 }}></div>
      <div style={{ background: A.ink, color: "#ece9e1", padding: "clamp(64px,8vw,110px) clamp(28px,6vw,84px)", textAlign: "center" }}>
        <div className="reveal" style={{ display: "flex", flexDirection: "column", alignItems: "center", maxWidth: 700, margin: "0 auto" }}>
          <h2 className="serif" style={{ fontSize: "clamp(26px,2.6vw,40px)", fontWeight: 300, lineHeight: 1.06, margin: "0", letterSpacing: "-0.015em", maxWidth: "13ch" }}>
            Come home to the <span className="ital" style={{ color: "#cfc7b6" }}>feeling.</span>
          </h2>
          <p className="journal" style={{ fontSize: "clamp(15px,1.4vw,18px)", color: "#a9a396", margin: "clamp(16px,2vw,22px) 0 clamp(28px,3.4vw,38px)", maxWidth: 400, lineHeight: 1.5, fontWeight: 200 }}>
            Book a discovery call.
          </p>
          <a href="mailto:hello@monics.studio" className="arrowlink" style={{ display: "inline-block", fontFamily: "'Redonda Compressed','Hanken Grotesk',sans-serif", textTransform: "uppercase", fontSize: "clamp(11px,1vw,13px)", letterSpacing: "0.22em", color: "#ece9e1", textDecoration: "none", padding: "13px 32px", borderRadius: 44, background: "rgba(255,255,255,0.10)", backdropFilter: "blur(16px) saturate(1.3)", WebkitBackdropFilter: "blur(16px) saturate(1.3)", border: "1px solid rgba(255,255,255,0.4)" }}>Connect <span className="arw">→</span></a>
        </div>
      </div>

      {/* ---- FOOTER (editorial, circular seal) ---- */}
      <footer style={{ background: A.paper2, color: A.ink, padding: "clamp(52px,6vw,72px) 6vw clamp(28px,3vw,36px)" }}>
        {/* seal + signup */}
        <div className="reveal" style={{ display: "flex", flexDirection: "column", alignItems: "center", textAlign: "center" }}>
          <Seal size={50} stroke={A.ink} />
          <p className="serif" style={{ fontSize: "clamp(20px,2.1vw,27px)", fontWeight: 300, margin: "20px 0 6px", letterSpacing: "-0.005em", lineHeight: 1.2 }}>
            Stay close to the studio.
          </p>
          <p className="journal" style={{ fontSize: "clamp(15px,1.5vw,17px)", color: A.soft, margin: "0 0 22px", maxWidth: 440, lineHeight: 1.45 }}>
            New projects, occasional letters on living well.<br />No noise.
          </p>
          <div style={{ display: "flex", alignItems: "center", gap: 0, borderBottom: `1px solid ${A.faint}`, width: "min(420px, 82vw)", paddingBottom: 10 }}>
            <span style={{ flex: 1, textAlign: "left", fontSize: 15, color: A.soft }}>Your email</span>
            <span className="label" style={{ fontSize: 13, letterSpacing: "0.2em", color: A.ink, cursor: "pointer" }}>Subscribe →</span>
          </div>
        </div>

        {/* divider */}
        <div style={{ height: 1, background: A.line, margin: "clamp(40px,5vw,48px) 0 clamp(28px,3vw,32px)" }} />

        {/* nav columns */}
        <div className="foot-grid" style={{ display: "grid", gridTemplateColumns: "repeat(auto-fit, minmax(150px, 1fr))", gap: 30, maxWidth: 1180, margin: "0 auto", textAlign: "center" }}>
          {[["Explore", ["Projects", "Services", "Method"]],
            ["Studio", ["About", "Journal", "Contact"]],
            ["Contact", ["hello@monics.studio", "+39 347 4374756", "+971 56 382 7107", "Via Giuseppe Mazzini 9, 20123 Milano MI"]],
            ["Studios", ["Milano, Italy", "Dubai, UAE"]],
            ["Follow", ["Instagram", "Pinterest", "LinkedIn"]],
            ["Sister company", ["monicsvieira.com"]]].map(([h, items]) => (
            <div key={h} className={"foot-" + h.toLowerCase().replace(/[^a-z]+/g, "-")}>
              <div className="label" style={{ fontSize: 12, color: A.soft, marginBottom: 13, letterSpacing: "0.22em" }}>{h}</div>
              {items.map(it => {
                const map = {
                  "Projects": "projects.html", "Services": "services.html", "Method": "method.html",
                  "About": "about.html", "Contact": "index.html?from=enter#book",
                  "Journal": "https://substack.com/@taniamonics",
                  "hello@monics.studio": "mailto:hello@monics.studio",
                  "monicsvieira.com": "https://monicsvieira.com",
                  "+39 347 4374756": "tel:+393474374756",
                  "+971 56 382 7107": "tel:+971563827107",
                  "Instagram": "https://www.instagram.com/monics.studio",
                  "Pinterest": "https://pin.it/2Lt0WGTY0",
                  "LinkedIn": "https://www.linkedin.com/in/tania-monics/",
                };
                const href = map[it];
                const st = { fontSize: 15, lineHeight: 1.85, color: A.ink, cursor: href ? "pointer" : "default", textDecoration: "none", display: "block", transition: "color 0.2s ease" };
                return href
                  ? <a key={it} href={href} className="footlink" style={st}
                      target={href.startsWith("http") ? "_blank" : undefined} rel={href.startsWith("http") ? "noopener" : undefined}>{it}</a>
                  : <div key={it} style={{ ...st, cursor: "default" }}>{it}</div>;
              })}
            </div>
          ))}
        </div>

        {/* baseline */}
        <div className="foot-base" style={{ display: "flex", justifyContent: "space-between", flexWrap: "wrap", gap: 16, alignItems: "center", marginTop: "clamp(40px,5vw,50px)" }}>
          <Wordmark size={19} color={A.ink} />
          <div className="label" style={{ fontSize: 12, color: A.soft, letterSpacing: "0.2em" }}>© 2026 Monics Studio · Spatial Sensory Intelligence</div>
        </div>
      </footer>
    </div>
  );
}

ReactDOM.createRoot(document.getElementById("root")).render(<HomeLive />);
