/* useReveal — adds .in to elements once they intersect */
function useReveal() {
  React.useEffect(() => {
    const els = document.querySelectorAll('.reveal');
    const io = new IntersectionObserver((entries) => {
      for (const e of entries) {
        if (e.isIntersecting) {
          e.target.classList.add('in');
          io.unobserve(e.target);
        }
      }
    }, { threshold: 0.15 });
    els.forEach(el => io.observe(el));
    return () => io.disconnect();
  }, []);
}

/* SECTION A — Paradigm Shift (problem)
   Animated graphic visualization: building silhouette toggles between
   "Code-police" state (mutilated, blocked, slow) and "Beigman" state
   (preserved, light, fast). Auto-cycles in view; click bar to control. */

function ParadigmShift() {
  const [mode, setMode] = React.useState(0); // 0 = traditional, 1 = beigman
  const [auto, setAuto] = React.useState(true);
  const [inView, setInView] = React.useState(false);
  const ref = React.useRef(null);

  React.useEffect(() => {
    if (!ref.current) return;
    const io = new IntersectionObserver(([e]) => setInView(e.isIntersecting), { threshold: 0.4 });
    io.observe(ref.current);
    return () => io.disconnect();
  }, []);

  React.useEffect(() => {
    if (!auto || !inView) return;
    const id = setInterval(() => setMode((m) => 1 - m), 4200);
    return () => clearInterval(id);
  }, [auto, inView]);

  const isB = mode === 1;

  return (
    <section
      id="shift"
      ref={ref}
      data-screen-label="02 Paradigm Shift"
      className="relative bg-off-white py-24 md:py-32 overflow-hidden"
    >
      <div className="absolute inset-0 tech-grid opacity-60 pointer-events-none" />
      <div className="relative max-w-[1320px] mx-auto px-6 md:px-10 lg:px-16">
        {/* Header */}
        <div className="reveal grid md:grid-cols-12 gap-10 md:gap-14 mb-16">
          <div className="md:col-span-5">
            <div className="font-heading text-[11px] tracking-[0.32em] text-copper">
              02 &nbsp;— &nbsp;THE APPROACH
            </div>
            <span className="copper-rule mt-5 mb-8" />
            <h2 className="font-heading font-bold tracking-[-0.01em] text-charcoal text-3xl md:text-4xl lg:text-[44px] leading-[1.08]">
              From <span className="text-copper">compliance roadblock</span><br/>
              to <span className="text-copper">strategic project partner</span>.
            </h2>
          </div>

          <div className="md:col-span-6 md:col-start-7 self-end">
            <p className="text-[16px] md:text-[17px] leading-[1.7] text-charcoal/80 max-w-[520px]">
              We believe fire engineering should do more than satisfy minimum requirements.
              It should <span className="text-charcoal font-medium">protect design intent</span>,
              support commercial outcomes and help projects move forward.
            </p>
            <p className="mt-6 text-[16px] md:text-[17px] leading-[1.7] text-charcoal/80 max-w-[520px]">
              Compliance is the baseline. <span className="text-charcoal font-medium">Project value is the objective.</span>
            </p>
          </div>
        </div>

        {/* The animated graphic */}
        <div className="reveal r-xl border border-charcoal/12 bg-white overflow-hidden">
          {/* Toggle bar */}
          <div className="grid grid-cols-2 border-b border-charcoal/10 relative">
            <button
              onClick={() => { setMode(0); setAuto(false); }}
              className="relative px-5 md:px-8 py-5 text-left z-10"
            >
              <div className={`font-heading text-[10px] tracking-[0.28em] mb-1 transition-colors duration-500 ${!isB ? 'text-charcoal/45' : 'text-charcoal/35'}`}>
                THE PROBLEM
              </div>
              <div className={`font-heading font-bold text-base md:text-lg transition-colors duration-500 ${!isB ? 'text-charcoal' : 'text-charcoal/40'}`}>
                Traditional · Compliance roadblock
              </div>
            </button>
            <button
              onClick={() => { setMode(1); setAuto(false); }}
              className="relative px-5 md:px-8 py-5 text-left z-10"
            >
              <div className={`font-heading text-[10px] tracking-[0.28em] mb-1 transition-colors duration-500 ${isB ? 'text-copper' : 'text-charcoal/35'}`}>
                OUR PROPOSITION
              </div>
              <div className={`font-heading font-bold text-base md:text-lg transition-colors duration-500 ${isB ? 'text-copper' : 'text-charcoal/40'}`}>
                Beigman · Strategic project partner
              </div>
            </button>
            {/* sliding indicator */}
            <div
              className="absolute bottom-0 h-[2px] bg-copper transition-transform duration-700"
              style={{
                width: '50%',
                transform: `translateX(${isB ? '100%' : '0%'})`,
                transitionTimingFunction: 'cubic-bezier(0.2, 0, 0, 1)',
              }}
            />
          </div>

          {/* Stage */}
          <div className="grid lg:grid-cols-12">
            {/* Animated diagram */}
            <div className="lg:col-span-7 relative bg-gradient-to-br from-[#fafafa] to-[#efeae4] aspect-[16/11] lg:aspect-auto lg:min-h-[480px]">
              <ParadigmDiagram mode={mode} />

              {/* play/pause */}
              <button
                onClick={() => setAuto((a) => !a)}
                className="m3-btn absolute top-4 right-4 z-10 w-9 h-9 grid place-items-center border border-charcoal/20 hover:border-copper text-charcoal/55 hover:text-copper bg-white/80 backdrop-blur"
                aria-label={auto ? 'Pause' : 'Play'}
              >
                {auto ? (
                  <svg width="9" height="11" viewBox="0 0 10 12" fill="currentColor"><rect width="3" height="12"/><rect x="7" width="3" height="12"/></svg>
                ) : (
                  <svg width="9" height="11" viewBox="0 0 10 12" fill="currentColor"><polygon points="0,0 10,6 0,12" /></svg>
                )}
              </button>
            </div>

            {/* Animated stats column */}
            <div className="lg:col-span-5 relative p-7 md:p-10 border-t lg:border-t-0 lg:border-l border-charcoal/10">
              <ParadigmMetrics mode={mode} />
            </div>
          </div>
        </div>
      </div>
    </section>
  );
}

