// Home view
const HV_NS = window.DeckhausDesignSystem_ca5964;

// Small shared bits for the hero deck cards
function HeroEyebrow({ children, right }) {
  const tick = <span style={{ width: 22, height: 2, background: "var(--lime-500)", flex: "none" }} />;
  return (
    <div style={{ display: "flex", alignItems: "center", gap: 10, justifyContent: right ? "flex-end" : "flex-start" }}>
      {right ? null : tick}
      <span style={{ fontFamily: "var(--font-mono)", fontSize: 11.5, lineHeight: 1.4, letterSpacing: ".22em", textTransform: "uppercase", color: "var(--text-secondary)" }}>{children}</span>
      {right ? tick : null}
    </div>
  );
}

// Card 1 — a reel of premium, art-directed slides (shows the craft without saying it)
const HS_SERIF = "var(--font-display)", HS_MONO = "var(--font-mono)", HS_LIME = "var(--lime-500)";
function HSlide({ children, n, dark }) {
  return (
    <div style={{ position: "relative", width: "100%", aspectRatio: "16 / 9", containerType: "size", background: dark ? "#0E1013" : "#F4F0E7", color: dark ? "#EFEAE0" : "#17140D", borderRadius: "1.4cqw", overflow: "hidden", boxShadow: "0 5cqw 9cqw -5cqw rgba(0,0,0,.75), inset 0 0 0 0.3cqw rgba(0,0,0,.04)" }}>
      <div aria-hidden="true" style={{ position: "absolute", inset: 0, background: dark ? "radial-gradient(120% 120% at 50% -10%, rgba(255,255,255,.06), transparent 55%)" : "radial-gradient(130% 130% at 50% -10%, rgba(255,255,255,.5), transparent 45%)", pointerEvents: "none" }} />
      {children}
      {n ? <span style={{ position: "absolute", right: "5cqw", bottom: "4.5cqw", fontFamily: HS_MONO, fontSize: "2.2cqw", letterSpacing: ".16em", color: dark ? "rgba(239,234,224,.42)" : "rgba(0,0,0,.34)" }}>{n} / 24</span> : null}
    </div>
  );
}
const hsKick = (dark) => ({ fontFamily: HS_MONO, fontSize: "2.4cqw", letterSpacing: ".26em", textTransform: "uppercase", color: dark ? "rgba(239,234,224,.5)" : "rgba(0,0,0,.4)" });
const HERO_DECK = [
  () => <HSlide n="01">
    <span aria-hidden="true" style={{ position: "absolute", right: "-10cqw", top: "10cqw", width: "50cqw", height: "50cqw", borderRadius: "50%", border: "0.35cqw solid rgba(0,0,0,.07)" }} />
    <div style={{ position: "absolute", inset: 0, padding: "9cqw", display: "flex", flexDirection: "column" }}>
      <div style={{ display: "flex", justifyContent: "space-between", alignItems: "center" }}><span style={hsKick()}>Deckhaus Studio</span><span style={hsKick()}>2026</span></div>
      <div style={{ marginTop: "auto", fontFamily: HS_SERIF, fontWeight: 400, fontSize: "13cqw", lineHeight: .95, letterSpacing: "-0.02em" }}>The Growth<br/>Plan<span style={{ color: HS_LIME }}>.</span></div>
    </div>
  </HSlide>,
  () => <HSlide n="04"><div style={{ position: "absolute", inset: 0, padding: "9cqw", display: "flex", flexDirection: "column", justifyContent: "center" }}>
    <span style={hsKick()}>Impact</span>
    <div style={{ display: "flex", alignItems: "flex-start", gap: "1cqw", marginTop: "3cqw" }}><span style={{ fontFamily: HS_SERIF, fontSize: "38cqw", lineHeight: .74, letterSpacing: "-0.03em" }}>68</span><span style={{ fontFamily: HS_SERIF, fontSize: "11cqw", color: HS_LIME, marginTop: "2cqw" }}>%</span></div>
    <span style={{ fontFamily: HS_MONO, fontSize: "2.4cqw", letterSpacing: ".14em", color: "rgba(0,0,0,.46)", marginTop: "4cqw", maxWidth: "58%", lineHeight: 1.5 }}>faster from brief to a pitch that's ready for the room</span>
  </div></HSlide>,
  () => <HSlide n="05"><div style={{ position: "absolute", inset: 0, padding: "9cqw", display: "flex", flexDirection: "column" }}>
    <div style={{ display: "flex", justifyContent: "space-between", alignItems: "baseline" }}><span style={hsKick()}>Momentum</span><span style={{ fontFamily: HS_MONO, fontSize: "2.2cqw", letterSpacing: ".14em", color: "rgba(0,0,0,.4)" }}>Q1 — Q4</span></div>
    <div style={{ position: "relative", marginTop: "auto", height: "58%" }}>
      <svg viewBox="0 0 100 44" preserveAspectRatio="none" style={{ position: "absolute", inset: 0, width: "100%", height: "100%", overflow: "visible" }}>
        <defs><linearGradient id="hs-chartfill" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stopColor="rgba(183,201,74,.32)"/><stop offset="1" stopColor="rgba(183,201,74,0)"/></linearGradient></defs>
        {[0,11,22,33].map(y => <line key={y} x1="0" y1={y} x2="100" y2={y} stroke="rgba(0,0,0,.07)" strokeWidth="1" vectorEffect="non-scaling-stroke" />)}
        <path d="M0,36 C14,32 20,30 32,31 C46,32 52,20 66,16 C80,12 90,6 100,3 L100,44 L0,44 Z" fill="url(#hs-chartfill)" />
        <path d="M0,36 C14,32 20,30 32,31 C46,32 52,20 66,16 C80,12 90,6 100,3" fill="none" stroke="#17140D" strokeWidth="1.6" vectorEffect="non-scaling-stroke" strokeLinecap="round" strokeLinejoin="round" />
      </svg>
      <span style={{ position: "absolute", left: "31cqw", top: "60cqw", width: "2cqw", height: "2cqw", borderRadius: "50%", background: "#F4F0E7", border: "0.5cqw solid rgba(0,0,0,.5)", transform: "translate(-50%,-50%)" }} />
      <span style={{ position: "absolute", right: "-1.2cqw", top: "-1.2cqw", width: "3cqw", height: "3cqw", borderRadius: "50%", background: HS_LIME, boxShadow: "0 0 0 1.4cqw rgba(183,201,74,.22)" }} />
    </div>
    <div style={{ display: "flex", justifyContent: "space-between", marginTop: "2.5cqw", fontFamily: HS_MONO, fontSize: "1.9cqw", letterSpacing: ".1em", color: "rgba(0,0,0,.34)" }}><span>2.4×</span><span style={{ color: HS_LIME }}>+68%</span></div>
  </div></HSlide>,
  () => <HSlide n="07" dark><div style={{ position: "absolute", inset: 0, padding: "9.5cqw", display: "flex", flexDirection: "column", justifyContent: "center" }}>
    <span style={{ fontFamily: HS_SERIF, fontSize: "20cqw", lineHeight: .5, color: HS_LIME, height: "8cqw" }}>“</span>
    <div style={{ fontFamily: HS_SERIF, fontWeight: 400, fontSize: "8.4cqw", lineHeight: 1.08, letterSpacing: "-0.015em", marginTop: "2cqw" }}>We design how a brand <span style={{ fontStyle: "italic" }}>appears</span> in the room.</div>
    <span style={{ fontFamily: HS_MONO, fontSize: "2.3cqw", letterSpacing: ".22em", textTransform: "uppercase", color: "rgba(239,234,224,.46)", marginTop: "5cqw" }}>The thesis</span>
  </div></HSlide>,
  () => <HSlide n="09" dark>
    <div style={{ position: "absolute", inset: 0, background: "radial-gradient(80% 120% at 72% 40%, #26382a 0%, #12160f 46%, #080a07 100%)" }} />
    <span aria-hidden="true" style={{ position: "absolute", right: "12cqw", top: "50%", transform: "translateY(-50%)", width: "34cqw", height: "34cqw", borderRadius: "50%", background: "radial-gradient(circle at 38% 32%, rgba(183,201,74,.55), rgba(183,201,74,.06) 60%, transparent 72%)", border: "0.3cqw solid rgba(239,234,224,.14)" }} />
    <div style={{ position: "absolute", inset: 0, padding: "9cqw", display: "flex", flexDirection: "column", justifyContent: "space-between" }}>
      <span style={hsKick(true)}>Fig. 09 — Film</span>
      <span style={{ fontFamily: HS_SERIF, fontSize: "9cqw", lineHeight: .98, letterSpacing: "-0.01em", color: "#EFEAE0", maxWidth: "62%" }}>Brand, in motion.</span>
    </div></HSlide>,
  () => <HSlide n="03"><div style={{ position: "absolute", inset: 0, padding: "9cqw", display: "flex", flexDirection: "column", justifyContent: "center" }}>
    <span style={{ fontFamily: HS_SERIF, fontSize: "40cqw", lineHeight: .72, color: "transparent", WebkitTextStroke: "0.4cqw rgba(0,0,0,.42)" }}>02</span>
    <div style={{ display: "flex", alignItems: "center", gap: "3cqw", marginTop: "3cqw" }}><span style={{ width: "10cqw", height: "0.6cqw", background: HS_LIME }} /><span style={{ fontFamily: HS_SERIF, fontSize: "7cqw", letterSpacing: "-0.01em" }}>The Strategy</span></div>
  </div></HSlide>,
];
function HeroCardPresentation() {
  const [i, setI] = React.useState(0);
  const [paused, setPaused] = React.useState(false);
  React.useEffect(() => { if (paused) return; const t = setInterval(() => setI(p => (p + 1) % HERO_DECK.length), 1900); return () => clearInterval(t); }, [paused]);
  const Cur = HERO_DECK[i];
  const go = (d) => setI(p => (p + d + HERO_DECK.length) % HERO_DECK.length);
  const arrow = { all: "unset", boxSizing: "border-box", cursor: "pointer", flex: "none", width: 30, height: 30, borderRadius: "50%", border: "1px solid rgba(255,255,255,.2)", background: "rgba(255,255,255,.04)", color: "var(--paper)", display: "flex", alignItems: "center", justifyContent: "center", transition: "background .2s, border-color .2s" };
  const hov = (e, on) => { e.currentTarget.style.background = on ? "var(--lime-500)" : "rgba(255,255,255,.04)"; e.currentTarget.style.color = on ? "var(--ink-900)" : "var(--paper)"; e.currentTarget.style.borderColor = on ? "var(--lime-500)" : "rgba(255,255,255,.2)"; };
  return (
    <React.Fragment>
      <div style={{ display: "flex", justifyContent: "space-between", alignItems: "center" }}>
        <HeroEyebrow>Presentation</HeroEyebrow>
        <span style={{ fontFamily: "var(--font-mono)", fontSize: 10.5, letterSpacing: ".14em", textTransform: "uppercase", color: "var(--text-muted)" }}>Keynote-ready</span>
      </div>
      <div style={{ flex: 1, minHeight: 0, marginTop: 16, display: "flex", flexDirection: "column", justifyContent: "center", gap: 14 }} onMouseEnter={() => setPaused(true)} onMouseLeave={() => setPaused(false)}>
        <div style={{ display: "flex", alignItems: "center", gap: 12 }}>
          <button aria-label="Previous slide" onClick={() => go(-1)} style={arrow} onMouseEnter={(e) => hov(e, true)} onMouseLeave={(e) => hov(e, false)}>
            <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.4" strokeLinecap="round" strokeLinejoin="round"><polyline points="15 18 9 12 15 6"/></svg>
          </button>
          <div style={{ flex: 1, minWidth: 0 }}><div key={i} className="dh-reel-in"><Cur /></div></div>
          <button aria-label="Next slide" onClick={() => go(1)} style={arrow} onMouseEnter={(e) => hov(e, true)} onMouseLeave={(e) => hov(e, false)}>
            <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.4" strokeLinecap="round" strokeLinejoin="round"><polyline points="9 18 15 12 9 6"/></svg>
          </button>
        </div>
        <div style={{ display: "flex", alignItems: "center", gap: 10 }}>
          <div style={{ flex: 1, height: 2, background: "rgba(255,255,255,.14)", overflow: "hidden" }}><div key={i} className="dh-reel-fill" style={{ height: "100%", background: "var(--lime-500)", transformOrigin: "left" }} /></div>
          <span style={{ fontFamily: "var(--font-mono)", fontSize: 10, letterSpacing: ".1em", color: "var(--text-muted)", flex: "none" }}>{String(i + 1).padStart(2, "0")}/{String(HERO_DECK.length).padStart(2, "0")}</span>
        </div>
      </div>
      <div style={{ marginTop: 14 }}><HeroEyebrow right>Every slide, art-directed</HeroEyebrow></div>
    </React.Fragment>
  );
}

// Card 2 — services as an interactive, clickable schematic
function HeroCardServices() {
  const D = window.DH_DATA;
  const [hover, setHover] = React.useState(-1);
  return (
    <React.Fragment>
      <HeroEyebrow>What we do</HeroEyebrow>
      <div style={{ marginTop: 6, display: "flex", flexDirection: "column", justifyContent: "center", flex: 1 }}>
        {D.lines.map((l, i) => {
          const on = hover === i;
          return (
            <button key={l.title} onClick={() => window.DH_NAV("services")} onMouseEnter={() => setHover(i)} onMouseLeave={() => setHover(-1)} aria-label={`Explore ${l.title}`}
              style={{ all: "unset", boxSizing: "border-box", width: "100%", cursor: "pointer", display: "grid", gridTemplateColumns: "30px 1fr auto", gap: 16, alignItems: "center", padding: "16px 0", paddingLeft: on ? 10 : 0, borderTop: `${i === 0 ? "2px" : "1px"} solid ${on ? "var(--lime-500)" : (i === 0 ? "var(--accent-tick)" : "var(--border-subtle)")}`, transition: "padding-left .3s cubic-bezier(.16,1,.3,1), border-color .3s" }}>
              <span style={{ fontFamily: "var(--font-mono)", fontSize: 12, letterSpacing: ".08em", color: (on || i === 0) ? "var(--lime-500)" : "var(--text-muted)", transition: "color .25s" }}>{String(i + 1).padStart(2, "0")}</span>
              <div>
                <div style={{ fontFamily: "var(--font-display)", fontWeight: 400, fontSize: "clamp(18px,1.7vw,22px)", lineHeight: 1.12, color: on ? "var(--lime-500)" : "var(--paper)", transition: "color .25s" }}>{l.title}</div>
                <div style={{ fontFamily: "var(--font-mono)", fontSize: 10.5, letterSpacing: ".08em", textTransform: "uppercase", color: "var(--text-muted)", marginTop: 7 }}>{l.tags.join("  ·  ")}</div>
              </div>
              <span aria-hidden="true" style={{ fontFamily: "var(--font-display)", fontSize: 18, color: "var(--lime-500)", opacity: on ? 1 : 0, transform: on ? "translateX(0)" : "translateX(-8px)", transition: "opacity .25s, transform .25s" }}>→</span>
            </button>
          );
        })}
      </div>
      <div style={{ marginTop: 4 }}><HeroEyebrow right>Tap a scale to explore →</HeroEyebrow></div>
    </React.Fragment>
  );
}

// Card 3 — the key idea, as a fragmentation → system schematic
function HeroCardIdea() {
  const scatter = [
    { l: "2%", t: "8%", r: -9 }, { l: "44%", t: "0%", r: 6 }, { l: "20%", t: "52%", r: -4 }, { l: "60%", t: "46%", r: 8 },
  ];
  return (
    <React.Fragment>
      <HeroEyebrow>The thesis</HeroEyebrow>
      <div style={{ flex: 1, display: "grid", gridTemplateColumns: "1fr 40px 1fr", alignItems: "center", gap: 8, marginTop: 14 }}>
        <div>
          <div style={{ fontFamily: "var(--font-mono)", fontSize: 10, letterSpacing: ".14em", textTransform: "uppercase", color: "var(--text-muted)", marginBottom: 12 }}>Fragmented</div>
          <div style={{ position: "relative", height: 120 }}>
            {scatter.map((s, i) => (
              <div key={i} style={{ position: "absolute", left: s.l, top: s.t, width: "38%", height: 26, border: "1px solid rgba(255,255,255,.16)", background: "rgba(255,255,255,.02)", transform: `rotate(${s.r}deg)` }} />
            ))}
          </div>
        </div>
        <div style={{ display: "flex", justifyContent: "center", color: "var(--lime-500)" }}>
          <svg width="26" height="14" viewBox="0 0 26 14" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round"><line x1="1" y1="7" x2="24" y2="7" /><polyline points="18 2 24 7 18 12" /></svg>
        </div>
        <div>
          <div style={{ fontFamily: "var(--font-mono)", fontSize: 10, letterSpacing: ".14em", textTransform: "uppercase", color: "var(--text-accent)", marginBottom: 12 }}>One system</div>
          <div style={{ display: "flex", flexDirection: "column", gap: 8 }}>
            {[0, 1, 2].map(i => (
              <div key={i} style={{ height: 32, border: `1px solid ${i === 0 ? "var(--lime-500)" : "rgba(255,255,255,.18)"}`, borderTop: i === 0 ? "2px solid var(--lime-500)" : undefined, background: i === 0 ? "rgba(183,201,74,.07)" : "rgba(255,255,255,.02)" }} />
            ))}
          </div>
        </div>
      </div>
      <div style={{ fontFamily: "var(--font-display)", fontWeight: 400, fontSize: "clamp(17px,1.7vw,21px)", lineHeight: 1.22, color: "var(--paper)", marginTop: 14, maxWidth: "26ch" }}>Not a design problem — a communication-system problem.</div>
    </React.Fragment>
  );
}

// Card 4 — a real selected work (Lacoste)
function HeroCardDesign() {
  const cases = window.DH_DATA.cases;
  const [i, setI] = React.useState(0);
  React.useEffect(() => {
    if (window.matchMedia && window.matchMedia("(prefers-reduced-motion: reduce)").matches) return;
    const t = setInterval(() => setI(p => (p + 1) % cases.length), 2000);
    return () => clearInterval(t);
  }, []);
  const c = cases[i];
  return (
    <React.Fragment>
      <div style={{ display: "flex", justifyContent: "space-between", alignItems: "center" }}>
        <HeroEyebrow>Selected work</HeroEyebrow>
        <span style={{ fontFamily: "var(--font-mono)", fontSize: 10.5, letterSpacing: ".14em", textTransform: "uppercase", color: "var(--text-muted)" }}>Fig. {c.fig}</span>
      </div>
      <div onClick={() => window.DH_NAV("case", c.slug)} role="link" tabIndex={0} onKeyDown={(e) => { if (e.key === "Enter") window.DH_NAV("case", c.slug); }} aria-label={"Open " + c.client + " case study"}
        style={{ marginTop: 16, flex: 1, position: "relative", border: "1px solid var(--border-default)", borderRadius: "var(--radius-sm)", overflow: "hidden", background: "#0b0f0c", cursor: "pointer" }}>
        {cases.map((cc, k) => (
          <img key={cc.slug} src={cc.img} alt={cc.client + " — " + cc.title} style={{ position: "absolute", inset: 0, width: "100%", height: "100%", objectFit: "cover", objectPosition: "center", transform: "scale(1.04)", transformOrigin: "center", opacity: k === i ? 1 : 0, transition: "opacity .8s ease" }} />
        ))}
        <div style={{ position: "absolute", inset: 0, background: "linear-gradient(to top, rgba(8,10,8,.78) 4%, rgba(8,10,8,.05) 44%)" }} />
        {cases.map((cc, k) => (
          <div key={cc.slug} aria-hidden={k !== i} style={{ position: "absolute", inset: 0, opacity: k === i ? 1 : 0, transition: "opacity .8s ease", pointerEvents: "none" }}>
            <div style={{ position: "absolute", left: 14, top: 13, fontFamily: "var(--font-mono)", fontSize: 10, letterSpacing: ".16em", textTransform: "uppercase", color: "rgba(244,244,239,.7)" }}>{cc.client}</div>
            <div style={{ position: "absolute", left: 14, bottom: 14, fontFamily: "var(--font-display)", fontSize: "clamp(20px,2.1vw,28px)", lineHeight: 1.05, color: "var(--paper)" }}>{cc.title}</div>
          </div>
        ))}
      </div>
      <div style={{ marginTop: 14 }}><HeroEyebrow right>Real project · Visual Sprint</HeroEyebrow></div>
    </React.Fragment>
  );
}

