const { useState: useS2, useEffect: useE2 } = React;
const { Reveal: Rv, WordReveal: WR, ChapterHead: CH, Counter: Ct, FrameShell: FS, Check: Ck, ProductShot: PS } = window;

/* ===================== VISION (manifesto band — compact, one-shot reveal) ===================== */
function Vision({ copy, motionOn = true }) {
  const v = copy.vision;
  return (
    <section id="vision" className="vision">
      <div className="gridfield vision-grid" aria-hidden="true">
        <i className="gl-h gl-h1"></i>
        <i className="gl-h gl-h2"></i>
        <i className="gl-v gl-v1"></i>
        <i className="gl-v gl-v2"></i>
      </div>
      <div className="container vision-inner">
        <div className="eyebrow vision-eyebrow">{v.eyebrow}</div>
        <WR as="h2" className="vision-statement">
          {v.lead} <em>{v.emph}</em> {v.tail}
        </WR>
        <Rv delay={220} className="vision-chips">
          {v.chips.map((c) => (
            <span key={c} className="vision-chip"><span className="vision-chip-dot"></span>{c}</span>
          ))}
        </Rv>
      </div>
      <style>{`
        .vision { padding: 120px 0; position: relative; overflow: hidden; }
        .vision::before { content: ""; position: absolute; z-index: 0; left: 4%; top: 26%; width: 44vw; height: 44vw; max-width: 600px; max-height: 600px; background: radial-gradient(circle, var(--accent-soft), transparent 66%); pointer-events: none; }
        .vision-inner { max-width: none; position: relative; z-index: 1; text-align: center; }
        .vision-eyebrow { margin-bottom: 24px; }
        .vision-statement {
          font-family: var(--serif);
          font-size: clamp(28px, 3.4vw, 50px);
          line-height: 1.18; letter-spacing: -0.022em; color: var(--ink);
          max-width: 50ch; text-wrap: balance; font-weight: 400; margin: 0 auto;
        }
        .vision-statement em { font-style: italic; color: var(--accent); }
        .vision-chips { margin-top: 34px; display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
        .vision-chip { display: inline-flex; align-items: center; gap: 9px; padding: 10px 16px; background: var(--paper-2); border: 1px solid var(--line); border-radius: 999px; font-size: 13px; color: var(--ink-2); }
        .vision-chip-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
        @media (max-width: 900px) { .vision { padding: 88px 0; } }
      `}</style>
    </section>
  );
}