/* Animated SVG: code-police vs Beigman */
function ParadigmDiagram({ mode }) {
  const isB = mode === 1;

  return (
    <svg viewBox="0 0 700 480" className="w-full h-full" aria-hidden="true">
      <defs>
        <linearGradient id="pgSky" x1="0" x2="0" y1="0" y2="1">
          <stop offset="0%" stopColor={isB ? '#FFE6CF' : '#E6E4DF'} stopOpacity="0.55" />
          <stop offset="100%" stopColor="#FFFFFF" stopOpacity="0" />
        </linearGradient>
        <linearGradient id="pgGlass" x1="0" x2="0" y1="0" y2="1">
          <stop offset="0%" stopColor="#D49968" />
          <stop offset="100%" stopColor="#8E5F38" />
        </linearGradient>
        <pattern id="pgHatch" width="6" height="6" patternUnits="userSpaceOnUse" patternTransform="rotate(45)">
          <line x1="0" y1="0" x2="0" y2="6" stroke="#1A1A1A" strokeWidth="1.2" opacity="0.45" />
        </pattern>
        <filter id="pgGlow">
          <feGaussianBlur stdDeviation="3" result="b"/>
          <feMerge><feMergeNode in="b"/><feMergeNode in="SourceGraphic"/></feMerge>
        </filter>
      </defs>

      {/* sky/sun mood */}
      <rect x="0" y="0" width="700" height="480" fill="url(#pgSky)" style={{ transition: 'all .8s var(--ease-emphasized-decel)' }} />
      {/* sun (only beigman) */}
      <circle cx="560" cy="120" r="38" fill="#B27C4D" opacity={isB ? 0.18 : 0} style={{ transition: 'opacity .8s' }} />
      <circle cx="560" cy="120" r="22" fill="#B27C4D" opacity={isB ? 0.5 : 0} style={{ transition: 'opacity .8s' }} />

      {/* Ground line */}
      <line x1="40" y1="400" x2="660" y2="400" stroke="#1A1A1A" strokeOpacity="0.25" strokeWidth="1" />
      <text x="40" y="420" fontSize="9" letterSpacing="2" fill="#1A1A1A" opacity="0.4" fontFamily="Montserrat">SITE BOUNDARY</text>

      {/* === BUILDING SHELL (always visible — represents the architect's vision) === */}
      <g>
        {/* outline of intended building */}
        <path
          d="M 130 400 L 130 110 L 280 80 L 430 110 L 570 90 L 570 400 Z"
          fill="none"
          stroke="#1A1A1A"
          strokeOpacity={isB ? 0.18 : 0.5}
          strokeWidth="1.2"
          strokeDasharray={isB ? '0 0' : '4 3'}
          style={{ transition: 'stroke-opacity .8s, stroke-dasharray .8s' }}
        />
        <text x="135" y="100" fontSize="9" letterSpacing="2" fill="#1A1A1A" opacity={isB ? 0.4 : 0.55} fontFamily="Montserrat">
          ARCHITECT'S INTENT
        </text>
      </g>

      {/* === TRADITIONAL STATE — mutilated building === */}
      <g style={{ opacity: isB ? 0 : 1, transition: 'opacity .9s var(--ease-emphasized-decel)' }}>
        {/* Lost NLA — hatched zones eaten by oversized cores/corridors */}
        <rect x="160" y="200" width="60" height="200" fill="url(#pgHatch)" />
        <rect x="380" y="160" width="80" height="240" fill="url(#pgHatch)" />
        <text x="190" y="195" textAnchor="middle" fontSize="8" fill="#1A1A1A" opacity="0.7" fontFamily="Montserrat" letterSpacing="1.5">−12% NLA</text>
        <text x="420" y="155" textAnchor="middle" fontSize="8" fill="#1A1A1A" opacity="0.7" fontFamily="Montserrat" letterSpacing="1.5">CORE BLOAT</text>

        {/* Solid mass (no glass) */}
        <path d="M 130 400 L 130 110 L 280 80 L 430 110 L 570 90 L 570 400 Z" fill="#1A1A1A" fillOpacity="0.18" />

        {/* Blank walls instead of windows */}
        {[160, 240, 320, 480, 540].map((x, i) => (
          <rect key={i} x={x} y={200} width="40" height="180" fill="#1A1A1A" fillOpacity="0.5" />
        ))}
        <text x="350" y="445" textAnchor="middle" fontSize="9" fill="#1A1A1A" opacity="0.6" fontFamily="Montserrat" letterSpacing="2">BLIND WALLS · MANDATED SPANDRELS</text>

        {/* Bureaucracy stamps stacked */}
        <g transform="translate(40, 60)">
          {[0, 1, 2, 3].map((i) => (
            <g key={i} transform={`translate(${i * 4}, ${i * -3}) rotate(${-8 + i * 2})`}>
              <rect width="60" height="22" fill="none" stroke="#1A1A1A" strokeWidth="0.8" opacity="0.7" />
              <text x="30" y="14" textAnchor="middle" fontSize="7" fill="#1A1A1A" fontFamily="Montserrat" letterSpacing="1.5" opacity="0.7">RFI #{i+1}</text>
            </g>
          ))}
        </g>

        {/* Slow clock indicator */}
        <g transform="translate(620, 60)">
          <circle r="20" fill="none" stroke="#1A1A1A" strokeWidth="1" opacity="0.55" />
          <line x1="0" y1="0" x2="0" y2="-14" stroke="#1A1A1A" strokeWidth="1.4" opacity="0.7">
            <animateTransform attributeName="transform" type="rotate" from="0" to="360" dur="6s" repeatCount="indefinite" />
          </line>
          <line x1="0" y1="0" x2="10" y2="0" stroke="#1A1A1A" strokeWidth="1" opacity="0.55">
            <animateTransform attributeName="transform" type="rotate" from="0" to="360" dur="48s" repeatCount="indefinite" />
          </line>
          <text y="36" textAnchor="middle" fontSize="8" fill="#1A1A1A" fontFamily="Montserrat" letterSpacing="1.5" opacity="0.6">14–22 WKS</text>
        </g>

        {/* Heavy compliance label */}
        <text x="350" y="55" textAnchor="middle" fontSize="11" fill="#1A1A1A" fontFamily="Montserrat" letterSpacing="3" opacity="0.6">DEFENSIVE · PRESCRIPTIVE</text>
      </g>

      {/* === BEIGMAN STATE — preserved building, glass, fast === */}
      <g style={{ opacity: isB ? 1 : 0, transition: 'opacity .9s var(--ease-emphasized-decel)' }}>
        {/* full glass façade */}
        <path d="M 130 400 L 130 110 L 280 80 L 430 110 L 570 90 L 570 400 Z" fill="url(#pgGlass)" fillOpacity="0.18" />
        {/* glass mullions */}
        {Array.from({ length: 9 }).map((_, i) => {
          const x = 150 + i * 50;
          return <line key={i} x1={x} y1={400} x2={x} y2={130} stroke="#B27C4D" strokeWidth="0.6" opacity="0.5" />;
        })}
        {[180, 240, 300, 360].map((y, i) => (
          <line key={i} x1={130} y1={y} x2={570} y2={y} stroke="#B27C4D" strokeWidth="0.6" opacity="0.4" />
        ))}

        {/* +15% NLA recovered band — animated growth */}
        <g>
          <rect x="170" y="220" width="380" height="0" fill="#B27C4D" fillOpacity="0.16" stroke="#B27C4D" strokeWidth="0.8" strokeDasharray="3 2">
            {isB && <animate attributeName="height" from="0" to="160" dur="0.9s" begin="0.2s" fill="freeze" />}
          </rect>
          <text x="360" y="260" textAnchor="middle" fontSize="22" fill="#B27C4D" fontFamily="Montserrat" fontWeight="700" letterSpacing="2" opacity="0">
            +15% NLA
            {isB && <animate attributeName="opacity" from="0" to="1" dur="0.7s" begin="0.6s" fill="freeze" />}
          </text>
          <text x="360" y="280" textAnchor="middle" fontSize="9" fill="#B27C4D" fontFamily="Montserrat" letterSpacing="2" opacity="0">
            RECOVERED THROUGH EVIDENCE
            {isB && <animate attributeName="opacity" from="0" to="0.85" dur="0.7s" begin="0.7s" fill="freeze" />}
          </text>
        </g>

        {/* Shield over building (the value prop) */}
        <g transform="translate(350, 90)" filter="url(#pgGlow)">
          <path d="M 0 -28 L 22 -18 L 22 8 Q 22 24 0 32 Q -22 24 -22 8 L -22 -18 Z"
            fill="#B27C4D" fillOpacity="0.92" stroke="#0F1B2A" strokeWidth="0.8" />
          <path d="M -10 0 L -3 7 L 12 -8" stroke="#0F1B2A" strokeWidth="2" fill="none" strokeLinecap="round" strokeLinejoin="round" />
          {/* radiating rings */}
          {[36, 50, 64].map((r, i) => (
            <circle key={r} r={r} fill="none" stroke="#B27C4D" strokeWidth="0.8" opacity="0.5">
              {isB && <>
                <animate attributeName="r" from={r} to={r + 14} dur="2.5s" begin={`${i * 0.4}s`} repeatCount="indefinite" />
                <animate attributeName="opacity" from="0.6" to="0" dur="2.5s" begin={`${i * 0.4}s`} repeatCount="indefinite" />
              </>}
            </circle>
          ))}
        </g>

        {/* Fast-track approval stamp */}
        <g transform="translate(80, 60)">
          <rect width="100" height="34" fill="#B27C4D" fillOpacity="0.95" />
          <text x="50" y="14" textAnchor="middle" fontSize="7" fill="#0F1B2A" fontFamily="Montserrat" letterSpacing="2" fontWeight="700">CONSENT</text>
          <text x="50" y="26" textAnchor="middle" fontSize="9" fill="#0F1B2A" fontFamily="Montserrat" letterSpacing="2" fontWeight="700">3–5 WKS</text>
          {isB && (
            <animateTransform attributeName="transform" type="scale" from="0.5" to="1" dur="0.6s" begin="0.3s" fill="freeze" additive="sum" />
          )}
        </g>

        {/* Performance markers */}
        {[[100, 360, 'CFD'], [600, 360, 'FDS'], [600, 200, 'FEB']].map(([x, y, lbl], i) => (
          <g key={i} transform={`translate(${x},${y})`}>
            <circle r="12" fill="none" stroke="#B27C4D" strokeWidth="1" opacity="0.7">
              <animate attributeName="r" values="10;14;10" dur="2.4s" begin={`${i * 0.5}s`} repeatCount="indefinite" />
            </circle>
            <text textAnchor="middle" fontSize="6.5" fill="#B27C4D" fontFamily="Montserrat" letterSpacing="1.2" dy="2">{lbl}</text>
          </g>
        ))}

        {/* Heading label */}
        <text x="350" y="55" textAnchor="middle" fontSize="11" fill="#B27C4D" fontFamily="Montserrat" letterSpacing="3" fontWeight="700">EVIDENCE-LED · OUTCOME-FIRST</text>
      </g>
    </svg>
  );
}

