// home.jsx — JEWELthePAINT home page sections
// Hero · What is jeweling (definition) · Before/After 5-stage slider
// Two pillars (correction + headlights) · Mobile callout
// ─────────────────────────────────────────────────────────────

const { useState: useStateH, useEffect: useEffectH, useRef: useRefH, useMemo: useMemoH } = React;

// ────────────────────────────────────────────── HERO ──────────
function Hero() {
  return (
    <section className="section" style={{
      paddingTop: 80, paddingBottom: 0, position: "relative",
    }}>
      <span className="crosshair tl" style={{ top: 80 }} />
      <span className="crosshair tr" style={{ top: 80 }} />

      <div className="wrap col" style={{ alignItems: "center", textAlign: "center", gap: 24 }}>
        <div className="spec">A BAY AREA MOBILE PAINT-CORRECTION STUDIO · EST. 2019</div>

        <h1 className="h-display" style={{
          fontSize: "clamp(56px, 11vw, 172px)",
          margin: "24px 0 8px",
          letterSpacing: "-0.035em",
        }}>
          Jewel <em>the</em> Paint
        </h1>

        <p style={{
          fontFamily: "var(--serif)", fontWeight: 300, fontStyle: "italic",
          fontSize: "clamp(20px, 2vw, 28px)", color: "var(--ink-2)",
          maxWidth: 760, margin: "0 auto", lineHeight: 1.35,
        }}>
          The Bay Area's most meticulous detailer — brought to your driveway.
          Multi-stage paint correction taken to its optical limit, measured in gloss
          units, not adjectives.
        </p>

        <div className="row gap-12 responsive-stack" style={{ marginTop: 16 }}>
          <a href="contact.html" className="btn">
            Start a consultation <span className="arr">→</span>
          </a>
          <a href="#what-is-jeweling" className="btn btn-ghost">
            What is jeweling? <span className="arr">↓</span>
          </a>
        </div>
      </div>

      {/* hero panel — real photo */}
      <div className="wrap" style={{ marginTop: 64, position: "relative" }}>
        <ImageFrame
          src="media/mclaren-paint-correction.png"
          alt="Multi-stage paint correction on a McLaren in client's driveway"
          aspect="21/9"
          corner="FIG. 01 · CORRECTION IN PROGRESS · CLIENT DRIVEWAY"
          caption="POST-DECON · COMPOUND STAGE · 4500K HEADLAMP"
          style={{ borderTop: "1px solid var(--rule)" }}
        />

        {/* spec strip */}
        <div style={{ marginTop: 0 }}>
          <SpecStrip items={[
            ["Mobile",        "we come to you, Bay Area"],
            ["By appointment", "single intake per day"],
            ["~ 40 hrs",       "average correction time"],
            ["Measured",       "gloss meter · 3 light temps"],
          ]} />
        </div>
      </div>
    </section>
  );
}