/* ===================== GODOS (module rail + morphing frame) ===================== */
function ChatVoiceView({ m }) {
  return (
    <div className="gv">
      <div className="gv-head mono">godos · chat + voice</div>
      <div className="gv-msg user"><div className="gv-bub">{m.demo.user}</div></div>
      <div className="gv-msg ai"><div className="gv-bub">{m.demo.ai}</div></div>
      <div className="gv-input"><span className="mono">▍ speak or type…</span><span className="gv-vtag mono">VOICE</span></div>
    </div>
  );
}
function MemoryView({ m }) {
  return (
    <div className="gv">
      <div className="gv-head mono">memory · persistent context</div>
      <div className="gv-mem">
        {m.demo.items.map((it, i) => (
          <div className="gv-mem-row" key={i}>
            <span className="gv-mem-dot"></span>
            <span className="gv-mem-t">{it}</span>
          </div>
        ))}
      </div>
      <div className="gv-input"><span className="mono">↳ knowledge graph · {m.demo.items.length} nodes linked</span></div>
    </div>
  );
}
function BuildView({ m }) {
  return (
    <div className="gv">
      <div className="gv-head mono">build · runtime tools</div>
      <div className="gv-task"><span className="gv-task-q mono">»</span> {m.demo.task}</div>
      <div className="gv-steps">
        {m.demo.steps.map((s, i) => (
          <div className="gv-step" key={i} style={{ transitionDelay: `${i * 90}ms` }}>
            <Ck /> <span>{s}</span>
          </div>
        ))}
      </div>
      <div className="gv-input"><span className="mono" style={{ color: 'var(--accent)' }}>● shipped — no engineer involved</span></div>
    </div>
  );
}
function OperatorView({ m }) {
  return (
    <div className="gv">
      <div className="gv-head mono">operator · weekly plan</div>
      {m.demo.items.map((it) => (
        <div className="gv-op" key={it.t}>
          <div className="gv-op-top"><span className="gv-op-t">{it.t}</span><span className="gv-op-roi mono">ROI {it.roi}</span></div>
          <div className="gv-op-bar"><div className="gv-op-fill" style={{ width: `${it.roi}%` }}></div></div>
        </div>
      ))}
      <div className="gv-input"><span className="mono">approve all · or let it auto-run</span><span className="gv-vtag mono">SAFE</span></div>
    </div>
  );
}
function ClipView({ m }) {
  return (
    <div className="gv">
      <div className="gv-head mono">clip ai · autonom</div>
      <div className="gv-clip-src">
        <span className="gv-clip-film"></span>
        <span className="gv-clip-name mono">{m.demo.src}</span>
        <span className="gv-clip-prog"><span></span></span>
      </div>
      <div className="gv-pipe">
        {m.demo.stages.map((s, i) => (
          <div className="gv-pipe-step" key={s.k} style={{ animationDelay: `${i * 0.6}s` }}>
            <span className="gv-pipe-k mono">{s.k}</span>
            <span className="gv-pipe-t">{s.t}</span>
            <span className="gv-pipe-go mono">→</span>
          </div>
        ))}
      </div>
    </div>
  );
}

const GV_VIEWS = { chat: ChatVoiceView, memory: MemoryView, build: BuildView, operator: OperatorView, clip: ClipView };