/* Animated metric panel that swaps between modes */
const PARADIGM_METRICS = [
  // traditional
  [
    { k: 'NLA outcome',   v: '−12%',         neg: true,  note: 'Lost to corridor / shaft inflation' },
    { k: 'Façade',        v: 'Blind walls',  neg: true,  note: 'Spandrel mandated where glass specified' },
    { k: 'Approval',      v: '14–22 wks',    neg: true,  note: 'Multiple RFIs · re-submissions' },
    { k: 'Design intent', v: 'Compromised',  neg: true,  note: 'Architecture traded for compliance' },
  ],
  // beigman
  [
    { k: 'NLA outcome',   v: '+15%',          neg: false, note: 'Recovered through fire & egress modelling' },
    { k: 'Façade',        v: 'Glass intact',  neg: false, note: 'CFD-validated radiation analysis' },
    { k: 'Approval',      v: '3–5 wks',       neg: false, note: 'Pre-aligned authority engagement' },
    { k: 'Design intent', v: '100% preserved',neg: false, note: 'Original vision delivered' },
  ],
];

function ParadigmMetrics({ mode }) {
  const data = PARADIGM_METRICS[mode];
  const isB = mode === 1;
  return (
    <div>
      <div className="font-heading text-[10px] tracking-[0.32em] text-charcoal/45 mb-6">
        VALUE PROPOSITION · MEASURED
      </div>
      <ul className="space-y-5" key={mode /* re-trigger animation on swap */}>
        {data.map((m, i) => (
          <li
            key={m.k}
            className="border-b border-charcoal/10 pb-5"
            style={{ animation: `slideSwap 0.7s var(--ease-emphasized-decel) ${0.05 + i * 0.08}s both` }}
          >
            <div className="flex items-baseline justify-between gap-4">
              <div className="font-heading text-[11px] tracking-[0.22em] text-charcoal/55 uppercase">{m.k}</div>
              <div className={`font-heading font-bold tabular-nums text-lg md:text-xl ${isB ? 'text-copper' : 'text-charcoal/65'}`}>
                {m.v}
              </div>
            </div>
            <div className="mt-1.5 text-[12.5px] text-charcoal/55">{m.note}</div>
          </li>
        ))}
      </ul>
      <div className="mt-7 flex items-center gap-3">
        <span className={`w-2 h-2 rounded-full ${isB ? 'bg-copper' : 'bg-charcoal/30'} transition-colors duration-500`} />
        <span className="font-heading text-[10px] tracking-[0.22em] text-charcoal/55">
          {isB ? 'WITH BEIGMAN — STRATEGIC PARTNER' : 'WITHOUT BEIGMAN — COMPLIANCE ROADBLOCK'}
        </span>
      </div>
    </div>
  );
}