// ─────────────────────────────────────── WHAT IS JEWELING ─────
function WhatIsJeweling() {
  return (
    <section id="what-is-jeweling" className="section" style={{
      paddingTop: "calc(var(--pad-section) + 40px)",
      paddingBottom: "var(--pad-section)",
      borderTop: "1px solid var(--rule)",
      marginTop: "calc(var(--pad-section) - 40px)",
      background: "var(--bg-2)",
    }}>
      <div className="wrap responsive-grid-2" style={{
        display: "grid", gridTemplateColumns: "1.1fr 1fr", gap: 80,
      }}>
        <div className="col gap-24">
          <div className="spec">§ 02 · DEFINITION</div>

          <h2 className="h-display" style={{
            fontSize: "clamp(40px, 5.5vw, 84px)", margin: "8px 0 0",
          }}>
            What is <em>jeweling</em><br />the paint?
          </h2>

          <div className="col gap-16" style={{ maxWidth: 580, marginTop: 8 }}>
            <p style={{
              fontFamily: "var(--serif)", fontSize: 21, fontWeight: 300,
              lineHeight: 1.5, color: "var(--ink)", margin: 0,
            }}>
              <span style={{
                fontFamily: "var(--mono)", fontSize: 11, letterSpacing: "0.14em",
                textTransform: "uppercase", color: "var(--ink-3)", marginRight: 10,
              }}>jew·el·ing</span>
              <span style={{ fontStyle: "italic", color: "var(--ink-3)" }}>verb.</span>
              {" "}The final stage of paint correction. After contamination is
              removed and defects are leveled, an ultra-fine polish is worked
              into the clear coat with refined pressure and slow, deliberate passes.
            </p>
            <p style={{
              fontFamily: "var(--serif)", fontSize: 18, fontWeight: 300,
              lineHeight: 1.6, color: "var(--ink-2)", margin: 0,
            }}>
              The micro-scratches that scatter light disappear. Reflections sharpen.
              Depth returns. The panel begins to behave like a faceted gemstone —
              light enters cleanly, and what comes back is the colour the factory
              intended, only deeper.
            </p>
            <p style={{
              fontSize: 14, color: "var(--ink-3)", lineHeight: 1.6, margin: 0,
              maxWidth: 520, paddingTop: 8,
            }}>
              We verify each pass under three light temperatures — 4500 K halogen,
              6500 K daylight, and raked-angle LED — and record gloss-unit readings
              before and after. The math is the point.
            </p>
          </div>

          <div className="row gap-32" style={{ marginTop: 24, flexWrap: "wrap" }}>
            <div className="col">
              <div className="spec">GLOSS GAIN</div>
              <div className="num" style={{ fontSize: 36, fontWeight: 300, marginTop: 4 }}>+18 GU</div>
              <div className="spec" style={{ color: "var(--ink-4)" }}>typical, post-jewel</div>
            </div>
            <div className="col">
              <div className="spec">DOI</div>
              <div className="num" style={{ fontSize: 36, fontWeight: 300, marginTop: 4 }}>97–99</div>
              <div className="spec" style={{ color: "var(--ink-4)" }}>distinctness of image</div>
            </div>
            <div className="col">
              <div className="spec">REMOVAL DEPTH</div>
              <div className="num" style={{ fontSize: 36, fontWeight: 300, marginTop: 4 }}>&lt; 1.5 µm</div>
              <div className="spec" style={{ color: "var(--ink-4)" }}>per refinement pass</div>
            </div>
          </div>
        </div>

        <RefractionDiagram />
      </div>
    </section>
  );
}