function FolderRestore({ onClick, shake }) {
  const [hov, setHov] = React.useState(false);
  return (
    <button onClick={onClick} onMouseEnter={() => setHov(true)} onMouseLeave={() => setHov(false)} aria-label="Reopen — more info"
      className="dh-folder-in" style={{ all: "unset", boxSizing: "border-box", cursor: "pointer", position: "absolute", inset: 0, display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", gap: 16 }}>
      <span className={shake ? "dh-folder-shake" : undefined} style={{ transform: hov ? "translateY(-4px) scale(1.04)" : "none", transition: "transform .3s cubic-bezier(.16,1,.3,1)", filter: "drop-shadow(0 22px 30px rgba(0,0,0,.5))" }}>
        <svg width="96" height="78" viewBox="0 0 96 78" fill="none">
          <defs>
            <linearGradient id="dhfg" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stopColor="#8FBEFF"/><stop offset="1" stopColor="#4C8DFF"/></linearGradient>
          </defs>
          <path d="M8 12 h24 l8 9 h44 a6 6 0 0 1 6 6 v39 a6 6 0 0 1 -6 6 H8 a6 6 0 0 1 -6 -6 V18 a6 6 0 0 1 6 -6 z" fill="#3B79DA"/>
          <path d="M8 27 h80 a5 5 0 0 1 5 5 v34 a6 6 0 0 1 -6 6 H9 a6 6 0 0 1 -6 -6 V32 a5 5 0 0 1 5 -5 z" fill="url(#dhfg)"/>
          <path d="M8 27 h80 a5 5 0 0 1 5 5 v4 H3 v-4 a5 5 0 0 1 5 -5 z" fill="#A9CCFF" opacity=".55"/>
        </svg>
      </span>
      <span style={{ fontFamily: "var(--font-sans)", fontSize: 14, fontWeight: 500, color: hov ? "var(--paper)" : "var(--text-secondary)", transition: "color .25s", display: "inline-flex", alignItems: "center", gap: 7 }}>
        more info? <span style={{ transform: hov ? "translateX(3px)" : "none", transition: "transform .25s", color: "var(--lime-500)" }}>→</span>
      </span>
    </button>
  );
}

// Floating deck covers — full-bleed 3D gallery behind the whole hero.
// Every real project cover is present; depth is built from three tiers
// (far/mid/near) via width, blur, opacity and shadow. Gentle per-cover drift,
// plus a cursor parallax that tilts the plane and moves nearer covers more.
// Widths are in vw so the field scales edge-to-edge on any viewport.
const COVERS = [
  // ── far bokeh wall: heavily blurred, dim, some repeated — fills every gap ─
  { src: "toyota.png",        l: "-5%", t: "-8%",  w: "13vw", ry: 8,   rz: -3, z: 1, op: .26, blur: 7,   d: 5,  cf: "dh-cf-a 13s",   sh: "0 14px 30px rgba(0,0,0,.4)" },
  { src: "michelin.png",      l: "27%", t: "-13%", w: "13vw", ry: -6,  rz: 2,  z: 1, op: .24, blur: 7.5, d: 5,  cf: "dh-cf-c 14s",   sh: "0 14px 30px rgba(0,0,0,.4)" },
  { src: "yum.png",           l: "58%", t: "-11%", w: "12vw", ry: -8,  rz: -2, z: 1, op: .26, blur: 7,   d: 6,  cf: "dh-cf-b 13.5s", sh: "0 14px 30px rgba(0,0,0,.4)" },
  { src: "moncler.png",       l: "88%", t: "-5%",  w: "14vw", ry: -10, rz: 3,  z: 1, op: .3,  blur: 6.5, d: 6,  cf: "dh-cf-d 12.5s", sh: "0 14px 30px rgba(0,0,0,.4)" },
  { src: "human-ia.png",      l: "-7%", t: "33%",  w: "12vw", ry: 9,   rz: -2, z: 1, op: .26, blur: 7,   d: 5,  cf: "dh-cf-a 14s",   sh: "0 14px 30px rgba(0,0,0,.4)" },
  { src: "lazura.png",        l: "91%", t: "32%",  w: "12vw", ry: -8,  rz: 2,  z: 1, op: .28, blur: 7,   d: 6,  cf: "dh-cf-c 13s",   sh: "0 14px 30px rgba(0,0,0,.4)" },
  { src: "evowallet.png",     l: "-5%", t: "73%",  w: "13vw", ry: 9,   rz: 2,  z: 1, op: .26, blur: 7,   d: 5,  cf: "dh-cf-b 14s",   sh: "0 14px 30px rgba(0,0,0,.4)" },
  { src: "roger.png",         l: "23%", t: "89%",  w: "12vw", ry: -6,  rz: -2, z: 1, op: .26, blur: 7,   d: 6,  cf: "dh-cf-d 13s",   sh: "0 14px 30px rgba(0,0,0,.4)" },
  { src: "michelin.png",      l: "85%", t: "81%",  w: "13vw", ry: -9,  rz: 3,  z: 1, op: .24, blur: 7.5, d: 6,  cf: "dh-cf-a 12.5s", sh: "0 14px 30px rgba(0,0,0,.4)" },
  { src: "toyota.png",        l: "54%", t: "90%",  w: "13vw", ry: -6,  rz: 2,  z: 1, op: .22, blur: 7.5, d: 5,  cf: "dh-cf-c 13.5s", sh: "0 14px 30px rgba(0,0,0,.4)" },
  { src: "santander.png",     l: "80%", t: "-8%",  w: "13vw", ry: -9,  rz: 3,  z: 1, op: .3,  blur: 6.5, d: 6,  cf: "dh-cf-a 13.2s", sh: "0 14px 30px rgba(0,0,0,.4)" },
  { src: "america-cup.png",   l: "67%", t: "-13%", w: "13vw", ry: 6,   rz: 2,  z: 1, op: .24, blur: 7,   d: 5,  cf: "dh-cf-d 12.8s", sh: "0 14px 30px rgba(0,0,0,.4)" },
  { src: "rolex-daytona.png", l: "90%", t: "25%",  w: "12vw", ry: -8,  rz: 2,  z: 1, op: .3,  blur: 7,   d: 6,  cf: "dh-cf-c 13.4s", sh: "0 14px 30px rgba(0,0,0,.4)" },
  { src: "yum.png",           l: "92%", t: "62%",  w: "12vw", ry: -10, rz: 3,  z: 1, op: .3,  blur: 6.5, d: 6,  cf: "dh-cf-b 12.2s", sh: "0 14px 30px rgba(0,0,0,.4)" },
  { src: "lacoste.png",       l: "66%", t: "89%",  w: "13vw", ry: -6,  rz: -2, z: 1, op: .24, blur: 7.5, d: 5,  cf: "dh-cf-a 14.1s", sh: "0 14px 30px rgba(0,0,0,.4)" },
  { src: "santander.png",     l: "88%", t: "86%",  w: "13vw", ry: -9,  rz: 3,  z: 1, op: .28, blur: 7,   d: 6,  cf: "dh-cf-c 12.9s", sh: "0 14px 30px rgba(0,0,0,.4)" },
  { src: "synara.png",        l: "10%", t: "88%",  w: "14vw", ry: 8,   rz: -2, z: 1, op: .3,  blur: 7,   d: 5,  cf: "dh-cf-b 13.1s", sh: "0 14px 30px rgba(0,0,0,.4)" },
  { src: "mondaine.png",      l: "41%", t: "-14%", w: "13vw", ry: -6,  rz: 2,  z: 1, op: .3,  blur: 7,   d: 5,  cf: "dh-cf-d 13.3s", sh: "0 14px 30px rgba(0,0,0,.4)" },
  // ── mid tier: soft depth around the composition ─────────────────────────
  { src: "lazura.png",        l: "3%",  t: "15%",  w: "15vw", ry: 11,  rz: -2, z: 3, op: .5,  blur: 1.5, d: 14, cf: "dh-cf-b 10.5s", sh: "0 22px 42px rgba(0,0,0,.44)" },
  { src: "tedx.png",          l: "-3%", t: "51%",  w: "15vw", ry: 12,  rz: 2,  z: 3, op: .58, blur: 1.2, d: 15, cf: "dh-cf-a 11s",   sh: "0 22px 42px rgba(0,0,0,.44)" },
  { src: "rolex-vmo.png",     l: "73%", t: "-7%",  w: "18vw", ry: -11, rz: 3,  z: 3, op: .74, blur: .8,  d: 17, cf: "dh-cf-c 10.6s", sh: "0 26px 48px rgba(0,0,0,.48)" },
  { src: "jura.png",          l: "80%", t: "43%",  w: "18vw", ry: -11, rz: -2, z: 4, op: .95, blur: 0,   d: 18, cf: "dh-cf-d 10.8s", sh: "0 34px 60px rgba(0,0,0,.5)" },
  { src: "human-ia.png",      l: "60%", t: "41%",  w: "16vw", ry: -6,  rz: 2,  z: 3, op: .6,  blur: 1.1, d: 15, cf: "dh-cf-a 10.9s", sh: "0 24px 44px rgba(0,0,0,.46)" },
  { src: "michelin.png",      l: "84%", t: "36%",  w: "15vw", ry: -10, rz: 3,  z: 3, op: .64, blur: 1,   d: 16, cf: "dh-cf-c 11.3s", sh: "0 24px 44px rgba(0,0,0,.46)" },
  { src: "swissquote.png",    l: "39%", t: "21%",  w: "14vw", ry: 8,   rz: -2, z: 2, op: .38, blur: 5,   d: 9,  cf: "dh-cf-b 12s",   sh: "0 16px 32px rgba(0,0,0,.4)" },
  { src: "roger.png",         l: "55%", t: "30%",  w: "13vw", ry: -7,  rz: 2,  z: 2, op: .36, blur: 5.5, d: 10, cf: "dh-cf-d 12.5s", sh: "0 16px 32px rgba(0,0,0,.4)" },
  // ── near tier: crisp, large, overlapping fans — the recognisable brands ─
  // top fan (left → centre)
  { src: "santander.png",     l: "2%",  t: "1%",   w: "16vw", ry: 12,  rz: -3, z: 5, op: .95, blur: 0,   d: 26, cf: "dh-cf-c 9s",    sh: "0 34px 60px rgba(0,0,0,.5)" },
  { src: "america-cup.png",   l: "18%", t: "-3%",  w: "18vw", ry: -5,  rz: 2,  z: 4, op: .9,  blur: 0,   d: 24, cf: "dh-cf-d 9.4s",  sh: "0 34px 60px rgba(0,0,0,.5)" },
  { src: "evowallet.png",     l: "40%", t: "-6%",  w: "17vw", ry: -8,  rz: -2, z: 6, op: .95, blur: 0,   d: 28, cf: "dh-cf-a 9.2s",  sh: "0 36px 64px rgba(0,0,0,.52)" },
  // centre focal pair
  { src: "paris-masters.png", l: "50%", t: "9%",   w: "18vw", ry: -10, rz: 3,  z: 6, op: 1,   blur: 0,   d: 30, cf: "dh-cf-b 9.4s",  sh: "0 40px 70px rgba(0,0,0,.55)" },
  { src: "yum.png",           l: "66%", t: "25%",  w: "17vw", ry: -8,  rz: 2,  z: 5, op: .95, blur: 0,   d: 27, cf: "dh-cf-c 9.5s",  sh: "0 36px 64px rgba(0,0,0,.52)" },
  { src: "santander.png",     l: "82%", t: "13%",  w: "16vw", ry: -6,  rz: -2, z: 5, op: .92, blur: 0,   d: 25, cf: "dh-cf-d 9.7s",  sh: "0 34px 60px rgba(0,0,0,.5)" },
  { src: "lacoste.png",       l: "34%", t: "39%",  w: "20vw", ry: -6,  rz: -2, z: 7, op: 1,   blur: 0,   d: 34, cf: "dh-cf-c 9.3s",  sh: "0 48px 84px rgba(0,0,0,.6)" },
  { src: "rolex-daytona.png", l: "13%", t: "50%",  w: "16vw", ry: 12,  rz: 2,  z: 5, op: .95, blur: 0,   d: 25, cf: "dh-cf-a 8.8s",  sh: "0 34px 60px rgba(0,0,0,.5)" },
  { src: "rolex-vmo.png",     l: "65%", t: "58%",  w: "17vw", ry: -9,  rz: 3,  z: 5, op: .92, blur: 0,   d: 26, cf: "dh-cf-b 9.6s",  sh: "0 36px 64px rgba(0,0,0,.52)" },
  // bottom fan (centre → right)
  { src: "swissquote.png",    l: "29%", t: "63%",  w: "16vw", ry: 9,   rz: -2, z: 5, op: .92, blur: 0,   d: 22, cf: "dh-cf-d 9.6s",  sh: "0 34px 60px rgba(0,0,0,.5)" },
  { src: "mooncard.png",      l: "42%", t: "70%",  w: "19vw", ry: -8,  rz: -2, z: 6, op: .95, blur: 0,   d: 27, cf: "dh-cf-b 9.1s",  sh: "0 36px 64px rgba(0,0,0,.52)" },
  { src: "synara.png",        l: "54%", t: "72%",  w: "14vw", ry: -7,  rz: 2,  z: 6, op: .97, blur: 0,   d: 24, cf: "dh-cf-c 9.4s",  sh: "0 32px 58px rgba(0,0,0,.5)" },
  { src: "preventive.png",    l: "66%", t: "80%",  w: "16vw", ry: -6,  rz: -2, z: 5, op: .95, blur: 0,   d: 25, cf: "dh-cf-a 9.7s",  sh: "0 36px 64px rgba(0,0,0,.48)" },
  { src: "mondaine.png",      l: "21%", t: "69%",  w: "16vw", ry: 9,   rz: 2,  z: 5, op: .95, blur: 0,   d: 23, cf: "dh-cf-d 9.5s",  sh: "0 36px 64px rgba(0,0,0,.5)" },
];
// Aligned-collage target: first instance of each cover snaps into a tidy grid;
// duplicates + bokeh repeats fade out. Computed once at module load.
(function () {
  const seen = new Set();
  let gi = 0;
  COVERS.forEach(c => { c._primary = !seen.has(c.src); if (c._primary) { seen.add(c.src); c._gi = gi++; } });
  COVERS._gridN = gi;
})();
const G_COLS = 7;
// Slidor-style collage: real covers in three tall columns on a tilted plane.
// The centre column scrolls up while the two outer columns scroll down, each
// looping seamlessly (two copies, translateY -50%). Large tiles bleeding off
// the right edge — the hero's signature visual.
const COVERS_A = ["santander", "paris-masters", "lacoste", "mooncard", "swissquote", "evowallet", "rolex-vmo"];
const COVERS_B = ["synara", "america-cup", "jura", "preventive", "tedx", "mondaine", "human-ia"];
const COVERS_C = ["moncler", "rolex-daytona", "michelin", "yum", "roger", "toyota", "lazura"];
const CF_REDUCED = !!(window.matchMedia && window.matchMedia("(prefers-reduced-motion: reduce)").matches);
function cfRand(n) { const x = Math.sin(n * 127.1 + 11.7) * 43758.5453; return x - Math.floor(x); }
// Same character of disorder as the old floating field: covers spread across the
// whole hero, varied sizes, and the smaller/farther ones softly blurred (depth).
// Plus a SMALL bounded nudge: covers whose column slot sits just one-to-three
// slots outside the viewport get pulled a little toward it, so a handful more
// covers appear on screen during the scattered phase — nothing beyond that.
function scatterT(k, i, colIndex, dir) {
  const tx = (cfRand(k) * 2 - 1) * 28 - 8;    // vw — clustered centre-right
  let ty = (cfRand(k + 31) * 2 - 1) * 30;     // vh — tighter vertically (less empty)
  const effI = dir === "down" ? i - 7 : i;    // slot index relative to the visible band
  if (effI >= 5 && effI <= 7) ty -= (effI - 4) * 12;  // just below the fold → nudge up
  if (effI <= -1 && effI >= -4) ty += (-effI) * 14;   // just above the fold → nudge a bit more onto screen
  const rot = (cfRand(k + 61) * 2 - 1) * 26;  // deg
  const sc = 0.68 + cfRand(k + 91) * 0.66;    // 0.68–1.34
  const far = sc < 0.94;
  return {
    t: `translate(${tx.toFixed(1)}vw, ${ty.toFixed(1)}vh) rotate(${rot.toFixed(1)}deg) scale(${sc.toFixed(2)})`,
    blur: far ? +(2 + cfRand(k + 7) * 4.5).toFixed(1) : 0,
    op: far ? +(0.4 + cfRand(k + 5) * 0.32).toFixed(2) : 1,
  };
}
function CoverColumn({ list, dir, dur, colIndex, assembled, scrolling }) {
  const items = list.concat(list);
  const driftRefs = React.useRef([]);
  // Restore the original scattered look (varied dh-cf-a…d drift, ±7–15px in
  // mixed directions) — but instead of cutting the keyframe dead at assembly
  // (the old snap), freeze each cover at its current drift phase and ease that
  // residual offset away with the same curve + stagger as the fly-in.
  React.useEffect(() => {
    if (!assembled || CF_REDUCED) return;
    driftRefs.current.forEach((el, i) => {
      if (!el) return;
      const cur = getComputedStyle(el).transform;
      el.style.animation = "none";
      if (cur && cur !== "none") el.style.transform = cur;
      const delay = i * 55 + colIndex * 45;
      requestAnimationFrame(() => requestAnimationFrame(() => {
        el.style.transition = `transform 1.7s cubic-bezier(.6,0,.2,1) ${delay}ms`;
        el.style.transform = "none";
      }));
    });
  }, [assembled, colIndex]);
  return (
    <div style={{ flex: 1, minWidth: 0, height: "100%" }}>
      <div style={{ display: "flex", flexDirection: "column", willChange: "transform",
        animation: (scrolling && !CF_REDUCED) ? `${dir === "up" ? "dh-marq-up" : "dh-marq-down"} ${dur}s linear infinite` : "none" }}>
        {items.map((src, i) => {
          const k = colIndex * 100 + i;
          const S = (!assembled && !CF_REDUCED) ? scatterT(k, i, colIndex, dir) : null;
          const delay = i * 55 + colIndex * 45;
          const driftName = ["dh-cf-a", "dh-cf-b", "dh-cf-c", "dh-cf-d"][k % 4];
          return (
            <div key={i} style={{ position: "relative", width: "100%", aspectRatio: "16 / 9", marginBottom: "clamp(7px,0.6vw,12px)",
              transform: assembled ? "none" : (S ? S.t : "none"),
              opacity: assembled ? 1 : (S ? S.op : 1),
              transition: `transform 1.7s cubic-bezier(.6,0,.2,1) ${delay}ms, opacity 1s ease ${delay}ms` }}>
              <div ref={(el) => { driftRefs.current[i] = el; }} style={{ position: "absolute", inset: 0, borderRadius: 12, overflow: "hidden",
                boxShadow: "0 26px 54px -12px rgba(0,0,0,.62)", border: "1px solid rgba(255,255,255,.07)",
                animation: CF_REDUCED ? "none" : `${driftName} ${7 + (k % 5)}s ease-in-out infinite`, animationDelay: (k * -0.9) + "s" }}>
                <img src={`assets/work/covers/${src}.png`} alt="" draggable="false"
                  style={{ position: "absolute", inset: 0, width: "100%", height: "100%", objectFit: "cover", objectPosition: "center",
                    filter: (S && S.blur > 0) ? `blur(${S.blur}px)` : "none", transition: `filter .75s ease ${delay}ms` }} />
              </div>
            </div>
          );
        })}
      </div>
    </div>
  );
}
// Covers are born scattered across the hero — already floating: each one has a
// gentle idle drift AND the three columns' slow opposing scroll runs from the
// very first frame, so the whole cloud is alive from the start. At ~3.2s the
// covers converge into the moving columns with a soft in-out ease. Nothing ever
// switches on or off mid-scene (no scroll onset, no drift cutoff), so there is
// no velocity discontinuity anywhere — the morph from mess to order is seamless.
function FloatingCovers() {
  const [assembled, setAssembled] = React.useState(false);
  React.useEffect(() => {
    const t1 = setTimeout(() => setAssembled(true), 3200);
    return () => clearTimeout(t1);
  }, []);
  return (
    <div aria-hidden="true" style={{ position: "absolute", inset: 0, overflow: "hidden", pointerEvents: "none", zIndex: 0 }}>
      {/* subtle premium lime glow — sits BEHIND the covers, on the right */}
      <div style={{ position: "absolute", left: "74%", top: "50%", width: "52vw", height: "52vw", transform: "translate(-50%,-50%)", borderRadius: "50%", background: "radial-gradient(circle, color-mix(in srgb, var(--lime-500) 34%, transparent) 0%, color-mix(in srgb, var(--lime-500) 14%, transparent) 32%, transparent 64%)", filter: "blur(90px)", opacity: .9 }} />
      <div className="dh-cf-collage" style={{ position: "absolute", top: "-36%", bottom: "-36%", left: "35%", right: "-24%",
        display: "flex", gap: "clamp(8px,0.7vw,14px)", transformOrigin: "center" }}>
        <CoverColumn list={COVERS_A} dir="down" dur={42} colIndex={0} assembled={assembled} scrolling={true} />
        <CoverColumn list={COVERS_B} dir="up" dur={34} colIndex={1} assembled={assembled} scrolling={true} />
        <CoverColumn list={COVERS_C} dir="down" dur={46} colIndex={2} assembled={assembled} scrolling={true} />
      </div>
      {/* legibility scrims — left fade for the headline, vignette + top/bottom grade */}
      <div style={{ position: "absolute", inset: 0, background: "linear-gradient(90deg, var(--bg-base) 0%, var(--bg-base) 30%, color-mix(in srgb, var(--bg-base) 80%, transparent) 46%, color-mix(in srgb, var(--bg-base) 46%, transparent) 60%, color-mix(in srgb, var(--bg-base) 16%, transparent) 72%, transparent 82%)" }} />
      <div style={{ position: "absolute", inset: 0, background: "radial-gradient(150% 120% at 60% 40%, transparent 55%, rgba(10,10,11,.45) 100%)" }} />
      <div style={{ position: "absolute", inset: 0, background: "linear-gradient(180deg, rgba(10,10,11,.55) 0%, transparent 16%, transparent 66%, rgba(10,10,11,.7) 90%, var(--bg-base) 100%)" }} />
    </div>
  );
}

const HERO_STACK = ["lazura/cover.png", "lazura/trust-shifts.png", "lazura/mission.png", "lazura/reimagined.png", "lazura/growth.png", "lazura/app.png", "lazura/wellbeing.png", "lazura/contact.png"];
function HeroDeckStack({ slides = HERO_STACK, tone = "#0b0f14" }) {
  const n = slides.length;
  const [active, setActive] = React.useState(0);
  const [paused, setPaused] = React.useState(false);
  React.useEffect(() => {
    if (paused) return;
    if (window.matchMedia && window.matchMedia("(prefers-reduced-motion: reduce)").matches) return;
    const t = setInterval(() => setActive(a => (a + 1) % n), 2000);
    return () => clearInterval(t);
  }, [paused, n]);
  return (
    <div onMouseEnter={() => setPaused(true)} onMouseLeave={() => setPaused(false)}
      style={{ position: "relative", width: "100%", aspectRatio: "16 / 10", perspective: "1900px" }}>
      <div aria-hidden="true" style={{ position: "absolute", inset: "-14% -10%", background: "radial-gradient(52% 52% at 54% 42%, color-mix(in srgb, var(--lime-500) 16%, transparent), transparent 72%)", filter: "blur(30px)", pointerEvents: "none" }} />
      {slides.map((img, i) => {
        const slot = (i - active + n) % n;
        const vis = slot < 4;
        return (
          <div key={img} style={{ position: "absolute", inset: 0, margin: "auto", width: "100%", aspectRatio: "16 / 9", borderRadius: 14, overflow: "hidden", border: "1px solid rgba(255,255,255,.16)", boxShadow: "0 60px 120px -34px rgba(0,0,0,.74)", transform: `translate(${slot * 3.4}%, ${slot * 5}%) scale(${1 - slot * 0.07}) rotate(${slot * 0.8}deg)`, opacity: vis ? (1 - slot * 0.18) : 0, zIndex: n - slot, transition: "transform 1s cubic-bezier(.16,1,.3,1), opacity .7s ease" }}>
            <img src={"assets/work/" + img} alt="" draggable="false" style={{ position: "absolute", inset: 0, width: "100%", height: "100%", objectFit: "cover" }} />
          </div>
        );
      })}
      <div style={{ position: "absolute", left: 0, right: 0, bottom: "-2%", display: "flex", justifyContent: "center", gap: 7, zIndex: 40 }}>
        {slides.map((img, i) => (
          <button key={img} onClick={() => setActive(i)} aria-label={"Slide " + (i + 1)} style={{ all: "unset", cursor: "pointer", width: i === active ? 20 : 7, height: 7, borderRadius: 999, background: i === active ? "var(--lime-500)" : "rgba(244,244,239,.28)", transition: "all .3s cubic-bezier(.16,1,.3,1)" }} />
        ))}
      </div>
    </div>
  );
}

function HeroPanel() {
  // Dynamic hero deck: window-chrome + numbered tab index that navigates the
  // presentation, services, the thesis and a selected-work preview.
  const cards = [
    { C: HeroCardPresentation, label: "Presentation" },
    { C: HeroCardServices, label: "What we do" },
    { C: HeroCardIdea, label: "The thesis" },
    { C: HeroCardDesign, label: "Selected work" },
  ];
  const [i, setI] = React.useState(0);
  const [paused, setPaused] = React.useState(false);
  const [mode, setMode] = React.useState("normal"); // normal | expanded | collapsed
  const [armed, setArmed] = React.useState(false);
  const [enter, setEnter] = React.useState(false); // false = pre-entrance (hidden)
  React.useEffect(() => {
    // Hold the block back so the floating covers get the spotlight, then the
    // panel itself fades + scales in directly — no folder "more info" step.
    // (The folder is only used later, if the user closes the panel with the
    // red/yellow window dots, as a way to restore it.)
    const t0 = setTimeout(() => setArmed(true), 8000);
    const t1 = setTimeout(() => setEnter(true), 8080); // next frames → trigger the entrance transition
    return () => { clearTimeout(t0); clearTimeout(t1); };
  }, []);
  React.useEffect(() => {
    if (paused || mode === "collapsed") return;
    const t = setInterval(() => setI(p => (p + 1) % cards.length), 4600);
    return () => clearInterval(t);
  }, [paused, mode, cards.length]);
  const dots = [
    { c: "rgba(255,95,87,.95)", t: "Close", act: () => setMode("collapsed") },
    { c: "rgba(254,188,46,.95)", t: "Minimize", act: () => setMode("collapsed") },
    { c: "rgba(40,200,64,.95)", t: "Zoom", act: () => setMode(m => m === "expanded" ? "normal" : "expanded") },
  ];
  const expanded = mode === "expanded", collapsed = mode === "collapsed";
  if (!armed) return null;
  return (
    <div style={{ position: "relative", zIndex: expanded ? 30 : 1 }}>
      <div onMouseEnter={() => setPaused(true)} onMouseLeave={() => setPaused(false)}
        style={{ position: "relative", aspectRatio: "4 / 3.4", borderRadius: "var(--radius-xl)", overflow: "hidden", border: "1px solid rgba(255,255,255,.22)", background: "linear-gradient(155deg, rgba(16,16,20,.34), rgba(9,9,12,.42))", backdropFilter: "blur(64px) saturate(1.4)", WebkitBackdropFilter: "blur(64px) saturate(1.4)", display: "flex", flexDirection: "column",
          transformOrigin: collapsed ? "50% 56%" : "center right", transform: expanded ? "scale(1.3)" : collapsed ? "scale(.12)" : (enter ? "scale(1)" : "scale(.965) translateY(16px)"), opacity: collapsed ? 0 : (enter ? 1 : 0), pointerEvents: collapsed ? "none" : "auto", boxShadow: (expanded ? "0 70px 130px -40px rgba(0,0,0,.85), " : "0 30px 80px -46px rgba(0,0,0,.7), ") + "inset 0 1.5px 0 rgba(255,255,255,.4), inset 0 0 0 1px rgba(255,255,255,.06), inset 0 -20px 60px -30px rgba(0,0,0,.4)", transition: "transform .8s cubic-bezier(.16,1,.3,1), opacity .6s ease, box-shadow .5s ease" }}>
        {/* liquid-glass specular sheen */}
        <div aria-hidden="true" style={{ position: "absolute", inset: 0, pointerEvents: "none", background: "radial-gradient(130% 90% at 12% -10%, rgba(255,255,255,.14), rgba(255,255,255,.03) 28%, transparent 55%)" }} />
        <div aria-hidden="true" style={{ position: "absolute", left: 0, right: 0, top: 0, height: "46%", pointerEvents: "none", background: "linear-gradient(180deg, rgba(255,255,255,.08), transparent)" }} />
        <div style={{ position: "absolute", inset: 0, backgroundImage: "linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px)", backgroundSize: "44px 44px", opacity: .4, pointerEvents: "none" }} />
        {/* chrome bar — window dots + numbered tab index */}
        <div style={{ position: "relative", zIndex: 3, display: "flex", alignItems: "center", gap: "clamp(8px,1.4vw,16px)", padding: "12px clamp(16px,2.2vw,24px)", borderBottom: "1px solid rgba(255,255,255,.08)" }}>
          <div style={{ display: "flex", gap: 6, flex: "none" }}>
            {dots.map(d => (
              <button key={d.t} onClick={d.act} title={d.t} aria-label={d.t}
                style={{ all: "unset", cursor: "pointer", width: 11, height: 11, borderRadius: "50%", background: d.c, display: "flex", alignItems: "center", justifyContent: "center", transition: "filter .2s" }}
                onMouseEnter={(e) => { e.currentTarget.style.filter = "brightness(1.15)"; }} onMouseLeave={(e) => { e.currentTarget.style.filter = "none"; }} />
            ))}
          </div>
          <div style={{ display: "flex", gap: "clamp(2px,0.5vw,5px)", flex: 1, minWidth: 0 }}>
            {cards.map((c, idx) => {
              const on = idx === i;
              return (
                <button key={c.label} onClick={() => setI(idx)} aria-label={c.label}
                  style={{ all: "unset", boxSizing: "border-box", cursor: "pointer", display: "flex", alignItems: "center", gap: 6, minWidth: 0, padding: "6px 9px", borderRadius: 6, background: on ? "var(--lime-500)" : "rgba(30,30,34,.5)", backdropFilter: on ? "none" : "blur(8px)", WebkitBackdropFilter: on ? "none" : "blur(8px)", border: on ? "1px solid transparent" : "1px solid rgba(255,255,255,.1)", color: on ? "var(--ink-900)" : "rgba(244,244,239,.82)", transition: "background .25s, color .25s" }}>
                  <span style={{ fontFamily: "var(--font-mono)", fontSize: 9.5, opacity: on ? .7 : .7 }}>{String(idx + 1).padStart(2, "0")}</span>
                  <span style={{ fontFamily: "var(--font-mono)", fontSize: 10.5, letterSpacing: ".06em", textTransform: "uppercase", whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" }}>{c.label}</span>
                </button>
              );
            })}
          </div>
        </div>
        {/* content */}
        <div style={{ position: "relative", flex: 1 }}>
          {cards.map((c, idx) => {
            const C = c.C;
            return (
              <div key={c.label} className="dh-deck-card" aria-hidden={idx !== i}
                style={{ position: "absolute", inset: 0, padding: "clamp(22px,2.8vw,32px) clamp(20px,2.6vw,30px)", display: "flex", flexDirection: "column", opacity: idx === i ? 1 : 0, transform: idx === i ? "translateY(0)" : "translateY(10px)", pointerEvents: idx === i ? "auto" : "none" }}>
                <C />
              </div>
            );
          })}
        </div>
      </div>
      {collapsed ? <FolderRestore onClick={() => setMode("normal")} shake={false} /> : null}
    </div>
  );
}

function VisualSprintLoop() {
  // Embedded, container-scaled port of the "Loop 06 — Visual Sprint" brand loop.
  // cqw units scale every element to the framed 16:9 container.
  const cards = [
    { delay: "-0.2s" }, { delay: "-0.5s" }, { sel: true }, { delay: "-0.8s" }, { delay: "-1.1s" },
  ];
  return (
    <div style={{ position: "relative", width: "100%", aspectRatio: "16 / 9", containerType: "size", background: "#0A0A0B", border: "1px solid var(--border-default)", borderRadius: "var(--radius-lg)", overflow: "hidden", fontFamily: "var(--font-sans)" }}>
      <div style={{ position: "absolute", inset: 0, backgroundImage: "linear-gradient(rgba(255,255,255,0.03) 1px,transparent 1px),linear-gradient(90deg,rgba(255,255,255,0.03) 1px,transparent 1px)", backgroundSize: "5% 8.8%" }} />
      {/* phase row */}
      <div style={{ position: "absolute", left: "50%", top: "27%", transform: "translateX(-50%)", width: "68%" }}>
        <div style={{ position: "absolute", left: 0, right: 0, top: "50%", height: 1, background: "rgba(255,255,255,0.10)" }} />
        <div className="dh-vsl" style={{ position: "absolute", left: 0, top: "50%", height: 1, background: "var(--lime-500)", animation: "dh-fill 7s linear infinite" }} />
        <div style={{ position: "relative", display: "flex", justifyContent: "space-between", alignItems: "center" }}>
          <span className="dh-vsl" style={{ fontFamily: "var(--font-display)", fontWeight: 400, fontSize: "2cqw", color: "rgba(244,244,239,.7)", background: "#0A0A0B", padding: "0 1cqw", animation: "dh-w1 7s ease-in-out infinite" }}>Briefing</span>
          <span className="dh-vsl" style={{ fontFamily: "var(--font-display)", fontWeight: 400, fontSize: "2cqw", color: "rgba(244,244,239,.7)", background: "#0A0A0B", padding: "0 1cqw", animation: "dh-w2 7s ease-in-out infinite" }}>Explore</span>
          <span style={{ position: "relative", fontFamily: "var(--font-display)", fontWeight: 400, fontSize: "2cqw", color: "rgba(244,244,239,.7)", background: "#0A0A0B", padding: "0 1cqw" }}>
            <span className="dh-vsl" style={{ position: "relative", zIndex: 1, animation: "dh-w3 7s ease-in-out infinite" }}>Align</span>
            <span className="dh-vsl" style={{ position: "absolute", left: "50%", top: "50%", width: "calc(100% + 1cqw)", aspectRatio: "1 / 1", height: "auto", border: "1.5px solid var(--lime-500)", borderRadius: "50%", transform: "translate(-50%,-50%)", animation: "dh-ring 7s ease-out infinite" }} />
          </span>
          <span className="dh-vsl" style={{ fontFamily: "var(--font-display)", fontWeight: 400, fontSize: "2cqw", color: "rgba(244,244,239,.7)", background: "#0A0A0B", padding: "0 1cqw", animation: "dh-w4 7s ease-in-out infinite" }}>Craft</span>
          <span className="dh-vsl" style={{ fontFamily: "var(--font-display)", fontWeight: 400, fontSize: "2cqw", color: "rgba(244,244,239,.7)", background: "#0A0A0B", padding: "0 1cqw", animation: "dh-w5 7s ease-in-out infinite" }}>Delivery</span>
        </div>
      </div>
      {/* candidate routes — the Direction Room */}
      <div style={{ position: "absolute", left: "50%", top: "56%", transform: "translateX(-50%)", display: "flex", gap: "1.6cqw" }}>
        {cards.map((c, i) => (
          <div key={i} className="dh-vsl" style={{ width: "5cqw", height: "7cqw", border: `1px solid ${c.sel ? "rgba(183,201,74,0.85)" : "rgba(255,255,255,0.12)"}`, background: c.sel ? "#1A1B14" : "#141417", padding: "0.7cqw", animation: c.sel ? "dh-sel 7s ease-in-out infinite" : "dh-other 7s ease-in-out infinite", animationDelay: c.delay || "0s" }}>
            <div style={{ width: c.sel ? "60%" : "50%", height: "0.4cqw", background: c.sel ? "var(--lime-500)" : "rgba(244,244,239,0.4)" }} />
            <div style={{ width: "85%", height: "0.25cqw", background: `rgba(244,244,239,${c.sel ? "0.35" : "0.18"})`, marginTop: "0.6cqw" }} />
            <div style={{ width: "68%", height: "0.25cqw", background: `rgba(244,244,239,${c.sel ? "0.35" : "0.18"})`, marginTop: "0.4cqw" }} />
            {c.sel ? <div style={{ width: "80%", height: "0.25cqw", background: "rgba(244,244,239,0.35)", marginTop: "0.4cqw" }} /> : null}
          </div>
        ))}
      </div>
      {/* caption */}
      <div className="dh-vsl" style={{ position: "absolute", left: 0, right: 0, bottom: "10%", textAlign: "center", animation: "dh-cap 7s ease-out infinite" }}>
        <div style={{ fontFamily: "var(--font-display)", fontWeight: 400, fontSize: "2cqw", lineHeight: 1.3, color: "#F4F4EF" }}>AI accelerates exploration.<br />Human judgement defines the result.</div>
      </div>
    </div>
  );
}

// Selected work — editorial spread: one featured case + a Swiss contents index
function CaseShowcase() {
  const { Eyebrow, Button } = HV_NS;
  const cases = window.DH_DATA.cases;
  const [active, setActive] = React.useState(0);
  const c = cases[active];
  return (
    <section data-theme="dark" style={{ position: "relative", background: "var(--bg-base)", borderBottom: "1px solid var(--border-subtle)", overflow: "hidden" }}>
      {/* ambient depth — a few blurred hero covers building a universe */}
      <div aria-hidden="true" style={{ position: "absolute", inset: 0, pointerEvents: "none", overflow: "hidden" }}>
        <img src="assets/work/lazura/trust-shifts.png" alt="" style={{ position: "absolute", top: "-6%", left: "-8%", width: "40%", filter: "blur(52px)", opacity: .5, transform: "rotate(-8deg)" }} />
        <img src="assets/work/cafe-vision-poster.jpg" alt="" style={{ position: "absolute", bottom: "-14%", right: "-6%", width: "38%", filter: "blur(60px)", opacity: .46, transform: "rotate(6deg)" }} />
        <img src="assets/work/lazura/growth.png" alt="" style={{ position: "absolute", top: "30%", right: "20%", width: "30%", filter: "blur(72px)", opacity: .32 }} />
        <img src="assets/work/lacoste-court.png" alt="" style={{ position: "absolute", top: "44%", left: "8%", width: "30%", filter: "blur(80px)", opacity: .3, transform: "rotate(4deg)" }} />
        <img src="assets/work/cafe-vision-system.png" alt="" style={{ position: "absolute", top: "-4%", right: "26%", width: "24%", filter: "blur(78px)", opacity: .28 }} />
        <div style={{ position: "absolute", inset: 0, background: "radial-gradient(130% 100% at 50% 42%, transparent 34%, color-mix(in srgb, var(--bg-base) 72%, transparent) 68%, var(--bg-base) 92%)" }} />
      </div>
      <div style={{ position: "relative", maxWidth: "var(--maxw-wide)", margin: "0 auto", padding: "var(--section-y) var(--page-margin)" }}>
        {/* header */}
        <div style={{ display: "grid", gridTemplateColumns: "1.2fr 0.8fr", gap: "clamp(28px,4vw,72px)", alignItems: "flex-end", marginBottom: "clamp(44px,5vw,72px)" }}>
          <div>
            <Eyebrow>Selected work</Eyebrow>
            <h2 style={{ fontFamily: "var(--font-display)", fontWeight: 400, fontSize: "clamp(34px,4.6vw,60px)", lineHeight: 1.08, letterSpacing: "0", margin: "26px 0 0", maxWidth: "18ch", color: "var(--paper)", textWrap: "balance" }}>
              One idea, made <span style={{ color: "var(--lime-500)" }}>presentation-ready.</span>
            </h2>
          </div>
          <div style={{ display: "flex", flexDirection: "column", gap: 18, alignItems: "flex-start" }}>
            <p style={{ fontFamily: "var(--font-sans)", fontSize: 16, lineHeight: 1.6, color: "var(--text-secondary)", margin: 0, maxWidth: "38ch" }}>Every project starts as a decision about how a brand should look, feel and be remembered — then becomes a system the whole team can run.</p>
            <span style={{ fontFamily: "var(--font-mono)", fontSize: 12.5, letterSpacing: ".2em", textTransform: "uppercase", color: "var(--text-muted)" }}>
              <span style={{ color: "var(--lime-500)" }}>{String(active + 1).padStart(2, "0")}</span> / {String(cases.length).padStart(2, "0")}
            </span>
          </div>
        </div>

        {/* editorial spread */}
        <div style={{ display: "grid", gridTemplateColumns: "1.34fr 0.66fr", gap: "clamp(40px,5vw,80px)", alignItems: "start" }}>
          {/* featured */}
          <div key={active} className="dh-rise">
            {c.deck ? (
              <div onClick={() => window.DH_NAV("case", c.slug)} role="link" tabIndex={0} onKeyDown={(e) => { if (e.key === "Enter") window.DH_NAV("case", c.slug); }} aria-label={"Open " + c.client + " case study"} style={{ position: "relative", cursor: "pointer" }}><HeroDeckStack slides={c.deck} tone={c.tone} /></div>
            ) : (
            <div onClick={() => window.DH_NAV("case", c.slug)} role="link" tabIndex={0} onKeyDown={(e) => { if (e.key === "Enter") window.DH_NAV("case", c.slug); }} aria-label={"Open " + c.client + " case study"} style={{ position: "relative", cursor: "pointer", aspectRatio: "16 / 10", borderRadius: "var(--radius-lg)", overflow: "hidden", background: `linear-gradient(150deg, ${c.tone}, #0b0b0d)`, border: "1px solid var(--border-subtle)" }}>
              {c.img ? (
                <img src={c.img} alt={c.client + " — " + c.title} style={{ position: "absolute", inset: 0, width: "100%", height: "100%", objectFit: "cover", objectPosition: "center", transform: `scale(${c.imgScale || 1.35})`, transformOrigin: "center" }} />
              ) : (
                <React.Fragment>
                  <div style={{ position: "absolute", inset: 0, backgroundImage: "linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px)", backgroundSize: "clamp(46px,4vw,64px) clamp(46px,4vw,64px)", opacity: .55 }} />
                  <img src="assets/logos/deckhaus-mark-lime.svg" style={{ position: "absolute", right: "6%", top: "50%", transform: "translateY(-50%)", height: "46%", opacity: .4 }} alt="" />
                </React.Fragment>
              )}
              <span style={{ position: "absolute", left: "clamp(20px,2vw,30px)", top: "clamp(18px,1.8vw,26px)", zIndex: 2, fontFamily: "var(--font-mono)", fontSize: 11.5, letterSpacing: ".22em", textTransform: "uppercase", color: "rgba(244,244,239,.5)", mixBlendMode: c.img ? "difference" : "normal" }}>Fig. {c.fig}</span>
            </div>
            )}
            <div style={{ borderTop: "1px solid var(--border-default)", marginTop: "clamp(24px,2.6vw,34px)", paddingTop: "clamp(20px,2vw,28px)" }}>
              <div style={{ display: "flex", justifyContent: "space-between", alignItems: "baseline", gap: 16, flexWrap: "wrap" }}>
                <span style={{ display: "flex", alignItems: "center", gap: 10, fontFamily: "var(--font-mono)", fontSize: 12, letterSpacing: ".16em", textTransform: "uppercase", color: "var(--text-accent)" }}>
                  <span style={{ width: 22, height: 2, background: "var(--lime-500)", flex: "none" }} />{c.sector}
                </span>
                <span style={{ fontFamily: "var(--font-mono)", fontSize: 13, letterSpacing: ".08em", color: "var(--text-muted)" }}>{c.year}</span>
              </div>
              <h3 style={{ fontFamily: "var(--font-display)", fontWeight: 400, fontSize: "clamp(32px,3.8vw,54px)", lineHeight: 1.05, letterSpacing: "0", margin: "20px 0 0", color: "var(--paper)", textWrap: "balance" }}>
                {c.client} <span style={{ color: "var(--text-muted)" }}>— {c.title}</span>
              </h3>
              <p style={{ fontFamily: "var(--font-sans)", fontSize: 17, lineHeight: 1.64, color: "var(--text-secondary)", margin: "20px 0 0", maxWidth: "56ch" }}>{c.blurb}</p>
              <div style={{ marginTop: "clamp(26px,2.6vw,34px)" }}>
                <Button variant="ghost" onClick={() => window.DH_NAV("case", c.slug)} trailingIcon={<ArrowR/>}>View case study</Button>
              </div>
            </div>
          </div>

          {/* contents index */}
          {/* contents index — cover tiles */}
          <div style={{ display: "flex", flexDirection: "column" }}>
            <span style={{ fontFamily: "var(--font-mono)", fontSize: 11.5, letterSpacing: ".22em", textTransform: "uppercase", color: "var(--text-muted)", marginBottom: 14 }}>Index · {String(cases.length).padStart(2, "0")}</span>
            <div style={{ display: "flex", flexDirection: "column", gap: 10, minHeight: "clamp(340px,32vw,460px)", flex: 1 }}>
              {cases.map((cc, i) => {
                const on = i === active;
                const cover = cc.rotate ? ("assets/work/" + cc.rotate[0]) : cc.deck ? ("assets/work/" + cc.deck[0]) : cc.img;
                return (
                  <button key={cc.client} onClick={() => window.DH_NAV("case", cc.slug)} onMouseEnter={() => setActive(i)} aria-label={`Open ${cc.client} case study`}
                    style={{ all: "unset", cursor: "pointer", position: "relative", flex: on ? 1.9 : 1, minHeight: 0, borderRadius: "var(--radius-md)", overflow: "hidden", border: "1px solid " + (on ? "var(--lime-500)" : "var(--border-subtle)"), transition: "flex .55s cubic-bezier(.16,1,.3,1), border-color .3s" }}>
                    <img src={cover} alt="" style={{ position: "absolute", inset: 0, width: "100%", height: "100%", objectFit: "cover", filter: on ? "none" : "grayscale(.45) brightness(.66)", transition: "filter .45s ease" }} />
                    <div style={{ position: "absolute", inset: 0, background: "linear-gradient(to top, rgba(8,9,12,.9), transparent 72%)" }} />
                    <span style={{ position: "absolute", top: 12, right: 15, fontFamily: "var(--font-mono)", fontSize: 11, letterSpacing: ".14em", color: on ? "var(--lime-500)" : "rgba(244,244,239,.6)", transition: "color .3s" }}>{String(i + 1).padStart(2, "0")}</span>
                    <div style={{ position: "absolute", left: 16, bottom: 14, right: 16, display: "flex", justifyContent: "space-between", alignItems: "flex-end", gap: 10 }}>
                      <div style={{ minWidth: 0 }}>
                        <div style={{ fontFamily: "var(--font-display)", fontWeight: 400, fontSize: "clamp(21px,1.9vw,27px)", lineHeight: 1.02, color: "var(--paper)" }}>{cc.client}</div>
                        <div style={{ fontFamily: "var(--font-mono)", fontSize: 10, letterSpacing: ".12em", textTransform: "uppercase", color: "rgba(244,244,239,.66)", marginTop: 6, maxHeight: on ? 20 : 0, opacity: on ? 1 : 0, overflow: "hidden", transition: "max-height .4s cubic-bezier(.16,1,.3,1), opacity .4s ease" }}>{cc.title}</div>
                      </div>
                      <span aria-hidden="true" style={{ flex: "none", color: "var(--lime-500)", fontFamily: "var(--font-display)", fontSize: 18, lineHeight: 1, opacity: on ? 1 : 0, transform: on ? "translateX(0)" : "translateX(-6px)", transition: "opacity .3s, transform .3s" }}>→</span>
                    </div>
                  </button>
                );
              })}
            </div>
          </div>
        </div>

        {/* footer link */}
        <div style={{ display: "flex", justifyContent: "center", marginTop: "clamp(40px,4.5vw,64px)" }}>
          <Button variant="secondary" onClick={() => window.DH_NAV("work")} trailingIcon={<ArrowR/>}>See all case studies</Button>
        </div>
      </div>
    </section>
  );
}

// Presentation-native belief diagrams — slide frames, grid, branch & signature
const DH_LIME = "#B7C94A";
const DH_STROKE = "rgba(255,255,255,.55)";
const DH_SOFT = "rgba(255,255,255,.28)";
const DH_FILL = "rgba(255,255,255,.025)";

function BeliefDiagram({ kind }) {
  if (kind === 1) {
    // 01-A — One system: a slide master radiates its grid + accent to every format
    return (
      <svg viewBox="0 0 200 150" width="100%" height="100%" preserveAspectRatio="xMidYMid meet">
        {/* connectors — accent travels from master to each piece */}
        <g className="dh-d" fill="none" stroke={DH_LIME} strokeWidth="1" strokeDasharray="2.5 4.5" style={{ animation: "dh-dash 1.1s linear infinite" }}>
          <path d="M82 64 L52 32" />
          <path d="M126 72 L160 58" />
          <path d="M100 90 L100 106" />
        </g>
        {/* master */}
        <g className="dh-d" style={{ animation: "dh-floaty 7s ease-in-out infinite" }}>
          <rect x="74" y="56" width="52" height="34" rx="2.5" fill={DH_FILL} stroke={DH_STROKE} strokeWidth="1.2" />
          <rect x="74" y="56" width="52" height="5" rx="1" fill={DH_LIME} opacity=".9" />
          <line x1="80" y1="70" x2="120" y2="70" stroke={DH_SOFT} />
          <line x1="80" y1="76" x2="112" y2="76" stroke={DH_SOFT} />
          <line x1="80" y1="82" x2="118" y2="82" stroke={DH_SOFT} />
        </g>
        {/* derived format — 16:9 */}
        <g>
          <rect x="26" y="18" width="40" height="22" rx="1.5" fill={DH_FILL} stroke={DH_STROKE} strokeWidth="1" />
          <rect className="dh-d" x="26" y="18" width="40" height="3.5" fill={DH_LIME} style={{ animation: "dh-accpulse 4.8s ease-in-out infinite" }} />
        </g>
        {/* derived format — vertical */}
        <g>
          <rect x="158" y="40" width="24" height="40" rx="1.5" fill={DH_FILL} stroke={DH_STROKE} strokeWidth="1" />
          <rect className="dh-d" x="158" y="40" width="24" height="3.5" fill={DH_LIME} style={{ animation: "dh-accpulse 4.8s ease-in-out .5s infinite" }} />
        </g>
        {/* derived format — event wide */}
        <g>
          <rect x="60" y="108" width="80" height="22" rx="1.5" fill={DH_FILL} stroke={DH_STROKE} strokeWidth="1" />
          <rect className="dh-d" x="60" y="108" width="80" height="3.5" fill={DH_LIME} style={{ animation: "dh-accpulse 4.8s ease-in-out 1s infinite" }} />
        </g>
      </svg>
    );
  }

  if (kind === 2) {
    // 02-B — Decide before you produce: branches lock to one route, then it produces
    const track = [
      { x: 120, w: 15, d: 0 }, { x: 139, w: 15, d: 0.1 },
      { x: 158, w: 15, d: 0.2 }, { x: 177, w: 13, d: 0.3 },
    ];
    return (
      <svg viewBox="0 0 200 150" width="100%" height="100%" preserveAspectRatio="xMidYMid meet">
        {/* origin node */}
        <rect x="12" y="62" width="26" height="26" rx="2" fill={DH_FILL} stroke={DH_STROKE} strokeWidth="1.2" />
        <line x1="18" y1="70" x2="32" y2="70" stroke={DH_SOFT} />
        <line x1="18" y1="76" x2="29" y2="76" stroke={DH_SOFT} />
        <line x1="18" y1="82" x2="32" y2="82" stroke={DH_SOFT} />
        {/* branches */}
        <path className="dh-d" d="M38 75 C58 58, 60 36, 76 31" fill="none" stroke={DH_STROKE} strokeWidth="1.2" strokeDasharray="64" style={{ animation: "dh-branch 6s ease-in-out infinite" }} />
        <path className="dh-d" d="M38 75 L76 75" fill="none" stroke={DH_LIME} strokeWidth="1.4" strokeDasharray="64" style={{ animation: "dh-branch 6s ease-in-out .15s infinite" }} />
        <path className="dh-d" d="M38 75 C58 92, 60 114, 76 119" fill="none" stroke={DH_STROKE} strokeWidth="1.2" strokeDasharray="64" style={{ animation: "dh-branch 6s ease-in-out .3s infinite" }} />
        {/* candidates that get set aside */}
        <g className="dh-d" style={{ animation: "dh-dim 6s ease-in-out infinite" }}>
          <rect x="78" y="22" width="30" height="18" rx="1.5" fill={DH_FILL} stroke={DH_STROKE} strokeWidth="1" />
          <line x1="83" y1="31" x2="103" y2="31" stroke={DH_SOFT} />
        </g>
        <g className="dh-d" style={{ animation: "dh-dim 6s ease-in-out infinite" }}>
          <rect x="78" y="110" width="30" height="18" rx="1.5" fill={DH_FILL} stroke={DH_STROKE} strokeWidth="1" />
          <line x1="83" y1="119" x2="103" y2="119" stroke={DH_SOFT} />
        </g>
        {/* chosen route */}
        <g>
          <rect x="78" y="66" width="30" height="18" rx="1.5" fill="rgba(183,201,74,.10)" stroke={DH_LIME} strokeWidth="1.4" />
          <line x1="83" y1="75" x2="103" y2="75" stroke={DH_LIME} opacity=".7" />
        </g>
        {/* production track — only the chosen route cascades */}
        <g fill={DH_FILL} stroke={DH_STROKE} strokeWidth="1">
          {track.map((t, i) => (
            <g key={i} className="dh-d" style={{ animation: `dh-track 6s ease-in-out ${t.d}s infinite` }}>
              <rect x={t.x} y="67" width={t.w} height="17" rx="1.5" />
              <rect x={t.x} y="67" width={t.w} height="2.5" fill={DH_LIME} stroke="none" />
            </g>
          ))}
        </g>
      </svg>
    );
  }

  // 03-A — AI accelerates; people decide: a generated grid, one chosen + signed
  const cells = [
    { x: 14, y: 20, x2: 38 }, { x: 55, y: 20, x2: 76 }, { x: 96, y: 20, x2: 122 }, { x: 137, y: 20, x2: 160 },
    { x: 14, y: 58, x2: 40 }, { x: 55, y: 58, x2: 78 }, { x: 96, y: 58, x2: 120 }, { x: 137, y: 58, x2: 162 },
    { x: 14, y: 96, x2: 38 }, { x: 55, y: 96, x2: 80 }, { x: 96, y: 96, x2: 118 }, { x: 137, y: 96, x2: 160 },
  ];
  return (
    <svg viewBox="0 0 200 150" width="100%" height="100%" preserveAspectRatio="xMidYMid meet">
      <g fill={DH_FILL} stroke={DH_STROKE} strokeWidth=".9">
        {cells.map((c, i) => (
          <g key={i} className="dh-d" style={{ animation: `dh-flick 6s ease-in-out ${(i * 0.05).toFixed(2)}s infinite` }}>
            <rect x={c.x} y={c.y} width="34" height="26" rx="1.5" />
            <line x1={c.x + 5} y1={c.y + 8} x2={c.x2} y2={c.y + 8} stroke={DH_SOFT} />
          </g>
        ))}
      </g>
      {/* the human pick + signature */}
      <g className="dh-d" style={{ animation: "dh-pickshow 6s ease-in-out infinite" }}>
        <rect x="94" y="56" width="38" height="30" rx="2" fill="rgba(183,201,74,.12)" stroke={DH_LIME} strokeWidth="1.5" />
        <line className="dh-d" x1="96" y1="92" x2="130" y2="92" stroke={DH_LIME} strokeWidth="1.6" strokeLinecap="round" strokeDasharray="34" style={{ animation: "dh-sign 6s ease-in-out infinite" }} />
      </g>
    </svg>
  );
}

function ManifestoCard({ n, title, desc, kind, idx, kicker }) {
  const ref = React.useRef(null);
  const [seen, setSeen] = React.useState(false);
  React.useEffect(() => {
    const el = ref.current;
    if (!el) return;
    const io = new IntersectionObserver((entries) => {
      entries.forEach(e => { if (e.isIntersecting) { setSeen(true); io.disconnect(); } });
    }, { threshold: 0.3 });
    io.observe(el);
    return () => io.disconnect();
  }, []);
  const delay = idx * 0.13;
  return (
    <div ref={ref} className={"dh-mf" + (seen ? " in-view" : "")} style={{ transitionDelay: delay + "s", height: "100%", position: "relative", display: "flex", flexDirection: "column", paddingLeft: "clamp(20px,2.4vw,40px)", paddingRight: "clamp(20px,2.4vw,40px)", borderLeft: idx > 0 ? "1px solid var(--border-default)" : "none", boxSizing: "border-box" }}>
      {/* index row — number + kicker on one editorial rule that draws in */}
      <div style={{ display: "flex", alignItems: "center", gap: 12 }}>
        <span aria-hidden="true" style={{ width: 16, height: 2, background: "var(--lime-500)", flex: "none", transformOrigin: "left center", transform: seen ? "scaleX(1)" : "scaleX(0)", transition: "transform .6s cubic-bezier(.16,1,.3,1)", transitionDelay: (delay + 0.1) + "s" }} />
        <span style={{ fontFamily: "var(--font-display)", fontWeight: 400, fontSize: "clamp(20px,1.8vw,27px)", lineHeight: 1, letterSpacing: "-0.01em", color: "var(--ink-900)" }}>{n}</span>
        <span style={{ fontFamily: "var(--font-mono)", fontSize: 11.5, letterSpacing: ".2em", textTransform: "uppercase", color: "var(--text-accent)" }}>{kicker}</span>
        <span style={{ position: "relative", flex: 1, height: 1, overflow: "hidden" }}>
          <span aria-hidden="true" style={{ position: "absolute", inset: 0, background: "rgba(10,10,11,.22)", transformOrigin: "left center", transform: seen ? "scaleX(1)" : "scaleX(0)", transition: "transform 1s cubic-bezier(.16,1,.3,1)", transitionDelay: (delay + 0.25) + "s" }} />
        </span>
      </div>
      <h3 style={{ fontFamily: "var(--font-display)", fontWeight: 400, fontSize: "clamp(26px,2.4vw,34px)", lineHeight: 1.12, letterSpacing: "-0.01em", margin: "clamp(26px,2.8vw,40px) 0 0", minHeight: "2.24em" }}>{title}</h3>
      <p style={{ fontFamily: "var(--font-sans)", fontSize: "clamp(15px,1.1vw,16.5px)", lineHeight: 1.66, color: "var(--text-secondary)", margin: "20px 0 0", maxWidth: "34ch", minHeight: "4.98em" }}>{desc}</p>
      <figure style={{ margin: 0, marginTop: "auto", paddingTop: "clamp(30px,3.4vw,46px)" }}>
        <div style={{ position: "relative", height: "clamp(186px,16vw,224px)", background: "#0A0A0C", border: "1px solid var(--border-default)", borderRadius: "var(--radius-sm)", overflow: "hidden" }}>
          <div aria-hidden="true" style={{ position: "absolute", inset: 0, backgroundImage: "linear-gradient(rgba(255,255,255,.045) 1px,transparent 1px),linear-gradient(90deg,rgba(255,255,255,.045) 1px,transparent 1px)", backgroundSize: "27px 27px" }} />
          <span style={{ position: "absolute", left: 15, top: 13, fontFamily: "var(--font-mono)", fontSize: 10.5, letterSpacing: ".16em", textTransform: "uppercase", color: "rgba(244,244,239,.5)" }}>Fig. {n}</span>
          <span style={{ position: "absolute", right: 15, top: 13, fontFamily: "var(--font-mono)", fontSize: 10.5, letterSpacing: ".16em", textTransform: "uppercase", color: "rgba(244,244,239,.32)" }}>{kicker}</span>
          <div style={{ position: "absolute", inset: 0, padding: "34px 20px 22px" }}><BeliefDiagram kind={kind} /></div>
        </div>
      </figure>
    </div>
  );
}

// Per-line schematic for the interactive "what we do" selector
function LineSchematic({ i }) {
  const BD = "var(--border-default)", LIME = "var(--lime-500)", INK = "rgba(10,10,11,.82)";
  if (i === 0) {
    // Strategic Presentations — a slide + filmstrip
    return (
      <div style={{ display: "flex", flexDirection: "column", gap: 10, width: "100%" }}>
        <div style={{ position: "relative", aspectRatio: "16 / 9", borderRadius: 6, overflow: "hidden", border: `1px solid ${BD}`, background: "#fff", padding: 14, display: "flex", flexDirection: "column", boxShadow: "0 18px 34px -26px rgba(0,0,0,.4)" }}>
          <span style={{ width: 15, height: 15, background: LIME, flex: "none" }} />
          <div style={{ marginTop: "auto", display: "flex", flexDirection: "column", gap: 6 }}>
            <span style={{ height: 7, width: "70%", background: INK, borderRadius: 2 }} />
            <span style={{ height: 7, width: "48%", background: INK, borderRadius: 2 }} />
            <span style={{ height: 4, width: "30%", background: LIME, borderRadius: 2, marginTop: 3 }} />
          </div>
        </div>
        <div style={{ display: "flex", gap: 7 }}>
          {[0, 1, 2].map(k => <span key={k} style={{ flex: 1, aspectRatio: "16 / 9", borderRadius: 3, border: `1px solid ${k === 0 ? LIME : BD}`, background: "#fff" }} />)}
        </div>
      </div>
    );
  }
  if (i === 1) {
    // Content Systems — one reusable language, repeated
    const lit = { 1: true, 5: true, 6: true };
    return (
      <div style={{ display: "grid", gridTemplateColumns: "repeat(3,1fr)", gap: 7, width: "100%" }}>
        {Array.from({ length: 9 }).map((_, k) => (
          <span key={k} style={{ aspectRatio: "1", borderRadius: 3, background: lit[k] ? LIME : "#fff", border: lit[k] ? "none" : `1px solid ${BD}` }} />
        ))}
      </div>
    );
  }
  // Brand Experiences — a stage screen + multi-format adaptations
  return (
    <div style={{ display: "flex", flexDirection: "column", gap: 10, width: "100%" }}>
      <div style={{ position: "relative", aspectRatio: "16 / 9", borderRadius: 6, overflow: "hidden", background: "var(--ink-900)", padding: 13, display: "flex", alignItems: "flex-end", boxShadow: "0 18px 34px -26px rgba(0,0,0,.5)" }}>
        <span style={{ position: "absolute", inset: 0, backgroundImage: "linear-gradient(rgba(244,244,239,.07) 1px,transparent 1px),linear-gradient(90deg,rgba(244,244,239,.07) 1px,transparent 1px)", backgroundSize: "16px 16px" }} />
        <span style={{ position: "absolute", top: 11, left: 13, width: 34, height: 4, background: LIME, borderRadius: 1 }} />
        <span style={{ position: "relative", height: 5, width: "56%", background: "var(--paper)", borderRadius: 1 }} />
      </div>
      <div style={{ display: "flex", gap: 7 }}>
        <span style={{ flex: 1, aspectRatio: "9 / 16", borderRadius: 3, background: "#fff", border: `1px solid ${BD}` }} />
        <span style={{ flex: 1, aspectRatio: "9 / 16", borderRadius: 3, background: LIME }} />
        <span style={{ flex: 1, aspectRatio: "9 / 16", borderRadius: 3, background: "#fff", border: `1px solid ${BD}` }} />
        <span style={{ flex: 1, aspectRatio: "9 / 16", borderRadius: 3, background: "#fff", border: `1px solid ${BD}` }} />
      </div>
    </div>
  );
}

// Interactive "what we do" — tab list + detail panel (ported from the Smartbrand proposal)
function BusinessLinesInteractive({ lines }) {
  const [active, setActive] = React.useState(0);
  const labels = ["01 — Core", "02", "03"];
  const l = lines[active];
  return (
    <div style={{ display: "grid", gridTemplateColumns: "minmax(300px,0.9fr) 1.1fr", gap: "clamp(28px,3vw,52px)", alignItems: "stretch" }}>
      {/* tab list */}
      <div role="tablist" style={{ display: "flex", flexDirection: "column", borderTop: "1px solid var(--border-default)" }}>
        {lines.map((line, i) => {
          const on = i === active;
          return (
            <button key={line.title} role="tab" aria-selected={on} onClick={() => setActive(i)} onMouseEnter={() => setActive(i)}
              style={{ all: "unset", boxSizing: "border-box", cursor: "pointer", textAlign: "left", borderBottom: "1px solid var(--border-subtle)", padding: "clamp(18px,1.8vw,24px) 6px", paddingLeft: on ? 16 : 6, display: "flex", alignItems: "center", gap: 18, transition: "padding-left .3s cubic-bezier(.16,1,.3,1)" }}>
              <span style={{ fontFamily: "var(--font-mono)", fontSize: "clamp(12px,1vw,13px)", letterSpacing: ".1em", textTransform: "uppercase", color: on ? "var(--text-accent)" : "var(--text-muted)", transition: "color .25s", flex: "none", width: 62 }}>{labels[i]}</span>
              <span style={{ fontFamily: "var(--font-display)", fontWeight: 400, fontSize: "clamp(20px,1.9vw,28px)", lineHeight: 1.1, color: on ? "var(--text-primary)" : "var(--text-secondary)", transition: "color .25s" }}>{line.title}</span>
              <span style={{ marginLeft: "auto", width: 8, height: 8, borderRadius: "50%", flex: "none", background: on ? "var(--lime-500)" : "transparent", transform: on ? "scale(1)" : "scale(0)", transition: "all .25s" }} />
            </button>
          );
        })}
      </div>
      {/* detail panel */}
      <div style={{ position: "relative", background: "var(--surface-card)", border: "1px solid var(--border-default)", borderRadius: 14, padding: "clamp(26px,2.6vw,40px)", minHeight: "clamp(360px,42vh,440px)", overflow: "hidden" }}>
        <div style={{ position: "absolute", inset: 0, backgroundImage: "linear-gradient(var(--border-subtle) 1px,transparent 1px),linear-gradient(90deg,var(--border-subtle) 1px,transparent 1px)", backgroundSize: "46px 46px", opacity: .5, pointerEvents: "none" }} />
        <div key={active} className="dh-rise" style={{ position: "relative", display: "grid", gridTemplateColumns: "1fr clamp(150px,18vw,220px)", gap: "clamp(20px,2.4vw,38px)", height: "100%", alignItems: "center" }}>
          <div style={{ display: "flex", flexDirection: "column", justifyContent: "center" }}>
            <span style={{ fontFamily: "var(--font-mono)", fontSize: 12, letterSpacing: ".18em", textTransform: "uppercase", color: "var(--text-accent)" }}>{l.scale}</span>
            <h3 style={{ fontFamily: "var(--font-display)", fontWeight: 400, fontSize: "clamp(26px,2.6vw,38px)", lineHeight: 1.1, margin: "14px 0 0", color: "var(--text-primary)" }}>{l.title}</h3>
            <p style={{ fontFamily: "var(--font-sans)", fontSize: "clamp(15px,1.15vw,17px)", lineHeight: 1.6, color: "var(--text-secondary)", margin: "16px 0 0", maxWidth: "46ch" }}>{l.desc}</p>
            <div style={{ display: "flex", flexWrap: "wrap", gap: 9, marginTop: 22 }}>
              {l.tags.map((t, k) => (
                <span key={t} style={{ fontFamily: "var(--font-mono)", fontSize: 11.5, letterSpacing: ".08em", textTransform: "uppercase", color: k === 0 ? "var(--ink-900)" : "var(--text-secondary)", background: k === 0 ? "var(--lime-500)" : "transparent", border: `1px solid ${k === 0 ? "var(--lime-500)" : "var(--border-default)"}`, borderRadius: 999, padding: "6px 13px" }}>{t}</span>
              ))}
            </div>
          </div>
          <div style={{ justifySelf: "center", width: "100%", maxWidth: 220 }}>
            <LineSchematic i={active} />
          </div>
        </div>
      </div>
    </div>
  );
}

// Registration crosshair tick for the manifesto grid
function GridTick({ left, top, seen, delay }) {
  return (
    <span aria-hidden="true" style={{ position: "absolute", left, top, width: 12, height: 12, transform: "translate(-50%,-50%)", opacity: seen ? 1 : 0, transition: "opacity .6s ease", transitionDelay: delay }}>
      <span style={{ position: "absolute", left: 0, right: 0, top: "50%", height: 1, background: "var(--lime-500)", transform: "translateY(-50%)" }} />
      <span style={{ position: "absolute", top: 0, bottom: 0, left: "50%", width: 1, background: "var(--lime-500)", transform: "translateX(-50%)" }} />
    </span>
  );
}

// A big line-art coffee cup — the humorous wink
function CoffeeIcon() {
  return (
    <span aria-hidden="true" style={{ display: "inline-block", width: "clamp(40px,3.6vw,52px)", height: "clamp(40px,3.6vw,52px)", flex: "none" }}>
      <svg width="100%" height="100%" viewBox="0 0 48 48" fill="none" stroke="var(--lime-500)" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
        <path className="dh-steam" style={{ animationDelay: "0s" }} d="M18 13c2-2.4-2-4 0-7" />
        <path className="dh-steam" style={{ animationDelay: ".5s" }} d="M24 13c2-2.4-2-4 0-7" />
        <path className="dh-steam" style={{ animationDelay: "1s" }} d="M30 13c2-2.4-2-4 0-7" />
        <path d="M11 20h26v7a9 9 0 0 1-9 9h-8a9 9 0 0 1-9-9z" />
        <path d="M37 22a6 6 0 0 1 0 11" />
        <path d="M9 42h30" />
      </svg>
    </span>
  );
}

// Manifesto headline — word-by-word reveal on a self-drawing Swiss grid
function ManifestoHeadline() {
  const { Eyebrow } = HV_NS;
  const ref = React.useRef(null);
  const [seen, setSeen] = React.useState(false);
  React.useEffect(() => {
    const el = ref.current;
    if (!el) return;
    if (window.matchMedia && window.matchMedia("(prefers-reduced-motion: reduce)").matches) { setSeen(true); return; }
    const io = new IntersectionObserver((es) => es.forEach(e => { if (e.isIntersecting) { setSeen(true); io.disconnect(); } }), { threshold: 0.35 });
    io.observe(el);
    return () => io.disconnect();
  }, []);
  const words = [
    "We", "don't", "just", "design", "pieces.", "We", "design", "how", "a", "brand",
    { w: "appears", accent: true }, "in", "front", "of", "an", "audience", "—", "or", "an", "investor.",
  ];
  const ease = "cubic-bezier(.16,1,.3,1)";
  return (
    <div ref={ref} style={{ position: "relative", paddingTop: "clamp(18px,2.4vw,34px)" }}>
      {/* Swiss grid canvas — reveals with a subtle zoom-out */}
      <div aria-hidden="true" style={{ position: "absolute", left: "clamp(-24px,-2vw,-8px)", right: "clamp(-24px,-2vw,-8px)", top: 0, bottom: "-12px", backgroundImage: "linear-gradient(rgba(10,10,11,.055) 1px, transparent 1px), linear-gradient(90deg, rgba(10,10,11,.055) 1px, transparent 1px)", backgroundSize: "clamp(40px,4vw,64px) clamp(40px,4vw,64px)", opacity: seen ? 1 : 0, transform: seen ? "none" : "scale(1.05)", transformOrigin: "left top", transition: `opacity 1s ease, transform 1.3s ${ease}`, pointerEvents: "none", WebkitMaskImage: "linear-gradient(to bottom, transparent 0%, #000 20%, #000 68%, transparent 100%)", maskImage: "linear-gradient(to bottom, transparent 0%, #000 20%, #000 68%, transparent 100%)" }} />
      <GridTick left="14%" top="7%" seen={seen} delay=".7s" />
      <GridTick left="92%" top="3%" seen={seen} delay=".85s" />
      <GridTick left="62%" top="86%" seen={seen} delay="1s" />
      {/* content */}
      <div style={{ position: "relative", paddingLeft: "clamp(20px,2.4vw,40px)" }}>
        <Eyebrow>What we believe</Eyebrow>
        <h2 style={{ fontFamily: "var(--font-display)", fontWeight: 400, fontSize: "clamp(36px,5.4vw,76px)", lineHeight: 1.1, letterSpacing: "-0.01em", margin: "28px 0 0", maxWidth: "22ch", textWrap: "balance" }}>
          {words.flatMap((tok, i) => {
            const isObj = typeof tok === "object";
            const w = isObj ? tok.w : tok;
            const base = { display: "inline-block", opacity: seen ? 1 : 0, transform: seen ? "none" : "translateY(22px)", filter: seen ? "blur(0)" : "blur(9px)", transition: `opacity .7s ${ease}, transform .7s ${ease}, filter .7s ${ease}`, transitionDelay: (i * 0.065) + "s" };
            const span = isObj ? (
              <span key={i} style={{ ...base, position: "relative", color: "var(--text-accent)", whiteSpace: "nowrap" }}>
                {w}
                <svg viewBox="0 0 100 46" preserveAspectRatio="none" aria-hidden="true" style={{ position: "absolute", left: "-0.42em", right: "-0.38em", top: "-0.34em", bottom: "-0.22em", overflow: "visible", pointerEvents: "none", clipPath: seen ? "inset(-30% 0% -30% 0)" : "inset(-30% 100% -30% 0)", WebkitClipPath: seen ? "inset(-30% 0% -30% 0)" : "inset(-30% 100% -30% 0)", transition: `clip-path 1s ${ease}, -webkit-clip-path 1s ${ease}`, transitionDelay: (i * 0.065 + 0.5) + "s" }}>
                  <path d="M 27,11 C 46,5 66,5 82,10 C 95,13 98,24 88,32 C 78,40 58,42 40,40 C 23,38 7,32 9,21 C 10,13 20,9 40,7" fill="none" stroke="var(--lime-500)" strokeWidth="1.4" strokeLinecap="round" strokeLinejoin="round" vectorEffect="non-scaling-stroke" />
                </svg>
              </span>
            ) : <span key={i} style={base}>{w}</span>;
            return [span, " "];
          })}
        </h2>
        {/* coffee wink — footnote */}
        <div style={{ display: "inline-flex", alignItems: "center", gap: 14, marginTop: "clamp(26px,3vw,40px)", opacity: seen ? 1 : 0, transform: seen ? "none" : "translateY(8px)", transition: "opacity .9s ease, transform .9s ease", transitionDelay: "1.3s" }}>
          <CoffeeIcon />
          <span style={{ fontFamily: "var(--font-mono)", fontSize: "clamp(11.5px,1vw,13px)", letterSpacing: ".03em", color: "var(--text-muted)" }}>fig. — the third coffee, ~9:41am</span>
        </div>
      </div>
    </div>
  );
}

// Studio band — cinematic photo with the four principles overlaid, revealed on scroll
function StudioPrinciple({ t, d, i, seen, ease }) {
  const [hov, setHov] = React.useState(false);
  const lead = i === 0;
  return (
    <div onMouseEnter={() => setHov(true)} onMouseLeave={() => setHov(false)}
      style={{ position: "relative", paddingTop: 20, cursor: "default",
        opacity: seen ? 1 : 0, filter: seen ? "blur(0px)" : "blur(7px)",
        transform: seen ? (hov ? "translateY(-6px)" : "translateY(0)") : "translateY(26px)",
        transition: `opacity .8s ${ease} ${0.5 + i * 0.14}s, filter .8s ${ease} ${0.5 + i * 0.14}s, transform ${seen ? ".45s" : ".8s"} ${ease} ${seen ? "0s" : (0.5 + i * 0.14) + "s"}` }}>
      <span aria-hidden="true" style={{ position: "absolute", top: 0, left: 0, right: 0, height: lead ? 2 : 1,
        background: (hov || lead) ? "var(--lime-500)" : "rgba(244,244,239,.4)",
        transformOrigin: "left", transform: seen ? "scaleX(1)" : "scaleX(0)",
        transition: `transform .7s ${ease} ${0.34 + i * 0.14}s, background .35s ${ease}` }} />
      <div style={{ display: "flex", alignItems: "center", justifyContent: "space-between" }}>
        <span style={{ fontFamily: "var(--font-mono)", fontSize: 12.5, letterSpacing: ".16em", color: (hov || lead) ? "var(--lime-500)" : "rgba(244,244,239,.62)", transition: `color .35s ${ease}` }}>{String(i + 1).padStart(2, "0")}</span>
        <span aria-hidden="true" style={{ fontFamily: "var(--font-mono)", fontSize: 15, color: "var(--lime-500)", opacity: hov ? 1 : 0, transform: hov ? "translateX(0)" : "translateX(-6px)", transition: `opacity .35s ${ease}, transform .35s ${ease}` }}>→</span>
      </div>
      <h3 style={{ fontFamily: "var(--font-display)", fontWeight: 400, fontSize: "clamp(18px,1.45vw,23px)", lineHeight: 1.16, letterSpacing: "-0.005em", margin: "16px 0 11px", color: "#F4F4EF" }}>{t}</h3>
      <p style={{ fontSize: "clamp(13px,1vw,14.5px)", lineHeight: 1.55, margin: 0, color: hov ? "rgba(244,244,239,.82)" : "rgba(244,244,239,.64)", transition: `color .35s ${ease}` }}>{d}</p>
    </div>
  );
}

function StudioBand() {
  const ref = React.useRef(null);
  const paraRef = React.useRef(null);
  const [seen, setSeen] = React.useState(false);
  React.useEffect(() => {
    const el = ref.current; if (!el) return;
    if (window.matchMedia && window.matchMedia("(prefers-reduced-motion: reduce)").matches) { setSeen(true); return; }
    const io = new IntersectionObserver((es) => es.forEach(e => { if (e.isIntersecting) { setSeen(true); io.disconnect(); } }), { threshold: 0.22 });
    io.observe(el);
    return () => io.disconnect();
  }, []);
  // Real parallax: a dedicated over-sized layer glides slower than the scroll.
  // The image bleeds 18% past the frame on both sides so it never reveals an edge.
  React.useEffect(() => {
    const el = ref.current, layer = paraRef.current; if (!el || !layer) return;
    if (window.matchMedia && window.matchMedia("(prefers-reduced-motion: reduce)").matches) return;
    const RANGE = 0; // parallax disabled so the full photo stays edge-to-edge (no bleed crop)
    let raf = null;
    const update = () => {
      raf = null;
      const r = el.getBoundingClientRect();
      const vh = window.innerHeight || document.documentElement.clientHeight;
      // progress: -1 as it enters from the bottom → +1 as it leaves the top
      let p = (vh / 2 - (r.top + r.height / 2)) / (vh / 2 + r.height / 2);
      p = Math.max(-1, Math.min(1, p));
      layer.style.transform = `translate3d(0, ${(-p * RANGE).toFixed(2)}px, 0)`;
    };
    const onScroll = () => { if (raf == null) raf = requestAnimationFrame(update); };
    update();
    window.addEventListener("scroll", onScroll, { passive: true });
    window.addEventListener("resize", onScroll);
    return () => { window.removeEventListener("scroll", onScroll); window.removeEventListener("resize", onScroll); if (raf) cancelAnimationFrame(raf); };
  }, []);
  const ease = "cubic-bezier(.16,1,.3,1)";
  const items = [
    ["Senior attention, end to end.", "The people who shape the work stay close to it."],
    ["Systems, not one-offs.", "We leave teams with a stronger starting point."],
    ["AI with judgement.", "Exploration moves faster. Human direction decides."],
    ["Built across borders.", "Remote by design. Close to the work."],
  ];
  return (
    <div ref={ref} style={{ position: "relative", marginTop: "clamp(40px,4.5vw,68px)", borderRadius: "var(--radius-xl)", overflow: "hidden", border: "1px solid var(--border-default)", aspectRatio: "3168 / 1344", boxShadow: "0 60px 120px -56px rgba(10,10,11,.45)" }}>
      {/* full-bleed studio photo — shown whole, aspect-matched so nothing is cropped */}
      <div ref={paraRef} aria-hidden="true" style={{ position: "absolute", inset: 0, willChange: "transform" }}>
        <img src="assets/studio.png" alt="Inside the Deckhaus studio — Swiss design references, books and work in progress" style={{ position: "absolute", inset: 0, width: "100%", height: "100%", objectFit: "cover", objectPosition: "center", display: "block", transform: seen ? "scale(1)" : "scale(1.06)", transition: `transform 2s ${ease}` }} />
      </div>
      {/* cinematic grade — deeper, richer bottom for the type to sit on */}
      <div style={{ position: "absolute", inset: 0, pointerEvents: "none", background: "linear-gradient(to top, rgba(8,9,11,.98) 0%, rgba(8,9,11,.92) 20%, rgba(8,9,11,.7) 40%, rgba(8,9,11,.34) 60%, rgba(8,9,11,.08) 80%, transparent 92%)", opacity: seen ? 1 : 0, transition: `opacity 1.1s ${ease}` }} />
      <div aria-hidden="true" style={{ position: "absolute", inset: 0, pointerEvents: "none", background: "radial-gradient(140% 120% at 50% 8%, transparent 52%, rgba(8,9,11,.42) 100%)" }} />
      <div style={{ position: "absolute", left: "clamp(20px,2.4vw,40px)", top: "clamp(18px,2vw,30px)", display: "flex", alignItems: "center", gap: 12, opacity: seen ? 1 : 0, transform: seen ? "none" : "translateY(-8px)", transition: `opacity .9s ${ease} .2s, transform .9s ${ease} .2s` }}>
        <span style={{ width: 24, height: 2, background: "var(--lime-500)", flex: "none" }} />
        <span style={{ fontFamily: "var(--font-mono)", fontSize: "clamp(11px,1vw,13px)", letterSpacing: ".18em", textTransform: "uppercase", color: "#F4F4EF" }}>Inside the studio · remote by design</span>
      </div>
      <div style={{ position: "absolute", left: 0, right: 0, bottom: 0, padding: "0 clamp(20px,2.4vw,40px) clamp(24px,2.6vw,40px)", display: "grid", gridTemplateColumns: "repeat(4, 1fr)", gap: "clamp(18px,2vw,36px)" }}>
        {items.map(([t, d], i) => (
          <StudioPrinciple key={t} t={t} d={d} i={i} seen={seen} ease={ease} />
        ))}
      </div>
    </div>
  );
}

// Visual Sprint — interactive phase explorer (fused with the Guide's method language)
function SprintStepper({ steps }) {
  const short = ["Briefing", "Prompt", "Explore", "Craft", "Delivery"];
  const ai = { 1: true, 2: true };
  const [active, setActive] = React.useState(0);
  const [paused, setPaused] = React.useState(false);
  React.useEffect(() => {
    if (paused) return;
    const t = setInterval(() => setActive(a => (a + 1) % steps.length), 3600);
    return () => clearInterval(t);
  }, [paused, steps.length]);
  const frac = steps.length > 1 ? active / (steps.length - 1) : 0;
  const ease = "cubic-bezier(.16,1,.3,1)";
  return (
    <div onMouseEnter={() => setPaused(true)} onMouseLeave={() => setPaused(false)}
      style={{ position: "relative", background: "#0A0A0B", border: "1px solid var(--border-default)", borderRadius: "var(--radius-lg)", overflow: "hidden", padding: "clamp(26px,3vw,40px)" }}>
      <div style={{ position: "absolute", inset: 0, backgroundImage: "linear-gradient(rgba(255,255,255,.04) 1px,transparent 1px),linear-gradient(90deg,rgba(255,255,255,.04) 1px,transparent 1px)", backgroundSize: "44px 44px", pointerEvents: "none" }} />
      {/* header */}
      <div style={{ position: "relative", display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: "clamp(24px,2.6vw,34px)" }}>
        <span style={{ display: "flex", alignItems: "center", gap: 10, fontFamily: "var(--font-mono)", fontSize: 12, letterSpacing: ".18em", textTransform: "uppercase", color: "var(--lime-500)" }}><span style={{ width: 20, height: 2, background: "var(--lime-500)", flex: "none" }} />The method</span>
        <span style={{ fontFamily: "var(--font-mono)", fontSize: 11.5, letterSpacing: ".14em", textTransform: "uppercase", color: "var(--text-muted)" }}>05 phases</span>
      </div>
      {/* track */}
      <div style={{ position: "relative", marginTop: 4 }}>
        <div style={{ position: "absolute", left: 7, right: 7, top: 9, height: 1, background: "rgba(255,255,255,.14)" }} />
        <div style={{ position: "absolute", left: 7, top: 9, height: 1, width: `calc((100% - 14px) * ${frac})`, background: "var(--lime-500)", transition: `width .6s ${ease}` }} />
        <div style={{ position: "relative", display: "flex", justifyContent: "space-between" }}>
          {steps.map((s, i) => {
            const on = i === active; const done = i <= active;
            return (
              <button key={s.n} onClick={() => setActive(i)} onMouseEnter={() => setActive(i)} aria-label={s.title}
                style={{ all: "unset", cursor: "pointer", display: "flex", flexDirection: "column", alignItems: "center", gap: 12 }}>
                <span style={{ width: on ? 18 : 14, height: on ? 18 : 14, borderRadius: "50%", background: done ? "var(--lime-500)" : "#0A0A0B", border: `1.5px solid ${done ? "var(--lime-500)" : "rgba(255,255,255,.28)"}`, boxShadow: on ? "0 0 0 5px rgba(183,201,74,.16)" : "none", transition: `all .3s ${ease}` }} />
                <span style={{ fontFamily: "var(--font-mono)", fontSize: "clamp(10px,.9vw,12px)", letterSpacing: ".1em", textTransform: "uppercase", color: on ? "var(--lime-500)" : "var(--text-muted)", transition: "color .3s", whiteSpace: "nowrap" }}>{short[i]}</span>
              </button>
            );
          })}
        </div>
      </div>
      {/* detail */}
      <div style={{ position: "relative", marginTop: "clamp(28px,3vw,40px)", minHeight: 156 }}>
        <div key={active} className="dh-rise" style={{ display: "flex", flexDirection: "column" }}>
          <div style={{ display: "flex", alignItems: "center", gap: 14, flexWrap: "wrap" }}>
            <span style={{ fontFamily: "var(--font-display)", fontWeight: 400, fontSize: "clamp(30px,3.4vw,46px)", lineHeight: 1, color: "var(--lime-500)" }}>{steps[active].n}</span>
            <h3 style={{ fontFamily: "var(--font-display)", fontWeight: 400, fontSize: "clamp(22px,2.2vw,30px)", lineHeight: 1.1, margin: 0, color: "var(--paper)" }}>{steps[active].title}</h3>
            {ai[active] ? <span style={{ fontFamily: "var(--font-mono)", fontSize: 11, letterSpacing: ".12em", textTransform: "uppercase", color: "var(--lime-500)", border: "1px solid var(--lime-700)", borderRadius: 999, padding: "5px 11px" }}>AI-assisted</span> : null}
          </div>
          <p style={{ fontFamily: "var(--font-sans)", fontSize: "clamp(15px,1.2vw,18px)", lineHeight: 1.6, color: "var(--text-secondary)", margin: "18px 0 0", maxWidth: "48ch" }}>{steps[active].desc}</p>
        </div>
      </div>
      {/* footer hint */}
      <div style={{ position: "relative", marginTop: "clamp(20px,2vw,28px)", display: "flex", alignItems: "center", gap: 10 }}>
        <span style={{ width: 18, height: 2, background: "var(--lime-500)", flex: "none" }} />
        <span style={{ fontFamily: "var(--font-mono)", fontSize: 12, letterSpacing: ".1em", textTransform: "uppercase", color: "var(--text-muted)" }}>Hover the phases · full method inside</span>
      </div>
    </div>
  );
}

// What we do — animated line-art icon per service (clarity from the Guide's "four ways")
function WhatWeDoIcon({ kind }) {
  const LIME = "var(--lime-500)";
  const ST = "rgba(10,10,11,.32)", STn = "rgba(10,10,11,.18)", LN = "rgba(10,10,11,.26)", LNs = "rgba(10,10,11,.16)";
  if (kind === 0) {
    return (
      <svg viewBox="0 0 120 80" width="100%" style={{ maxWidth: 220, height: "auto", display: "block" }}>
        <rect x="14" y="20" width="74" height="46" rx="3" fill="#fff" stroke={STn} />
        <rect x="32" y="12" width="74" height="46" rx="3" fill="#fff" stroke={ST} />
        <rect x="32" y="12" width="74" height="7" rx="1.5" fill={LIME} className="dh-cw-sweep" />
        <line x1="40" y1="32" x2="84" y2="32" stroke={LN} strokeWidth="2.2" strokeLinecap="round" />
        <line x1="40" y1="40" x2="98" y2="40" stroke={LNs} strokeWidth="2.2" strokeLinecap="round" />
        <line x1="40" y1="48" x2="72" y2="48" stroke={LNs} strokeWidth="2.2" strokeLinecap="round" />
      </svg>
    );
  }
  if (kind === 1) {
    return (
      <svg viewBox="0 0 120 80" width="100%" style={{ maxWidth: 230, height: "auto", display: "block" }}>
        <g stroke={LIME} strokeWidth="1.4" strokeDasharray="3 4" fill="none" className="dh-cw-dash">
          <path d="M50 40 L84 18" />
          <path d="M50 40 L90 40" />
          <path d="M50 40 L84 62" />
        </g>
        <rect x="16" y="26" width="34" height="28" rx="3" fill="#fff" stroke={ST} />
        <rect x="16" y="26" width="34" height="6" fill={LIME} />
        <line x1="22" y1="41" x2="44" y2="41" stroke={LNs} strokeWidth="2" strokeLinecap="round" />
        <line x1="22" y1="47" x2="38" y2="47" stroke={LNs} strokeWidth="2" strokeLinecap="round" />
        <g><rect x="84" y="8" width="26" height="20" rx="2" fill="#fff" stroke={STn} /><rect x="84" y="8" width="26" height="4" fill={LIME} className="dh-cw-sweep" style={{ animationDelay: "0s" }} /></g>
        <g><rect x="90" y="30" width="26" height="20" rx="2" fill="#fff" stroke={STn} /><rect x="90" y="30" width="26" height="4" fill={LIME} className="dh-cw-sweep" style={{ animationDelay: "1s" }} /></g>
        <g><rect x="84" y="52" width="26" height="20" rx="2" fill="#fff" stroke={STn} /><rect x="84" y="52" width="26" height="4" fill={LIME} className="dh-cw-sweep" style={{ animationDelay: "2s" }} /></g>
      </svg>
    );
  }
  return (
    <svg viewBox="0 0 120 80" width="100%" style={{ maxWidth: 230, height: "auto", display: "block" }}>
      <g className="dh-cw-pop" style={{ animationDelay: "0s" }}>
        <rect x="6" y="14" width="20" height="15" rx="2" fill="#fff" stroke={ST} />
        <rect x="6" y="14" width="20" height="3" fill={LIME} />
      </g>
      <g className="dh-cw-pop" style={{ animationDelay: "1.4s" }}>
        <rect x="96" y="46" width="17" height="23" rx="2" fill="#fff" stroke={ST} />
        <rect x="96" y="46" width="17" height="3" fill={LIME} />
      </g>
      <rect x="32" y="18" width="58" height="40" rx="3" fill="#0A0A0B" stroke={ST} />
      <rect x="32" y="18" width="58" height="6" fill={LIME} />
      <text x="41" y="47" style={{ fontFamily: "var(--font-display)", fontSize: "18px" }} fill="#F4F4EF">Aa</text>
      <path d="M61 58 L61 66 M49 66 L73 66" stroke={ST} strokeWidth="2" fill="none" strokeLinecap="round" />
    </svg>
  );
}

// What we do — three visual service cards
function WhatWeDoCards({ lines }) {
  const labels = ["01 — Core", "02", "03"];
  const outcomes = [
    "The pitch, the sale, the board — built to win the room.",
    "One visual language that keeps every moment on-brand.",
    "Screens, keynotes and motion that own the moment.",
  ];
  const tones = ["#1d2a1f", "#24201a", "#181b22"];
  const shots = ["Pitch deck / sales", "Campaign / social", "Event / keynote"];
  return (
    <div className="dh-mstack" style={{ display: "grid", gridTemplateColumns: "repeat(3, 1fr)", gap: "clamp(20px,2.2vw,32px)" }}>
      {lines.map((l, i) => (
        <div key={l.title} style={{ display: "flex", flexDirection: "column", background: "var(--surface-card)", border: "1px solid var(--border-default)", borderRadius: "var(--radius-lg)", overflow: "hidden" }}>
          <div style={{ position: "relative", aspectRatio: "4 / 3", borderBottom: "1px solid var(--border-default)", overflow: "hidden", background: `linear-gradient(150deg, ${tones[i]}, #0b0b0d)` }}>
            <div style={{ position: "absolute", inset: 0, backgroundImage: "repeating-linear-gradient(135deg, rgba(255,255,255,.05) 0 10px, transparent 10px 20px)" }} />
            <div style={{ position: "absolute", inset: 0, backgroundImage: "linear-gradient(rgba(255,255,255,.05) 1px,transparent 1px),linear-gradient(90deg,rgba(255,255,255,.05) 1px,transparent 1px)", backgroundSize: "32px 32px", opacity: .5 }} />
            <img src="assets/logos/deckhaus-mark-lime.svg" style={{ position: "absolute", right: 16, bottom: 14, height: 40, opacity: .32 }} alt="" />
            <span style={{ position: "absolute", left: 16, top: 14, fontFamily: "var(--font-mono)", fontSize: 10.5, letterSpacing: ".18em", textTransform: "uppercase", color: "rgba(244,244,239,.5)" }}>Fig. 0{i + 1}</span>
            <span style={{ position: "absolute", left: 16, bottom: 14, display: "flex", alignItems: "center", gap: 8, fontFamily: "var(--font-mono)", fontSize: 11, letterSpacing: ".14em", textTransform: "uppercase", color: "rgba(244,244,239,.7)" }}><span style={{ width: 14, height: 2, background: "var(--lime-500)", flex: "none" }} />{shots[i]} · drop photo</span>
          </div>
          <div style={{ flex: 1, display: "flex", flexDirection: "column", padding: "clamp(22px,2vw,30px)" }}>
            <div style={{ display: "flex", justifyContent: "space-between", alignItems: "baseline", gap: 10 }}>
              <span style={{ fontFamily: "var(--font-mono)", fontSize: 12, letterSpacing: ".14em", textTransform: "uppercase", color: i === 0 ? "var(--text-accent)" : "var(--text-muted)" }}>{labels[i]}</span>
              <span style={{ fontFamily: "var(--font-mono)", fontSize: 11, letterSpacing: ".1em", textTransform: "uppercase", color: "var(--text-muted)" }}>{l.scale}</span>
            </div>
            <h3 style={{ fontFamily: "var(--font-display)", fontWeight: 400, fontSize: "clamp(23px,2vw,30px)", lineHeight: 1.12, letterSpacing: "0", margin: "16px 0 0" }}>{l.title}</h3>
            <p style={{ color: "var(--text-secondary)", fontSize: 16, lineHeight: 1.55, margin: "12px 0 0", flex: 1 }}>{outcomes[i]}</p>
            <div style={{ display: "flex", flexWrap: "wrap", gap: 8, marginTop: 22 }}>
              {l.tags.map((t, k) => (
                <span key={t} style={{ fontFamily: "var(--font-mono)", fontSize: 11, letterSpacing: ".06em", textTransform: "uppercase", color: k === 0 ? "var(--ink-900)" : "var(--text-secondary)", background: k === 0 ? "var(--lime-500)" : "transparent", border: `1px solid ${k === 0 ? "var(--lime-500)" : "var(--border-default)"}`, borderRadius: 999, padding: "5px 11px" }}>{t}</span>
              ))}
            </div>
          </div>
        </div>
      ))}
    </div>
  );
}

// Count-up number that animates when it scrolls into view
function CountUp({ to, duration = 1500 }) {
  const ref = React.useRef(null);
  const [val, setVal] = React.useState(0);
  React.useEffect(() => {
    const el = ref.current;
    if (!el) return;
    if (window.matchMedia && window.matchMedia("(prefers-reduced-motion: reduce)").matches) { setVal(to); return; }
    let raf = null, started = false;
    const io = new IntersectionObserver((es) => es.forEach(e => {
      if (e.isIntersecting && !started) {
        started = true;
        const t0 = performance.now();
        const step = (t) => {
          const p = Math.min(1, (t - t0) / duration);
          setVal(Math.round((1 - Math.pow(1 - p, 3)) * to));
          if (p < 1) raf = requestAnimationFrame(step);
        };
        raf = requestAnimationFrame(step);
        io.disconnect();
      }
    }), { threshold: 0.6 });
    io.observe(el);
    return () => { io.disconnect(); if (raf) cancelAnimationFrame(raf); };
  }, [to, duration]);
  return <span ref={ref}>{val}</span>;
}

// Visual Sprint — big count-up numbers band
function SprintStats() {
  const items = [
    { kicker: "Up to", to: 70, unit: "%", label: "less time exploring visual directions" },
    { to: 5, unit: "", label: "phases, from briefing to delivery" },
    { to: 1, unit: "", label: "direction, locked before production" },
  ];
  return (
    <div className="dh-mstack" style={{ marginTop: "clamp(44px,5vw,76px)", paddingTop: "clamp(32px,3.5vw,48px)", borderTop: "1px solid var(--border-subtle)", display: "grid", gridTemplateColumns: "repeat(3, 1fr)", gap: "clamp(24px,3vw,56px)" }}>
      {items.map((s, i) => (
        <div key={i}>
          <div style={{ fontFamily: "var(--font-mono)", fontSize: 11.5, letterSpacing: ".18em", textTransform: "uppercase", color: "var(--text-muted)", marginBottom: 12, visibility: s.kicker ? "visible" : "hidden" }}>{s.kicker || "—"}</div>
          <div style={{ display: "flex", alignItems: "baseline" }}>
            <span style={{ fontFamily: "var(--font-display)", fontWeight: 400, fontSize: "clamp(50px,6.4vw,96px)", lineHeight: .85, letterSpacing: "-0.01em", color: "var(--paper)" }}><CountUp to={s.to} /></span>
            {s.unit ? <span style={{ fontFamily: "var(--font-display)", fontWeight: 400, fontSize: "clamp(40px,5vw,76px)", lineHeight: .85, color: "var(--lime-500)" }}>{s.unit}</span> : null}
          </div>
          <span style={{ display: "block", fontFamily: "var(--font-mono)", fontSize: 13, letterSpacing: ".04em", color: "var(--text-secondary)", marginTop: 16, maxWidth: "22ch" }}>{s.label}</span>
        </div>
      ))}
    </div>
  );
}

// Three scales — big, persuasive, clickable service rows
// Three scales — spotlight panels: white when collapsed, dark spotlight when active
const SR_EASE = "cubic-bezier(.16,1,.3,1)";
const SR_BENEFIT = ["Win the room.", "Stay unmistakable.", "Own the moment."];
const SR_PITCH = [
  "The pitch, the sale, the board — designed to land when it matters most.",
  "One visual language that keeps every moment, every month, on-brand.",
  "Screens, keynotes and motion that command the room and the feed.",
];

// Crossfading loop of the two clips — only plays while `playing` is true
function VideoDuet({ playing }) {
  const SRCS = [
    "uploads/VideoWeb.mp4",
    "uploads/business-meeting-presentation-in-modern-office-set-2026-01-20-22-58-42-utc.mp4",
  ];
  const FADE = 0.8; // seconds of crossfade before a clip ends
  const refs = [React.useRef(null), React.useRef(null)];
  const [cur, setCur] = React.useState(0);
  const busy = React.useRef(false);
  React.useEffect(() => {
    if (playing) { refs[cur].current && refs[cur].current.play().catch(() => {}); }
    else { refs[0].current && refs[0].current.pause(); refs[1].current && refs[1].current.pause(); }
  }, [playing, cur]);
  const onTime = (idx) => () => {
    if (idx !== cur || busy.current || !playing) return;
    const v = refs[idx].current;
    if (!v || !v.duration || isNaN(v.duration)) return;
    if (v.duration - v.currentTime <= FADE) {
      busy.current = true;
      const next = idx === 0 ? 1 : 0;
      const nv = refs[next].current;
      if (nv) { try { nv.currentTime = 0; } catch (e) {} nv.play().catch(() => {}); }
      setCur(next);
      setTimeout(() => { busy.current = false; }, FADE * 1000 + 150);
    }
  };
  return (
    <div style={{ position: "absolute", inset: 0, overflow: "hidden", background: "#000" }}>
      {SRCS.map((src, idx) => (
        <video key={src} ref={refs[idx]} src={src} muted playsInline preload="auto" onTimeUpdate={onTime(idx)}
          style={{ position: "absolute", inset: 0, width: "100%", height: "100%", objectFit: "cover", objectPosition: "center", opacity: idx === cur ? 1 : 0, transition: `opacity ${FADE}s ease-in-out` }} />
      ))}
    </div>
  );
}

// Lacoste brand-experience reel — crossfades event shots while the panel is active
function LacosteReel({ playing }) {
  const SHOTS = [
    "assets/work/lacoste-court-hero.jpg?v=3",
    "assets/work/lacoste/ev-photocall.png?v=3",
    "assets/work/lacoste/ev-stage.png",
    "assets/work/lacoste/ev-entrance.png",
    "assets/work/lacoste/ev-cocktail.png?v=3",
  ];
  const [i, setI] = React.useState(0);
  React.useEffect(() => {
    if (!playing) return;
    if (window.matchMedia && window.matchMedia("(prefers-reduced-motion: reduce)").matches) return;
    const t = setInterval(() => setI(p => (p + 1) % SHOTS.length), 2000);
    return () => clearInterval(t);
  }, [playing]);
  return (
    <div style={{ position: "absolute", inset: 0, overflow: "hidden", background: "#0b0f0c" }}>
      {SHOTS.map((s, k) => (
        <img key={s} src={s} alt="" draggable="false" style={{ position: "absolute", inset: 0, width: "100%", height: "100%", objectFit: "cover", objectPosition: "center", opacity: k === i ? 1 : 0, transform: k === i ? "scale(1.06)" : "scale(1.14)", transition: "opacity 1s ease-in-out, transform 2.4s ease-out" }} />
      ))}
    </div>
  );
}

// Content-systems reel — crossfades the brand visual-library pieces while active
function ContentReel({ playing }) {
  const SHOTS = [
    "assets/work/content-systems/mango.png",
    "assets/work/content-systems/on.png",
    "assets/work/content-systems/rolex.png",
  ];
  const [i, setI] = React.useState(0);
  React.useEffect(() => {
    if (!playing) return;
    if (window.matchMedia && window.matchMedia("(prefers-reduced-motion: reduce)").matches) return;
    const t = setInterval(() => setI(p => (p + 1) % SHOTS.length), 2400);
    return () => clearInterval(t);
  }, [playing]);
  return (
    <div style={{ position: "absolute", inset: 0, overflow: "hidden", background: "#0d0e10" }}>
      {SHOTS.map((s, k) => (
        <img key={s} src={s} alt="" draggable="false" style={{ position: "absolute", inset: 0, width: "100%", height: "100%", objectFit: "cover", objectPosition: "center", opacity: k === i ? 1 : 0, transform: k === i ? "scale(1.05)" : "scale(1.12)", transition: "opacity 1s ease-in-out, transform 2.6s ease-out" }} />
      ))}
    </div>
  );
}

function ServicePanel({ l, i, active, onActivate }) {
  const on = i === active;
  const hasVideo = i === 0;
  const hasContent = i === 1;
  const hasReel = i === 2;
  return (
    <div onMouseEnter={onActivate} onClick={() => window.DH_NAV(i === 2 ? "case" : "services", i === 2 ? "lacoste" : undefined)} role="button" tabIndex={0} aria-label={`Explore ${l.title}`}
      onKeyDown={(e) => { if (e.key === "Enter" || e.key === " ") window.DH_NAV(i === 2 ? "case" : "services", i === 2 ? "lacoste" : undefined); }}
      style={{ position: "relative", flex: on ? "3.4 1 0" : "1 1 0", minWidth: 0, overflow: "hidden", cursor: "pointer",
        borderLeft: i === 0 ? "none" : `1px solid ${on ? "rgba(244,244,239,.10)" : "var(--border-default)"}`,
        background: on ? "#101012" : "var(--paper)", transition: `flex .6s ${SR_EASE}, background .5s ${SR_EASE}` }}>
      <div aria-hidden="true" style={{ position: "absolute", inset: 0, backgroundImage: on ? "linear-gradient(rgba(255,255,255,.045) 1px,transparent 1px),linear-gradient(90deg,rgba(255,255,255,.045) 1px,transparent 1px)" : "linear-gradient(rgba(10,10,11,.05) 1px,transparent 1px),linear-gradient(90deg,rgba(10,10,11,.05) 1px,transparent 1px)", backgroundSize: "44px 44px", opacity: on ? 1 : .6, transition: `opacity .5s ${SR_EASE}` }} />
      {hasVideo ? (
        <div aria-hidden="true" style={{ position: "absolute", inset: 0, opacity: on ? 1 : 0, transition: `opacity .5s ${SR_EASE}`, pointerEvents: "none" }}>
          <VideoDuet playing={on} />
          <div style={{ position: "absolute", inset: 0, background: "linear-gradient(to top, rgba(10,10,11,.94) 2%, rgba(10,10,11,.6) 38%, rgba(10,10,11,.32) 72%, rgba(10,10,11,.42) 100%)" }} />
        </div>
      ) : null}
      {hasContent ? (
        <div aria-hidden="true" style={{ position: "absolute", inset: 0, opacity: on ? 1 : 0, transition: `opacity .5s ${SR_EASE}`, pointerEvents: "none" }}>
          <ContentReel playing={on} />
          <div style={{ position: "absolute", inset: 0, background: "linear-gradient(to top, rgba(10,10,11,.94) 2%, rgba(10,10,11,.6) 38%, rgba(10,10,11,.32) 72%, rgba(10,10,11,.42) 100%)" }} />
        </div>
      ) : null}
      {hasReel ? (
        <div aria-hidden="true" style={{ position: "absolute", inset: 0, opacity: on ? 1 : 0, transition: `opacity .5s ${SR_EASE}`, pointerEvents: "none" }}>
          <LacosteReel playing={on} />
          <div style={{ position: "absolute", inset: 0, background: "linear-gradient(to top, rgba(10,10,11,.94) 2%, rgba(10,10,11,.6) 38%, rgba(10,10,11,.32) 72%, rgba(10,10,11,.42) 100%)" }} />
        </div>
      ) : null}
      <span aria-hidden="true" style={{ position: "absolute", top: 0, left: 0, height: 3, background: "var(--lime-500)", width: on ? "100%" : "0%", transition: `width .55s ${SR_EASE}`, zIndex: 2 }} />
      <div style={{ position: "relative", height: "100%", padding: "clamp(24px,2.4vw,38px)", display: "flex", flexDirection: "column", zIndex: 2 }}>
        <div style={{ display: "flex", alignItems: "center", justifyContent: "space-between", gap: 12 }}>
          <span style={{ fontFamily: "var(--font-mono)", fontSize: "clamp(13px,1vw,15px)", letterSpacing: ".1em", color: on ? "var(--lime-500)" : "var(--text-muted)", transition: `color .35s ${SR_EASE}` }}>{String(i + 1).padStart(2, "0")}</span>
          <span aria-hidden="true" style={{ width: 30, height: 30, borderRadius: "50%", border: `1px solid ${on ? "var(--lime-500)" : "var(--border-default)"}`, display: "flex", alignItems: "center", justifyContent: "center", color: on ? "var(--lime-500)" : "var(--text-muted)", fontFamily: "var(--font-display)", fontSize: 16, flex: "none", transition: `all .35s ${SR_EASE}` }}>{on ? "→" : "+"}</span>
        </div>
        <div aria-hidden={on} style={{ position: "absolute", left: "clamp(24px,2.4vw,38px)", bottom: "clamp(24px,2.4vw,38px)", opacity: on ? 0 : 1, transition: `opacity .35s ${SR_EASE}`, pointerEvents: "none" }}>
          <span style={{ display: "inline-block", writingMode: "vertical-rl", transform: "rotate(180deg)", fontFamily: "var(--font-display)", fontWeight: 400, fontSize: "clamp(24px,2.2vw,34px)", letterSpacing: "-0.01em", color: "var(--text-primary)", whiteSpace: "nowrap" }}>{l.title}</span>
        </div>
        <div style={{ marginTop: "auto", opacity: on ? 1 : 0, transform: on ? "translateY(0)" : "translateY(14px)", transition: `opacity .5s ${SR_EASE} .1s, transform .5s ${SR_EASE} .1s`, pointerEvents: on ? "auto" : "none" }}>
          <span style={{ display: "block", fontFamily: "var(--font-mono)", fontSize: 12, letterSpacing: ".16em", textTransform: "uppercase", color: "var(--lime-500)", whiteSpace: "nowrap" }}>{l.title}</span>
          <h3 style={{ fontFamily: "var(--font-display)", fontWeight: 400, fontSize: "clamp(34px,3.6vw,58px)", lineHeight: 1.02, letterSpacing: "-0.01em", margin: "12px 0 0", color: "#F4F4EF", whiteSpace: "nowrap" }}>{SR_BENEFIT[i]}</h3>
          <p style={{ fontFamily: "var(--font-sans)", fontSize: "clamp(15px,1.15vw,18px)", lineHeight: 1.55, color: "rgba(244,244,239,.72)", margin: "16px 0 0", maxWidth: "42ch" }}>{SR_PITCH[i]}</p>
          <div style={{ display: "flex", flexWrap: "wrap", gap: 8, marginTop: 20 }}>
            {l.tags.map((t) => (
              <span key={t} style={{ fontFamily: "var(--font-mono)", fontSize: 11, letterSpacing: ".06em", textTransform: "uppercase", color: "rgba(244,244,239,.7)", border: "1px solid rgba(244,244,239,.2)", borderRadius: 999, padding: "5px 12px", whiteSpace: "nowrap" }}>{t}</span>
            ))}
          </div>
          <span style={{ display: "inline-flex", alignItems: "center", gap: 10, marginTop: 26, fontFamily: "var(--font-sans)", fontWeight: 600, fontSize: 15, padding: "12px 22px", borderRadius: 999, background: "var(--lime-500)", color: "var(--ink-900)", whiteSpace: "nowrap" }}>Explore service →</span>
        </div>
      </div>
    </div>
  );
}

function ServiceRows({ lines }) {
  const [active, setActive] = React.useState(0);
  return (
    <div style={{ display: "flex", height: "clamp(440px,50vw,580px)", borderRadius: "var(--radius-xl)", overflow: "hidden", border: "1px solid var(--border-default)", boxShadow: "0 60px 120px -56px rgba(10,10,11,.4)" }}>
      {lines.map((l, i) => <ServicePanel key={l.title} l={l} i={i} active={active} onActivate={() => setActive(i)} />)}
    </div>
  );
}

// Interactive self-writing brief — pick chips, the brief writes itself, send it
function MomentCTA() {
  const { Button } = HV_NS;
  const NEED = ["a pitch deck", "a campaign", "an event", "a brand system", "templates"];
  const MOMENT = ["raising a round", "launching a product", "a keynote", "a rebrand", "an internal moment"];
  const TIMELINE = ["this month", "this quarter", "still exploring"];
  const [need, setNeed] = React.useState([]);
  const [moment, setMoment] = React.useState(null);
  const [timeline, setTimeline] = React.useState(null);
  const [name, setName] = React.useState("");
  const [email, setEmail] = React.useState("");
  const [status, setStatus] = React.useState("idle"); // idle | sending | sent | error
  const EASE = "cubic-bezier(.16,1,.3,1)";
  const DEST = "deckhaus@pm.me";
  const emailOk = (v) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(v);
  const joinList = (a) => a.length <= 1 ? (a[0] || "") : a.length === 2 ? (a[0] + " and " + a[1]) : (a.slice(0, -1).join(", ") + " and " + a[a.length - 1]);

  const s1 = need.length > 0, s2 = !!moment, s3 = !!timeline;
  const step = s3 ? 3 : (s2 || s1) ? 2 : 1;
  const ready = s3 && name.trim() && emailOk(email.trim());

  // live brief sentence
  let brief = "Pick what fits — your brief writes itself.";
  if (need.length && moment) brief = "We're " + moment + " and we need " + joinList(need) + ".";
  else if (moment) brief = "We're preparing " + moment + ".";
  else if (need.length) brief = "We need " + joinList(need) + ".";
  if ((need.length || moment) && timeline) brief += " We'd like to start " + (timeline === "still exploring" ? "soon" : timeline) + ".";
  const briefLive = brief !== "Pick what fits — your brief writes itself.";

  const toggleNeed = (v) => setNeed((p) => p.includes(v) ? p.filter((x) => x !== v) : [...p, v]);

  const submit = () => {
    if (!ready || status === "sending" || status === "sent") return;
    setStatus("sending");
    fetch("https://formsubmit.co/ajax/" + DEST, {
      method: "POST",
      headers: { "Content-Type": "application/json", "Accept": "application/json" },
      body: JSON.stringify({ _subject: "New project brief · Deckhaus", _template: "table", _captcha: "false", Name: name.trim(), Email: email.trim(), "What they need": need.join(", "), "The moment": moment || "", Timeline: timeline || "", Brief: brief }),
    }).then((r) => { if (!r.ok) throw new Error("http " + r.status); return r.json().catch(() => ({})); })
      .then(() => setStatus("sent"))
      .catch(() => setStatus("error"));
  };

  const Group = ({ label, options, selected, onPick, multi }) => (
    <div style={{ marginTop: 22 }}>
      <div style={{ fontFamily: "var(--font-mono)", fontSize: 11, letterSpacing: ".16em", textTransform: "uppercase", color: "var(--text-muted)", marginBottom: 12 }}>{label}</div>
      <div style={{ display: "flex", flexWrap: "wrap", gap: 8 }}>
        {options.map((o) => {
          const on = multi ? selected.includes(o) : selected === o;
          return (
            <button key={o} onClick={() => onPick(o)} aria-pressed={on}
              style={{ all: "unset", cursor: "pointer", boxSizing: "border-box", fontFamily: "var(--font-sans)", fontSize: 14, fontWeight: on ? 600 : 400, padding: "9px 15px", borderRadius: 999, border: `1px solid ${on ? "var(--lime-500)" : "rgba(244,244,239,.2)"}`, background: on ? "var(--lime-500)" : "transparent", color: on ? "var(--ink-900)" : "rgba(244,244,239,.78)", transition: `all .2s ${EASE}`, transform: on ? "translateY(-1px)" : "none" }}>
              {o}
            </button>
          );
        })}
      </div>
    </div>
  );

  return (
    <section style={{ maxWidth: "var(--maxw-wide)", margin: "0 auto", padding: "0 var(--page-margin) var(--section-y)" }}>
      <div data-theme="dark" style={{ position: "relative", overflow: "hidden", borderRadius: "var(--radius-xl)", border: "1px solid var(--border-default)", background: "linear-gradient(140deg, #15170f, #0c0c0e 62%)", display: "grid", gridTemplateColumns: "1fr 0.92fr" }}>
        <div aria-hidden="true" style={{ position: "absolute", inset: 0, backgroundImage: "linear-gradient(rgba(255,255,255,.04) 1px,transparent 1px),linear-gradient(90deg,rgba(255,255,255,.04) 1px,transparent 1px)", backgroundSize: "46px 46px", WebkitMaskImage: "radial-gradient(120% 120% at 12% 0%, #000 20%, transparent 70%)", maskImage: "radial-gradient(120% 120% at 12% 0%, #000 20%, transparent 70%)", pointerEvents: "none" }} />

        {/* LEFT — controls */}
        <div style={{ position: "relative", padding: "clamp(36px,4.4vw,64px)" }}>
          <div style={{ display: "flex", justifyContent: "space-between", alignItems: "center", gap: 16 }}>
            <span style={{ fontFamily: "var(--font-mono)", fontSize: 12, letterSpacing: ".2em", textTransform: "uppercase", color: "var(--text-accent)" }}>Start a brief</span>
            <span style={{ fontFamily: "var(--font-mono)", fontSize: 12, letterSpacing: ".14em", color: "var(--text-muted)" }}>Step 0{step} / 03</span>
          </div>
          <h2 style={{ fontFamily: "var(--font-display)", fontWeight: 400, fontSize: "clamp(30px,3.8vw,52px)", lineHeight: 1.06, letterSpacing: "-0.01em", margin: "18px 0 0", color: "var(--text-primary)", maxWidth: "16ch" }}>Tell us the moment. <span style={{ color: "var(--lime-500)" }}>We'll write the brief.</span></h2>

          <Group label="What you need" options={NEED} selected={need} onPick={toggleNeed} multi />
          {s1 ? <Group label="The moment" options={MOMENT} selected={moment} onPick={(o) => setMoment((p) => p === o ? null : o)} /> : null}
          {s2 ? <Group label="Timeline" options={TIMELINE} selected={timeline} onPick={(o) => setTimeline((p) => p === o ? null : o)} /> : null}

          {s3 ? (
            <div style={{ marginTop: 28, animation: "dh-fade-up .45s " + EASE }}>
              <div style={{ display: "grid", gridTemplateColumns: "1fr 1fr", gap: 12 }}>
                <input value={name} onChange={(e) => setName(e.target.value)} placeholder="Your name" disabled={status === "sent"}
                  style={{ all: "unset", boxSizing: "border-box", width: "100%", fontFamily: "var(--font-sans)", fontSize: 15, color: "var(--paper)", padding: "13px 15px", border: "1px solid rgba(244,244,239,.2)", borderRadius: "var(--radius-sm)", background: "rgba(255,255,255,.03)" }} />
                <input value={email} onChange={(e) => setEmail(e.target.value)} placeholder="Email" type="email" disabled={status === "sent"}
                  style={{ all: "unset", boxSizing: "border-box", width: "100%", fontFamily: "var(--font-sans)", fontSize: 15, color: "var(--paper)", padding: "13px 15px", border: "1px solid rgba(244,244,239,.2)", borderRadius: "var(--radius-sm)", background: "rgba(255,255,255,.03)" }} />
              </div>
              <div style={{ display: "flex", alignItems: "center", gap: 16, marginTop: 16, flexWrap: "wrap" }}>
                <button onClick={submit} disabled={!ready || status === "sending" || status === "sent"}
                  style={{ all: "unset", cursor: ready && status === "idle" ? "pointer" : "default", fontFamily: "var(--font-sans)", fontWeight: 600, fontSize: 15, padding: "13px 24px", borderRadius: 999, background: status === "sent" ? "transparent" : "var(--lime-500)", color: status === "sent" ? "var(--lime-500)" : "var(--ink-900)", border: status === "sent" ? "1px solid rgba(183,201,74,.55)" : "1px solid var(--lime-500)", opacity: (ready || status !== "idle") ? 1 : .45, transition: "all .25s" }}>
                  {status === "sending" ? "Sending…" : status === "sent" ? "Brief sent ✓" : "Send my brief →"}
                </button>
                <span style={{ fontFamily: "var(--font-mono)", fontSize: 12, letterSpacing: ".02em", color: status === "sent" ? "var(--lime-500)" : status === "error" ? "#D98B5F" : "var(--text-muted)", maxWidth: "30ch" }}>
                  {status === "sent" ? `Thanks, ${name.trim()} — we'll reply to ${email.trim()} shortly.` : status === "error" ? `Couldn't send — email us at ${DEST}.` : ready ? "Ready — your brief is written. Tap send." : "Add your name and email to send."}
                </span>
              </div>
            </div>
          ) : null}
        </div>

        {/* RIGHT — the document writing itself */}
        <div style={{ position: "relative", borderLeft: "1px solid rgba(244,244,239,.1)", padding: "clamp(28px,3vw,44px)", display: "flex" }}>
          <div style={{ position: "relative", flex: 1, background: "var(--paper)", borderRadius: "var(--radius-sm)", boxShadow: "0 40px 80px -40px rgba(0,0,0,.6)", padding: "clamp(26px,2.6vw,40px)", display: "flex", flexDirection: "column", minHeight: 320 }}>
            <div style={{ display: "flex", justifyContent: "space-between", alignItems: "center", paddingBottom: 18, borderBottom: "1px solid var(--border-default)" }}>
              <img src="assets/logos/deckhaus-mark-black.svg" style={{ height: 22 }} alt="Deckhaus" />
              <span style={{ fontFamily: "var(--font-mono)", fontSize: 10.5, letterSpacing: ".18em", textTransform: "uppercase", color: "var(--text-muted)" }}>Project brief</span>
            </div>
            <div style={{ display: "flex", flexDirection: "column", gap: 14, padding: "22px 0", borderBottom: "1px solid var(--border-default)" }}>
              {[["Need", need.length ? joinList(need) : "—"], ["Moment", moment || "—"], ["Timeline", timeline ? (timeline === "still exploring" ? "exploring" : timeline) : "—"]].map(([k, v]) => (
                <div key={k} style={{ display: "grid", gridTemplateColumns: "84px 1fr", gap: 14, alignItems: "baseline" }}>
                  <span style={{ fontFamily: "var(--font-mono)", fontSize: 10.5, letterSpacing: ".14em", textTransform: "uppercase", color: "var(--text-muted)" }}>{k}</span>
                  <span style={{ fontFamily: "var(--font-sans)", fontSize: 15, color: v === "—" ? "var(--text-muted)" : "var(--ink-900)", transition: "color .3s" }}>{v}</span>
                </div>
              ))}
            </div>
            <p style={{ fontFamily: "var(--font-display)", fontWeight: 400, fontSize: "clamp(20px,1.9vw,27px)", lineHeight: 1.32, letterSpacing: "-0.005em", color: briefLive ? "var(--ink-900)" : "var(--text-muted)", margin: "22px 0 0" }}>
              {brief}<span aria-hidden="true" style={{ display: "inline-block", width: 2, height: "1em", marginLeft: 3, background: "var(--lime-600, #9EAD3F)", verticalAlign: "-0.12em", animation: "dh-caret 1s steps(1) infinite" }} />
            </p>
            <div style={{ marginTop: "auto", paddingTop: 24, display: "flex", alignItems: "center", gap: 10 }}>
              <span style={{ width: 24, height: 2, background: s3 ? "var(--lime-600, #9EAD3F)" : "var(--border-default)", flex: "none", transition: "background .3s" }} />
              <span style={{ fontFamily: "var(--font-mono)", fontSize: 11, letterSpacing: ".1em", textTransform: "uppercase", color: "var(--text-muted)" }}>{status === "sent" ? "Submitted" : s3 ? "Ready to send" : "Drafting…"}</span>
            </div>
          </div>
        </div>
      </div>
    </section>
  );
}

// Client reviews — playful wink button + editorial modal
function ReviewsModal({ onClose }) {
  const [show, setShow] = React.useState(false);
  React.useEffect(() => { const r = requestAnimationFrame(() => setShow(true)); return () => cancelAnimationFrame(r); }, []);
  const close = () => { setShow(false); setTimeout(onClose, 240); };
  React.useEffect(() => {
    const onKey = (e) => { if (e.key === "Escape") close(); };
    document.addEventListener("keydown", onKey);
    const prev = document.body.style.overflow; document.body.style.overflow = "hidden";
    return () => { document.removeEventListener("keydown", onKey); document.body.style.overflow = prev; };
  }, []);
  const reviews = [
    { quote: "Fast, great attitude, and simply the best at building high-impact presentations. We always come back to him.", client: "Mango", who: "Brand team", logo: "mango-black.png", h: 20, feat: true },
    { quote: "He turned a vague brief into a room-ready story in days. It just looked like us — only sharper.", client: "Lacoste", who: "Event direction", logo: "lacoste-black.png", h: 24 },
    { quote: "Clear thinking, clean execution, zero drama. Exactly what you want when the deadline is yesterday.", client: "On", who: "Marketing", logo: "on-black.svg", h: 22 },
  ];
  const ease = "cubic-bezier(.16,1,.3,1)";
  return (
    <div onClick={close} style={{ position: "fixed", inset: 0, zIndex: 300, display: "flex", alignItems: "center", justifyContent: "center", padding: "clamp(16px,3vw,40px)", background: "rgba(10,10,11,.5)", backdropFilter: "blur(8px)", WebkitBackdropFilter: "blur(8px)", opacity: show ? 1 : 0, transition: "opacity .28s ease" }}>
      <div onClick={(e) => e.stopPropagation()} data-theme="light" style={{ position: "relative", width: "min(680px, 100%)", maxHeight: "86vh", overflowY: "auto", background: "var(--paper)", borderRadius: "var(--radius-xl)", border: "1px solid var(--border-default)", boxShadow: "0 60px 120px -40px rgba(0,0,0,.6)", transform: show ? "translateY(0) scale(1)" : "translateY(18px) scale(.98)", opacity: show ? 1 : 0, transition: `transform .38s ${ease}, opacity .38s ${ease}` }}>
        {/* header */}
        <div style={{ position: "sticky", top: 0, zIndex: 2, display: "flex", justifyContent: "space-between", alignItems: "center", gap: 16, padding: "clamp(22px,2.4vw,30px) clamp(24px,2.6vw,36px)", background: "var(--paper)", borderBottom: "1px solid var(--border-default)" }}>
          <div style={{ display: "flex", alignItems: "center", gap: 12 }}>
            <span style={{ width: 18, height: 2, background: "var(--lime-500)", flex: "none" }} />
            <span style={{ fontFamily: "var(--font-mono)", fontSize: 11.5, letterSpacing: ".2em", textTransform: "uppercase", color: "var(--text-accent)" }}>What clients say</span>
          </div>
          <button onClick={close} aria-label="Close" style={{ all: "unset", cursor: "pointer", width: 34, height: 34, borderRadius: "50%", border: "1px solid var(--border-strong)", display: "flex", alignItems: "center", justifyContent: "center", color: "var(--text-secondary)" }}>
            <svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.2" strokeLinecap="round"><line x1="6" y1="6" x2="18" y2="18"/><line x1="18" y1="6" x2="6" y2="18"/></svg>
          </button>
        </div>
        {/* reviews */}
        <div style={{ padding: "clamp(26px,3vw,40px) clamp(24px,2.6vw,36px) clamp(30px,3.4vw,44px)" }}>
          {reviews.map((r, i) => (
            <figure key={r.client} style={{ margin: 0, paddingTop: i === 0 ? 0 : "clamp(24px,2.6vw,34px)", marginTop: i === 0 ? 0 : "clamp(24px,2.6vw,34px)", borderTop: i === 0 ? "none" : "1px solid var(--border-default)" }}>
              <blockquote style={{ margin: 0, fontFamily: "var(--font-display)", fontWeight: 400, fontSize: r.feat ? "clamp(24px,2.9vw,38px)" : "clamp(19px,1.9vw,24px)", lineHeight: 1.24, letterSpacing: "-0.01em", color: "var(--ink-900)", textWrap: "balance" }}>
                <span style={{ color: "var(--lime-600, var(--text-accent))" }}>“</span>{r.quote}<span style={{ color: "var(--lime-600, var(--text-accent))" }}>”</span>
              </blockquote>
              <figcaption style={{ display: "flex", alignItems: "center", gap: 14, marginTop: "clamp(16px,1.8vw,22px)" }}>
                <img src={`assets/logos/${r.logo}`} alt={r.client} style={{ height: r.h, width: "auto", objectFit: "contain", filter: "grayscale(1)", opacity: .8 }} />
                <span style={{ width: 1, height: 20, background: "var(--border-strong)" }} />
                <span style={{ fontFamily: "var(--font-mono)", fontSize: 12, letterSpacing: ".1em", textTransform: "uppercase", color: "var(--text-muted)" }}>{r.who}</span>
              </figcaption>
            </figure>
          ))}
          <p style={{ fontFamily: "var(--font-mono)", fontSize: 11.5, letterSpacing: ".04em", color: "var(--text-disabled)", margin: "clamp(28px,3vw,40px) 0 0", textAlign: "center" }}>Yes, we kept the nice ones. You would too.</p>
        </div>
      </div>
    </div>
  );
}

function ReviewsWink() {
  const [open, setOpen] = React.useState(false);
  const [hover, setHover] = React.useState(false);
  return (
    <React.Fragment>
      <div style={{ display: "flex", flexDirection: "column", justifyContent: "center", alignItems: "center", gap: 12, marginTop: "clamp(24px,2.8vw,38px)" }}>
        <button onClick={() => setOpen(true)} onMouseEnter={() => setHover(true)} onMouseLeave={() => setHover(false)}
          style={{ all: "unset", cursor: "pointer", display: "inline-flex", alignItems: "center", gap: 9, fontFamily: "var(--font-sans)", fontWeight: 600, fontSize: 14, color: hover ? "var(--ink-900)" : "var(--text-primary)", background: hover ? "var(--lime-500)" : "transparent", border: `1px solid ${hover ? "var(--lime-500)" : "var(--border-strong)"}`, borderRadius: 999, padding: "9px 18px", transition: "all .2s ease" }}>
          Read the reviews <span style={{ transform: hover ? "translateX(3px)" : "none", transition: "transform .2s ease" }}>→</span>
        </button>
        <span style={{ fontFamily: "var(--font-mono)", fontSize: 11, letterSpacing: ".03em", color: "var(--text-muted)" }}>I know you're dying to see what they say about us ;)</span>
      </div>
      {open ? <ReviewsModal onClose={() => setOpen(false)} /> : null}
    </React.Fragment>
  );
}

function HomeView() {
  const { Button, Eyebrow, StatBlock, Badge, Tag, Card } = HV_NS;
  const D = window.DH_DATA;
  const heroRef = React.useRef(null);
  React.useEffect(() => {
    const hero = heroRef.current;
    if (!hero) return;
    if (!(window.matchMedia && window.matchMedia("(pointer:fine)").matches)) return;
    const glow = hero.querySelector("[data-grid-glow]");
    const light = hero.querySelector("[data-cursor-light]");
    let raf = null, cx = 0, cy = 0, on = false;
    const apply = () => {
      raf = null;
      hero.style.setProperty("--mx", cx + "px");
      hero.style.setProperty("--my", cy + "px");
      if (light) { light.style.left = cx + "px"; light.style.top = cy + "px"; }
    };
    const move = (e) => {
      const r = hero.getBoundingClientRect();
      cx = e.clientX - r.left; cy = e.clientY - r.top;
      if (!on) { on = true; if (glow) glow.style.opacity = ".5"; if (light) light.style.opacity = "1"; }
      if (!raf) raf = requestAnimationFrame(apply);
    };
    const leave = () => { on = false; if (glow) glow.style.opacity = "0"; if (light) light.style.opacity = "0"; };
    hero.addEventListener("pointermove", move);
    hero.addEventListener("pointerleave", leave);
    return () => { hero.removeEventListener("pointermove", move); hero.removeEventListener("pointerleave", leave); if (raf) cancelAnimationFrame(raf); };
  }, []);
  return (
    <main>
      {/* HERO — dark impact, work-wall as depth layer behind */}
      <section ref={heroRef} data-theme="dark" style={{ position: "relative", background: "var(--bg-base)", borderBottom: "1px solid var(--border-subtle)", overflow: "hidden" }}>
        {/* full-bleed floating-covers gallery — the hero backdrop */}
        <FloatingCovers />
        {/* premium background grid — spans the hero, faded in radially toward the
            right (where the lime glow sits) and out at the edges */}
        <div aria-hidden="true" style={{ position: "absolute", inset: 0, zIndex: 0, pointerEvents: "none", backgroundImage: "linear-gradient(color-mix(in srgb, var(--lime-500) 46%, transparent) 1px, transparent 1px), linear-gradient(90deg, color-mix(in srgb, var(--lime-500) 46%, transparent) 1px, transparent 1px)", backgroundSize: "72px 72px", opacity: .16, WebkitMaskImage: "radial-gradient(80% 90% at 72% 52%, #000 4%, rgba(0,0,0,.42) 44%, transparent 78%)", maskImage: "radial-gradient(80% 90% at 72% 52%, #000 4%, rgba(0,0,0,.42) 44%, transparent 78%)" }} />
        {/* ambient lime destello + faint grid on the left, behind the headline */}
        <div aria-hidden="true" style={{ position: "absolute", left: 0, top: 0, bottom: 0, width: "58%", zIndex: 0, pointerEvents: "none", backgroundImage: "linear-gradient(var(--lime-500) 1px, transparent 1px), linear-gradient(90deg, var(--lime-500) 1px, transparent 1px)", backgroundSize: "128px 128px", opacity: .07, WebkitMaskImage: "radial-gradient(52% 55% at 26% 8%, #000 0%, transparent 72%)", maskImage: "radial-gradient(52% 55% at 26% 8%, #000 0%, transparent 72%)" }} />
        <div aria-hidden="true" style={{ position: "absolute", left: "-6%", top: "-30%", width: "66%", height: "64%", zIndex: 0, pointerEvents: "none", background: "radial-gradient(50% 55% at 34% 46%, color-mix(in srgb, var(--lime-500) 24%, transparent) 0%, transparent 70%)", filter: "blur(36px)" }} />
        {/* living grid — lime grid + soft halo that follow the cursor (invisible at rest) */}
        <div data-grid-glow="" aria-hidden="true" style={{ position: "absolute", inset: 0, zIndex: 1, pointerEvents: "none", backgroundImage: "linear-gradient(var(--lime-500) 1px, transparent 1px), linear-gradient(90deg, var(--lime-500) 1px, transparent 1px)", backgroundSize: "88px 88px", opacity: 0, transition: "opacity .7s ease", WebkitMaskImage: "radial-gradient(circle 300px at var(--mx,50%) var(--my,50%), #000 0%, rgba(0,0,0,.3) 46%, transparent 72%)", maskImage: "radial-gradient(circle 300px at var(--mx,50%) var(--my,50%), #000 0%, rgba(0,0,0,.3) 46%, transparent 72%)", mixBlendMode: "screen" }} />
        <div data-cursor-light="" aria-hidden="true" style={{ position: "absolute", left: 0, top: 0, width: 560, height: 560, borderRadius: "50%", zIndex: 1, pointerEvents: "none", transform: "translate(-50%,-50%)", background: "radial-gradient(circle, color-mix(in srgb, var(--lime-500) 22%, transparent) 0%, transparent 66%)", opacity: 0, transition: "opacity .7s ease", filter: "blur(6px)", willChange: "left, top" }} />
        <div style={{ position: "relative", zIndex: 1, maxWidth: "var(--maxw-wide)", margin: "0 auto", padding: "clamp(56px,8vw,116px) var(--page-margin) clamp(56px,7vw,96px)", display: "grid", gridTemplateColumns: "1fr clamp(360px, 38vw, 520px)", gap: 72, alignItems: "center" }}>
          <div>
            <div className="dh-rise"><Eyebrow>Boutique visual communication studio</Eyebrow></div>
            <h1 className="dh-rise" style={{ animationDelay: ".08s", fontFamily: "var(--font-display)", fontSize: "clamp(46px, 6.6vw, 82px)", lineHeight: 1.1, letterSpacing: "0", margin: "34px 0 0", textWrap: "balance" }}>
              Present.<br />Launch. <span style={{ color: "var(--lime-500)" }}>Grow.</span>
            </h1>
            <p className="dh-rise" style={{ animationDelay: ".16s", fontSize: 19, lineHeight: 1.62, color: "var(--text-secondary)", maxWidth: "48ch", margin: "36px 0 0" }}>
              Most companies don't have a design problem — they have a communication-system problem. Deckhaus builds the visual<br/> systems behind how a brand presents, launches and grows.
            </p>
            <div className="dh-rise" style={{ animationDelay: ".24s", display: "flex", gap: 14, marginTop: 44 }}>
              <Button size="lg" onClick={() => window.DH_NAV("contact")} trailingIcon={<ArrowR/>}>Start a project</Button>
              <Button size="lg" variant="secondary" onClick={() => window.DH_NAV("work")}>View work</Button>
            </div>
            <div style={{ display: "flex", alignItems: "center", gap: 12, marginTop: "clamp(40px,5vw,64px)" }}>
              <span style={{ width: 24, height: 2, background: "var(--lime-500)", flex: "none" }} />
              <span style={{ fontFamily: "var(--font-mono)", fontSize: 12, lineHeight: 1.4, letterSpacing: ".2em", textTransform: "uppercase", color: "var(--text-secondary)" }}>One message · many moments</span>
            </div>
          </div>
          <HeroPanel />
        </div>
      </section>

      {/* MARQUEE — clients */}
      {/* TRUSTED BY — centered, equal cells, uniform optical sizing */}
      <section style={{ borderBottom: "1px solid var(--border-subtle)" }}>
        <div style={{ maxWidth: "var(--maxw-content)", margin: "0 auto", padding: "clamp(22px,2.4vw,34px) var(--page-margin)" }}>
          <div style={{ textAlign: "center", fontFamily: "var(--font-mono)", fontSize: 11.5, letterSpacing: ".22em", textTransform: "uppercase", color: "var(--text-muted)", marginBottom: "clamp(20px,2.2vw,30px)" }}>Trusted by teams at</div>
          <div style={{ display: "grid", gridTemplateColumns: "repeat(6, 1fr)", alignItems: "center" }}>
            {[
              ["lacoste-black.png", "Lacoste", 30],
              ["tedx-black.png", "TEDx", 26],
              ["rolex-black.svg", "Rolex", 34],
              ["jura-black.png", "JURA", 26],
              ["mango-black.png", "Mango", 22],
              ["on-black.svg", "On", 27],
            ].map(([f, alt, h], i) => (
              <div key={f} style={{ display: "flex", alignItems: "center", justifyContent: "center", height: 44, padding: "0 clamp(8px,1.6vw,28px)", borderLeft: i === 0 ? "none" : "1px solid var(--border-subtle)" }}>
                <img src={`assets/logos/${f}`} alt={alt} style={{ height: h, maxWidth: "100%", width: "auto", objectFit: "contain", opacity: .62, filter: "grayscale(1)", transition: "opacity .3s" }}
                  onMouseEnter={(e) => { e.currentTarget.style.opacity = 1; }} onMouseLeave={(e) => { e.currentTarget.style.opacity = .62; }} />
              </div>
            ))}
          </div>
          <ReviewsWink />
        </div>
      </section>

      {/* MANIFESTO — paper, editorial belief moment */}
      <section style={{ borderBottom: "1px solid var(--border-subtle)" }}>
        <div style={{ maxWidth: "var(--maxw-content)", margin: "0 auto", padding: "clamp(40px,5vw,72px) var(--page-margin) var(--section-y)" }}>
          <ManifestoHeadline />
          <div style={{ position: "relative", marginTop: "clamp(48px,6vw,72px)" }}>
            <div aria-hidden="true" className="dh-mfgrid" style={{ position: "absolute", inset: "-20px 0", backgroundImage: "linear-gradient(rgba(10,10,11,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(10,10,11,.06) 1px, transparent 1px)", backgroundSize: "46px 46px", pointerEvents: "none", WebkitMaskImage: "radial-gradient(120% 80% at 50% 40%, #000 35%, transparent 78%)", maskImage: "radial-gradient(120% 80% at 50% 40%, #000 35%, transparent 78%)" }} />
            <div style={{ position: "relative", display: "grid", gridTemplateColumns: "repeat(3, 1fr)", gap: 0, alignItems: "stretch" }}>
            {[
              ["01", "One system, not many pieces.", "A deck, a campaign and an event should feel like one mind — we build the language, not the one-off.", 1, "System"],
              ["02", "Decide before you produce.", "Alignment before execution — we validate the direction visually, so everything after is faster.", 2, "Decide"],
              ["03", <React.Fragment key="t3">AI accelerates; <span style={{ fontStyle: "italic", color: "var(--text-accent)" }}>people decide.</span></React.Fragment>, "It widens exploration and removes repetition. Judgement still chooses the route and signs the work.", 3, "Judgement"],
            ].map(([n, t, d, kind, kicker], i) => (
              <ManifestoCard key={n} n={n} title={t} desc={d} kind={kind} idx={i} kicker={kicker} />
            ))}
            </div>
          </div>
        </div>
      </section>

      {/* CASE SHOWCASE — flagship 3-up */}
      <CaseShowcase />

      {/* BUSINESS LINES — paper editorial */}
      <section style={{ maxWidth: "var(--maxw-wide)", margin: "0 auto", padding: "clamp(40px,5vw,84px) var(--page-margin) var(--section-y)" }}>
        <div style={{ display: "flex", justifyContent: "space-between", alignItems: "center", gap: 24, flexWrap: "wrap" }}>
          <Eyebrow>What we do</Eyebrow>
          <Button variant="ghost" onClick={() => window.DH_NAV("services")} trailingIcon={<ArrowR/>}>All services</Button>
        </div>
        <h2 style={{ fontFamily: "var(--font-display)", fontWeight: 400, fontSize: "clamp(40px,5.6vw,84px)", lineHeight: 1.04, letterSpacing: "-0.01em", margin: "clamp(20px,2vw,30px) 0 0" }}>Three scales of one idea.</h2>
        <p style={{ color: "var(--text-secondary)", fontSize: 17, lineHeight: 1.62, margin: "22px 0 clamp(40px,4.5vw,60px)", maxWidth: "52ch" }}>Not three markets — three scales of the same problem: how a brand shows up, stays clear and becomes memorable.</p>
        <ServiceRows lines={D.lines} />
      </section>

      {/* VISUAL SPRINT — dark impact band */}
      <section data-theme="dark" style={{ background: "var(--bg-base)", borderTop: "1px solid var(--border-subtle)", borderBottom: "1px solid var(--border-subtle)" }}>
        <div style={{ maxWidth: "var(--maxw-wide)", margin: "0 auto", padding: "clamp(56px,7vw,120px) var(--page-margin)" }}>
          <div style={{ display: "grid", gridTemplateColumns: "0.82fr 1.18fr", gap: "clamp(36px,4vw,72px)", alignItems: "start" }}>
            <div style={{ display: "flex", flexDirection: "column" }}>
              <span style={{ display: "inline-flex", alignItems: "center", gap: 10, fontFamily: "var(--font-mono)", fontSize: 12, letterSpacing: ".18em", textTransform: "uppercase", color: "var(--lime-500)" }}><span style={{ width: 20, height: 2, background: "var(--lime-500)", flex: "none" }} />Visual Sprint™</span>
              <h2 style={{ fontFamily: "var(--font-display)", fontWeight: 400, fontSize: "clamp(30px,3.8vw,50px)", lineHeight: 1.08, letterSpacing: "-0.01em", margin: "clamp(20px,2vw,28px) 0 0", maxWidth: "18ch" }}>Decide how it should look and feel — <span style={{ color: "var(--lime-500)" }}>before you build everything else.</span></h2>
              <p style={{ color: "var(--text-secondary)", fontSize: 17, lineHeight: 1.6, maxWidth: "46ch", margin: "clamp(16px,1.6vw,22px) 0 0" }}>
                Not just speed — it's how we reach alignment before execution. Routes are validated visually before production, so everything after stays coherent and scales faster.
              </p>
              <div style={{ marginTop: "clamp(28px,3vw,40px)" }}>
                <Button variant="secondary" onClick={() => window.DH_NAV("sprint")} trailingIcon={<ArrowR/>}>See the method</Button>
              </div>
            </div>
            <SprintStepper steps={D.sprint} />
          </div>
          <SprintStats />
        </div>
      </section>

      {/* STUDIO — paper, who & how */}
      <section style={{ borderBottom: "1px solid var(--border-subtle)" }}>
        <div style={{ maxWidth: "var(--maxw-wide)", margin: "0 auto", padding: "var(--section-y) var(--page-margin)" }}>
          <Eyebrow>The studio</Eyebrow>
          <div style={{ display: "grid", gridTemplateColumns: "1.15fr 0.85fr", gap: "clamp(28px,4vw,72px)", alignItems: "end", marginTop: "clamp(20px,2vw,30px)" }}>
            <h2 style={{ fontFamily: "var(--font-display)", fontWeight: 400, fontSize: "clamp(34px,5vw,72px)", lineHeight: 1.05, letterSpacing: "-0.01em", margin: 0, maxWidth: "15ch", textWrap: "balance" }}>Design-led. Human first. <span style={{ color: "var(--text-accent)" }}>AI throughout.</span></h2>
            <div style={{ position: "relative", alignSelf: "stretch", display: "flex", alignItems: "flex-end" }}>
              <div aria-hidden="true" style={{ position: "absolute", inset: "-24px -24px -16px -8px", backgroundImage: "linear-gradient(var(--border-default) 1px, transparent 1px), linear-gradient(90deg, var(--border-default) 1px, transparent 1px)", backgroundSize: "30px 30px", opacity: .6, WebkitMaskImage: "radial-gradient(120% 100% at 85% 50%, #000 25%, transparent 78%)", maskImage: "radial-gradient(120% 100% at 85% 50%, #000 25%, transparent 78%)", pointerEvents: "none" }} />
              <p style={{ position: "relative", color: "var(--text-secondary)", fontSize: 17, lineHeight: 1.64, maxWidth: "42ch", margin: 0 }}>
                A focused studio where every project is led end to end by the people who shape it. AI sits in the room to widen exploration and cut repetition — never to make the call.
              </p>
            </div>
          </div>

          {/* cinematic studio band — principles overlaid on the photo */}
          <StudioBand />
        </div>
      </section>

      {/* CTA — interactive moment chooser */}
      <MomentCTA />
    </main>
  );
}

function ArrowR() {
  return <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.2" strokeLinecap="round" strokeLinejoin="round"><line x1="5" y1="12" x2="19" y2="12"/><polyline points="12 5 19 12 12 19"/></svg>;
}

Object.assign(window, { HomeView, ArrowR, MomentCTA });