function Stat({ n, label }) {
  return (
    <div>
      <div className="font-heading font-bold text-charcoal text-3xl md:text-4xl tabular-nums">{n}</div>
      <div className="mt-2 font-heading text-[10px] tracking-[0.22em] text-charcoal/60 uppercase">{label}</div>
    </div>
  );
}

/* SECTION C — Core Pillars */
const PILLAR_ICONS = {
  perf: (
    <svg viewBox="0 0 48 48" fill="none" stroke="currentColor" strokeWidth="1.4" strokeLinecap="square">
      <path d="M8 40 L8 16 L24 6 L40 16 L40 40 Z" />
      <path d="M16 40 V26 H32 V40" />
      <path d="M24 40 V32" opacity="0.5" />
    </svg>
  ),
  comp: (
    <svg viewBox="0 0 48 48" fill="none" stroke="currentColor" strokeWidth="1.4" strokeLinecap="square">
      <path d="M8 12 L24 4 L40 12 L40 36 L24 44 L8 36 Z" />
      <path d="M8 12 L24 20 L40 12 M24 20 V44" />
      <path d="M16 16 L16 24 M32 16 L32 24" opacity="0.4" />
    </svg>
  ),
  nla: (
    <svg viewBox="0 0 48 48" fill="none" stroke="currentColor" strokeWidth="1.4" strokeLinecap="square">
      <rect x="6" y="10" width="36" height="28" />
      <path d="M6 22 H42 M22 10 V38" opacity="0.5" />
      <rect x="22" y="22" width="20" height="16" fill="currentColor" fillOpacity="0.15" stroke="none" />
    </svg>
  ),
  reg: (
    <svg viewBox="0 0 48 48" fill="none" stroke="currentColor" strokeWidth="1.4" strokeLinecap="square">
      <path d="M10 6 H30 L38 14 V42 H10 Z" />
      <path d="M30 6 V14 H38" />
      <path d="M16 22 H32 M16 28 H32 M16 34 H26" />
    </svg>
  ),
  feas: (
    <svg viewBox="0 0 48 48" fill="none" stroke="currentColor" strokeWidth="1.4" strokeLinecap="square">
      <circle cx="24" cy="24" r="18" />
      <path d="M24 10 V24 L33 30" />
      <path d="M6 24 H10 M38 24 H42 M24 6 V10 M24 38 V42" />
    </svg>
  ),
};