// ─────── light-behavior diagram (kept; champagne accent instead of sapphire)
function RefractionDiagram() {
  return (
    <div className="col gap-16">
      <div className="spec">FIG. 02 · BEHAVIOUR OF LIGHT ACROSS A CLEAR COAT</div>

      <svg viewBox="0 0 600 540" style={{ width: "100%", height: "auto", display: "block" }}>
        <defs>
          <linearGradient id="paintGrad" x1="0" x2="0" y1="0" y2="1">
            <stop offset="0" stopColor="oklch(0.92 0.005 85)" />
            <stop offset="1" stopColor="oklch(0.86 0.008 85)" />
          </linearGradient>
        </defs>

        {/* PANEL 01 — contaminated */}
        <g>
          <text x="0" y="14" fontFamily="var(--mono)" fontSize="10"
                fill="var(--ink-3)" letterSpacing="1.4">
            01 · BEFORE — CONTAMINATED CLEAR COAT
          </text>

          {/* incoming sun rays */}
          <g stroke="var(--ink-3)" strokeWidth="0.6" strokeDasharray="2 3">
            {[80, 160, 240, 320, 400, 480].map((x, i) => (
              <line key={i} x1={x} y1="40" x2={x} y2="120" />
            ))}
          </g>
          <text x="500" y="50" fontFamily="var(--mono)" fontSize="9"
                fill="var(--ink-3)" letterSpacing="1.2">SUN ↓</text>

          <rect x="20" y="120" width="560" height="40" fill="url(#paintGrad)" />
          <g stroke="var(--ink-3)" strokeWidth="0.7" fill="none" opacity="0.7">
            <path d="M 40,138 q 8,-6 16,0 t 16,0 t 16,0" />
            <path d="M 110,148 q 8,-6 16,0 t 16,0" />
            <path d="M 200,135 q 8,-5 16,0 t 16,0 t 16,0 t 16,0" />
            <path d="M 320,150 q 6,-4 12,0 t 12,0" />
            <path d="M 400,140 q 8,-6 16,0 t 16,0 t 16,0" />
            <path d="M 510,148 q 8,-6 16,0" />
          </g>
          <rect x="20" y="160" width="560" height="20" fill="oklch(0.18 0.012 60)" />
          <text x="586" y="143" textAnchor="end" fontFamily="var(--mono)" fontSize="9"
                fill="var(--ink-3)" letterSpacing="1">CLEAR COAT</text>
          <text x="586" y="174" textAnchor="end" fontFamily="var(--mono)" fontSize="9"
                fill="var(--bg)" letterSpacing="1">BASE COAT</text>

          <g stroke="var(--accent)" strokeWidth="1" opacity="0.9" fill="none">
            <path d="M 80,120 L 50,40" /><path d="M 80,120 L 110,30" />
            <path d="M 160,120 L 130,50" /><path d="M 160,120 L 220,40" />
            <path d="M 240,120 L 200,30" /><path d="M 240,120 L 290,55" />
            <path d="M 320,120 L 280,40" /><path d="M 320,120 L 370,30" />
            <path d="M 400,120 L 360,50" /><path d="M 400,120 L 460,40" />
            <path d="M 480,120 L 440,30" /><path d="M 480,120 L 530,55" />
          </g>
          <text x="0" y="220" fontFamily="var(--serif)" fontStyle="italic" fontSize="14"
                fill="var(--ink-3)">
            Light scatters. Reflection blurs. Colour reads shallow.
          </text>
        </g>

        <line x1="0" y1="260" x2="600" y2="260" stroke="var(--rule)" />

        {/* PANEL 02 — jeweled */}
        <g transform="translate(0, 290)">
          <text x="0" y="14" fontFamily="var(--mono)" fontSize="10"
                fill="var(--ink-3)" letterSpacing="1.4">
            02 · AFTER — JEWELED CLEAR COAT
          </text>

          <g stroke="var(--ink-3)" strokeWidth="0.6" strokeDasharray="2 3">
            {[80, 160, 240, 320, 400, 480].map((x, i) => (
              <line key={i} x1={x} y1="40" x2={x} y2="120" />
            ))}
          </g>
          <text x="500" y="50" fontFamily="var(--mono)" fontSize="9"
                fill="var(--ink-3)" letterSpacing="1.2">SUN ↓</text>

          <rect x="20" y="120" width="560" height="40" fill="url(#paintGrad)" />
          <g stroke="var(--accent)" strokeWidth="0.6" fill="none" opacity="0.65">
            <polygon points="100,140 130,128 160,140 130,152" />
            <polygon points="200,140 230,128 260,140 230,152" />
            <polygon points="300,140 330,128 360,140 330,152" />
            <polygon points="400,140 430,128 460,140 430,152" />
            <polygon points="500,140 530,128 560,140 530,152" />
          </g>
          <rect x="20" y="160" width="560" height="20" fill="oklch(0.18 0.012 60)" />

          <text x="586" y="143" textAnchor="end" fontFamily="var(--mono)" fontSize="9"
                fill="var(--ink-3)" letterSpacing="1">CLEAR COAT · LEVELED</text>
          <text x="586" y="174" textAnchor="end" fontFamily="var(--mono)" fontSize="9"
                fill="var(--bg)" letterSpacing="1">BASE COAT</text>

          <g stroke="var(--accent)" strokeWidth="1.2" opacity="0.95" fill="none">
            {[80, 160, 240, 320, 400, 480].map((x, i) => (
              <line key={i} x1={x} y1="120" x2={x} y2="40" />
            ))}
          </g>
          <text x="0" y="220" fontFamily="var(--serif)" fontStyle="italic" fontSize="14"
                fill="var(--ink-3)">
            Light returns whole. Reflection sharpens. Colour reads deep.
          </text>
        </g>
      </svg>
    </div>
  );
}

// ─────────────────────────────────────── BEFORE / AFTER ───────
const STAGES = [
  { at: 0,   key: "contaminated", label: "Contaminated", note: "Iron, tar, & embedded fallout" },
  { at: 22,  key: "decon",        label: "Decon",        note: "Chemical & clay decontamination" },
  { at: 44,  key: "compound",     label: "Compound",     note: "Defect leveling, heavy cut" },
  { at: 68,  key: "polish",       label: "Polish",       note: "Refinement, removing haze" },
  { at: 100, key: "jewel",        label: "Jewel",        note: "Final finishing pass" },
];