function GodOSSection({ copy }) {
  const s = copy.godos;
  const [active, setActive] = useS2(0);
  const [paused, setPaused] = useS2(false);

  useE2(() => {
    if (paused || document.body.classList.contains('no-motion')) return;
    const id = setInterval(() => setActive(a => (a + 1) % s.modules.length), 4600);
    return () => clearInterval(id);
  }, [paused, s.modules.length]);

  return (
    <section id="godos" className="godos">
      <div className="container">
        <CH chapter="01" label={s.eyebrow} title={<>{s.title[0]}<em>{s.title[1]}</em></>} lede={s.lede} />
        <div className="gx-tagrow"><span className="gx-tag mono"><span className="gx-tag-dot"></span>{s.tag}</span></div>
        <div className="stage gx-stage">
          <div className="gx-left" onMouseLeave={() => setPaused(false)}>
            {s.modules.map((m, i) => (
              <button
                key={m.id}
                className={`gx-row ${i === active ? 'active' : ''}`}
                onMouseEnter={() => { setActive(i); setPaused(true); }}
                onFocus={() => { setActive(i); setPaused(true); }}
                onClick={() => { setActive(i); setPaused(true); }}
              >
                <div className="gx-row-head">
                  <span className="gx-row-num mono">{m.id}</span>
                  <span className="gx-row-t serif">{m.t}</span>
                </div>
                <div className="gx-row-detail">
                  <p className="gx-row-d">{m.d}</p>
                  <div className="gx-feats">
                    {m.features.map((ft) => <span className="gx-feat mono" key={ft}>{ft}</span>)}
                  </div>
                </div>
                <span className="gx-row-bar"><span style={{ animationPlayState: (i === active && !paused) ? 'running' : 'paused' }}></span></span>
              </button>
            ))}
          </div>

          <div className="gx-right">
            <div className="frame gx-frame">
              {s.modules.map((m, i) => {
                const View = GV_VIEWS[m.view];
                return (
                  <div className={`gx-view ${i === active ? 'on' : ''}`} key={m.id} aria-hidden={i !== active}>
                    <View m={m} />
                  </div>
                );
              })}
            </div>
          </div>
        </div>
      </div>

      <style>{`
        .godos { padding: 84px 0; }
        .godos .ch-head { margin-bottom: 24px; }
        .godos .ch-title { font-size: clamp(28px, 3.4vw, 50px); }
        .godos .ch-lede { font-size: 15px; }
        .gx-tagrow { margin: -8px 0 18px; }
        .gx-tag { display: inline-flex; align-items: center; gap: 8px; font-size: 11px; color: var(--ink-2); background: var(--paper-2); border: 1px solid var(--line); padding: 7px 13px; border-radius: 999px; letter-spacing: 0.06em; }
        .gx-tag-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

        .gx-stage { margin-top: 8px; align-items: stretch; }
        .gx-left { display: flex; flex-direction: column; justify-content: center; }
        .gx-row {
          appearance: none; background: none; border: none; text-align: left; cursor: pointer;
          display: block; width: 100%; padding: 15px 0; position: relative;
          border-top: 1px solid var(--line); font-family: var(--sans);
        }
        .gx-left .gx-row:last-child { border-bottom: 1px solid var(--line); }
        .gx-row-head { display: grid; grid-template-columns: 40px 1fr; gap: 14px; align-items: baseline; }
        .gx-row-num { font-size: 12px; color: var(--ink-3); letter-spacing: 0.12em; transition: color 0.3s; }
        .gx-row.active .gx-row-num { color: var(--accent); }
        .gx-row-t { font-family: var(--serif); font-size: clamp(19px, 2vw, 26px); line-height: 1.12; letter-spacing: -0.02em; color: var(--ink-3); transition: color 0.3s; }
        .gx-row.active .gx-row-t { color: var(--ink); }
        .gx-row-detail { max-height: 0; overflow: hidden; opacity: 0; transition: max-height 0.5s cubic-bezier(0.2,0.7,0.2,1), opacity 0.4s; padding-left: 54px; }
        .gx-row.active .gx-row-detail { max-height: 160px; opacity: 1; margin-top: 10px; }
        .gx-row-d { color: var(--ink-2); font-size: 14px; line-height: 1.55; margin: 0; max-width: 42ch; }
        .gx-feats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
        .gx-feat { font-size: 10px; padding: 5px 10px; background: var(--paper-3); border: 1px solid var(--line); border-radius: 999px; color: var(--ink-2); letter-spacing: 0.04em; }
        .gx-row-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: transparent; overflow: hidden; }
        .gx-row.active .gx-row-bar { background: var(--line); }
        .gx-row-bar span { display: block; height: 100%; width: 0; background: var(--accent); }
        .gx-row.active .gx-row-bar span { animation: gxFill 4.6s linear forwards; }
        @keyframes gxFill { from { width: 0; } to { width: 100%; } }
        body.no-motion .gx-row-detail { max-height: none; opacity: 1; margin-top: 12px; }
        body.no-motion .gx-row-bar span { animation: none; }

        .gx-right { position: relative; display: flex; align-items: center; }
        .gx-frame {
          position: relative; width: 100%; min-height: 380px;
          background: linear-gradient(180deg, #0E1014, var(--bg));
          border: 1px solid var(--line); border-radius: var(--r-frame);
          box-shadow: var(--sh-frame); overflow: hidden; padding: 26px;
          display: flex; align-items: center; justify-content: center;
        }
        .gx-view { position: absolute; inset: 26px; opacity: 0; transform: translateY(8px) scale(0.99); transition: opacity 0.35s ease, transform 0.45s cubic-bezier(0.2,0.7,0.2,1); display: flex; align-items: center; justify-content: center; pointer-events: none; }
        .gx-view.on { opacity: 1; transform: none; pointer-events: auto; }
        body.no-motion .gx-view { transition: none; }

        /* shared godos-view (dark, inside .frame) */
        .gv { width: 100%; max-width: 460px; display: flex; flex-direction: column; gap: 12px; }
        .gv-head { font-size: 10px; color: var(--text-3); letter-spacing: 0.14em; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
        .gv-input { margin-top: 4px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px; font-size: 11px; color: var(--text-3); }
        .gv-vtag { font-size: 9px; padding: 3px 8px; background: var(--accent-soft); color: var(--accent); border-radius: 999px; border: 1px solid var(--accent-line); }

        .gv-msg { display: flex; }
        .gv-msg.user { justify-content: flex-end; }
        .gv-bub { max-width: 84%; padding: 11px 14px; border-radius: 14px; font-size: 13px; line-height: 1.5; }
        .gv-msg.user .gv-bub { background: rgba(255,255,255,0.06); color: var(--text); border-top-right-radius: 4px; }
        .gv-msg.ai .gv-bub { background: rgba(0,0,0,0.35); border: 1px solid var(--line); color: var(--text-2); border-top-left-radius: 4px; }

        .gv-mem { display: flex; flex-direction: column; gap: 0; position: relative; padding-left: 6px; }
        .gv-mem-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px dashed rgba(255,255,255,0.06); position: relative; }
        .gv-mem-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); flex-shrink: 0; }
        .gv-mem-t { font-size: 13px; color: var(--text-2); }

        .gv-task { font-size: 13px; color: var(--text); padding: 12px 14px; background: rgba(255,255,255,0.04); border: 1px solid var(--line); border-radius: 10px; }
        .gv-task-q { color: var(--accent); }
        .gv-steps { display: flex; flex-direction: column; gap: 9px; margin-top: 2px; }
        .gv-step { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }

        .gv-op { padding: 9px 0; border-top: 1px dashed rgba(255,255,255,0.06); }
        .gv-op:first-of-type { border-top: 1px solid var(--line); }
        .gv-op-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
        .gv-op-t { font-size: 13px; color: var(--text); }
        .gv-op-roi { font-size: 10px; color: var(--accent); }
        .gv-op-bar { height: 3px; background: rgba(255,255,255,0.06); border-radius: 2px; margin-top: 7px; overflow: hidden; }
        .gv-op-fill { height: 100%; background: var(--accent); }

        .gv-clip-src { display: flex; align-items: center; gap: 10px; padding: 12px; background: rgba(255,255,255,0.03); border: 1px solid var(--line); border-radius: 10px; }
        .gv-clip-film { width: 26px; height: 20px; border-radius: 4px; background: linear-gradient(135deg, #3a3f49, #20242b); border: 1px solid var(--line-2); flex-shrink: 0; }
        .gv-clip-name { font-size: 11px; color: var(--text-2); flex: 1; }
        .gv-clip-prog { width: 56px; height: 3px; background: rgba(255,255,255,0.08); border-radius: 2px; overflow: hidden; }
        .gv-clip-prog span { display: block; height: 100%; width: 100%; background: var(--accent); }
        .gv-clips { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
        .gv-clip { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: rgba(255,255,255,0.025); border: 1px dashed var(--accent-line); border-radius: 8px; font-size: 12px; color: var(--text-2); }
        .gv-clip-play { color: var(--accent); font-size: 10px; }

        .gv-pipe { display: flex; flex-direction: column; gap: 8px; margin-top: 2px; }
        .gv-pipe-step { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,0.02); animation: gvPipe 3.6s ease-in-out infinite; }
        .gv-pipe-k { font-size: 9px; letter-spacing: 0.06em; color: var(--accent); border: 1px solid var(--accent-line); background: var(--accent-soft); border-radius: 999px; padding: 4px 0; width: 96px; text-align: center; flex-shrink: 0; }
        .gv-pipe-t { font-size: 12px; color: var(--text-2); flex: 1; }
        .gv-pipe-go { color: var(--text-3); font-size: 12px; }
        @keyframes gvPipe { 0%, 72%, 100% { border-color: var(--line); background: rgba(255,255,255,0.02); } 10% { border-color: var(--accent-line); background: rgba(91,147,184,0.07); } 22% { border-color: var(--line); background: rgba(255,255,255,0.02); } }
        body.no-motion .gv-pipe-step { animation: none; }
      `}</style>
    </section>
  );
}

