// app.jsx — MIBH Commercial homepage. Full single-page interactive prototype.

const { useState, useEffect, useRef, useMemo } = React;

const TWEAK_DEFAULTS = /*EDITMODE-BEGIN*/{
  "theme": "dark",
  "accent": "#e08a3c",
  "displayFont": "serif"
}/*EDITMODE-END*/;

const ACCENT_SWATCHES = ["#e08a3c", "#c9412a", "#d6cdb8", "#7fa3b8"];

// ────────────────────────────────────────────────────────────────────────────
// NAV
// ────────────────────────────────────────────────────────────────────────────
const NAV_LINKS = [
  ["Services", "/services"],
  ["Portfolio", "/portfolio"],
  ["Why MIBH", "#why"],
  ["About Us", "#about"],
  ["Contact Us", "#contact"],
];

function Nav({ scrolled }) {
  const [open, setOpen] = useState(false);
  const solid = scrolled || open;
  return (
    <header style={{
      position: "fixed", top: 0, left: 0, right: 0, zIndex: 50,
      transition: "background .3s ease, border-color .3s ease, backdrop-filter .3s ease",
      background: solid ? "rgba(14,13,11,.92)" : "transparent",
      backdropFilter: solid ? "blur(14px) saturate(140%)" : "none",
      WebkitBackdropFilter: solid ? "blur(14px) saturate(140%)" : "none",
      borderBottom: `1px solid ${solid ? "var(--line)" : "transparent"}`,
    }}>
      <div style={{ maxWidth: 1440, margin: "0 auto", padding: "18px 40px", display: "flex", alignItems: "center", justifyContent: "space-between", gap: 32 }}>
        <a href="#top" style={{ display: "flex", alignItems: "center", gap: 12 }}>
          <img src="assets/mibh-mark.png" alt="MIBH" style={{ height: 38, width: "auto", display: "block" }} />
          <div>
            <div style={{ font: "600 14px/1 var(--sans)", letterSpacing: ".14em" }}>MIBH</div>
            <div style={{ font: "400 9.5px/1.2 var(--mono)", letterSpacing: ".18em", color: "var(--fg-3)", textTransform: "uppercase", marginTop: 3 }}>Commercial · General Contractor</div>
          </div>
        </a>
        <nav style={{ display: "flex", gap: 28, alignItems: "center" }}>
          {NAV_LINKS.map(([l, href]) =>
            <a key={l} href={href} style={{ font: "500 13px/1 var(--sans)", color: "var(--fg-2)", letterSpacing: ".01em" }}
               onMouseOver={e => e.currentTarget.style.color = "var(--fg)"}
               onMouseOut={e => e.currentTarget.style.color = "var(--fg-2)"}>{l}</a>
          )}
        </nav>
        <div style={{ display: "flex", alignItems: "center", gap: 14 }}>
          <a data-desktop-cta href="tel:+13057467307" style={{ font: "500 12.5px/1 var(--mono)", letterSpacing: ".05em", color: "var(--fg-2)" }}>+1 305 746 7307</a>
          <Btn data-desktop-cta kind="ghost" as="a" href="#contact" style={{ padding: "10px 16px", fontSize: 12.5 }}>Request Bid <Arrow size={12} /></Btn>
          <button data-mobile-toggle onClick={() => setOpen(o => !o)} aria-label="Toggle menu"
            style={{ display: "none", alignItems: "center", justifyContent: "center", width: 42, height: 42, background: "transparent", border: "1px solid var(--line-strong)", borderRadius: 10, cursor: "pointer", color: "var(--fg)" }}>
            <svg width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round">
              {open
                ? <g><line x1="3" y1="3" x2="15" y2="15" /><line x1="15" y1="3" x2="3" y2="15" /></g>
                : <g><line x1="2" y1="5" x2="16" y2="5" /><line x1="2" y1="9" x2="16" y2="9" /><line x1="2" y1="13" x2="16" y2="13" /></g>}
            </svg>
          </button>
        </div>
      </div>

      {open && (
        <div data-mobile-menu style={{ borderTop: "1px solid var(--line)", padding: "10px 18px 20px" }}>
          <div style={{ display: "flex", flexDirection: "column" }}>
            {NAV_LINKS.map(([l, href]) => (
              <a key={l} href={href} onClick={() => setOpen(false)}
                 style={{ padding: "13px 4px", font: "500 15px/1 var(--sans)", color: "var(--fg-2)", borderBottom: "1px solid var(--line)" }}>{l}</a>
            ))}
          </div>
        </div>
      )}
    </header>
  );
}