function BeforeAfter({ sectionNum = "02", eyebrow = "DRAG TO REVEAL" }) {
  const [pct, setPct] = useStateH(50);
  const wrapRef = useRefH(null);
  const draggingRef = useRefH(false);

  const stageIdx = useMemoH(() => {
    let s = 0;
    for (let i = 0; i < STAGES.length; i++) if (pct >= STAGES[i].at) s = i;
    return s;
  }, [pct]);

  function setFromX(clientX) {
    const r = wrapRef.current?.getBoundingClientRect();
    if (!r) return;
    const x = (clientX - r.left) / r.width;
    setPct(Math.max(0, Math.min(100, x * 100)));
  }

  useEffectH(() => {
    function move(e) {
      if (!draggingRef.current) return;
      const cx = e.touches ? e.touches[0].clientX : e.clientX;
      setFromX(cx);
    }
    function up() { draggingRef.current = false; }
    window.addEventListener("mousemove", move);
    window.addEventListener("mouseup", up);
    window.addEventListener("touchmove", move, { passive: true });
    window.addEventListener("touchend", up);
    return () => {
      window.removeEventListener("mousemove", move);
      window.removeEventListener("mouseup", up);
      window.removeEventListener("touchmove", move);
      window.removeEventListener("touchend", up);
    };
  }, []);

  const stage = STAGES[stageIdx];

  return (
    <section id="process" className="section" style={{
      paddingTop: "var(--pad-section)", paddingBottom: "var(--pad-section)",
      borderTop: "1px solid var(--rule)",
      background: "var(--bg-2)",
    }}>
      <div className="wrap col gap-32">
        <div className="row responsive-stack" style={{
          justifyContent: "space-between", alignItems: "end", gap: 24, flexWrap: "wrap",
        }}>
          <div className="col gap-12" style={{ flex: "1 1 auto", minWidth: 0 }}>
            <div className="spec">§ {sectionNum} · {eyebrow}</div>
            <h2 className="h-display" style={{ fontSize: "clamp(40px, 5vw, 76px)", margin: 0 }}>
              From contaminated <em>to</em> jeweled.
            </h2>
          </div>
          <p style={{
            fontFamily: "var(--serif)", fontStyle: "italic", fontWeight: 300,
            color: "var(--ink-3)", maxWidth: 360, margin: 0, fontSize: 17, lineHeight: 1.5,
          }}>
            Drag across the panel — the divider doubles as a process scrubber.
            Each tick is a stage of multi-stage paint correction.
          </p>
        </div>

        <div
          ref={wrapRef}
          onMouseDown={(e) => { draggingRef.current = true; setFromX(e.clientX); }}
          onTouchStart={(e) => { draggingRef.current = true; setFromX(e.touches[0].clientX); }}
          style={{
            position: "relative", width: "100%", aspectRatio: "21/10",
            background: "#0a0a0c", overflow: "hidden",
            cursor: "ew-resize", userSelect: "none",
            border: "1px solid var(--rule)",
          }}
        >
          <PaintLayer stage="jewel" stageIdx={STAGES.length - 1} />
          <div style={{
            position: "absolute", inset: 0,
            clipPath: `inset(0 ${100 - pct}% 0 0)`,
          }}>
            <PaintLayer stage={stage.key} stageIdx={stageIdx} />
          </div>

          <div style={{
            position: "absolute", top: 0, bottom: 0, left: `${pct}%`,
            width: 1, background: "oklch(0.95 0.02 80 / 0.85)",
            boxShadow: "0 0 18px oklch(0.95 0.02 80 / 0.4)",
            transform: "translateX(-0.5px)", pointerEvents: "none",
          }}>
            <div style={{
              position: "absolute", top: "50%", left: "50%",
              transform: "translate(-50%,-50%)",
              width: 46, height: 46, borderRadius: "50%",
              background: "oklch(0.96 0.01 85 / 0.96)",
              border: "1px solid oklch(0.18 0.012 60 / 0.3)",
              display: "flex", alignItems: "center", justifyContent: "center",
              fontFamily: "var(--mono)", fontSize: 11, color: "var(--ink-2)",
              letterSpacing: "0.05em",
            }}>‹ ›</div>
          </div>

          <div style={{
            position: "absolute", top: 14, left: 18,
            fontFamily: "var(--mono)", fontSize: 10,
            color: "oklch(0.92 0.02 80 / 0.7)", letterSpacing: "0.14em",
          }}>
            BEFORE · {stage.label.toUpperCase()}
          </div>
          <div style={{
            position: "absolute", top: 14, right: 18,
            fontFamily: "var(--mono)", fontSize: 10,
            color: "oklch(0.92 0.02 80 / 0.7)", letterSpacing: "0.14em",
          }}>
            AFTER · JEWELED
          </div>
          <div style={{
            position: "absolute", bottom: 14, left: 18,
            fontFamily: "var(--mono)", fontSize: 10,
            color: "oklch(0.92 0.02 80 / 0.5)", letterSpacing: "0.14em",
          }}>
            FIG. 03 · MACRO @ 4500K · 1:1 PANEL
          </div>
        </div>

        {/* tick / stage scrubber */}
        <div className="col gap-12">
          <div style={{ position: "relative", height: 48 }}>
            <div style={{
              position: "absolute", top: 8, left: 0, right: 0, height: 1,
              background: "var(--rule)",
            }} />
            <div style={{
              position: "absolute", top: 8, left: 0, height: 1, width: `${pct}%`,
              background: "var(--accent)",
            }} />
            {STAGES.map((s, i) => (
              <button key={s.key}
                onClick={() => setPct(s.at)}
                style={{
                  position: "absolute", left: `${s.at}%`, top: 0,
                  transform: "translateX(-50%)",
                  border: 0, background: "transparent", cursor: "pointer",
                  display: "flex", flexDirection: "column", alignItems: "center", gap: 6,
                  padding: 0,
                }}>
                <div style={{
                  width: i === stageIdx ? 14 : 10,
                  height: i === stageIdx ? 14 : 10,
                  borderRadius: "50%",
                  background: i <= stageIdx ? "var(--accent)" : "var(--bg)",
                  border: `1px solid ${i <= stageIdx ? "var(--accent)" : "var(--rule)"}`,
                  marginTop: i === stageIdx ? 1 : 3,
                  transition: "all .2s ease",
                }} />
                <div className="spec" style={{
                  fontSize: 10, color: i === stageIdx ? "var(--ink)" : "var(--ink-3)",
                  fontWeight: i === stageIdx ? 500 : 400,
                  whiteSpace: "nowrap",
                }}>
                  0{i + 1} · {s.label}
                </div>
              </button>
            ))}
          </div>

          <div className="row responsive-stack" style={{
            justifyContent: "space-between", alignItems: "baseline", marginTop: 8,
          }}>
            <div className="col">
              <div className="spec">CURRENT STAGE</div>
              <div style={{
                fontFamily: "var(--serif)", fontSize: 26, fontWeight: 300, marginTop: 2,
              }}>
                {stage.label}<span style={{ color: "var(--ink-3)" }}> — {stage.note.toLowerCase()}.</span>
              </div>
            </div>
            <div className="num" style={{ fontSize: 26, color: "var(--ink-3)", fontWeight: 300 }}>
              {String(Math.round(pct)).padStart(3, "0")} <span style={{ fontSize: 12, color: "var(--ink-4)" }}>/100</span>
            </div>
          </div>
        </div>
      </div>
    </section>
  );
}