function Pillars() {
  const items = [
    {
      key: "perf",
      num: "01",
      title: "Performance-Based Fire Engineering",
      lead: "Performance solutions that protect better design outcomes.",
      body: "We develop fire engineering strategies that move beyond rigid Deemed-to-Satisfy pathways, helping complex buildings achieve compliance without unnecessary design compromise.",
    },
    {
      key: "comp",
      num: "02",
      title: "Computational Modelling",
      lead: "Evidence built from modelling, not assumption.",
      body: "We use computational analysis to test scenarios, support technical arguments and give project teams stronger evidence for approval discussions.",
    },
    {
      key: "nla",
      num: "03",
      title: "NLA & Spatial Value Optimisation",
      lead: "Find commercial value hidden in the floorplate.",
      body: "We review fire strategy, stairs, corridors and spatial constraints to identify where conservative assumptions may be reducing usable or lettable area.",
    },
    {
      key: "reg",
      num: "04",
      title: "Regulatory Strategy & Representation",
      lead: "Technical support when approval conversations become difficult.",
      body: "We help project teams prepare, explain and defend performance-based strategies with Building Surveyors and relevant stakeholders.",
    },
    {
      key: "feas",
      num: "05",
      title: "Day-Zero Feasibility Review",
      lead: "Know what is possible before the project slows down.",
      body: "Our early-stage review helps identify approval risks, design constraints and potential value opportunities before major documentation decisions are locked in.",
    },
  ];
  return (
    <section
      id="pillars"
      data-screen-label="04 Pillars"
      className="relative bg-off-white py-24 md:py-32"
    >
      <div className="max-w-[1280px] mx-auto px-6 md:px-10 lg:px-16">
        <div className="reveal flex flex-col md:flex-row md:items-end md:justify-between gap-6 mb-16">
          <div>
            <div className="font-heading text-[11px] tracking-[0.32em] text-copper">
              CORE PILLARS
            </div>
            <span className="copper-rule mt-5 mb-7" />
            <h2 className="font-heading font-bold text-charcoal text-3xl md:text-4xl lg:text-[44px] tracking-[-0.01em] leading-[1.1] max-w-[680px]">
              Performance engineering, computational evidence<br/>
              and regulatory strategy.
            </h2>
          </div>
          <p className="text-charcoal/70 max-w-[360px] text-[15px] leading-relaxed">
            Five capabilities — calibrated to the design, approval and commercial pressures of your scheme.
          </p>
        </div>

        <div className="reveal grid md:grid-cols-2 lg:grid-cols-3 gap-px bg-charcoal/12 border border-charcoal/12 r-lg overflow-hidden">
          {items.map((it, i) => (
            <article
              key={it.key}
              className="group relative bg-off-white p-8 md:p-10 overflow-hidden transition-all duration-500 hover:bg-white hover:shadow-[0_30px_60px_-30px_rgba(178,124,77,0.35)] hover:-translate-y-1"
              style={{ transitionDelay: `${i * 90}ms` }}
            >
              {/* copper top rule — grows from left on hover */}
              <span
                aria-hidden="true"
                className="pointer-events-none absolute top-0 left-0 right-0 h-[2px] bg-copper origin-left transform scale-x-0 group-hover:scale-x-100 transition-transform duration-700 ease-[cubic-bezier(0.2,0,0,1)] z-10"
              />
              <span aria-hidden="true" className="pointer-events-none absolute inset-0 bg-gradient-to-br from-copper/0 via-copper/0 to-copper/10 opacity-0 group-hover:opacity-100 transition-opacity duration-500" />

              <div className="flex items-start justify-between">
                <div className="text-copper w-12 h-12 transition-transform duration-500 group-hover:scale-110 group-hover:rotate-[-3deg]">
                  {PILLAR_ICONS[it.key]}
                </div>
                <span className="font-heading text-[10px] tracking-[0.28em] text-charcoal/45 tabular-nums">
                  {it.num} / 05
                </span>
              </div>
              <h3 className="mt-10 font-heading font-bold text-charcoal text-xl md:text-[22px] tracking-tight leading-snug transition-colors duration-300 group-hover:text-copper">
                {it.title}
              </h3>
              <div className="mt-3 font-heading text-copper text-[12px] tracking-[0.14em] uppercase leading-snug">
                {it.lead}
              </div>
              <p className="mt-5 text-[14.5px] leading-[1.7] text-charcoal/75">
                {it.body}
              </p>
              <div className="mt-10 flex items-center gap-3 text-charcoal/45 group-hover:text-copper transition-all duration-500">
                <span className="w-10 h-px bg-current transition-all duration-500 group-hover:w-16" />
                <span className="font-heading text-[10px] tracking-[0.28em]">LEARN MORE</span>
                <svg width="14" height="8" viewBox="0 0 14 8" fill="none" className="opacity-0 -translate-x-2 group-hover:opacity-100 group-hover:translate-x-0 transition-all duration-500">
                  <path d="M0 4 H12 M9 1 L12 4 L9 7" stroke="currentColor" strokeWidth="1.2" />
                </svg>
              </div>
            </article>
          ))}
        </div>
      </div>
    </section>
  );
}