/* ===================== TREVI (dark band — the money layer) ===================== */
function TreviPay({ copy }) {
  const f = copy.trevi.frame;
  return (
    <FS copy={copy} title={f.label} liveLabel="live" activeNav={0} sidebar={["Pay", "Wallet", "Cashback", "Coin", "Treasury", "Settings"]}>
      <div className="ws-card tp-pay">
        <div className="ws-card-head">
          <div className="ws-card-eyebrow mono"><span className="dot"></span>{f.label}</div>
          <div className="mono tp-method">⚡ {f.method}</div>
        </div>
        <div className="tp-amount"><span className="ws-bignum">{f.amount}</span><span className="mono tp-unit">{f.unit}</span></div>
        <div className="tp-paybody">
          <div className="tp-qr" aria-hidden="true">
            {Array.from({ length: 36 }).map((_, i) => <span key={i} className={(i * 7 + (i % 5)) % 3 === 0 ? 'on' : ''}></span>)}
          </div>
          <div className="tp-paymeta">
            <div className="tp-addr mono">{f.addr}</div>
            <div className="tp-row"><span className="mono tp-l">{f.statusLabel}</span><span className="tp-status"><span className="tp-status-dot"></span>{f.statusVal}</span></div>
            <div className="tp-cashback mono">{f.cashback}</div>
          </div>
        </div>
      </div>

      <div className="ws-card tp-coin">
        <div className="ws-card-head">
          <div className="ws-card-eyebrow mono"><span className="dot"></span>{f.coin}</div>
        </div>
        <div className="tp-coinbal"><span className="tp-coin-mark"></span><span className="ws-bignum">{f.coinVal}</span></div>
      </div>

      <style>{`
        .tp-pay { background: linear-gradient(180deg, rgba(91,147,184,0.07), rgba(255,255,255,0.005)); }
        .tp-method { font-size: 11px; color: var(--warn); }
        .tp-amount { display: flex; align-items: baseline; gap: 8px; margin-top: 12px; }
        .tp-unit { font-size: 12px; color: var(--text-3); }
        .tp-paybody { display: grid; grid-template-columns: 92px 1fr; gap: 16px; margin-top: 16px; align-items: center; }
        .tp-qr { width: 92px; height: 92px; display: grid; grid-template-columns: repeat(6, 1fr); grid-auto-rows: 1fr; gap: 2px; padding: 8px; background: #fff; border-radius: 8px; }
        .tp-qr span { background: transparent; border-radius: 1px; }
        .tp-qr span.on { background: #0B0C0E; }
        .tp-addr { font-size: 11px; color: var(--text-2); word-break: break-all; }
        .tp-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
        .tp-l { font-size: 11px; color: var(--text-3); }
        .tp-status { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--good); }
        .tp-status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--good); box-shadow: 0 0 8px var(--good); }
        .tp-cashback { margin-top: 10px; font-size: 11px; color: var(--good); }
        .tp-coinbal { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
        .tp-coin-mark { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), #6FA8C9); box-shadow: 0 0 0 4px rgba(91,147,184,0.14); flex-shrink: 0; }
      `}</style>
    </FS>
  );
}