function PaintLayer({ stage, stageIdx }) {
  const t = stageIdx / (STAGES.length - 1);
  return (
    <div style={{ position: "absolute", inset: 0 }}>
      <div style={{
        position: "absolute", inset: 0,
        background: `
          radial-gradient(120% 80% at 30% 25%,
            oklch(${0.28 + t * 0.18} ${0.02 + t * 0.015} 80) 0%,
            transparent 55%),
          radial-gradient(80% 60% at 80% 75%,
            oklch(${0.16 + t * 0.10} 0.015 80) 0%,
            transparent 60%),
          linear-gradient(180deg,
            oklch(${0.10 + t * 0.08} 0.015 80) 0%,
            oklch(0.04 0.008 80) 65%,
            oklch(${0.06 + t * 0.05} 0.015 80) 100%)
        `,
      }} />

      <svg style={{
        position: "absolute", inset: 0, width: "100%", height: "100%",
        opacity: Math.max(0, 1 - t * 1.15),
      }} preserveAspectRatio="none" viewBox="0 0 1000 480">
        <defs>
          <radialGradient id={`sw-${stage}`} cx="50%" cy="50%" r="50%">
            <stop offset="0" stopColor="white" stopOpacity="0.18" />
            <stop offset="1" stopColor="white" stopOpacity="0" />
          </radialGradient>
        </defs>
        <circle cx="220" cy="180" r="260" fill={`url(#sw-${stage})`} />
        <circle cx="780" cy="320" r="200" fill={`url(#sw-${stage})`} />
        <g stroke="white" strokeWidth="0.5" fill="none" opacity="0.45">
          {Array.from({ length: 120 }).map((_, i) => {
            const cx = (i * 53) % 1000;
            const cy = ((i * 97) % 480);
            const r = 6 + ((i * 13) % 16);
            const a1 = (i * 37) % 360;
            const a2 = a1 + 50 + ((i * 7) % 80);
            const sa1 = (a1 * Math.PI) / 180, sa2 = (a2 * Math.PI) / 180;
            const x1 = cx + r * Math.cos(sa1), y1 = cy + r * Math.sin(sa1);
            const x2 = cx + r * Math.cos(sa2), y2 = cy + r * Math.sin(sa2);
            return <path key={i} d={`M ${x1.toFixed(1)},${y1.toFixed(1)} A ${r},${r} 0 0 1 ${x2.toFixed(1)},${y2.toFixed(1)}`} />;
          })}
        </g>
        {stageIdx <= 1 && (
          <g fill="oklch(0.45 0.05 60)" opacity="0.65">
            {Array.from({ length: 30 }).map((_, i) => {
              const cx = (i * 87) % 1000, cy = (i * 53) % 480, r = 1 + ((i * 3) % 2);
              return <circle key={i} cx={cx} cy={cy} r={r} />;
            })}
          </g>
        )}
      </svg>

      <div style={{
        position: "absolute", inset: 0,
        background: `linear-gradient(105deg,
          transparent ${42 - t * 4}%,
          oklch(0.95 0.02 80 / ${0.10 + t * 0.20}) 50%,
          transparent ${58 + t * 4}%)`,
        mixBlendMode: "screen",
      }} />
    </div>
  );
}