/* SECTION D — Trust */
function Trust() {
  const quotes = [
    { quote: "[ Quote here ]", name: "[ Name ]", role: "Developer" },
    { quote: "[ Quote here ]", name: "[ Name ]", role: "Architect" },
    { quote: "[ Quote here ]", name: "[ Name ]", role: "Project Manager" },
  ];
  return (
    <section
      id="trust"
      data-screen-label="05 Trust"
      className="relative bg-off-white py-24 md:py-32 border-t border-charcoal/10"
    >
      <div className="max-w-[1280px] mx-auto px-6 md:px-10 lg:px-16">
        <div className="reveal mb-16">
          <div className="font-heading text-[11px] tracking-[0.32em] text-copper">
            05 &nbsp;— &nbsp;TRUST
          </div>
          <span className="copper-rule mt-5 mb-7" />
          <h2 className="font-heading font-bold text-charcoal text-3xl md:text-4xl lg:text-[44px] tracking-[-0.01em] leading-[1.1] max-w-[720px]">
            The people we work for keep coming back.
          </h2>
        </div>

        <div className="grid md:grid-cols-3 gap-6 md:gap-8">
          {quotes.map((q, i) => (
            <figure
              key={i}
              className="reveal r-lg bg-white border border-charcoal/10 p-8 md:p-9 shadow-[0_30px_60px_-40px_rgba(15,27,42,0.25)] flex flex-col"
              style={{ transitionDelay: `${i * 80}ms` }}
            >
              <svg width="28" height="22" viewBox="0 0 28 22" fill="none" className="text-copper mb-6">
                <path d="M0 22 V12 C0 5 4 1 11 0 V4 C7 5 5 7 5 11 H11 V22 Z M16 22 V12 C16 5 20 1 27 0 V4 C23 5 21 7 21 11 H27 V22 Z" fill="currentColor" />
              </svg>
              <blockquote className="font-heading text-charcoal text-[18px] md:text-[19px] leading-[1.5] tracking-[-0.005em] flex-1">
                "{q.quote}"
              </blockquote>
              <figcaption className="mt-8 pt-6 border-t border-charcoal/10">
                <div className="font-heading text-[12px] tracking-[0.18em] text-charcoal">
                  {q.name}
                </div>
                <div className="mt-1 text-[11px] text-charcoal/50">
                  {q.role}
                </div>
              </figcaption>
            </figure>
          ))}
        </div>
      </div>
    </section>
  );
}

Object.assign(window, { useReveal, ParadigmShift, Pillars, Trust });
