/* tenroin-top/lp-events.jsx — イベントLP用の追加レイヤー（CD非管理・私の管理）
   ──────────────────────────────────────────────────────────────────────
   CDの lp.jsx / lp.css は一切触らず、そこで定義済みのグローバル関数コンポーネント
   （Hero / Authority / Proof / Problem / Solution / Curriculum / Testimony / FAQ /
     Ecosystem / FinalCTA / StickyCTA / SecHead / Eyebrow）を再利用し、
   写真イベント固有のセクション（作例ギャラリー / モデル / Before→After / 当日・持ち物 /
     開催回リスト＋予約）を追加する。スタイルは lp-events.css（同じく私の管理）。
   エントリ html は <EventLP cfg={window.LP.LP_PORTRAIT}/> を描画する。 */

const { useState: useEvState, useEffect: useEvEffect, useRef: useEvRef } = React;

const evStar = '✦';

/* ===== S-REEL シネマティック・リール（画像＋GSAPで「動画風」）=====
   写真講座＝商品が「写真」なので、作例をスクロール非依存の自動再生フィルムで没入させる。
   GSAPで Ken Burns＋クロスフェード＋コピー出し（在ビュー時のみ再生＝スクロールは奪わない）。
   GSAP未ロード/reduced-motion時は先頭フレーム静止にフォールバック（壊れない）。データ＝cfg.reel。 */
function CinematicReel({ cfg }) {
  const r = cfg.reel; if (!r || !(r.frames || []).length) return null;
  const frames = r.frames;
  const rootRef = useEvRef(null);
  useEvEffect(() => {
    const root = rootRef.current; if (!root) return;
    if (typeof matchMedia === 'function' && matchMedia('(prefers-reduced-motion:reduce)').matches) return; // 静止
    const gsap = window.gsap; if (!gsap) return; // CSSデフォルト＝先頭フレーム表示
    const ST = window.ScrollTrigger; if (ST) { try { gsap.registerPlugin(ST); } catch (e) {} }
    const slides = Array.from(root.querySelectorAll('.lp-reel-slide'));
    const caps = Array.from(root.querySelectorAll('.lp-reel-cap'));
    if (!slides.length) return;
    let st;
    const ctx = gsap.context(() => {
      gsap.set(slides, { autoAlpha: 0 });
      gsap.set(slides[0], { autoAlpha: 1 });
      gsap.set(caps, { autoAlpha: 0, y: 18 });
      const tl = gsap.timeline({ repeat: -1, paused: true });
      const HOLD = 3.4, FADE = 0.9, STEP = HOLD + FADE;   // 各フレームが STEP 秒を占有（絶対時間配置＝ループが綺麗）
      slides.forEach((sl, i) => {
        const img = sl.querySelector('img, image-slot');
        const cap = caps[i];
        const start = i * STEP;
        tl.fromTo(sl, { autoAlpha: 0 }, { autoAlpha: 1, duration: FADE }, start);                       // 入場
        if (img) tl.fromTo(img, { scale: 1.0 }, { scale: 1.07, duration: STEP + FADE, ease: 'none' }, start); // Ken Burns（控えめ＝見切れ抑制）
        if (cap) tl.fromTo(cap, { autoAlpha: 0, y: 18 }, { autoAlpha: 1, y: 0, duration: FADE }, start + 0.25);
        tl.to(sl, { autoAlpha: 0, duration: FADE }, start + STEP);                                       // 退場
        if (cap) tl.to(cap, { autoAlpha: 0, y: -14, duration: FADE * 0.7 }, start + STEP);
      });
      tl.to({}, { duration: FADE }, slides.length * STEP);   // 末尾の余白（最後の退場を見せてからループ）
      if (ST) {
        st = ST.create({
          trigger: root, start: 'top 85%', end: 'bottom 15%',
          onEnter: () => tl.play(), onEnterBack: () => tl.play(),
          onLeave: () => tl.pause(), onLeaveBack: () => tl.pause(),
        });
      } else { tl.play(); }
    }, root);
    return () => { try { if (st) st.kill(); } catch (e) {} ctx.revert(); };
  }, []);
  return (
    <section className="lp-section lp-reel" id="lp-reel" ref={rootRef}>
      <div className="lp-reel-stage" data-reveal>
        {frames.map((f, i) => (
          <figure className={'lp-reel-slide' + (i === 0 ? ' is-first' : '')} key={i}>
            {f.src ? <img src={f.src} alt="" aria-hidden="true" loading="lazy" /> : <image-slot class="ph-c" shape="rect" placeholder="作例"></image-slot>}
          </figure>
        ))}
        <div className="lp-reel-grain" aria-hidden="true"></div>
        <div className="lp-reel-vignette" aria-hidden="true"></div>
        <div className="lp-reel-caps">
          <div className="lp-reel-capwrap">
            {frames.map((f, i) => (
              <p className={'lp-reel-cap' + (i === 0 ? ' is-first' : '')} key={i}>{f.phrase}</p>
            ))}
          </div>
          {r.eyebrow && <div className="lp-reel-eyebrow">{r.eyebrow}</div>}
        </div>
      </div>
    </section>
  );
}

/* ===== S-GALLERY 作例ギャラリー ===== */
function Gallery({ cfg }) {
  const g = cfg.gallery; if (!g) return null;
  return (
    <section className="lp-section lp-evgal" id="lp-gallery">
      <div className="lp-wrap">
        <SecHead eyebrow={g.eyebrow} title={g.title} />
        {g.lead && <p className="lp-lead" data-reveal>{g.lead}</p>}
        <div className="lp-evgal-grid" data-reveal>
          {(g.items || []).map((it, i) => (
            <figure className={'lp-evgal-cell' + (it.wide ? ' is-wide' : '')} key={i}>
              {it.src
                ? <img src={it.src} alt={it.cap || ''} loading="lazy" />
                : <image-slot class="ph-c" shape="rect" placeholder={it.cap || '作例写真（プロの1枚）'}></image-slot>}
              {it.cap && <figcaption className="lp-evgal-cap">{it.cap}</figcaption>}
            </figure>
          ))}
        </div>
        {g.note && <p className="lp-evgal-note" data-reveal>{g.note}</p>}
      </div>
    </section>
  );
}