// ─────────────────────────────────────── TWO PILLARS ──────────
function TwoPillars() {
  const pillars = [
    {
      num: "I",
      title: "Paint correction",
      sub: "Brought to its optical limit.",
      body: "Multi-stage cut, polish, and jeweling — verified under three light temperatures, scored on a gloss meter. We don't guess; we measure.",
      stats: [["Stages", "3–5"], ["Gloss gain", "+12 to +22 GU"], ["Light temps", "4500 · 6500 K"]],
      href: "services.html#correction",
    },
    {
      num: "II",
      title: "Headlight restoration",
      sub: "Optical-grade, sealed against UV.",
      body: "Yellowed, oxidized lenses re-clarified through the same cut/polish/jewel sequence used on paint. Resin reset, then sealed with a UV-stable coat.",
      stats: [["Clarity gain", "70 → 95%"], ["Sealed for", "2+ yrs"], ["Per pair", "~3 hrs"]],
      href: "services.html#headlights",
    },
  ];

  return (
    <section className="section" style={{
      paddingTop: "var(--pad-section)", paddingBottom: "var(--pad-section)",
      borderTop: "1px solid var(--rule)",
    }}>
      <div className="wrap col gap-48">
        <div className="row responsive-stack" style={{
          justifyContent: "space-between", alignItems: "end", gap: 24,
        }}>
          <div className="col gap-12">
            <div className="spec">§ 03 · TWO PILLARS</div>
            <h2 className="h-display" style={{ fontSize: "clamp(40px, 5vw, 76px)", margin: 0 }}>
              We do two <em>things</em>,<br />exceptionally.
            </h2>
          </div>
          <p style={{
            fontFamily: "var(--serif)", fontStyle: "italic", fontWeight: 300,
            color: "var(--ink-3)", maxWidth: 360, margin: 0, fontSize: 17, lineHeight: 1.5,
          }}>
            Paint and headlights are both about one thing — letting light
            pass through cleanly. Everything else follows from that.
          </p>
        </div>

        <div className="responsive-grid-2" style={{
          display: "grid", gridTemplateColumns: "1fr 1fr", gap: 24,
        }}>
          {pillars.map((p, i) => (
            <a key={p.num} href={p.href} style={{
              background: "var(--bg-2)",
              border: "1px solid var(--rule)",
              padding: "40px 36px",
              display: "flex", flexDirection: "column", gap: 24,
              position: "relative", transition: "background .25s ease",
            }}
              onMouseEnter={(e) => { e.currentTarget.style.background = "var(--bg-3)"; }}
              onMouseLeave={(e) => { e.currentTarget.style.background = "var(--bg-2)"; }}>
              <div className="row" style={{ justifyContent: "space-between", alignItems: "baseline" }}>
                <div className="spec" style={{ color: "var(--ink-3)" }}>PILLAR · {p.num}</div>
                <div className="spec">{p.num === "I" ? "FLAGSHIP" : "ADJACENT"}</div>
              </div>
              <div className="col gap-8">
                <h3 style={{
                  fontFamily: "var(--serif)", fontSize: 44, fontWeight: 300,
                  letterSpacing: "-0.02em", margin: 0, lineHeight: 1.05,
                }}>
                  {p.title}
                </h3>
                <p style={{
                  fontFamily: "var(--serif)", fontStyle: "italic", fontWeight: 300,
                  fontSize: 19, margin: 0, color: "var(--ink-2)",
                }}>{p.sub}</p>
              </div>
              <p style={{ color: "var(--ink-2)", fontSize: 15, lineHeight: 1.6, margin: 0 }}>
                {p.body}
              </p>
              <div className="row" style={{
                gap: 0, paddingTop: 16,
                borderTop: "1px solid var(--rule)",
              }}>
                {p.stats.map((s, j) => (
                  <div key={s[0]} className="col" style={{
                    flex: 1,
                    paddingRight: 12,
                    borderRight: j < p.stats.length - 1 ? "1px solid var(--rule)" : "none",
                    paddingLeft: j > 0 ? 16 : 0,
                  }}>
                    <div className="spec" style={{ fontSize: 10 }}>{s[0]}</div>
                    <div className="num" style={{ fontSize: 18, fontWeight: 300, marginTop: 2 }}>{s[1]}</div>
                  </div>
                ))}
              </div>
              <div className="row" style={{
                justifyContent: "space-between", alignItems: "center",
                marginTop: "auto", paddingTop: 8,
              }}>
                <span className="spec" style={{ color: "var(--accent)" }}>READ THE BRIEF</span>
                <span style={{ fontSize: 16 }}>→</span>
              </div>
            </a>
          ))}
        </div>
      </div>
    </section>
  );
}