// ────────────────────────────────────────────────────────────────────────────
// HERO
// ────────────────────────────────────────────────────────────────────────────
function Hero() {
  return (
    <section data-screen-label="01 Hero" id="top" style={{ position: "relative", minHeight: "100vh", overflow: "hidden", color: "var(--fg)", display: "flex", flexDirection: "column" }}>
      {/* hero video */}
      <video
        src="assets/hero-tilt.mp4"
        autoPlay muted loop playsInline
        style={{ position: "absolute", inset: 0, width: "100%", height: "100%", objectFit: "cover", zIndex: 0 }}
      />
      {/* legibility overlay */}
      <div style={{ position: "absolute", inset: 0, zIndex: 1, pointerEvents: "none", background:
        "linear-gradient(180deg, rgba(14,13,11,.62) 0%, rgba(14,13,11,.18) 32%, rgba(14,13,11,.30) 58%, rgba(14,13,11,.88) 100%)," +
        "radial-gradient(120% 80% at 50% 50%, rgba(14,13,11,0) 45%, rgba(14,13,11,.55) 100%)" }} />

      {/* main content */}
      <div style={{ position: "relative", zIndex: 2, flex: 1, width: "100%", maxWidth: 1440, margin: "0 auto", padding: "160px 40px 56px", display: "flex", flexDirection: "column", justifyContent: "space-between", gap: 64 }}>
        <div>
          <div>
            <h1 style={{ margin: 0, font: "400 clamp(48px, 7vw, 104px)/1.0 var(--display)", letterSpacing: "-.02em" }}>
              South Florida's<br/>
              <span style={{ fontStyle: "italic", color: "var(--accent)" }}>commercial general</span><br/>
              contractor.
            </h1>
            <p style={{ margin: "36px 0 0", maxWidth: 640, font: "300 17.5px/1.55 var(--sans)", color: "var(--fg-2)" }}>
              A licensed commercial general contractor building and managing ground-up
              warehouses, multifamily, structural steel and metal deck, concrete, and
              tenant build-outs — delivered on schedule, on budget, and built to code.
            </p>
            <div style={{ marginTop: 36, display: "flex", gap: 12, flexWrap: "wrap" }}>
              <Btn kind="solid" as="a" href="mailto:build@mibh.co?subject=Bid%20Request">Request a Bid <Arrow size={13} /></Btn>
              <Btn kind="ghost" as="a" href="/portfolio">View Projects</Btn>
            </div>
          </div>
        </div>

        {/* bottom stat row — in flow, not absolute */}
        <div style={{ display: "grid", gridTemplateColumns: "repeat(4, 1fr)", gap: 0, borderTop: "1px solid var(--line)", paddingTop: 22 }}>
          {[
            ["18 YRS", "Building South FL"],
            ["4.2M", "Sqft delivered"],
            ["120+", "Projects completed"],
            ["7 MUNI", "Permitting jurisdictions"],
          ].map(([n, l], i) => (
            <div key={i} style={{ paddingLeft: i ? 24 : 0, borderLeft: i ? "1px solid var(--line)" : "none" }}>
              <div style={{ font: "400 clamp(28px, 2.4vw, 36px)/1 var(--display)", letterSpacing: "-.01em" }}>{n}</div>
              <div style={{ marginTop: 8, font: "400 11.5px/1.3 var(--mono)", letterSpacing: ".08em", textTransform: "uppercase", color: "var(--fg-3)" }}>{l}</div>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

// ────────────────────────────────────────────────────────────────────────────
// TRUST BAR (marquee)
// ────────────────────────────────────────────────────────────────────────────
function TrustBar() {
  const items = [
    "CGC1527069 — Certified General Contractor",
    "Design-Build &amp; CM at-Risk",
    "Fully Licensed &amp; Insured",
    "South Florida service area",
    "OSHA-compliant safety program",
    "Florida Building Code · HVHZ compliant",
  ];
  const row = [...items, ...items];
  return (
    <section data-screen-label="02 Trust Bar" style={{ background: "var(--bg-2)", borderTop: "1px solid var(--line)", borderBottom: "1px solid var(--line)" }}>
      <div style={{ overflow: "hidden", padding: "22px 0" }}>
        <div className="trust-marquee" style={{ display: "flex", gap: 64, whiteSpace: "nowrap", willChange: "transform" }}>
          {row.map((t, i) => (
            <div key={i} style={{ display: "flex", alignItems: "center", gap: 16 }}>
              <span style={{ width: 6, height: 6, background: "var(--accent)", display: "inline-block" }} />
              <span dangerouslySetInnerHTML={{ __html: t }} style={{ font: "500 12.5px/1 var(--mono)", color: "var(--fg-2)", letterSpacing: ".06em", textTransform: "uppercase" }} />
            </div>
          ))}
        </div>
      </div>
      <style>{`
        .trust-marquee{animation: marquee 48s linear infinite;}
        @keyframes marquee { 0%{transform:translateX(0)} 100%{transform:translateX(-50%)} }
      `}</style>
    </section>
  );
}

// Auto-rotating image — cross-fades through a set of photos (used by Hospitality).
function RotatingImage({ photos, alt, interval = 3400, children }) {
  const [i, setI] = useState(0);
  useEffect(() => {
    if (!photos || photos.length < 2) return;
    const id = setInterval(() => setI(x => (x + 1) % photos.length), interval);
    return () => clearInterval(id);
  }, [photos ? photos.length : 0, interval]);
  return (
    <div style={{ position: "relative", aspectRatio: "16/10", overflow: "hidden", background: "#1c1a16" }}>
      {photos.map((src, idx) => (
        <img key={src} src={src} alt={alt} style={{ position: "absolute", inset: 0, width: "100%", height: "100%", objectFit: "cover", opacity: idx === i ? 1 : 0, transition: "opacity .9s ease" }} />
      ))}
      {children}
    </div>
  );
}

// ────────────────────────────────────────────────────────────────────────────
// DIVISIONS / SERVICES
// ────────────────────────────────────────────────────────────────────────────
function Divisions() {
  const divs = [
    { tag: "Division 01", title: "Warehouse &amp; Distribution", body: "Ground-up tilt-wall and structural-steel warehouses, distribution hubs, and light industrial — slab-to-shell, dock-high loading, and clear-span logistics space.", spec: "Tilt-wall · Clear-span · Dock-high", img: "drone — warehouse under construction" },
    { tag: "Division 02", title: "Multifamily &amp; Mixed-Use", body: "Podium, garden, and mid-rise multifamily, mixed-use, and residential — from foundations and framing through amenities, façade, and turnover.", spec: "Podium · Mid-rise · Mixed-use", img: "elevation — multifamily framing" },
    { tag: "Division 03", title: "Structural Steel &amp; Metal Deck", body: "Structural steel erection, bar joists, and metal roof &amp; floor decking — engineered connections, welded and fastened, sequenced to keep the build moving.", spec: "Steel · Joists · Metal deck", img: "site — steel frame & metal deck" },
    { tag: "Division 04", title: "Concrete &amp; Tilt-Wall", body: "Site concrete, foundations, slabs-on-grade, and tilt-up panel casting and erection — self-performed for schedule control and quality.", spec: "Foundations · Slabs · Tilt-up", img: "site — tilt-wall panel lift", video: "assets/tilt-wall.mp4" },
    { tag: "Division 05", title: "Tenant Improvements &amp; Build-Outs", body: "Interior build-outs, white-box and second-generation TIs, and occupied renovations for retail, office, restaurant, and industrial tenants.", spec: "TI · White-box · Renovation", img: "interior — commercial build-out" },
    { tag: "Division 06", title: "Site Development &amp; Sitework", body: "Clearing, grading, underground utilities, paving, and hardscape — turning raw and infill sites into pad-ready and finished projects.", spec: "Grading · Utilities · Paving", img: "drone — sitework & grading" },
    { tag: "Division 07", title: "Hospitality &amp; Hotels", body: "Ground-up and renovation work for national hotel flags — Home2 Suites, Hilton Garden Inn, and Residence Inn by Marriott — built to brand standard across South Florida.", spec: "Hotels · Flagged · Brand-standard", img: "recent hotel projects", photos: ["assets/home2suites-1.jpg", "assets/hiltongardeninn-1.jpg", "assets/residenceinn-1.jpg"] },
  ];
  const [hover, setHover] = useState(null);
  return (
    <section data-screen-label="03 Services" id="services" style={{ background: "var(--bg)", padding: "120px 40px" }}>
      <div style={{ maxWidth: 1440, margin: "0 auto" }}>
        <SectionHead index="03 / Services" kicker="What we build" title="Every phase of the build." lede="A commercial general contractor purpose-built for South Florida — ground-up construction, structural steel and metal deck, concrete, and interior build-outs delivered under one accountable builder." />

        <div style={{ display: "grid", gridTemplateColumns: "repeat(2, 1fr)", gap: 1, background: "var(--line)", border: "1px solid var(--line)" }}>
          {divs.map((d, i) => (
            <article key={i}
              onMouseEnter={() => setHover(i)} onMouseLeave={() => setHover(null)}
              style={{ background: "var(--bg)", padding: 0, position: "relative", overflow: "hidden", cursor: "pointer", transition: "background .25s" }}>
              {d.photos ? (
                <RotatingImage photos={d.photos} alt={d.title}>
                  <div style={{ position: "absolute", inset: 0, display: "flex", padding: 14, justifyContent: "space-between", alignItems: "flex-start", pointerEvents: "none" }}>
                    <span dangerouslySetInnerHTML={{ __html: d.img }} style={{ font: "500 10px/1 var(--mono)", letterSpacing: ".08em", textTransform: "uppercase", color: "var(--fg-2)", background: "rgba(14,13,11,.55)", padding: "5px 7px", border: "1px solid var(--line)" }} />
                    <span style={{ font: "500 10px/1 var(--mono)", letterSpacing: ".08em", color: "var(--fg-3)" }}>{`MIBH · ${d.tag.toUpperCase()}`}</span>
                  </div>
                </RotatingImage>
              ) : d.video ? (
                <div style={{ position: "relative", aspectRatio: "16/10", overflow: "hidden", background: "#1c1a16" }}>
                  <video src={d.video} autoPlay muted loop playsInline style={{ position: "absolute", inset: 0, width: "100%", height: "100%", objectFit: "cover" }} />
                  <div style={{ position: "absolute", inset: 0, display: "flex", padding: 14, justifyContent: "space-between", alignItems: "flex-start", pointerEvents: "none" }}>
                    <span dangerouslySetInnerHTML={{ __html: d.img }} style={{ font: "500 10px/1 var(--mono)", letterSpacing: ".08em", textTransform: "uppercase", color: "var(--fg-2)", background: "rgba(14,13,11,.55)", padding: "5px 7px", border: "1px solid var(--line)" }} />
                    <span style={{ font: "500 10px/1 var(--mono)", letterSpacing: ".08em", color: "var(--fg-3)" }}>{`MIBH · ${d.tag.toUpperCase()}`}</span>
                  </div>
                </div>
              ) : (
                <Placeholder ratio="16/10" mono={d.img} label={`MIBH · ${d.tag.toUpperCase()}`} />
              )}
              <div style={{ padding: "28px 32px 32px" }}>
                <div style={{ display: "flex", justifyContent: "space-between", alignItems: "baseline" }}>
                  <MonoTag style={{ color: "var(--accent)" }}>{d.tag}</MonoTag>
                  <MonoTag style={{ color: "var(--fg-3)" }} dangerouslySetInnerHTML={{ __html: d.spec }} />
                </div>
                <h3 style={{ margin: "16px 0 12px", font: "400 36px/1.05 var(--display)", letterSpacing: "-.005em" }} dangerouslySetInnerHTML={{ __html: d.title }} />
                <p style={{ margin: 0, maxWidth: 520, font: "300 15.5px/1.55 var(--sans)", color: "var(--fg-2)" }} dangerouslySetInnerHTML={{ __html: d.body }} />
                <div style={{ marginTop: 22, display: "inline-flex", alignItems: "center", gap: 8, color: "var(--fg)", font: "500 12.5px/1 var(--mono)", letterSpacing: ".08em", textTransform: "uppercase", borderBottom: "1px solid var(--line-strong)", paddingBottom: 6 }}>
                  Explore division <Arrow size={12} style={{ transform: hover === i ? "translateX(4px)" : "none", transition: "transform .2s" }} />
                </div>
              </div>
            </article>
          ))}
          <div style={{ background: "var(--bg)", padding: "44px 32px", display: "flex", flexDirection: "column", justifyContent: "center", gap: 16 }}>
            <MonoTag style={{ color: "var(--accent)" }}>Every sector</MonoTag>
            <h3 style={{ margin: 0, font: "400 30px/1.1 var(--display)", letterSpacing: "-.005em" }}>Don't see your project type?</h3>
            <p style={{ margin: 0, maxWidth: 420, font: "300 15px/1.55 var(--sans)", color: "var(--fg-2)" }}>We build across industrial, retail, office, medical, and more — tell us what you're planning and we'll scope it.</p>
            <div><Btn kind="ghost" as="a" href="#contact">Talk to us <Arrow size={12} /></Btn></div>
          </div>
        </div>
      </div>
    </section>
  );
}

// ────────────────────────────────────────────────────────────────────────────
// WHY MIBH
// ────────────────────────────────────────────────────────────────────────────
function WhyMIBH() {
  const items = [
    { n: "01", t: "Single Point of Responsibility", b: "Preconstruction, permitting, self-perform trades, subs, scheduling, and close-out coordinated by one accountable general contractor — not a fragmented sub chain." },
    { n: "02", t: "HVHZ &amp; Building-Code Expertise", b: "Every structure built to Florida Building Code, threshold-inspected where required, and engineered for High-Velocity Hurricane Zone loads from Miami-Dade to Palm Beach." },
    { n: "03", t: "Self-Perform Trades", b: "In-house concrete, steel, and metal-deck crews — the control that protects schedule, quality, and budget instead of waiting on the next sub to show up." },
    { n: "04", t: "Schedule &amp; Budget Discipline", b: "GMP transparency, real-time cost tracking, and phased scheduling that keep the project on its pro forma and the owner ahead of surprises." },
  ];
  return (
    <section data-screen-label="04 Why MIBH" id="why" style={{ background: "var(--bg-2)", color: "var(--fg)", padding: "120px 40px", borderTop: "1px solid var(--line)" }}>
      <div style={{ maxWidth: 1440, margin: "0 auto" }}>
        <SectionHead index="04 / Why MIBH" kicker="For owners &amp; developers" title="Built to reduce build risk." lede="A commercial project that slips means carrying costs, lost rent, and a blown pro forma. MIBH is structured around the four levers that actually de-risk a ground-up or build-out program." />

        <div style={{ display: "grid", gridTemplateColumns: "1fr 1fr", gap: 1, background: "var(--line)", border: "1px solid var(--line)" }}>
          {items.map(it => (
            <div key={it.n} style={{ background: "var(--bg-2)", padding: "44px 44px 48px" }}>
              <div style={{ display: "flex", alignItems: "baseline", gap: 18, marginBottom: 24 }}>
                <div style={{ font: "400 64px/1 var(--display)", color: "var(--accent)", letterSpacing: "-.02em" }}>{it.n}</div>
                <div style={{ flex: 1, borderTop: "1px solid var(--line-strong)" }} />
              </div>
              <h3 style={{ margin: "0 0 14px", font: "500 22px/1.25 var(--sans)", letterSpacing: "-.005em", color: "var(--fg)" }} dangerouslySetInnerHTML={{ __html: it.t }} />
              <p style={{ margin: 0, maxWidth: 520, font: "300 15.5px/1.6 var(--sans)", color: "var(--fg-2)" }} dangerouslySetInnerHTML={{ __html: it.b }} />
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

// ────────────────────────────────────────────────────────────────────────────
// FEATURED PROJECTS
// ────────────────────────────────────────────────────────────────────────────
const PROJECTS = [
  { id: "P-241", type: "Warehouse / Distribution", title: "Doral Logistics Warehouse", city: "Doral, FL", scope: "212,000 sqft tilt-wall distribution center, ground-up", systems: "Tilt-wall · steel joists · 32' clear · dock-high", timeline: "2024 · 11 months", shots: ["drone — tilt-wall shell", "exterior — dock-high doors", "interior — clear-span bays", "aerial — completed roof"] },
  { id: "P-238", type: "Multifamily", title: "Las Olas Residences", city: "Fort Lauderdale, FL", scope: "214-unit podium-deck mid-rise multifamily", systems: "Post-tension podium · wood-frame · amenity deck", timeline: "2024 · 22 months", shots: ["elevation — mid-rise façade", "amenity — pool deck", "interior — model unit", "aerial — podium & site"] },
  { id: "P-229", type: "Structural Steel", title: "Gateway Commerce Center", city: "Medley, FL", scope: "Structural steel &amp; metal deck, 3-building flex park", systems: "Steel frame · bar joists · 1.5\" B-deck", timeline: "2023 · 9 months", shots: ["site — steel erection", "detail — moment connection", "deck — metal floor deck", "frame — topped out"] },
  { id: "P-221", type: "Tilt-Wall", title: "Airport West Industrial", city: "Doral, FL", scope: "148,000 sqft tilt-up shell + office build-out", systems: "Tilt-up panels · slab-on-grade · TI", timeline: "2023 · 8 months", shots: ["site — panel lift", "exterior — finished shell", "interior — office build-out", "aerial — completed site"] },
  { id: "P-214", type: "Tenant Improvement", title: "Aventura Retail Build-Out", city: "Aventura, FL", scope: "34,000 sqft second-gen retail + restaurant TI", systems: "White-box · MEP · storefront · FF&amp;E", timeline: "2023 · 4 months", shots: ["interior — retail build-out", "storefront — glass & entry", "detail — MEP rough-in", "finish — completed space"] },
  { id: "P-208", type: "Mixed-Use", title: "Sunset Plaza Mixed-Use", city: "Miami, FL", scope: "Ground-floor retail over structured parking", systems: "Cast-in-place · steel · façade", timeline: "2022 · 16 months", shots: ["elevation — mixed-use podium", "retail — ground floor", "structure — cast-in-place", "aerial — completed block"] },
];

function FeaturedProjects() {
  const [active, setActive] = useState(0);
  const p = PROJECTS[active];
  return (
    <section data-screen-label="05 Featured Projects" id="projects" style={{ background: "var(--bg)", padding: "120px 40px", borderTop: "1px solid var(--line)" }}>
      <div style={{ maxWidth: 1440, margin: "0 auto" }}>
        <div style={{ display: "flex", justifyContent: "space-between", alignItems: "end", paddingBottom: 40 }}>
          <SectionHead index="05 / Portfolio" kicker="Selected projects, 2022—2024" title="Featured work." lede={null} />
          <div style={{ display: "flex", gap: 10, paddingBottom: 8 }}>
            <Btn kind="ghost" as="a" href="/portfolio" style={{ padding: "10px 16px", fontSize: 12.5 }}>All projects <Arrow size={12} /></Btn>
          </div>
        </div>

        {/* Featured detail panel */}
        <div style={{ display: "grid", gridTemplateColumns: "1.4fr 1fr", gap: 0, border: "1px solid var(--line)", marginBottom: 40 }}>
          <div style={{ position: "relative", minHeight: 520, display: "grid", gridTemplateColumns: "1fr 1fr", gridTemplateRows: "1fr 1fr", gap: 1, background: "var(--line)" }}>
            {p.shots.map((shot, si) => (
              <div key={si} style={{ position: "relative", minHeight: 240, overflow: "hidden" }}>
                <Placeholder mono={shot} label={`${si + 1}/4`} style={{ position: "absolute", inset: 0 }} />
              </div>
            ))}
            {/* overlay corners */}
            <div style={{ position: "absolute", left: 24, bottom: 24, right: 24, display: "flex", justifyContent: "space-between", alignItems: "flex-end", pointerEvents: "none" }}>
              <MonoTag style={{ background: "rgba(14,13,11,.6)", padding: "6px 10px", border: "1px solid var(--line)" }}>● {p.id} · 4 PHOTOS</MonoTag>
              <MonoTag style={{ background: "rgba(14,13,11,.6)", padding: "6px 10px", border: "1px solid var(--line)" }}>{p.timeline.split(" · ")[0]}</MonoTag>
            </div>
          </div>
          <div style={{ padding: "40px 40px", borderLeft: "1px solid var(--line)" }}>
            <div style={{ display: "flex", justifyContent: "space-between", alignItems: "baseline" }}>
              <MonoTag style={{ color: "var(--accent)" }}>{p.type}</MonoTag>
              <MonoTag style={{ color: "var(--fg-3)" }}>{p.id}</MonoTag>
            </div>
            <h3 style={{ margin: "20px 0 24px", font: "400 40px/1.05 var(--display)", letterSpacing: "-.005em" }}>{p.title}</h3>
            <Rule />
            <dl style={{ margin: "20px 0 0", display: "grid", gridTemplateColumns: "1fr", gap: 14 }}>
              {[["Location", p.city], ["Scope", p.scope], ["Systems", p.systems], ["Timeline", p.timeline]].map(([k, v]) => (
                <div key={k} style={{ display: "grid", gridTemplateColumns: "110px 1fr", gap: 16, paddingBottom: 14, borderBottom: "1px solid var(--line)" }}>
                  <dt style={{ font: "400 11px/1.3 var(--mono)", letterSpacing: ".1em", textTransform: "uppercase", color: "var(--fg-3)" }}>{k}</dt>
                  <dd style={{ margin: 0, font: "400 14.5px/1.5 var(--sans)", color: "var(--fg)" }} dangerouslySetInnerHTML={{ __html: v }} />
                </div>
              ))}
            </dl>
            <div style={{ marginTop: 28 }}>
              <Btn kind="ghost" as="a" href="/portfolio">Full case study <Arrow size={12} /></Btn>
            </div>
          </div>
        </div>

        {/* Project switcher rail */}
        <div style={{ display: "grid", gridTemplateColumns: `repeat(${PROJECTS.length}, 1fr)`, gap: 12 }}>
          {PROJECTS.map((pr, i) => (
            <button key={pr.id} onClick={() => setActive(i)}
              style={{
                background: i === active ? "rgba(241,237,229,.06)" : "transparent",
                border: i === active ? "1px solid var(--accent)" : "1px solid var(--line)",
                color: "var(--fg)", textAlign: "left", padding: "14px 14px 16px", cursor: "pointer",
                transition: "background .2s, border-color .2s",
              }}
              onMouseOver={e => { if (i !== active) e.currentTarget.style.borderColor = "var(--line-strong)" }}
              onMouseOut={e => { if (i !== active) e.currentTarget.style.borderColor = "var(--line)" }}>
              <div style={{ display: "flex", justifyContent: "space-between" }}>
                <MonoTag style={{ color: i === active ? "var(--accent)" : "var(--fg-3)" }}>{pr.id}</MonoTag>
                <MonoTag style={{ color: "var(--fg-3)" }}>{pr.timeline.split(" · ")[0]}</MonoTag>
              </div>
              <div style={{ marginTop: 14, font: "500 14px/1.3 var(--sans)", letterSpacing: "-.005em" }}>{pr.title}</div>
              <div style={{ marginTop: 6, font: "400 11.5px/1.3 var(--mono)", letterSpacing: ".05em", color: "var(--fg-3)" }}>{pr.city}</div>
            </button>
          ))}
        </div>
      </div>
    </section>
  );
}

// ────────────────────────────────────────────────────────────────────────────
// PROCESS — 5 steps timeline
// ────────────────────────────────────────────────────────────────────────────
function Process() {
  const steps = [
    { n: "01", t: "Preconstruction &amp; Estimating", b: "Constructability review, value engineering, budgeting, and GMP development — drawings, site logistics, and long-lead items pinned down before the first shovel." },
    { n: "02", t: "Design-Build &amp; Permitting", b: "Coordinate architects and engineers, threshold and structural detailing, and municipal permit submittals across Miami-Dade, Broward, and Palm Beach." },
    { n: "03", t: "Scheduling &amp; Procurement", b: "Critical-path schedule locked, steel and long-lead materials procured, subcontractors bought out, and crews and crane time confirmed." },
    { n: "04", t: "Self-Perform &amp; Construction", b: "Foundations, concrete, steel and metal deck, envelope, and interiors — daily photo logs and in-line QC against the approved GMP scope." },
    { n: "05", t: "Commissioning &amp; Close-Out", b: "Punch, inspections, Certificate of Occupancy, warranties, as-builts, and a clean digital handover package — turned over ready to occupy." },
  ];
  return (
    <section data-screen-label="06 Process" id="process" style={{ background: "#f1ede5", color: "#0e0d0b", padding: "120px 40px" }}>
      <div style={{ maxWidth: 1440, margin: "0 auto" }}>
        <SectionHead theme="light" index="06 / Process" kicker="Preconstruction-to-close-out" title="A build process built to outperform." lede="Five sequenced phases — methodical in structure, transparent by design. The same operating cadence applies whether it's a 4-month tenant build-out or a 200,000 sqft ground-up warehouse." />

        <div style={{ position: "relative", marginTop: 24 }}>
          {/* horizontal rule */}
          <div style={{ position: "absolute", top: 22, left: 0, right: 0, height: 1, background: "rgba(14,13,11,.18)" }} />
          <div style={{ display: "grid", gridTemplateColumns: "repeat(5, 1fr)", gap: 28 }}>
            {steps.map((s, i) => (
              <div key={s.n} style={{ paddingTop: 0 }}>
                <div style={{ position: "relative", height: 44 }}>
                  <div style={{ position: "absolute", top: 16, left: 0, width: 14, height: 14, borderRadius: "50%", background: i === 0 ? "var(--accent)" : "#0e0d0b", border: "3px solid #f1ede5", boxShadow: "0 0 0 1px rgba(14,13,11,.18)" }} />
                </div>
                <div style={{ font: "400 11px/1.3 var(--mono)", letterSpacing: ".12em", color: "rgba(14,13,11,.45)", textTransform: "uppercase" }}>Phase {s.n}</div>
                <h4 style={{ margin: "10px 0 14px", font: "400 26px/1.1 var(--display)", letterSpacing: "-.005em" }} dangerouslySetInnerHTML={{ __html: s.t }} />
                <p style={{ margin: 0, font: "300 14.5px/1.55 var(--sans)", color: "rgba(14,13,11,.65)" }} dangerouslySetInnerHTML={{ __html: s.b }} />
              </div>
            ))}
          </div>
        </div>

        {/* secondary differentiators */}
        <div style={{ marginTop: 80, display: "grid", gridTemplateColumns: "repeat(3, 1fr)", gap: 0, borderTop: "1px solid rgba(14,13,11,.18)" }}>
          {[
            ["Upload Plans & Drawings", "Submit plans, drawings, scopes, and site photos. Encrypted intake routed straight to preconstruction and estimating."],
            ["Project Map", "Interactive build map across Miami, Fort Lauderdale, Hollywood, Aventura, Boca, and Palm Beach."],
            ["Bid System", "Dedicated GC proposal workflow: Request a Bid, Schedule a Site Walk, Upload Plans."],
          ].map(([t, b], i) => (
            <div key={t} style={{ padding: "32px 32px 0", paddingLeft: i ? 32 : 0, borderLeft: i ? "1px solid rgba(14,13,11,.18)" : "none" }}>
              <MonoTag style={{ color: "rgba(14,13,11,.45)" }}>Differentiator · 0{i+1}</MonoTag>
              <h5 style={{ margin: "16px 0 8px", font: "500 18px/1.3 var(--sans)", letterSpacing: "-.005em" }}>{t}</h5>
              <p style={{ margin: 0, font: "300 14.5px/1.55 var(--sans)", color: "rgba(14,13,11,.65)" }}>{b}</p>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

// ────────────────────────────────────────────────────────────────────────────
// SOCIAL PROOF — credentials wall
// ────────────────────────────────────────────────────────────────────────────
function SocialProof() {
  const munis = ["Miami", "Miami Beach", "Coral Gables", "Aventura", "Hollywood", "Fort Lauderdale", "Pompano Beach", "Boca Raton", "Delray Beach", "West Palm Beach", "Palm Beach", "Doral", "Sunny Isles", "Hialeah"];
  const cats = ["Ground-up construction", "Tilt-wall &amp; concrete", "Structural steel", "Metal roof &amp; floor deck", "Tenant improvements", "Sitework &amp; utilities", "Design-build"];
  const sectors = ["Industrial", "Warehouse", "Multifamily", "Retail", "Office", "Mixed-Use", "Restaurant", "Medical", "Municipal"];

  return (
    <section data-screen-label="07 Social Proof" id="proof" style={{ background: "var(--bg)", padding: "120px 40px", borderTop: "1px solid var(--line)" }}>
      <div style={{ maxWidth: 1440, margin: "0 auto" }}>
        <SectionHead index="07 / Social Proof" kicker="How owners evaluate a builder" title="Credentials. Coverage. Documentation." lede="Owners and developers don't want testimonials — they want licenses, bonding capacity, safety records, and insurance. Here's the surface that matters." />

        <div style={{ display: "grid", gridTemplateColumns: "1.2fr 1fr", gap: 1, background: "var(--line)", border: "1px solid var(--line)" }}>
          {/* Municipalities */}
          <div style={{ background: "var(--bg)", padding: 40 }}>
            <MonoTag style={{ color: "var(--accent)" }}>Municipalities · Active permits</MonoTag>
            <div style={{ marginTop: 24, display: "flex", flexWrap: "wrap", gap: 8 }}>
              {munis.map(m => (
                <span key={m} style={{ padding: "8px 14px", border: "1px solid var(--line-strong)", borderRadius: 999, font: "500 12.5px/1 var(--sans)", color: "var(--fg)" }}>{m}, FL</span>
              ))}
            </div>

            <div style={{ marginTop: 36, display: "grid", gridTemplateColumns: "1fr 1fr", gap: 32 }}>
              <div>
                <MonoTag style={{ color: "var(--accent)" }}>Self-perform &amp; scope</MonoTag>
                <ul style={{ margin: "16px 0 0", padding: 0, listStyle: "none", display: "flex", flexDirection: "column", gap: 12 }}>
                  {cats.map(c => (
                    <li key={c} style={{ display: "flex", alignItems: "center", gap: 12, font: "400 14.5px/1.3 var(--sans)", color: "var(--fg-2)" }}>
                      <span style={{ width: 5, height: 5, background: "var(--accent)" }} />
                      <span dangerouslySetInnerHTML={{ __html: c }} />
                    </li>
                  ))}
                </ul>
              </div>
              <div>
                <MonoTag style={{ color: "var(--accent)" }}>Sectors we build</MonoTag>
                <div style={{ marginTop: 16, display: "grid", gridTemplateColumns: "repeat(3, 1fr)", gap: 0, border: "1px solid var(--line)" }}>
                  {sectors.map((v, i) => (
                    <div key={v} style={{ padding: "18px 12px", borderRight: (i % 3 !== 2) ? "1px solid var(--line)" : "none", borderBottom: (i < 6) ? "1px solid var(--line)" : "none", textAlign: "center", font: "500 13px/1 var(--sans)", color: "var(--fg-2)", letterSpacing: ".02em" }}>{v}</div>
                  ))}
                </div>
              </div>
            </div>
          </div>

          {/* Documents */}
          <div style={{ background: "var(--bg)", padding: 40 }}>
            <MonoTag style={{ color: "var(--accent)" }}>On file · Available on request</MonoTag>
            <div style={{ marginTop: 24, display: "flex", flexDirection: "column", gap: 1, background: "var(--line)", border: "1px solid var(--line)" }}>
              {[
                ["CGC1527069", "General Contractor", "FL DBPR · Active"],
                ["Bonding", "Bid &amp; Performance", "Aggregate available"],
                ["COI · GL/Auto", "Certificate of Insurance", "$2M / $4M agg."],
                ["WC Coverage", "Workers' Compensation", "FL · Active"],
                ["EMR / OSHA", "Safety record", "OSHA 30 · low EMR"],
                ["W-9 / SSAE", "Tax &amp; vendor docs", "Available on request"],
              ].map(([code, t, m]) => (
                <div key={code} style={{ background: "var(--bg)", padding: "18px 18px", display: "grid", gridTemplateColumns: "150px 1fr auto", gap: 16, alignItems: "center" }}>
                  <div style={{ font: "500 12px/1.3 var(--mono)", letterSpacing: ".05em", color: "var(--accent)" }} dangerouslySetInnerHTML={{ __html: code }} />
                  <div style={{ font: "500 14px/1.3 var(--sans)", color: "var(--fg)" }} dangerouslySetInnerHTML={{ __html: t }} />
                  <div style={{ font: "400 11.5px/1.3 var(--mono)", letterSpacing: ".05em", color: "var(--fg-3)", textAlign: "right" }} dangerouslySetInnerHTML={{ __html: m }} />
                </div>
              ))}
            </div>
            <div style={{ marginTop: 22 }}>
              <Btn kind="ghost" as="a" href="mailto:build@mibh.co?subject=Credential%20Package">Request credential package <Arrow size={12} /></Btn>
            </div>
          </div>
        </div>
      </div>
    </section>
  );
}

// ────────────────────────────────────────────────────────────────────────────
// ABOUT US
// ────────────────────────────────────────────────────────────────────────────
function AboutUs() {
  const items = [
    ["Owner-focused", "We build around your pro forma and your schedule — clear budgets, real-time cost tracking, and no surprises at close-out."],
    ["Self-perform trades", "In-house concrete, steel, and metal-deck crews keep the critical path in our hands, not stuck in a subcontractor's queue."],
    ["Licensed &amp; insured", "Certified General Contractor CGC1527069 — fully insured, OSHA-compliant, and permitted across Miami-Dade, Broward, and Palm Beach."],
    ["Built to code", "Every structure engineered to Florida Building Code and HVHZ wind loads — the standard South Florida actually demands."],
  ];
  return (
    <section data-screen-label="About Us" id="about" style={{ background: "var(--bg-2)", padding: "120px 40px", borderTop: "1px solid var(--line)" }}>
      <div style={{ maxWidth: 1440, margin: "0 auto" }}>
        <SectionHead index="/ About Us" kicker="Who we are" title="A South Florida builder." lede="MIBH Commercial is a licensed general contractor building across South Florida — ground-up warehouses and multifamily, structural steel and metal deck, concrete, and interior build-outs. We self-perform the trades that control schedule and quality, and manage the rest under one accountable team." />
        <div style={{ display: "grid", gridTemplateColumns: "1fr 1fr", gap: 1, background: "var(--line)", border: "1px solid var(--line)" }}>
          {items.map(([t, b]) => (
            <div key={t} style={{ background: "var(--bg-2)", padding: "40px 40px 44px" }}>
              <h3 style={{ margin: "0 0 12px", font: "500 20px/1.25 var(--sans)", letterSpacing: "-.005em", color: "var(--fg)" }} dangerouslySetInnerHTML={{ __html: t }} />
              <p style={{ margin: 0, maxWidth: 480, font: "300 15px/1.6 var(--sans)", color: "var(--fg-2)" }} dangerouslySetInnerHTML={{ __html: b }} />
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

// ────────────────────────────────────────────────────────────────────────────
// FINAL CTA + FOOTER
// ────────────────────────────────────────────────────────────────────────────
function FinalCTA() {
  return (
    <section data-screen-label="08 Final CTA" id="contact" style={{ position: "relative", background: "var(--bg-2)", borderTop: "1px solid var(--line)", padding: "140px 40px 80px", overflow: "hidden" }}>
      {/* faint pattern */}
      <svg style={{ position: "absolute", inset: 0, width: "100%", height: "100%", opacity: .25, pointerEvents: "none" }} preserveAspectRatio="xMidYMid slice" viewBox="0 0 1600 900">
        <defs>
          <pattern id="cta-stripe" patternUnits="userSpaceOnUse" width="22" height="22" patternTransform="rotate(-22)">
            <rect width="22" height="22" fill="transparent" />
            <rect width="1" height="22" fill="rgba(241,237,229,.18)" />
          </pattern>
        </defs>
        <rect width="1600" height="900" fill="url(#cta-stripe)" />
      </svg>

      <div style={{ position: "relative", maxWidth: 1440, margin: "0 auto", display: "grid", gridTemplateColumns: "1.2fr 1fr", gap: 80, alignItems: "end", paddingBottom: 80 }}>
        <div>
          <MonoTag style={{ color: "var(--accent)" }}>08 / Get in touch</MonoTag>
          <h2 style={{ margin: "20px 0 0", font: "400 clamp(56px, 7vw, 110px)/0.96 var(--display)", letterSpacing: "-.02em" }}>
            Ready to build<br/>your <span style={{ fontStyle: "italic", color: "var(--accent)" }}>project</span>?
          </h2>
          <p style={{ margin: "28px 0 0", maxWidth: 580, font: "300 17px/1.55 var(--sans)", color: "var(--fg-2)" }}>
            Commercial construction — warehouses, multifamily, structural steel and metal deck,
            concrete, and tenant build-outs — engineered for South Florida and delivered on schedule.
          </p>
        </div>
        <div style={{ display: "flex", flexDirection: "column", gap: 12, alignItems: "flex-start" }}>
          <Btn kind="solid" as="a" href="mailto:build@mibh.co?subject=Bid%20Request" style={{ width: "100%", justifyContent: "space-between" }}>Request a Bid <Arrow /></Btn>
          <Btn kind="light" as="a" href="mailto:build@mibh.co?subject=Upload%20Plans" style={{ width: "100%", justifyContent: "space-between" }}>Upload Plans <Arrow /></Btn>
          <Btn kind="ghost" as="a" href="mailto:build@mibh.co?subject=Schedule%20a%20Site%20Walk" style={{ width: "100%", justifyContent: "space-between" }}>Schedule a Site Walk <Arrow /></Btn>
          <div style={{ marginTop: 14, font: "400 11.5px/1.5 var(--mono)", color: "var(--fg-3)", letterSpacing: ".05em" }}>
            Encrypted intake · 1-business-day response<br/>
            Warehouse / Multifamily / Industrial / Retail
          </div>
        </div>
      </div>

      <Rule style={{ position: "relative" }} />

      <footer style={{ position: "relative", maxWidth: 1440, margin: "0 auto", paddingTop: 40, display: "grid", gridTemplateColumns: "1.4fr repeat(4, 1fr)", gap: 32 }}>
        <div>
          <div style={{ display: "flex", alignItems: "center", gap: 12 }}>
            <img src="assets/mibh-mark.png" alt="MIBH" style={{ height: 34, width: "auto", display: "block" }} />
            <div style={{ font: "600 13px/1 var(--sans)", letterSpacing: ".14em" }}>MIBH</div>
          </div>
          <div style={{ marginTop: 14, font: "400 11.5px/1.6 var(--mono)", color: "var(--fg-3)", letterSpacing: ".03em" }}>
            CGC1527069 · Certified General Contractor<br/>
            1450 NW 87th Ave, Doral, FL 33172<br/>
            +1 305 746 7307 · build@mibh.co
          </div>
        </div>
        {[
          ["Main", ["Homepage", "About MIBH", "Projects", "Service Areas", "Contact"]],
          ["Services", ["Warehouse &amp; Distribution", "Multifamily &amp; Mixed-Use", "Structural Steel", "Metal Deck", "Concrete &amp; Tilt-Wall", "Tenant Improvements"]],
          ["Sectors", ["Industrial", "Warehouse", "Multifamily", "Retail &amp; Office", "Mixed-Use", "Sitework", "Design-Build"]],
          ["For Clients", ["Request a Bid", "Schedule Site Walk", "Upload Plans", "Credential Package", "Insurance Certs", "Bonding Info"]],
        ].map(([h, links]) => (
          <div key={h}>
            <MonoTag style={{ color: "var(--fg-3)" }}>{h}</MonoTag>
            <ul style={{ margin: "16px 0 0", padding: 0, listStyle: "none", display: "flex", flexDirection: "column", gap: 8 }}>
              {links.map(l => (
                <li key={l}><a href="#" style={{ font: "400 13px/1.3 var(--sans)", color: "var(--fg-2)" }} dangerouslySetInnerHTML={{ __html: l }} /></li>
              ))}
            </ul>
          </div>
        ))}
      </footer>

      <div style={{ position: "relative", maxWidth: 1440, margin: "48px auto 0", display: "flex", justifyContent: "space-between", font: "400 11px/1.4 var(--mono)", letterSpacing: ".08em", color: "var(--fg-3)", textTransform: "uppercase" }}>
        <span>© 2026 MIBH Construction · CGC1527069 · All rights reserved</span>
        <span>Designed for South Florida · Built to outperform</span>
      </div>
    </section>
  );
}

// ────────────────────────────────────────────────────────────────────────────
// APP
// ────────────────────────────────────────────────────────────────────────────
function App() {
  const [t, setTweak] = useTweaks(TWEAK_DEFAULTS);
  const [scrolled, setScrolled] = useState(false);

  useEffect(() => {
    const onScroll = () => setScrolled(window.scrollY > 40);
    window.addEventListener("scroll", onScroll, { passive: true });
    return () => window.removeEventListener("scroll", onScroll);
  }, []);

  // Apply tweaks via CSS vars on root
  useEffect(() => {
    const root = document.documentElement;
    const isLight = t.theme === "light";
    const isConcrete = t.theme === "concrete";

    if (isLight) {
      root.style.setProperty("--bg", "#f1ede5");
      root.style.setProperty("--bg-2", "#e8e3d6");
      root.style.setProperty("--fg", "#0e0d0b");
      root.style.setProperty("--fg-2", "rgba(14,13,11,.62)");
      root.style.setProperty("--fg-3", "rgba(14,13,11,.42)");
      root.style.setProperty("--line", "rgba(14,13,11,.14)");
      root.style.setProperty("--line-strong", "rgba(14,13,11,.32)");
    } else if (isConcrete) {
      root.style.setProperty("--bg", "#1c1a16");
      root.style.setProperty("--bg-2", "#23201b");
      root.style.setProperty("--fg", "#efe9dc");
      root.style.setProperty("--fg-2", "rgba(239,233,220,.62)");
      root.style.setProperty("--fg-3", "rgba(239,233,220,.38)");
      root.style.setProperty("--line", "rgba(239,233,220,.14)");
      root.style.setProperty("--line-strong", "rgba(239,233,220,.32)");
    } else {
      root.style.setProperty("--bg", "#0e0d0b");
      root.style.setProperty("--bg-2", "#15130f");
      root.style.setProperty("--fg", "#f1ede5");
      root.style.setProperty("--fg-2", "rgba(241,237,229,.62)");
      root.style.setProperty("--fg-3", "rgba(241,237,229,.38)");
      root.style.setProperty("--line", "rgba(241,237,229,.14)");
      root.style.setProperty("--line-strong", "rgba(241,237,229,.32)");
    }
    root.style.setProperty("--accent", t.accent);
    root.style.setProperty("--accent-ink", "#0e0d0b");

    if (t.displayFont === "sans") {
      root.style.setProperty("--display", '"Archivo", "Inter Tight", sans-serif');
    } else {
      root.style.setProperty("--display", '"Instrument Serif", "Times New Roman", serif');
    }
  }, [t.theme, t.accent, t.displayFont]);

  return (
    <div>
      <Nav scrolled={scrolled} />
      <main>
        <Hero />
        <TrustBar />
        <WhyMIBH />
        <Process />
        <SocialProof />
        <AboutUs />
        <FinalCTA />
      </main>

      <TweaksPanel>
        <TweakSection label="Theme" />
        <TweakRadio label="Mode" value={t.theme} options={["dark", "light", "concrete"]} onChange={v => setTweak("theme", v)} />
        <TweakColor label="Accent" value={t.accent} options={ACCENT_SWATCHES} onChange={v => setTweak("accent", v)} />
        <TweakSection label="Type" />
        <TweakRadio label="Display" value={t.displayFont} options={["serif", "sans"]} onChange={v => setTweak("displayFont", v)} />
      </TweaksPanel>
    </div>
  );
}

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