/* ===== S-BEFORE/AFTER 受講生の変化（最強の説得装置） ===== */
function BeforeAfter({ cfg }) {
  const b = cfg.beforeAfter; if (!b) return null;
  return (
    <section className="lp-section lp-evba" id="lp-beforeafter">
      <div className="lp-wrap">
        <SecHead eyebrow={b.eyebrow} title={b.title} />
        {b.lead && <p className="lp-lead" data-reveal>{b.lead}</p>}
        <div className="lp-evba-grid">
          {(b.pairs || []).map((p, i) => (
            <div className="lp-evba-pair" data-reveal data-d={String((i % 3) + 1)} key={i}>
              <div className="lp-evba-imgs">
                <figure className="lp-evba-one">
                  <span className="lp-evba-tag is-before">BEFORE</span>
                  {p.before ? <img src={p.before} alt="受講前" loading="lazy" /> : <image-slot class="ph-c" shape="rect" placeholder="受講前の写真"></image-slot>}
                </figure>
                <figure className="lp-evba-one">
                  <span className="lp-evba-tag is-after">AFTER</span>
                  {p.after ? <img src={p.after} alt="受講後" loading="lazy" /> : <image-slot class="ph-c" shape="rect" placeholder="受講後の写真"></image-slot>}
                </figure>
              </div>
              {(p.name || p.note) && (
                <div className="lp-evba-meta">
                  {p.name && <div className="lp-evba-name">{p.name}</div>}
                  {p.note && <p className="lp-evba-note">{p.note}</p>}
                </div>
              )}
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

/* ===== S-STUDENTWORKS 受講生が撮った作品（会場ごとに切り替え） ===== */
function StudentGallery({ cfg, venue, setVenue }) {
  const g = cfg.studentWorks; if (!g) return null;
  const items = g.items || [];
  const stores = [];
  items.forEach(it => { if (it.store && stores.indexOf(it.store) < 0) stores.push(it.store); });
  const [localStore, setLocalStore] = useEvState('ALL');
  const store = venue != null ? venue : localStore;          // ★EventLPの共有会場状態（あれば）を使用＝講師帯/カレンダーと連動
  const setStore = setVenue || setLocalStore;
  const shown = store === 'ALL' ? items : items.filter(it => it.store === store);
  return (
    <section className="lp-section lp-evgal lp-evstud" id="lp-studentworks">
      <div className="lp-wrap">
        <SecHead eyebrow={g.eyebrow} title={g.title} />
        {g.lead && <p className="lp-lead" data-reveal>{g.lead}</p>}
        {stores.length > 1 && (
          <div className="lp-evstud-tabs" data-reveal>
            <button type="button" className={'lp-evstud-tab' + (store === 'ALL' ? ' is-on' : '')} onClick={() => setStore('ALL')}>全国</button>
            {stores.map(s => (
              <button type="button" key={s} className={'lp-evstud-tab' + (store === s ? ' is-on' : '')} onClick={() => setStore(s)}>{s}</button>
            ))}
          </div>
        )}
        <div className="lp-evgal-grid" data-reveal key={store}>
          {shown.map((it, i) => (
            <figure className={'lp-evgal-cell' + (it.wide ? ' is-wide' : '')} key={i}>
              {it.src
                ? <img src={it.src} alt={it.cap || ''} loading="lazy" />
                : <image-slot class="ph-c" shape="rect" placeholder={it.cap || '受講生作品'}></image-slot>}
              {(it.cap || it.store) && <figcaption className="lp-evgal-cap">{it.store ? it.store + '｜' : ''}{it.cap}</figcaption>}
            </figure>
          ))}
        </div>
        {g.note && <p className="lp-evgal-note" data-reveal>{g.note}</p>}
      </div>
    </section>
  );
}

/* ===== S-TICKETS チケット／料金（単発・4回券・パスポート＝UPX） ===== */
function Tickets({ cfg }) {
  const t = cfg.tickets; if (!t || !(t.items || []).length) return null;
  const [busy, setBusy] = useEvState('');
  const go = (it) => {
    if (it.action === 'sessions') { const el = document.getElementById('lp-sessions'); if (el) el.scrollIntoView({ behavior: 'smooth' }); return; }
    if (busy) return;
    if (it.lp && window.lpCheckout) { setBusy(it.lp); window.lpCheckout({ lp: it.lp, tier: it.tier || 'general' }); setTimeout(() => setBusy(''), 4000); }
  };
  return (
    <section className="lp-section lp-evtickets" id="lp-tickets">
      <div className="lp-wrap lp-narrow">
        <SecHead eyebrow={t.eyebrow} title={t.title} />
        {t.lead && <p className="lp-lead" data-reveal>{t.lead}</p>}
        <div className="lp-evtickets-grid" data-reveal>
          {(t.items || []).map((it, i) => (
            <div className={'lp-evticket' + (it.featured ? ' is-featured' : '')} key={i}>
              {it.badge && <span className="lp-evticket-badge">{it.badge}</span>}
              <div className="lp-evticket-name">{it.name}</div>
              {it.sub && <div className="lp-evticket-sub">{it.sub}</div>}
              <div className="lp-evticket-price">{it.price}{it.priceUnit && <span>{it.priceUnit}</span>}</div>
              {it.note && <div className="lp-evticket-pnote">{it.note}</div>}
              {it.perks && it.perks.length > 0 && (
                <ul className="lp-evticket-perks">{it.perks.map((p, j) => <li key={j}>{p}</li>)}</ul>
              )}
              <button type="button" className={'lp-btn lp-evticket-btn ' + (it.action === 'sessions' ? 'lp-btn-ghost' : 'lp-btn-gold')}
                disabled={busy === it.lp} onClick={() => go(it)}>
                {busy === it.lp ? '進む…' : it.cta}
              </button>
            </div>
          ))}
        </div>
        {t.note && <p className="lp-evgal-note" data-reveal>{t.note}</p>}
      </div>
    </section>
  );
}

/* ===== S-THEMES 毎月テーマが変わる（4テーマのビジュアル＝リピート装置） ===== */
function ThemeRotation({ cfg }) {
  const t = cfg.themes; if (!t || !(t.items || []).length) return null;
  return (
    <section className="lp-section lp-evthemes" id="lp-themes">
      <div className="lp-wrap">
        <SecHead eyebrow={t.eyebrow} title={t.title} />
        {t.lead && <p className="lp-lead" data-reveal>{t.lead}</p>}
        <div className="lp-evthemes-grid" data-reveal>
          {(t.items || []).map((it, i) => (
            <figure className="lp-evtheme" key={i}>
              <div className="lp-evtheme-img">
                {it.img ? <img src={it.img} alt={it.name || ''} loading="lazy" /> : <image-slot class="ph-c" shape="rect" placeholder={it.name || 'テーマ'}></image-slot>}
                {it.tag && <span className="lp-evtheme-tag">{it.tag}</span>}
              </div>
              <figcaption className="lp-evtheme-cap">
                <span className="lp-evtheme-name">{it.name}</span>
                {it.sub && <span className="lp-evtheme-sub">{it.sub}</span>}
                {it.d && <p className="lp-evtheme-d">{it.d}</p>}
              </figcaption>
            </figure>
          ))}
        </div>
        {t.note && <p className="lp-evgal-note" data-reveal>{t.note}</p>}
      </div>
    </section>
  );
}

/* ===== S-MODEL 当日撮影するモデル ===== */
function Model({ cfg }) {
  const m = cfg.model; if (!m) return null;
  return (
    <section className="lp-section lp-evmodel" id="lp-model">
      <div className="lp-wrap">
        <SecHead eyebrow={m.eyebrow} title={m.title} />
        {m.lead && <p className="lp-lead" data-reveal>{m.lead}</p>}
        <div className="lp-evmodel-grid" data-reveal>
          {(m.models || []).map((md, i) => (
            <figure className="lp-evmodel-card" key={i}>
              {md.photo ? <img src={md.photo} alt={md.name || ''} loading="lazy" /> : <image-slot class="ph-c" shape="rect" placeholder="モデル写真"></image-slot>}
              <figcaption>
                {md.name && <span className="lp-evmodel-name">{md.name}</span>}
                {md.note && <span className="lp-evmodel-note">{md.note}</span>}
              </figcaption>
            </figure>
          ))}
        </div>
        {m.note && <p className="lp-evgal-note" data-reveal>{m.note}</p>}
      </div>
    </section>
  );
}

/* ===== S-LOGISTICS 当日の流れ・持ち物・会場 ===== */
function Logistics({ cfg }) {
  const l = cfg.logistics; if (!l) return null;
  return (
    <section className="lp-section lp-evlog" id="lp-logistics">
      <div className="lp-wrap lp-narrow">
        <SecHead eyebrow={l.eyebrow} title={l.title} />
        {l.timeline && <div className="lp-evlog-timeline" data-reveal>
          {l.timeline.map((t, i) => (
            <div className="lp-evlog-step" key={i}>
              <span className="lp-evlog-time">{t.time}</span>
              <div className="lp-evlog-body">
                <div className="lp-evlog-t">{t.t}</div>
                {t.d && <div className="lp-evlog-d">{t.d}</div>}
              </div>
            </div>
          ))}
        </div>}
        {l.bring && <div className="lp-evlog-box" data-reveal>
          <div className="lp-evlog-box-h">{evStar} 持ち物</div>
          <ul className="lp-evlog-list">{l.bring.map((x, i) => <li key={i}>{x}</li>)}</ul>
        </div>}
        {l.provided && <div className="lp-evlog-box" data-reveal>
          <div className="lp-evlog-box-h">{evStar} 天狼院がご用意するもの</div>
          <ul className="lp-evlog-list">{l.provided.map((x, i) => <li key={i}>{x}</li>)}</ul>
        </div>}
        {l.note && <p className="lp-evgal-note" data-reveal>{l.note}</p>}
      </div>
    </section>
  );
}

/* ===== S-CALENDAR 開催回を月カレンダーで（会場ごと切替）＝既存 .cal CSS(styles.css)流用・LPの実開催回(/api/lp/sessions)で描画 ===== */
/* 開催日が今日（日本時間）より前の回は出さない＝台帳で閉じる前の間にも、過ぎた回を並べないため */
const evTodayJst = () => new Date(Date.now() + 9 * 3600e3).toISOString().slice(0, 10);
const evNotPast = (r) => !r || !r.date || String(r.date).slice(0, 10) >= evTodayJst();

function PortraitCalendar({ cfg, venue, setVenue }) {
  const c = cfg.calendar; if (!c) return null;
  const lpKey = (cfg.offer && cfg.offer.lpKey) || (cfg.meta && cfg.meta.id) || '';
  const [rows, setRows] = useEvState(null);
  const [localStore, setLocalStore] = useEvState('ALL');
  const store = venue != null ? venue : localStore;          // ★共有会場状態（講師帯/受講生ギャラリーと連動）
  const setStore = setVenue || setLocalStore;
  const [month, setMonth] = useEvState(() => { const d = new Date(); return new Date(d.getFullYear(), d.getMonth(), 1); });
  useEvEffect(() => {
    let alive = true;
    fetch('/api/lp/sessions?lp=' + encodeURIComponent(lpKey))
      .then(r => r.json()).then(d => { if (alive) setRows(((d && d.sessions) || []).filter(evNotPast)); })
      .catch(() => { if (alive) setRows([]); });
    return () => { alive = false; };
  }, [lpKey]);
  const all = rows || [];
  const stores = []; all.forEach(r => { if (r.store && stores.indexOf(r.store) < 0) stores.push(r.store); });
  const shown = store === 'ALL' ? all : all.filter(r => r.store === store);
  const ymd = (d) => `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`;
  const byDate = {}; shown.forEach(r => { (byDate[r.date] = byDate[r.date] || []).push(r); });
  const goBook = () => { const el = document.getElementById('lp-sessions'); if (el) el.scrollIntoView({ behavior: 'smooth' }); };
  const y = month.getFullYear(), m = month.getMonth();
  const startDow = new Date(y, m, 1).getDay(), daysIn = new Date(y, m + 1, 0).getDate();
  const DOWH = ['日', '月', '火', '水', '木', '金', '土'];
  const cells = []; for (let i = 0; i < startDow; i++) cells.push(null);
  for (let d = 1; d <= daysIn; d++) cells.push(new Date(y, m, d));
  while (cells.length % 7 !== 0) cells.push(null);
  const todayStr = ymd(new Date());
  return (
    <section className="lp-section lp-evcal" id="lp-calendar">
      <div className="lp-wrap lp-narrow">
        <SecHead eyebrow={c.eyebrow} title={c.title} />
        {c.lead && <p className="lp-lead" data-reveal>{c.lead}</p>}
        {stores.length > 1 && (
          <div className="lp-evstud-tabs" data-reveal>
            <button type="button" className={'lp-evstud-tab' + (store === 'ALL' ? ' is-on' : '')} onClick={() => setStore('ALL')}>全国</button>
            {stores.map(s => <button type="button" key={s} className={'lp-evstud-tab' + (store === s ? ' is-on' : '')} onClick={() => setStore(s)}>{s}</button>)}
          </div>
        )}
        <div className="cal-root ti" data-reveal>
          <div className="cal-grid-wrap">
            <div className="cal-bar">
              <button className="cal-nav" type="button" onClick={() => setMonth(new Date(y, m - 1, 1))} aria-label="前の月">‹</button>
              <div className="cal-month"><b>{y}</b><span>.</span><b>{String(m + 1).padStart(2, '0')}</b><i>{['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'][m]}</i></div>
              <button className="cal-nav" type="button" onClick={() => setMonth(new Date(y, m + 1, 1))} aria-label="次の月">›</button>
            </div>
            <div className="cal-grid">
              {DOWH.map((d, i) => <div key={d} className={'cal-dowh' + (i === 0 ? ' is-sun' : '') + (i === 6 ? ' is-sat' : '')}>{d}</div>)}
              {cells.map((cell, i) => {
                if (!cell) return <div key={i} className="cal-cell is-empty"></div>;
                const ds = ymd(cell), evs = byDate[ds] || [], dow = cell.getDay();
                return (
                  <div key={i} className={'cal-cell' + (ds === todayStr ? ' is-today' : '') + (evs.length ? ' has-ev' : '')}
                    onClick={() => evs.length && goBook()}>
                    <span className={'cal-dn' + (dow === 0 ? ' is-sun' : '') + (dow === 6 ? ' is-sat' : '')}>{cell.getDate()}</span>
                    <div className="cal-chips">
                      {evs.map((ev, j) => {
                        const soldout = (ev.seatsLeft != null && ev.seatsLeft <= 0) || ev.status !== 'open';
                        return <span key={j} className="cal-chip" style={{ background: 'rgba(214,188,126,.16)', color: 'var(--gold-700,#9a7b3f)' }} title={ev.store}>
                          <span className="cal-chip-dot" style={{ background: 'var(--gold-500,#c2a052)' }}></span>{ev.store}{soldout ? '・満席' : ''}</span>;
                      })}
                    </div>
                  </div>
                );
              })}
            </div>
          </div>
        </div>
        {rows === null
          ? <p className="lp-evgal-note" data-reveal>開催回を読み込み中…</p>
          : <p className="lp-evgal-note" data-reveal>{shown.length > 0 ? '◯印の日をタップ → 下の「開催回」からご予約ください。' : (c.emptyNote || 'この会場の開催回は現在ありません。次回をお待ちください。')}</p>}
      </div>
    </section>
  );
}

/* ===== S-SESSIONS 全国各店の開催回リスト＋予約（在庫はAPIから動的取得・会場/月/テーマで絞込） ===== */
function Sessions({ cfg, venue, setVenue }) {
  const s = cfg.sessions; if (!s) return null;
  const lpKey = (cfg.offer && cfg.offer.lpKey) || (cfg.meta && cfg.meta.id) || '';
  const tiers = (cfg.offer && cfg.offer.tiers) || [];
  const [tier, setTier] = useEvState((tiers[0] && tiers[0].key) || 'general');
  const [rows, setRows] = useEvState(null); // null=loading
  const [busy, setBusy] = useEvState('');
  // 絞り込み：会場は共有状態(あれば)＝カレンダー/タブと連動、月・テーマはこのセクション内。
  const [localVenue, setLocalVenue] = useEvState('ALL');
  const venueSel = venue != null ? venue : localVenue;
  const setVenueSel = setVenue || setLocalVenue;
  const [monthSel, setMonthSel] = useEvState('ALL');
  const [themeSel, setThemeSel] = useEvState('ALL');

  useEvEffect(() => {
    let alive = true;
    fetch('/api/lp/sessions?lp=' + encodeURIComponent(lpKey))
      .then(r => r.json()).then(d => { if (alive) setRows(((d && d.sessions) || []).filter(evNotPast)); })
      .catch(() => { if (alive) setRows([]); });
    return () => { alive = false; };
  }, [lpKey]);

  const cur = tiers.find(t => t.key === tier) || tiers[0] || {};
  const yen = n => '¥' + String(n || 0).replace(/\B(?=(\d{3})+(?!\d))/g, ',');
  // テーマ解決（カードと同じ・ただしフィルタ用は_defaultを含めない＝旧回は「全テーマ」でのみ表示）
  const themeOf = (r) => (cfg.sessionThemes && (cfg.sessionThemes[r.sessionSlug] || cfg.sessionThemes['d:' + r.date] || cfg.sessionThemes['m:' + String(r.date || '').slice(0, 7)])) || '';
  const themeShort = (th) => (th || '').split('─')[0].trim();
  const fmtMonth = (ym) => { const a = ym.split('-'); return a.length === 2 ? (+a[0]) + '年' + (+a[1]) + '月' : ym; };

  // 絞り込みの選択肢（読み込んだ開催回から動的生成）
  const all = rows || [];
  const stores = []; all.forEach(r => { if (r.store && stores.indexOf(r.store) < 0) stores.push(r.store); });
  const months = []; all.forEach(r => { const mo = (r.date || '').slice(0, 7); if (mo && months.indexOf(mo) < 0) months.push(mo); }); months.sort();
  /* 絞り込みは型の名（「─」の前）で束ねる＝同じ型で副題の違う月が、一つの札にまとまるように */
  const themeList = []; all.forEach(r => { const th = themeShort(themeOf(r)); if (th && themeList.indexOf(th) < 0) themeList.push(th); });
  const shown = all.filter(r =>
    (venueSel === 'ALL' || r.store === venueSel) &&
    (monthSel === 'ALL' || (r.date || '').slice(0, 7) === monthSel) &&
    (themeSel === 'ALL' || themeShort(themeOf(r)) === themeSel)
  );

  function book(slug, soldout) {
    if (soldout || busy) return;
    if (!window.lpCheckout) return;
    setBusy(slug);
    window.lpCheckout({ lp: lpKey, tier, sessionSlug: slug });
    // lpCheckout が遷移する。失敗時のために少し後で解除。
    setTimeout(() => setBusy(''), 4000);
  }

  return (
    <section className="lp-section lp-evsess" id="lp-sessions">
      <div className="lp-wrap lp-narrow">
        <SecHead eyebrow={s.eyebrow} title={s.title} />
        {s.lead && <p className="lp-lead" data-reveal>{s.lead}</p>}

        {/* 価格（プラン）選択 */}
        {tiers.length > 0 && <div className="lp-evsess-tiers" data-reveal>
          {tiers.map(t => (
            <button type="button" key={t.key} className={'lp-evsess-tier' + (tier === t.key ? ' is-on' : '')} onClick={() => setTier(t.key)}>
              <span className="lp-evsess-radio"></span>
              <span className="lp-evsess-tier-l">{t.label}</span>
              <span className="lp-evsess-tier-p">{yen(t.courseJpy != null ? t.courseJpy : t.total)}</span>
            </button>
          ))}
        </div>}
        {cur.note && <p className="lp-evsess-tiernote">{cur.note}</p>}

        {/* 絞り込み：会場 / 月 / テーマ */}
        {rows !== null && rows.length > 0 && (
          <div className="lp-evsess-filters" data-reveal>
            {stores.length > 1 && (
              <div className="lp-evsess-filterrow">
                <span className="lp-evsess-filterlabel">会場</span>
                <button type="button" className={'lp-evstud-tab' + (venueSel === 'ALL' ? ' is-on' : '')} onClick={() => setVenueSel('ALL')}>全国</button>
                {stores.map(st => <button type="button" key={st} className={'lp-evstud-tab' + (venueSel === st ? ' is-on' : '')} onClick={() => setVenueSel(st)}>{st}</button>)}
              </div>
            )}
            {months.length > 1 && (
              <div className="lp-evsess-filterrow">
                <span className="lp-evsess-filterlabel">月</span>
                <button type="button" className={'lp-evstud-tab' + (monthSel === 'ALL' ? ' is-on' : '')} onClick={() => setMonthSel('ALL')}>全期間</button>
                {months.map(mo => <button type="button" key={mo} className={'lp-evstud-tab' + (monthSel === mo ? ' is-on' : '')} onClick={() => setMonthSel(mo)}>{fmtMonth(mo)}</button>)}
              </div>
            )}
            {themeList.length > 1 && (
              <div className="lp-evsess-filterrow">
                <span className="lp-evsess-filterlabel">テーマ</span>
                <button type="button" className={'lp-evstud-tab' + (themeSel === 'ALL' ? ' is-on' : '')} onClick={() => setThemeSel('ALL')}>全テーマ</button>
                {themeList.map(th => <button type="button" key={th} className={'lp-evstud-tab' + (themeSel === th ? ' is-on' : '')} onClick={() => setThemeSel(th)}>{th}</button>)}
              </div>
            )}
          </div>
        )}

        {/* 開催回リスト */}
        <div className="lp-evsess-list" data-reveal key={venueSel + monthSel + themeSel}>
          {rows === null && <div className="lp-evsess-loading">開催回を読み込み中…</div>}
          {rows !== null && rows.length === 0 && <div className="lp-evsess-loading">{s.emptyNote || '現在受付中の開催回はありません。次回開催をお待ちください。'}</div>}
          {rows !== null && rows.length > 0 && shown.length === 0 && <div className="lp-evsess-loading">条件に合う開催回がありません。会場・月・テーマを変えてお試しください。</div>}
          {rows !== null && shown.map((r, i) => {
            const soldout = (r.seatsLeft != null && r.seatsLeft <= 0) || r.status !== 'open';
            const few = !soldout && r.seatsLeft != null && r.seatsLeft <= 3;
            // 各回のテーマ＝config(sessionThemes)を sessionSlug → 日（d:）→ 月（m:）の順で引く（DB非依存）。無ければ _default。
            const theme = (cfg.sessionThemes && (cfg.sessionThemes[r.sessionSlug] || cfg.sessionThemes['d:' + r.date] || cfg.sessionThemes['m:' + String(r.date || '').slice(0, 7)] || cfg.sessionThemes._default)) || '';
            return (
              <div className={'lp-evsess-row' + (soldout ? ' is-soldout' : '')} key={i}>
                <div className="lp-evsess-when">
                  {theme && <span className="lp-evsess-theme"><i>今回のテーマ</i>{theme}</span>}
                  <span className="lp-evsess-store">{r.store}</span>
                  <span className="lp-evsess-date">{r.date}{r.start ? ` ${r.start}` : ''}{r.end ? `–${r.end}` : ''}</span>
                  <span className="lp-evsess-inst">講師：{r.instructor || 'プロカメラマン'}</span>{/* 個別講師未設定の回（名古屋など）は「プロカメラマン」と表記 */}
                  {r.venue && <span className="lp-evsess-venue">{r.venue}</span>}
                </div>
                <div className="lp-evsess-act">
                  <span className={'lp-evsess-seats' + (few ? ' is-few' : '') + (soldout ? ' is-out' : '')}>
                    {soldout ? '満席' : (r.seatsLeft != null ? `残り ${r.seatsLeft} 席` : '受付中')}
                  </span>
                  <button type="button" className="lp-btn lp-btn-gold lp-evsess-btn" disabled={soldout || busy === r.sessionSlug} onClick={() => book(r.sessionSlug, soldout)}>
                    {soldout ? '満席' : (busy === r.sessionSlug ? '進む…' : 'この回を予約 →')}
                  </button>
                </div>
              </div>
            );
          })}
        </div>
        {s.note && <p className="lp-evgal-note" data-reveal>{s.note}</p>}
      </div>
    </section>
  );
}

/* ===== S-INSTRUCTOR（連動版＋簡易版プロフィール対応）=====
   会場タブで講師帯を切替。各会場の講師は2系統のいずれかで供給：
   ① フル・プロフィール型（/creators/<handle> の正本が window.LP_PROFILES にある）→ CDの Instructor(lp.jsx) にそのまま委譲＝厳密にCD意匠＋「全文→」リンク。
   ② 簡易版プロフィール（cfg.instructorsLite[key]＝LP内インラインデータ・専用ページ不要）→ 同じ .lp-inst* 意匠で自前描画。「全文→」は moreHref がある時だけ（旧イベントページ等）。
   会場解決：cfg.instructorsByStore[venue]（特定会場）→ 無ければ全会場の講師を重複排除して並べる（全国）→ それも無ければ cfg.instructors.handles。
   ＝実プロフィール未完成でも、簡易版で講師帯を出し「受注可能」にできる。フル作成後は instructorsByStore を handle に向けるだけでCD意匠へ昇格。 */
function evInstFromProfile(p, handle) {
  const hero = p.hero || {}, intro = p.intro || {};
  return {
    name: hero.name, cert: hero.cert, role: hero.role, photo: hero.photo, focusBand: hero.focusBand || hero.focus,
    facts: (intro.facts || []).slice(0, 3),
    works: (p.clients && p.clients.items) ? p.clients.items.slice(0, 7) : [],
    worksLabel: (p.clients && p.clients.label) || '主な仕事・著作',
    bio: (intro.bio && intro.bio.length) ? intro.bio : (hero.tagline ? [hero.tagline] : []),
    reading: hero.reading, moreHref: '/creators/' + (p.handle || handle), moreLabel: 'プロフィール全文を見る →',
  };
}
function evInstFromLite(l) {
  return {
    name: l.name, cert: l.cert, role: l.role, photo: l.photo, focusBand: l.focusBand || l.focus,
    facts: (l.facts || []).slice(0, 3),
    works: (l.works || []).slice(0, 7), worksLabel: l.worksLabel || '主な仕事',
    bio: l.bio || (l.tagline ? [l.tagline] : []),
    reading: l.reading, moreHref: l.moreHref || '', moreLabel: l.moreLabel || '詳しいプロフィール →',
  };
}
function EvInstBand({ vm, ins, idx }) {
  const facts = vm.facts || [];
  const capParas = ins.photoCaption ? [ins.photoCaption] : (vm.bio && vm.bio.length ? vm.bio : []);
  const capName = (!ins.photoCaption && vm.reading) ? vm.reading : null;
  return (
    <div className="lp-inst-band" data-reveal key={idx}>
      <div className="lp-inst-body">
        <div className="lp-inst-eyebrow">{ins.eyebrow || 'Instructor — 講師'}</div>
        {idx === 0 && ins.headline && <h2 className="lp-inst-headline">{ins.headline}</h2>}
        <div className="lp-inst-id">
          <span className="lp-inst-name">{vm.name}</span>
          {vm.cert && <span className="lp-inst-cert">✦ 天狼院書店 {vm.cert}</span>}
        </div>
        {vm.role && <div className="lp-inst-role">{vm.role}</div>}
        {facts.length > 0 && <div className="lp-inst-stats">{facts.map((f, j) => (
          <div className="lp-inst-stat" key={j}><span className="lp-inst-stat-n">{f.n}<i>{f.u}</i></span><span className="lp-inst-stat-l">{f.l}</span></div>
        ))}</div>}
        {vm.works && vm.works.length > 0 && (
          <div className="lp-inst-works">
            <span className="lp-inst-works-l">{vm.worksLabel}</span>
            <span className="lp-inst-works-v">{vm.works.join(' ・ ')}</span>
          </div>
        )}
        {vm.moreHref && <a className="lp-inst-go" href={vm.moreHref}>{vm.moreLabel}</a>}
      </div>
      <div className="lp-inst-bg">
        {vm.photo
          ? <img src={vm.photo} alt="" aria-hidden="true" loading="lazy" style={{ objectPosition: vm.focusBand || 'center 32%' }} />
          : <image-slot class="ph-c" shape="rect" placeholder={vm.name || '講師'}></image-slot>}
        {capParas.length > 0 && (
          <div className="lp-inst-bg-cap">
            {capParas.map((para, k) => (
              <p className="lp-inst-bg-cap-p" key={k}>{k === 0 && capName ? <><span className="lp-inst-bg-cap-name">{capName}</span>｜{para}</> : para}</p>
            ))}
          </div>
        )}
      </div>
    </div>
  );
}
function EventInstructor({ cfg, venue }) {
  const ins = cfg.instructors; if (!ins) return null;
  const reg = (typeof window !== 'undefined' && window.LP_PROFILES) || {};
  const map = cfg.instructorsByStore || null;
  const lite = cfg.instructorsLite || null;
  let keys;
  if (map && venue && venue !== 'ALL' && map[venue]) keys = [].concat(map[venue]);
  else if (map) { keys = []; Object.keys(map).forEach(st => [].concat(map[st]).forEach(k => { if (keys.indexOf(k) < 0) keys.push(k); })); if (!keys.length) keys = ins.handles || []; }
  else keys = ins.handles || [];
  const vms = keys.map(k => reg[k] ? { vm: evInstFromProfile(reg[k], k), full: true } : (lite && lite[k] ? { vm: evInstFromLite(lite[k]), full: false } : null)).filter(Boolean);
  if (!vms.length) return null;
  // 全員フル・プロフィール → CDの Instructor に委譲（厳密CD意匠）
  if (vms.every(x => x.full) && typeof Instructor !== 'undefined') {
    const merged = Object.assign({}, cfg, { instructors: Object.assign({}, ins, { handles: keys.filter(k => reg[k]) }) });
    return React.createElement(Instructor, { cfg: merged });
  }
  // 簡易版を含む → 自前の統一バンド（同じ .lp-inst* 意匠）
  return (
    <section className="lp-section lp-instructors" id="lp-instructors">
      <div className="lp-wrap">{vms.map((x, i) => <EvInstBand vm={x.vm} ins={ins} idx={i} key={i} />)}
        {ins.note && <p className="lp-evgal-note lp-inst-note" data-reveal>{ins.note}</p>}</div>
    </section>
  );
}

/* ===== 一年のテーマ表（cfg.year）＝その年の回とテーマを一覧で。過ぎた月は出さない ===== */
function YearThemes({ cfg }) {
  const y = cfg.year; if (!y || !(y.rows || []).length) return null;
  const rows = y.rows.filter(r => evNotPast({ date: r.date }));
  if (!rows.length) return null;
  const wd = ['日', '月', '火', '水', '木', '金', '土'];
  const fmt = (d) => { const a = d.split('-').map(Number); const w = new Date(Date.UTC(a[0], a[1] - 1, a[2])).getUTCDay(); return { m: a[1], d: a[2], w: wd[w] }; };
  return (
    <section className="lp-section lp-evyear" id="lp-year">
      <div className="lp-wrap lp-narrow">
        <SecHead eyebrow={y.eyebrow} title={y.title} />
        {y.lead && <p className="lp-lead" data-reveal>{y.lead}</p>}
        <ol className="lp-evyear-list" data-reveal>
          {rows.map(r => { const f = fmt(r.date); return (
            <li className="lp-evyear-row" key={r.date}>
              <span className="lp-evyear-date">{y.monthOnly ? <b>{f.m}月</b> : <><b>{f.m}/{f.d}</b><i>（{f.w}）</i></>}</span>
              <span className="lp-evyear-kind">{r.kind}</span>
              <span className="lp-evyear-sub">{r.sub}</span>
            </li>); })}
        </ol>
        {y.note && <p className="lp-evgal-note" data-reveal>{y.note}</p>}
      </div>
    </section>
  );
}

/* ===== 二つの形の違い（cfg.compare）＝受け放題だけの形と、新しい仕組みを横に並べる ===== */
function SystemCompare({ cfg }) {
  const c = cfg.compare; if (!c || !(c.rows || []).length) return null;
  return (
    <section className="lp-section lp-evcmp" id="lp-compare">
      <div className="lp-wrap lp-narrow">
        <SecHead eyebrow={c.eyebrow} title={c.title} />
        {c.lead && <p className="lp-lead" data-reveal>{c.lead}</p>}
        <div className="lp-evcmp-table" role="table" data-reveal>
          <div className="lp-evcmp-row lp-evcmp-head" role="row">
            <span role="columnheader"></span>
            {c.cols.map((h, i) => <span role="columnheader" key={i} className={i === 1 ? 'is-new' : ''}>{h}</span>)}
          </div>
          {c.rows.map((r, i) => (
            <div className="lp-evcmp-row" role="row" key={i}>
              <span role="rowheader" className="lp-evcmp-k">{r.k}</span>
              {r.v.map((v, j) => <span role="cell" key={j} className={(j === 1 ? 'is-new' : '') + (v ? '' : ' is-none')}>{v || 'ありません'}</span>)}
            </div>
          ))}
        </div>
        {c.cta && <div className="lp-evcmp-cta" data-reveal>
          <a className="lp-btn lp-btn-gold lp-evcmp-btn" href={c.cta.href}>{c.cta.label}</a>
          {c.cta.note && <p className="lp-evgal-note">{c.cta.note}</p>}
        </div>}
      </div>
    </section>
  );
}

/* ===== ルート：イベントLP構成（共有コンポーネントを再利用） ===== */
/* ===== パーフェクト・ポートレートゼミ NEO（cfg.zemi）＝三ヶ月の連続ゼミを期ごとに申し込む。額と残りの席は申込みの口から読む ===== */
function ZemiTerms({ cfg }) {
  const z = cfg.zemi; if (!z) return null;
  const stores = []; (z.terms || []).forEach(t => { if (stores.indexOf(t.store) < 0) stores.push(t.store); });
  const [plan, setPlan] = useEvState(undefined);
  const [fbPlan, setFbPlan] = useEvState(null);
  const [seats, setSeats] = useEvState({});
  const [tier, setTier] = useEvState('general');
  const [fbTier, setFbTier] = useEvState('general');
  const [store, setStore] = useEvState(stores[0] || '');
  const [busy, setBusy] = useEvState('');
  useEvEffect(() => {
    let alive = true;
    const j = (u) => fetch(u).then(r => (r.ok ? r.json() : null)).catch(() => null);
    Promise.all([j('/api/lp/plan/portrait-zemi'), j('/api/lp/plan/portrait-zemi-fb'), j('/api/lp/sessions?lp=portrait-zemi'), j('/api/lp/sessions?lp=portrait-zemi-fb')])
      .then(([p, pf, s1, s2]) => {
        if (!alive) return;
        setPlan(p && p.ok ? p : null); setFbPlan(pf && pf.ok ? pf : null);
        const m = {}; [s1, s2].forEach(s => ((s && s.sessions) || []).forEach(r => { m[r.sessionSlug] = r; }));
        setSeats(m);
      });
    return () => { alive = false; };
  }, []);
  const yen = n => '¥' + Number(n || 0).toLocaleString('ja-JP');
  const wd = ['日', '月', '火', '水', '木', '金', '土'];
  const md = (iso) => { const a = iso.split('-').map(Number); return a[1] + '/' + a[2] + '（' + wd[new Date(Date.UTC(a[0], a[1] - 1, a[2])).getUTCDay()] + '）'; };
  const T = plan && plan.tiers;
  const tiers = T ? [
    { key: 'general', label: '一般', total: T.general && T.general.courseJpy },
    { key: 'bookclub-member', label: '天狼院読書クラブ with AI 会員', total: T['bookclub-member'] && T['bookclub-member'].courseJpy, note: '会員としてログインしてお申し込みください。' },
    { key: 'bookclub-join', label: '読書クラブに同時入会', total: T['bookclub-join'] && T['bookclub-join'].courseJpy, note: '＋会費 月 ' + yen(plan.clubMonthlyJpy || 11000) + '（毎月の自動更新）が始まります。' },
  ].filter(t => t.total) : [];
  const cur = tiers.find(t => t.key === tier) || tiers[0];
  const FT = fbPlan && fbPlan.tiers;
  const fbTiers = FT ? [
    { key: 'general', label: '一般', total: FT.general && FT.general.courseJpy },
    { key: 'bookclub-member', label: '会員', total: FT['bookclub-member'] && FT['bookclub-member'].courseJpy },
  ].filter(t => t.total) : [];
  const fbCur = fbTiers.find(t => t.key === fbTier) || fbTiers[0];
  const shown = (z.terms || []).filter(t => t.store === store && evNotPast({ date: t.days[0][0] }));
  const ins = (z.instructors || []).find(x => x.store === store);
  function book(lp, slug, tk) {
    if (busy || !window.lpCheckout) return;
    setBusy(slug);
    window.lpCheckout({ lp, tier: tk, sessionSlug: slug });
    setTimeout(() => setBusy(''), 4000);
  }
  const seatLine = (r) => !r ? '' : (r.status !== 'open' || (r.seatsLeft || 0) <= 0) ? '満席' : '残り ' + r.seatsLeft + ' 席';
  return (
    <section className="lp-section lp-evzemi" id="lp-zemi">
      <div className="lp-wrap lp-narrow">
        <SecHead eyebrow={z.eyebrow} title={z.title} />
        {z.lead && <p className="lp-lead" data-reveal>{z.lead}</p>}
        <ol className="lp-evzemi-cycle" data-reveal>
          {(z.cycle || []).map((c, i) => <li key={i}><b>{c.k}</b><i>{c.t}</i><p>{c.d}</p></li>)}
        </ol>
        <ol className="lp-evzemi-months" data-reveal>
          {(z.months || []).map((m, i) => <li key={i}><span>{m.m}</span><b>{m.k}</b><p>{m.d}</p></li>)}
        </ol>
        <ul className="lp-evzemi-inc" data-reveal>{(z.includes || []).map(x => <li key={x}>{x}</li>)}</ul>

        <h3 className="lp-evzemi-h" data-reveal>2027年の日程と、お申し込み</h3>
        {plan === undefined && <p className="lp-evgal-note">額と残りの席を読み込んでいます…</p>}
        {plan === null && <p className="lp-evzemi-ng">額を読み込めませんでした。少し時間をおいて、頁を開き直してください。</p>}
        {tiers.length > 0 && <div className="lp-evsess-tiers" data-reveal>
          {tiers.map(t => (
            <button type="button" key={t.key} className={'lp-evsess-tier' + (cur && cur.key === t.key ? ' is-on' : '')} onClick={() => setTier(t.key)}>
              <span className="lp-evsess-radio"></span>
              <span className="lp-evsess-tier-l">{t.label}</span>
              <span className="lp-evsess-tier-p">月 {yen(Math.round(t.total / 3))}<small>（3ヶ月 {yen(t.total)}・一括）</small></span>
            </button>
          ))}
        </div>}
        {cur && cur.note && <p className="lp-evsess-tiernote">{cur.note}</p>}

        <div className="lp-evsess-filterrow lp-evzemi-stores" data-reveal>
          <span className="lp-evsess-filterlabel">会場</span>
          {stores.map(st => <button type="button" key={st} className={'lp-evstud-tab' + (store === st ? ' is-on' : '')} onClick={() => setStore(st)}>{st}</button>)}
        </div>
        {ins && <p className="lp-evzemi-ins">{ins.name ? <><b>講師 {ins.name}</b>　{ins.line}</> : ins.line}</p>}

        <div className="lp-evzemi-terms">
          {shown.map(t => { const r = seats[t.slug]; const full = !!r && (r.status !== 'open' || (r.seatsLeft || 0) <= 0); return (
            <article className="lp-evzemi-term" key={t.slug} data-reveal>
              <header><b>{t.store}　{t.term}</b>{r && <span className={full ? 'is-full' : ''}>{seatLine(r)}</span>}</header>
              <ol>
                {t.days.map((d, i) => { const x = d[2] || {}; return <li key={i}><span className="m">{i + 1}ヶ月目</span><span>撮影会 <b>{md(d[0])}{x.or ? ' または ' + md(x.or) : ''}</b> {t.shoot || '10:00〜13:00'}</span><span>講評会 <b>{md(d[1])}</b> 19:00〜21:00（オンライン）</span>{x.note ? <span className="n">※{x.note}</span> : null}</li>; })}
              </ol>
              {cur && <button type="button" className="lp-btn lp-btn-gold lp-evzemi-go" disabled={full || busy === t.slug} onClick={() => book('portrait-zemi', t.slug, cur.key)}>
                {full ? 'この期は満席です' : busy === t.slug ? '決済の画面を準備しています…' : 'この期に申し込む（' + yen(cur.total) + '）'}
              </button>}
              {store === '東京' && fbCur && (() => { const fs = t.slug.replace('tokyo-', 'tokyo-fb-'); const fr = seats[fs]; const ffull = !!fr && (fr.status !== 'open' || (fr.seatsLeft || 0) <= 0); return (
                <div className="lp-evzemi-fb">
                  <p><b>{z.fb && z.fb.title}</b>{fr && <span>{seatLine(fr)}</span>}</p>
                  {z.fb && z.fb.d && <p className="d">{z.fb.d}</p>}
                  <div className="row">
                    {fbTiers.map(ft => <button type="button" key={ft.key} className={'lp-evstud-tab' + (fbCur.key === ft.key ? ' is-on' : '')} onClick={() => setFbTier(ft.key)}>{ft.label} 月 {yen(Math.round(ft.total / 3))}</button>)}
                    <button type="button" className="lp-btn lp-evzemi-fbgo" disabled={ffull || busy === fs} onClick={() => book('portrait-zemi-fb', fs, fbCur.key)}>{ffull ? '満席です' : '講評会だけで申し込む（' + yen(fbCur.total) + '）'}</button>
                  </div>
                </div>); })()}
            </article>); })}
          {shown.length === 0 && <p className="lp-evgal-note">この会場の 2027 年の期は、受付を終えました。</p>}
        </div>
        {z.schedNote && <p className="lp-evgal-note" data-reveal>{z.schedNote}</p>}
        {(z.notes || []).length > 0 && <ul className="lp-evzemi-notes" data-reveal>{z.notes.map((n, i) => <li key={i}>{n}</li>)}</ul>}
      </div>
    </section>
  );
}

function EventLP({ cfg }) {
  const [showSticky, setShowSticky] = useEvState(false);
  const [venue, setVenue] = useEvState('ALL');   // ★会場の共有状態＝受講生ギャラリー/カレンダー/講師帯が連動
  useEvEffect(() => {
    const onScroll = () => setShowSticky(window.scrollY > window.innerHeight * 0.9);
    onScroll(); addEventListener('scroll', onScroll, { passive: true });
    return () => removeEventListener('scroll', onScroll);
  }, []);
  // CTA は「開催回を選ぶ」＝S-SESSIONS へスクロール
  const apply = () => { const el = document.getElementById('lp-sessions'); if (el) el.scrollIntoView({ behavior: 'smooth' }); };

  return (
    <div className="lp-root ti" data-section={'lp-' + cfg.meta.id}>
      <Hero cfg={cfg} onApply={apply} />
      <CinematicReel cfg={cfg} />
      <Authority cfg={cfg} />
      <Proof cfg={cfg} />
      <Gallery cfg={cfg} />
      <EventInstructor cfg={cfg} venue={venue} />
      <Problem cfg={cfg} />
      <Solution cfg={cfg} />
      <Model cfg={cfg} />
      <BeforeAfter cfg={cfg} />
      <StudentGallery cfg={cfg} venue={venue} setVenue={setVenue} />
      <Curriculum cfg={cfg} />
      <Logistics cfg={cfg} />
      <ThemeRotation cfg={cfg} />
      <YearThemes cfg={cfg} />
      <Tickets cfg={cfg} />
      <SystemCompare cfg={cfg} />
      <PortraitCalendar cfg={cfg} venue={venue} setVenue={setVenue} />
      <Sessions cfg={cfg} venue={venue} setVenue={setVenue} />
      <ZemiTerms cfg={cfg} />
      <Testimony cfg={cfg} />
      <FAQ cfg={cfg} />
      <Ecosystem cfg={cfg} />
      <FinalCTA cfg={cfg} onApply={apply} />
      <StickyCTA cfg={cfg} show={showSticky} onApply={apply} />
    </div>
  );
}

Object.assign(window, { EventLP, YearThemes, SystemCompare, ZemiTerms, EventInstructor, CinematicReel, ThemeRotation, Tickets, Gallery, StudentGallery, BeforeAfter, Model, Logistics, PortraitCalendar, Sessions });