function Trevi({ copy, motionOn = true }) {
  const t = copy.trevi;
  const ref = React.useRef(null);
  useE2(() => {
    const sec = ref.current;
    if (!sec) return;
    if (!motionOn) { sec.style.setProperty('--enter', '1'); return; }
    let raf = 0;
    const apply = () => {
      raf = 0;
      const r = sec.getBoundingClientRect();
      const ih = window.innerHeight;
      const e = window.smooth(ih - r.top, ih * 0.10, ih * 0.50);
      sec.style.setProperty('--enter', e.toFixed(4));
    };
    const onScroll = () => { if (!raf) raf = requestAnimationFrame(apply); };
    apply();
    window.addEventListener('scroll', onScroll, { passive: true });
    window.addEventListener('resize', onScroll, { passive: true });
    return () => { window.removeEventListener('scroll', onScroll); window.removeEventListener('resize', onScroll); if (raf) cancelAnimationFrame(raf); };
  }, [motionOn]);
  return (
    <section id="trevi" className="trevi section-dark dark-room" ref={ref}>
      <div className="trevi-aurora" aria-hidden="true"></div>
      <div className="container">
        <div className="stage trevi-stage">
          <div className="trevi-left">
            <CH chapter="04" label={t.eyebrow} title={<>{t.title[0]}<em>{t.title[1]}</em></>} lede={t.lede} ledeRight={false} />
            <div className="trevi-chips">
              {t.chips.map((c) => (
                <Rv key={c.t} className={`trevi-chip ${c.s}`}>
                  <span className="trevi-chip-dot"></span>{c.t}
                  <span className="trevi-chip-tag mono">{c.s === 'live' ? 'LIVE' : 'BALD'}</span>
                </Rv>
              ))}
            </div>
          </div>
          <div className="trevi-right">
            <Rv delay={120}>
              <div className="trevi-shots">
                <PS src="images/trevi-overview.png" alt="Trevi merchant dashboard — real-time payment analytics, revenue and cashback" title="trevi · merchant" />
                <div className="trevi-shot-float">
                  <PS src="images/trevi-wallet.png" alt="Trevi wallet — cashback pool, treasury balance and withdrawable funds" chrome={false} />
                </div>
              </div>
            </Rv>
          </div>
        </div>
      </div>

      <style>{`
        /* bg, rounded sheet + scene entrance come from the shared .dark-room primitive.
           Trevi drops the soft .room-fade bottom gradient (user disliked it) — instead it's a
           CONTAINED panel: rounded bottom corners sitting cleanly on the cream below. */
        .trevi.dark-room { border-bottom-left-radius: 38px; border-bottom-right-radius: 38px; padding-bottom: 120px; }
        @media (max-width: 900px) { .trevi.dark-room { border-bottom-left-radius: 26px; border-bottom-right-radius: 26px; } }
        .trevi-aurora { position: absolute; inset: 0; z-index: 0; pointer-events: none; opacity: 0.5;
          background:
            radial-gradient(40% 50% at 78% 28%, rgba(91,147,184,0.16), transparent 70%),
            radial-gradient(46% 54% at 14% 82%, rgba(201,162,75,0.10), transparent 72%);
          animation: treviAurora 24s ease-in-out infinite alternate; will-change: transform; }
        @keyframes treviAurora { from { transform: translate3d(2%,-2%,0) scale(1.05); } to { transform: translate3d(-3%,3%,0) scale(1.18); } }
        body.no-motion .trevi-aurora { animation: none; }
        .trevi .container { position: relative; z-index: 1; }
        .trevi-stage { align-items: center; }
        .trevi-left .ch-head { margin-bottom: 28px; }
        .trevi-chips { display: flex; flex-direction: column; gap: 10px; max-width: 380px; }
        .trevi-chip { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--paper-2); border: 1px solid var(--line); border-radius: 10px; font-size: 14px; color: var(--ink); }
        .trevi-chip-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
        .trevi-chip.soon { opacity: 0.72; }
        .trevi-chip.soon .trevi-chip-dot { background: var(--ink-3); }
        .trevi-chip-tag { margin-left: auto; font-size: 9px; letter-spacing: 0.1em; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--accent-line); color: var(--accent); }
        .trevi-chip.soon .trevi-chip-tag { color: var(--ink-3); border-color: var(--line-2); }
        .trevi-right { display: flex; min-width: 0; }
        .trevi-right > .reveal { display: flex; flex: 1; min-width: 0; }
        .section-dark .trevi-right .ws-shell { border-color: rgba(255,255,255,0.10); box-shadow: 0 30px 90px -24px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.05); }
        /* real Trevi dashboard screenshots — primary "merchant" view + a floating "wallet" card for depth */
        .trevi-shots { position: relative; flex: 1; min-width: 0; padding: 0 0 52px 44px; }
        .trevi-shots > .shot { position: relative; z-index: 1; }
        .trevi-shot-float { position: absolute; left: 0; bottom: 0; width: 46%; z-index: 2; }
        .trevi-shot-float .shot { box-shadow: 0 44px 100px -34px rgba(0,0,0,0.9), 0 0 0 1px rgba(255,255,255,0.06); }
        @media (max-width: 1024px) {
          .trevi-right, .trevi-right > .reveal { display: block; }
          .trevi-shots { padding: 0; }
          .trevi-shot-float { position: static; width: 72%; margin: 18px auto 0; }
        }
      `}</style>
    </section>
  );
}