// ─────────────────────────────────────── MOBILE CALLOUT ───────
function MobileCallout() {
  return (
    <section className="section" style={{
      paddingTop: "var(--pad-section)", paddingBottom: "var(--pad-section)",
      borderTop: "1px solid var(--rule)",
      background: "var(--bg-2)",
    }}>
      <div className="wrap responsive-grid-2" style={{
        display: "grid", gridTemplateColumns: "1fr 1.1fr", gap: 64, alignItems: "start",
      }}>
        <div className="col gap-24">
          <div className="spec">§ 04 · WE COME TO YOU</div>
          <h2 className="h-display" style={{
            fontSize: "clamp(36px, 4.8vw, 72px)", margin: 0,
          }}>
            A studio,<br /><em>in your driveway.</em>
          </h2>
          <p style={{
            fontFamily: "var(--serif)", fontWeight: 300, fontSize: 19,
            color: "var(--ink-2)", lineHeight: 1.55, margin: 0, maxWidth: 520,
          }}>
            We arrive with a covered mobile rig: filtered water, calibrated lighting
            in three temperatures, a sealed polish zone, and our own power. Set up
            in 25 minutes; gone the same evening or the next.
          </p>
          <div className="col gap-16" style={{
            marginTop: 8, paddingTop: 24, borderTop: "1px solid var(--rule)",
          }}>
            {[
              ["WHAT WE NEED", "A flat 12×24 ft space — driveway, garage apron, or covered carport. We bring everything else."],
              ["WHAT WE BRING", "Inverter power, water deionizer, 4500/6500 K lighting, sealed polish enclosure, gloss meter."],
              ["WHAT YOU PROVIDE", "Coffee, optionally. The car keys, ideally."],
            ].map(([k, v]) => (
              <div key={k} className="col gap-4">
                <div className="spec">{k}</div>
                <div style={{ fontSize: 15, color: "var(--ink-2)", lineHeight: 1.55, maxWidth: 480 }}>
                  {v}
                </div>
              </div>
            ))}
          </div>
        </div>

        {/* mobile-rig blueprint */}
        <div className="col gap-12">
          <div className="ph" style={{
            aspectRatio: "4/5", width: "100%",
            border: "1px solid var(--rule)",
          }}>
            <div className="ph-corner">FIG. 04 · MOBILE RIG · PLAN</div>
            <svg viewBox="0 0 400 500" preserveAspectRatio="none"
                 style={{ position: "absolute", inset: 0, width: "100%", height: "100%" }}>
              <g fill="none" stroke="var(--ink-3)" strokeWidth="0.6">
                {/* van outline */}
                <rect x="30" y="30" width="80" height="170" />
                <line x1="30" y1="80" x2="110" y2="80" />
                <text x="70" y="55" fontFamily="ui-monospace" fontSize="8"
                      fill="var(--ink-3)" textAnchor="middle" letterSpacing="1">VAN</text>
                <text x="70" y="140" fontFamily="ui-monospace" fontSize="8"
                      fill="var(--ink-3)" textAnchor="middle" letterSpacing="1">WATER</text>
                <text x="70" y="170" fontFamily="ui-monospace" fontSize="8"
                      fill="var(--ink-3)" textAnchor="middle" letterSpacing="1">PWR</text>

                {/* canopy/tent dashed */}
                <rect x="140" y="40" width="230" height="320" strokeDasharray="3 4" />
                <text x="255" y="58" fontFamily="ui-monospace" fontSize="9"
                      fill="var(--ink-3)" textAnchor="middle" letterSpacing="1.4">
                  COVERED · 12 × 24 FT
                </text>

                {/* car wireframe inside tent */}
                <path d="M 170,170 L 200,150 L 320,150 L 340,170 L 340,260 L 170,260 Z" />
                <line x1="240" y1="155" x2="240" y2="260" strokeDasharray="2 3" />
                <line x1="280" y1="155" x2="280" y2="260" strokeDasharray="2 3" />
                <circle cx="200" cy="260" r="14" />
                <circle cx="320" cy="260" r="14" />

                {/* lighting marks */}
                <circle cx="160" cy="100" r="6" />
                <line x1="160" y1="106" x2="160" y2="140" />
                <text x="160" y="92" fontFamily="ui-monospace" fontSize="7"
                      fill="var(--ink-3)" textAnchor="middle" letterSpacing="1">L1</text>
                <circle cx="350" cy="100" r="6" />
                <line x1="350" y1="106" x2="350" y2="140" />
                <text x="350" y="92" fontFamily="ui-monospace" fontSize="7"
                      fill="var(--ink-3)" textAnchor="middle" letterSpacing="1">L2</text>
                <circle cx="255" cy="340" r="6" />
                <text x="255" y="332" fontFamily="ui-monospace" fontSize="7"
                      fill="var(--ink-3)" textAnchor="middle" letterSpacing="1">L3</text>

                {/* polish enclosure */}
                <rect x="140" y="370" width="100" height="50" />
                <text x="190" y="400" fontFamily="ui-monospace" fontSize="8"
                      fill="var(--ink-3)" textAnchor="middle" letterSpacing="1.2">
                  POLISH ROOM
                </text>

                {/* tools / cart */}
                <rect x="260" y="370" width="110" height="50" />
                <text x="315" y="400" fontFamily="ui-monospace" fontSize="8"
                      fill="var(--ink-3)" textAnchor="middle" letterSpacing="1.2">
                  TOOLS · CHEMS
                </text>
              </g>
              <g fontFamily="ui-monospace" fontSize="9" fill="var(--ink-3)" letterSpacing="1">
                <text x="30" y="22">PLAN — 1:50</text>
                <text x="370" y="22" textAnchor="end">JTP · MOBILE</text>
                <text x="30" y="480">DIMENSIONS APPROX. · LEVEL SURFACE REQUIRED</text>
              </g>
            </svg>
            <div className="ph-label">[ mobile rig — to be replaced with photo ]</div>
          </div>
          <div className="row" style={{ justifyContent: "space-between", flexWrap: "wrap", gap: 12 }}>
            <div className="spec">12×24 FT FOOTPRINT</div>
            <div className="spec">SELF-POWERED</div>
            <div className="spec">DUST-CONTROLLED</div>
          </div>
        </div>
      </div>
    </section>
  );
}