/* ===================== FLEET (product gallery) ===================== */
function Fleet({ copy }) {
  const f = copy.fleet;
  return (
    <section id="fleet" className="fleet">
      <div className="container">
        <CH chapter="03" label={f.eyebrow} title={<>{f.title[0]}<em>{f.title[1]}</em></>} lede={f.lede} />
        <div className="fleet-grid">
          {f.products.map((p, i) => (
            <Rv key={p.name} delay={i * 40} className="fleet-card">
              <div className="fleet-card-top">
                <span className={`fleet-tag mono ${p.tag}`}>{f.tags[p.tag]}</span>
                <span className="fleet-card-num mono">{('0' + (i + 1)).slice(-2)}</span>
              </div>
              <h3 className="fleet-name serif">{p.name}</h3>
              <p className="fleet-one">{p.one}</p>
              <div className="fleet-card-foot mono">{p.meta}</div>
            </Rv>
          ))}
        </div>
      </div>
      <style>{`
        .fleet { padding: 92px 0; }
        .fleet .ch-head { margin-bottom: 30px; }
        .fleet .ch-title { font-size: clamp(28px, 3.2vw, 46px); }
        .fleet .ch-lede { font-size: 15px; }
        .fleet-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
        .fleet-card {
          display: flex; flex-direction: column;
          padding: 18px 18px 15px; min-height: 162px;
          background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--r-card);
          position: relative; overflow: hidden;
          transition: border-color 0.25s, transform 0.25s cubic-bezier(0.2,0.7,0.2,1), background 0.25s, box-shadow 0.25s;
        }
        .fleet-card:hover { border-color: var(--line-2); transform: translateY(-3px); background: var(--paper); box-shadow: var(--sh-md); }
        .fleet-card::after { content: ""; position: absolute; top: 0; left: -70%; width: 45%; height: 100%; background: linear-gradient(100deg, transparent, rgba(43,76,99,0.07), transparent); transform: skewX(-18deg); transition: left 0.7s cubic-bezier(0.2,0.7,0.2,1); pointer-events: none; }
        .fleet-card:hover::after { left: 160%; }
        body.no-motion .fleet-card::after { display: none; }
        .fleet-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
        .fleet-card-num { font-size: 10px; color: var(--ink-3); letter-spacing: 0.14em; }
        .fleet-tag { font-size: 9px; letter-spacing: 0.1em; padding: 4px 9px; border-radius: 999px; }
        .fleet-tag.live, .fleet-tag.mixed { color: var(--accent); background: var(--accent-soft); border: 1px solid var(--accent-line); }
        .fleet-tag.soon { color: #9A7B2E; background: rgba(154,123,46,0.10); border: 1px solid rgba(154,123,46,0.30); }
        .fleet-name { font-family: var(--serif); font-size: 20px; line-height: 1.12; letter-spacing: -0.02em; color: var(--ink); }
        .fleet-one { color: var(--ink-2); font-size: 13px; line-height: 1.5; margin: 7px 0 0; max-width: 52ch; }
        .fleet-card-foot { margin-top: auto; padding-top: 12px; font-size: 10px; color: var(--ink-3); letter-spacing: 0.04em; }
        @media (max-width: 1024px) { .fleet-grid { grid-template-columns: repeat(2, 1fr); } }
        @media (max-width: 560px) { .fleet-grid { grid-template-columns: 1fr; } }
      `}</style>
    </section>
  );
}

Object.assign(window, { Vision, GodOSSection, Trevi, Fleet });