// ─────────────────────────────────────── CLOSER ───────────────
function Closer() {
  return (
    <section className="section" style={{
      paddingTop: "var(--pad-section)", paddingBottom: "var(--pad-section)",
      borderTop: "1px solid var(--rule)",
      position: "relative",
    }}>
      <span className="crosshair tl" />
      <span className="crosshair tr" />
      <span className="crosshair bl" />
      <span className="crosshair br" />
      <div className="wrap col" style={{ alignItems: "center", textAlign: "center", gap: 32 }}>
        <div className="spec">§ 05 · CONSULTATION</div>
        <h2 className="h-display" style={{
          fontSize: "clamp(48px, 8vw, 124px)",
          maxWidth: "16ch", margin: 0,
        }}>
          A conversation about <em>your</em> paint.
        </h2>
        <p style={{
          fontFamily: "var(--serif)", fontStyle: "italic", fontWeight: 300,
          fontSize: 20, color: "var(--ink-2)", maxWidth: 580, margin: 0, lineHeight: 1.45,
        }}>
          Every car is different, so we begin with a consultation — not a calendar.
          Tell us about the vehicle; we reply within two business days.
        </p>
        <div className="row gap-12 responsive-stack" style={{ marginTop: 16 }}>
          <a href="contact.html" className="btn">
            Start a consultation <span className="arr">→</span>
          </a>
          <a href="services.html" className="btn btn-ghost">
            See the catalogue
          </a>
        </div>
      </div>
    </section>
  );
}

Object.assign(window, {
  Hero, WhatIsJeweling, BeforeAfter, TwoPillars, MobileCallout, Closer,
});
