// Three landing-page templates: Product, Content, Newsletter.
// Desktop (> 810 px) — original 1920-px fixed layout (scaled by index.html JS).
// Tablet (≤ 810 px) / Mobile (≤ 390 px) — fluid responsive layouts per Figma V3.

// ─── Shared primitives ────────────────────────────────────────────────────────

const NotionMockup = ({ density = 1, simple, kicker, title, calendar, rows }) => {
  const k = density;
  if (simple) {
    return (
      <div style={{ width: '100%', height: '100%', background: '#fff', padding: '22px 18px 14px', fontFamily: 'Inter', color: '#101010', overflow: 'hidden', display: 'flex', flexDirection: 'column', gap: 10 }}>
        {kicker && <div style={{ fontSize: 10, color: '#a59c93' }}>{kicker}</div>}
        {title && <div className="serif" style={{ fontSize: 18, lineHeight: 1 }}>{title}</div>}
        {calendar &&
        <div style={{ display: 'grid', gridTemplateColumns: 'repeat(7,1fr)', gap: 3 }}>
            {Array.from({ length: 28 }).map((_, i) => <div key={i} style={{ height: 10, borderRadius: 2, background: [3, 9, 14, 20].includes(i) ? '#dec1af' : '#f3ece6' }} />)}
          </div>
        }
        <div style={{ height: 6, background: '#101010', borderRadius: 2, width: '52%', marginTop: 2 }} />
        {(rows || [70, 90, 65]).map((w, i) => <div key={i} style={{ height: 4, background: '#e8e2dc', borderRadius: 2, width: w + '%' }} />)}
      </div>);

  }
  const cp = 16 * k;
  return (
    <div style={{ width: '100%', height: '100%', background: '#fff', position: 'relative', fontFamily: 'Inter', color: '#101010', overflow: 'hidden', padding: cp, display: 'flex', flexDirection: 'column', gap: 14 * k }}>
      <div style={{ width: 30 * k, height: 30 * k, borderRadius: 5, background: '#fff', border: '1px solid #e6e6e6', display: 'grid', placeItems: 'center', fontFamily: 'Inter', fontWeight: 800, fontSize: 18 * k, color: '#000', lineHeight: 1 }}>N</div>
      <div style={{ textAlign: 'center', display: 'flex', flexDirection: 'column', gap: 6 * k, padding: `${10 * k}px 0 ${6 * k}px` }}>
        <div style={{ fontSize: 10 * k, letterSpacing: '0.4em', color: '#101010' }}>★ ★ ★ ★ ★</div>
        <div className="serif" style={{ fontSize: 30 * k, lineHeight: 1.05, color: '#101010' }}>Athletic Training &amp; Nutrition</div>
        <div className="serif italic" style={{ fontSize: 18 * k, color: '#101010', lineHeight: 1 }}>Tracker and Planner</div>
        <svg width={80 * k} height={6 * k} viewBox="0 0 80 6" style={{ margin: '0 auto' }}><path d="M 0 3 C 20 -1 60 7 80 3" stroke="#101010" strokeWidth="0.6" fill="none" /></svg>
        <div style={{ fontSize: 9 * k, color: '#101010', letterSpacing: '0.02em' }}>Master your training, workouts and nutrition</div>
      </div>
      <div style={{ background: '#fff', border: '1px solid #ececec', borderRadius: 8, padding: `${10 * k}px ${12 * k}px`, display: 'flex', flexDirection: 'column', gap: 10 * k, boxShadow: '0 4px 20px rgba(0,0,0,0.04)' }}>
        <div style={{ fontFamily: 'Inter', fontWeight: 600, fontSize: 11 * k, color: '#101010' }}>Movement &amp; Nutrition</div>
        <div style={{ fontSize: 9 * k, color: '#a59c93', fontWeight: 500 }}>Homepage</div>
        <div style={{ display: 'grid', gridTemplateColumns: 'repeat(4,1fr)', gap: 6 * k }}>
          {['Workout', 'Training', 'Nutrition', 'Goals'].map((t) => <div key={t} style={{ padding: `${5 * k}px ${4 * k}px`, background: '#f7f4ef', borderRadius: 4, display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 3 * k }}><div style={{ fontSize: 9 * k, fontWeight: 500, color: '#101010' }}>{t}</div><div style={{ fontSize: 6 * k, color: '#a59c93' }}>● {t.toLowerCase()}</div></div>)}
        </div>
        <div style={{ display: 'flex', gap: 6 * k, marginTop: 4 * k }}>
          <div style={{ flex: 1, display: 'flex', flexDirection: 'column', gap: 4 * k }}>
            <div style={{ fontSize: 7 * k, color: '#a59c93', display: 'flex', justifyContent: 'space-between' }}><span>Goals</span><span>Workout · Training · Nutrition</span></div>
            <div style={{ fontSize: 6 * k, color: '#a59c93', textTransform: 'uppercase', letterSpacing: 1 }}>May 2026</div>
            <div style={{ display: 'grid', gridTemplateColumns: 'repeat(7,1fr)', gap: 2 * k }}>
              {Array.from({ length: 35 }).map((_, i) => <div key={i} style={{ height: 11 * k, borderRadius: 2, background: i === 12 ? '#dec1af' : i % 6 === 0 ? '#f3ece6' : '#fafafa', border: '0.5px solid #f0f0f0', display: 'grid', placeItems: 'center', fontSize: 5 * k, color: '#a59c93' }}>{i + 1}</div>)}
            </div>
          </div>
          <div style={{ width: 90 * k, display: 'flex', flexDirection: 'column', gap: 3 * k }}>
            <div style={{ fontSize: 6 * k, color: '#a59c93' }}>Quick Notes</div>
            {[80, 70, 90, 60, 75, 55].map((w, i) => <div key={i} style={{ height: 3 * k, width: w + '%', background: '#ececec', borderRadius: 1 }} />)}
          </div>
        </div>
      </div>
      <div style={{ marginTop: 'auto', display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
        <div style={{ fontSize: 7 * k, color: '#a59c93' }}>4 colors available</div>
        <div style={{ display: 'flex', gap: 4 * k }}>{['#f5d5c1', '#e6c0a8', '#cf9c80', '#c4a382'].map((c) => <div key={c} style={{ width: 8 * k, height: 8 * k, borderRadius: '50%', background: c }} />)}</div>
      </div>
      <div style={{ fontSize: 6 * k, color: '#101010', textAlign: 'center', letterSpacing: '0.02em', borderTop: '0.5px solid #ececec', paddingTop: 6 * k }}>Daily Workout Planner · Cardio, Muscle, Stretching · Training Hub · Meal Planner · Pantry Checklist</div>
    </div>);

};

// iPad image — desktop fixed 800×800
const IPadImage = ({ onClick, src = 'assets/product-listing-1.jpg' }) =>
<div style={{ width: 800, height: 800, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
    <img key={src} src={src} alt="Wellness Yoga Journey template — preview" onClick={onClick}
  style={{ width: 800, height: 800, objectFit: 'cover', cursor: onClick ? 'zoom-in' : 'default', borderRadius: 24, transition: 'opacity 200ms ease' }} />
  </div>;


// Desktop thumb — fixed 160×160
const Thumb = ({ active, onClick, src, alt }) =>
<div onClick={onClick} role="button" aria-label={alt} style={{
  width: 160, height: 160, overflow: 'hidden', cursor: 'pointer', flexShrink: 0,
  backgroundImage: `url(${src})`, backgroundSize: 'cover', backgroundPosition: '50%',
  boxShadow: active ? '0 10px 28px rgba(0,0,0,0.08)' : 'none',
  transform: active ? 'translateY(-2px)' : 'none', transition: 'all 180ms ease',
  border: `2px solid ${active ? '#D3D2D2' : '#F0F0F0'}`, borderRadius: 16
}} />;


const PlayBadge = ({ size = 96 }) => {
  // Triangle is 32×32 with rounded corners (paint stroked as well so the joins
  // pick up the 3 px radius via stroke-linejoin: round).
  const triangle =
  <svg width="32" height="32" viewBox="0 0 32 32" fill="none">
      <path d="M9 5 L26 16 L9 27 Z" fill="#fff" stroke="#fff" strokeWidth="3"
    strokeLinejoin="round" strokeLinecap="round" />
    </svg>;

  return (
    <div style={{ width: size, height: size, borderRadius: '50%',
      background: 'rgba(16,16,16,0.85)', display: 'grid', placeItems: 'center',
      backdropFilter: 'blur(8px)', boxShadow: '0 12px 40px rgba(0,0,0,0.25)' }}>
      {triangle}
    </div>);

};

// ─── 1) PRODUCT ───────────────────────────────────────────────────────────────

const PRODUCT_THUMBS = [
{ src: 'assets/product-listing-1.jpg', alt: 'Overview' },
{ src: 'assets/product-listing-2.jpg', alt: 'Home — My Journey' },
{ src: 'assets/product-listing-3.jpg', alt: 'Workout Hub' },
{ src: 'assets/product-listing-4.jpg', alt: 'Daily Workout' },
{ src: 'assets/product-listing-5.jpg', alt: 'Training' },
{ src: 'assets/product-listing-6.jpg', alt: 'Training Tracker' },
{ src: 'assets/product-listing-7.jpg', alt: 'Nutrition Hub' },
{ src: 'assets/product-listing-8.jpg', alt: 'Daily Meal Planner' },
{ src: 'assets/product-listing-9.jpg', alt: 'Pantry & Vitamins' }];


const PRODUCT_DISCLAIMER = "Along with my free template, we'll add you to our newsletter so you're the first to know when we drop new products and insights. By submitting your email, you're opting in. Unsubscribe anytime - no hard feelings.";

const ProductTemplate = ({ formState, submitEmail, openLightbox, defaultEmail, forcedError }) => {
  const [activeIdx, setActiveIdx] = React.useState(-1);
  const effectiveIdx = activeIdx >= 0 ? activeIdx : 0;
  const mainSrc = PRODUCT_THUMBS[effectiveIdx].src;
  const bp = useBreakpoint();
  const pricing = React.useContext(PricingContext);

  const sharedForm = pricing.model === 'paid' ? <PaidCTA /> :
  <div style={{ position: 'relative' }}>
      <EmailForm defaultEmail={defaultEmail} forcedError={forcedError} onSubmit={submitEmail} formState={formState}
    copy={{ cta: 'Download', sentCta: 'Sent', disclaimer: PRODUCT_DISCLAIMER }} />
      <SuccessToast visible={formState === 'success'} message="Check your email ! It's waiting for you." />
    </div>;


  // ── Desktop: exact original ────────────────────────────────────────────────
  // ── Large Desktop ───────────────────────────────────────────────────────
  if (bp === 'largeDesktop') {
    return (
      <main style={{ position: 'relative', background: '#fff' }}>
        <HeroBackdrop />
        <NavBar brand="Yoga with Tara" />
        <section style={{ position: 'relative', display: 'flex', flexDirection: 'column', gap: 56, alignItems: 'center', padding: "256px 128px 80px" }}>
          <PageTitle line1="Get my wellness template" line2="for Free" />
          <div style={{ width: 1536, display: 'flex', gap: 88, alignItems: 'center', justifyContent: 'center' }}>
            <div style={{ display: 'flex', gap: 32, alignItems: 'center' }}>
              {/* Scroll zone capped at main image height (800px). Horizontal padding+negative
                                   margin lets the active thumb's side shadow render past the clip box. */}
              <div className="spl-thumbs" style={{ display: 'flex', flexDirection: 'column', gap: 14, height: 800, overflowY: 'auto', padding: '0 40px', margin: '0 -40px', scrollbarWidth: 'none' }}>
                <style>{`.spl-thumbs::-webkit-scrollbar{display:none}`}</style>
                {PRODUCT_THUMBS.map((p, i) => <Thumb key={i} active={i === activeIdx} onClick={() => setActiveIdx(i)} src={p.src} alt={p.alt} />)}
              </div>
              <IPadImage src={mainSrc} onClick={() => openLightbox({ kind: 'ipad', idx: effectiveIdx })} />
            </div>
            <div style={{ width: 655, padding: '24px 0', display: 'flex', flexDirection: 'column', gap: 48, position: 'relative' }}>
              <div style={{ display: 'flex', flexDirection: 'column', gap: 12, padding: "0px 16px 0px 0px" }}>
                <h2 style={{ margin: 0, fontFamily: 'Inter', fontWeight: 500, fontSize: 32, letterSpacing: '-0.05em', color: '#101010' }}>Wellness Yoga Journey by Tara</h2>
                <PricePill />
              </div>
              <Highlights label="Highlights" items={['Available on Notion', 'Unlimited page duplications', 'Free beginner yoga course included']} />
              {sharedForm}
            </div>
          </div>
        </section>
        <BioSection portrait="assets/tara.jpg" headline="I'm Tara !" role="Yoga teacher, recovering overthinker, and lifelong student of the breath." story="I came to yoga ten years ago burned out from a corporate desk job, and what started as a way to stretch my back turned into a complete shift in how I move through the world. Today, I teach slow flow, restorative, and breath-led practices that help you reconnect with the body you've been carrying around all day. Whether you're brand new to a mat or have been practicing for years, my classes meet you exactly where you are. Come join me!" />
        <Footer tagline="A space where you can be fully you" sub="Check my channel Yoga with Tara" />
      </main>);

  }

  if (bp === 'desktop') {
    return (
      <main style={{ position: 'relative', background: '#fff' }}>
        <HeroBackdrop />
        <NavBar brand="Yoga with Tara" />
        <section style={{ position: 'relative', display: 'flex', flexDirection: 'column', gap: 56, alignItems: 'center', padding: "256px 128px 80px" }}>
          <PageTitle line1="Get my wellness template" line2="for Free" />
          <div style={{ width: 1536, display: 'flex', gap: 88, alignItems: 'center', justifyContent: 'center' }}>
            <div style={{ display: 'flex', gap: 32, alignItems: 'center' }}>
              {/* Scroll zone capped at main image height (800px). Horizontal padding+negative
                                   margin lets the active thumb's side shadow render past the clip box. */}
              <div className="spl-thumbs" style={{ display: 'flex', flexDirection: 'column', gap: 14, height: 800, overflowY: 'auto', padding: '0 40px', margin: '0 -40px', scrollbarWidth: 'none' }}>
                <style>{`.spl-thumbs::-webkit-scrollbar{display:none}`}</style>
                {PRODUCT_THUMBS.map((p, i) => <Thumb key={i} active={i === activeIdx} onClick={() => setActiveIdx(i)} src={p.src} alt={p.alt} />)}
              </div>
              <IPadImage src={mainSrc} onClick={() => openLightbox({ kind: 'ipad', idx: effectiveIdx })} />
            </div>
            <div style={{ width: 655, padding: '24px 0', display: 'flex', flexDirection: 'column', gap: 48, position: 'relative' }}>
              <div style={{ display: 'flex', flexDirection: 'column', gap: 12, padding: "0px 16px 0px 0px" }}>
                <h2 style={{ margin: 0, fontFamily: 'Inter', fontWeight: 500, fontSize: 32, letterSpacing: '-0.05em', color: '#101010' }}>Wellness Yoga Journey by Tara</h2>
                <PricePill />
              </div>
              <Highlights label="Highlights" items={['Available on Notion', 'Unlimited page duplications', 'Free beginner yoga course included']} />
              {sharedForm}
            </div>
          </div>
        </section>
        <BioSection portrait="assets/tara.jpg" headline="I'm Tara !" role="Yoga teacher, recovering overthinker, and lifelong student of the breath." story="I came to yoga ten years ago burned out from a corporate desk job, and what started as a way to stretch my back turned into a complete shift in how I move through the world. Today, I teach slow flow, restorative, and breath-led practices that help you reconnect with the body you've been carrying around all day. Whether you're brand new to a mat or have been practicing for years, my classes meet you exactly where you are. Come join me!" />
        <Footer tagline="A space where you can be fully you" sub="Check my channel Yoga with Tara" />
      </main>);

  }

  // ── Tablet: single column, 128px top padding, landscape thumbs ────────────
  if (bp === 'tablet') {
    return (
      <main style={{ position: 'relative', background: '#fff' }}>
        <HeroBackdrop />
        <NavBar brand="Yoga with Tara" />
        <section style={{ position: 'relative', display: 'flex', flexDirection: 'column', alignItems: 'center', gap: "40px", padding: "192px 64px 32px" }}>
          <PageTitle line1="Get my wellness template" line2="for Free" />
          <div style={{ width: '100%', display: 'flex', flexDirection: 'column', gap: 48 }}>
            {/* Image + thumbs grouped — inner gap 32px, then 48px to info */}
            <div style={{ display: 'flex', flexDirection: 'column', gap: 32 }}>
              {/* Main image — full content width, square — no zoom on tablet */}
              <div style={{ width: '100%', aspectRatio: '1', borderRadius: 32, overflow: 'hidden', boxShadow: '-12px 10px 80px rgba(0,0,0,0.10)' }}>
                <img src={mainSrc} alt="Wellness Yoga Journey"
                style={{ width: '100%', height: '100%', objectFit: 'cover', display: 'block' }} />
              </div>
              {/* Square thumb strip — 140×140 px, horizontal scroll — padded so shadow + stroke aren't clipped */}
              <div className="spl-th-t" style={{ display: 'flex', gap: 16, overflowX: 'auto', padding: '24px 16px 40px', margin: '-24px -16px -24px', scrollbarWidth: 'none' }}>
                <style>{`.spl-th-t::-webkit-scrollbar{display:none}`}</style>
                {PRODUCT_THUMBS.map((p, i) =>
                <div key={i} onClick={() => setActiveIdx(i)} role="button" aria-label={p.alt}
                style={{ width: 140, height: 140, flexShrink: 0, borderRadius: 16,
                  backgroundImage: `url(${p.src})`, backgroundSize: 'cover', backgroundPosition: '50%',
                  border: `2px solid ${i === effectiveIdx ? '#D3D2D2' : '#F0F0F0'}`,
                  boxShadow: i === effectiveIdx ? '0 10px 28px rgba(0,0,0,0.16)' : 'none',
                  transform: i === effectiveIdx ? 'translateY(-2px)' : 'none',
                  transition: 'all 180ms ease', cursor: 'pointer' }} />
                )}
              </div>
            </div>
            {/* Info + Form */}
            <div style={{ display: 'flex', flexDirection: 'column' }}>
              <div style={{ display: 'flex', flexDirection: 'column', gap: 12, marginBottom: 48 }}>
                <h2 style={{ margin: 0, fontFamily: 'Inter', fontWeight: 500, fontSize: 24, letterSpacing: '-0.05em', color: '#101010' }}>Wellness Yoga Journey by Tara</h2>
                <PricePill />
              </div>
              <div style={{ marginBottom: 32 }}>
                <Highlights label="Highlights" items={['Available on Notion', 'Unlimited page duplications', 'Free beginner yoga course included']} />
              </div>
              {sharedForm}
            </div>
          </div>
        </section>
        <BioSection portrait="assets/tara.jpg" headline="I'm Tara !" role="Yoga teacher, recovering overthinker, and lifelong student of the breath." story="I came to yoga ten years ago burned out from a corporate desk job, and what started as a way to stretch my back turned into a complete shift in how I move through the world. Today, I teach slow flow, restorative, and breath-led practices that help you reconnect with the body you've been carrying around all day. Whether you're brand new to a mat or have been practicing for years, my classes meet you exactly where you are. Come join me!" />
        <Footer tagline="A space where you can be fully you" sub="Check my channel Yoga with Tara" />
      </main>);

  }

  // ── Mobile: single column, 16 px sides, landscape thumbs 120×88 ──────────
  // ── Large Mobile ──────────────────────────────────────────────────────
  if (bp === 'largeMobile') {
    return (
      <main style={{ position: 'relative', background: '#fff' }}>
        <HeroBackdrop />
        <NavBar brand="Yoga with Tara" />
        <section style={{ position: 'relative', display: 'flex', flexDirection: 'column', gap: 16, alignItems: 'center', padding: "128px 32px 48px" }}>
          <PageTitle line1="Get my wellness template" line2="for Free" />
          <div style={{ width: '100%', display: 'flex', flexDirection: 'column', gap: 16 }}>
            {/* Main image — no zoom on mobile */}
            <div style={{ width: '100%', aspectRatio: '1', borderRadius: 24, overflow: 'hidden', boxShadow: '-8px 8px 48px rgba(0,0,0,0.10)' }}>
              <img src={mainSrc} alt="Wellness Yoga Journey"
              style={{ width: '100%', height: '100%', objectFit: 'cover', display: 'block' }} />
            </div>
            {/* Square thumb strip — 90×90 px — padded so shadow + stroke aren't clipped */}
            <div className="spl-th-m" style={{ display: 'flex', gap: 16, overflowX: 'auto', padding: '16px 12px 24px', margin: '-16px -12px -16px', scrollbarWidth: 'none' }}>
              <style>{`.spl-th-m::-webkit-scrollbar{display:none}`}</style>
              {PRODUCT_THUMBS.map((p, i) =>
              <div key={i} onClick={() => setActiveIdx(i)} role="button" aria-label={p.alt}
              style={{ width: 90, height: 90, flexShrink: 0, borderRadius: 11,
                backgroundImage: `url(${p.src})`, backgroundSize: 'cover', backgroundPosition: '50%',
                border: `2px solid ${i === effectiveIdx ? '#D3D2D2' : '#F0F0F0'}`,
                boxShadow: i === effectiveIdx ? '0 6px 18px rgba(0,0,0,0.14)' : 'none',
                transform: i === effectiveIdx ? 'translateY(-2px)' : 'none',
                transition: 'all 180ms ease', cursor: 'pointer' }} />
              )}
            </div>
            {/* Info + Form */}
            <div style={{ display: 'flex', flexDirection: 'column', gap: 32 }}>
              <div style={{ display: 'flex', flexDirection: 'column', gap: 12 }}>
                <h2 style={{ margin: 0, fontFamily: 'Inter', fontWeight: 500, fontSize: 18, letterSpacing: '-0.04em', color: '#101010' }}>Wellness Yoga Journey by Tara</h2>
                <PricePill />
              </div>
              <Highlights label="Highlights" items={['Available on Notion', 'Unlimited page duplications', 'Free beginner yoga course included']} />
              {sharedForm}
            </div>
          </div>
        </section>
        <BioSection portrait="assets/tara.jpg" headline="I'm Tara !" role="Yoga teacher, recovering overthinker, and lifelong student of the breath." story="I came to yoga ten years ago burned out from a corporate desk job, and what started as a way to stretch my back turned into a complete shift in how I move through the world. Today, I teach slow flow, restorative, and breath-led practices that help you reconnect with the body you've been carrying around all day. Whether you're brand new to a mat or have been practicing for years, my classes meet you exactly where you are. Come join me!" />
        <Footer tagline="A space where you can be fully you" sub="Check my channel Yoga with Tara" />
      </main>);

  }

  // ── Small Mobile ───────────────────────────────────────────────────────
  return (
    <main style={{ position: 'relative', background: '#fff' }}>
      <HeroBackdrop />
      <NavBar brand="Yoga with Tara" />
      <section style={{ position: 'relative', display: 'flex', flexDirection: 'column', gap: 16, alignItems: 'center', padding: "128px 16px 48px" }}>
        <PageTitle line1="Get my wellness template" line2="for Free" />
        <div style={{ width: '100%', display: 'flex', flexDirection: 'column', gap: 16 }}>
          {/* Main image — no zoom on mobile */}
          <div style={{ width: '100%', aspectRatio: '1', borderRadius: 24, overflow: 'hidden', boxShadow: '-8px 8px 48px rgba(0,0,0,0.10)' }}>
            <img src={mainSrc} alt="Wellness Yoga Journey"
            style={{ width: '100%', height: '100%', objectFit: 'cover', display: 'block' }} />
          </div>
          {/* Square thumb strip — 90×90 px — padded so shadow + stroke aren't clipped */}
          <div className="spl-th-m" style={{ display: 'flex', gap: 16, overflowX: 'auto', padding: '16px 12px 24px', margin: '-16px -12px -16px', scrollbarWidth: 'none' }}>
            <style>{`.spl-th-m::-webkit-scrollbar{display:none}`}</style>
            {PRODUCT_THUMBS.map((p, i) =>
            <div key={i} onClick={() => setActiveIdx(i)} role="button" aria-label={p.alt}
            style={{ width: 90, height: 90, flexShrink: 0, borderRadius: 11,
              backgroundImage: `url(${p.src})`, backgroundSize: 'cover', backgroundPosition: '50%',
              border: `2px solid ${i === effectiveIdx ? '#D3D2D2' : '#F0F0F0'}`,
              boxShadow: i === effectiveIdx ? '0 6px 18px rgba(0,0,0,0.14)' : 'none',
              transform: i === effectiveIdx ? 'translateY(-2px)' : 'none',
              transition: 'all 180ms ease', cursor: 'pointer' }} />
            )}
          </div>
          {/* Info + Form */}
          <div style={{ display: 'flex', flexDirection: 'column', gap: 32 }}>
            <div style={{ display: 'flex', flexDirection: 'column', gap: 12 }}>
              <h2 style={{ margin: 0, fontFamily: 'Inter', fontWeight: 500, fontSize: 18, letterSpacing: '-0.04em', color: '#101010' }}>Wellness Yoga Journey by Tara</h2>
              <PricePill />
            </div>
            <Highlights label="Highlights" items={['Available on Notion', 'Unlimited page duplications', 'Free beginner yoga course included']} />
            {sharedForm}
          </div>
        </div>
      </section>
      <BioSection portrait="assets/tara.jpg" headline="I'm Tara !" role="Yoga teacher, recovering overthinker, and lifelong student of the breath." story="I came to yoga ten years ago burned out from a corporate desk job, and what started as a way to stretch my back turned into a complete shift in how I move through the world. Today, I teach slow flow, restorative, and breath-led practices that help you reconnect with the body you've been carrying around all day. Whether you're brand new to a mat or have been practicing for years, my classes meet you exactly where you are. Come join me!" />
      <Footer tagline="A space where you can be fully you" sub="Check my channel Yoga with Tara" />
    </main>);

};

// ─── 1b) PRODUCT — EXTRA TEXT VARIANT ────────────────────────────────────────
// Same as Product, with a long-form text block between the product section
// and the Bio section. Per Figma node 69-1521 (desktop) + 69-482 (tablet/mobile).

const EXTRA_TEXT = {
  introKicker: "About this template",
  introHeading: "A calm space for your fitness journey",
  introBody: "This template is for anyone who wants to bring more intention to their wellness practice without the chaos of scattered notes, screenshots and half-remembered goals. Whether you're building strength, recovering between sessions, or trying to eat a little more mindfully, it gives you one space to track your training, nourish your body and stay connected to the goals that matter to you.",
  hubsHeading: "What's included",
  hubsLead: "Four connected hubs, each designed to support a different part of your fitness and wellness life.",
  hubs: [
  { emoji: '🏋️', name: 'Workout Hub', desc: "Your library of moves and routines. Save your favorite fitness content across four categories — cardio, muscle, power, and stretching & yoga — and pull from them to build workouts that fit your goals and your week." },
  { emoji: '📚', name: 'Training Hub', desc: "A space for the learning side of fitness. Track techniques and skills you've picked up, keep a wishlist of what you want to learn next, and plan how you'll move things from \u201Cwant to learn\u201D to \u201Clearned.\u201D" },
  { emoji: '🥗', name: 'Nutrition Hub', desc: "Everything food-related, organized and inspired. Gather your favorite recipes, plan daily meals with a pantry checklist, and set a weekly reminder system so your supplements actually get taken." },
  { emoji: '🎯', name: 'Goals', desc: "This is where you set your intentions — short-term, long-term, or anywhere in between — and revisit them as your journey evolves." }],

  fitHeading: "This template is a good fit if",
  fitItems: [
  "You want to track workouts and training sessions in one place instead of juggling apps and notebooks.",
  "You save fitness content — YouTube videos, reels, articles — and want a system to actually use them, not just hoard them.",
  "You're trying to eat better but lose track of what's in your pantry or what you wanted to cook this week.",
  "You want to build a routine across cardio, strength, mobility and recovery without losing sight of the bigger picture.",
  "You like structure but also want flexibility to make the system your own.",
  "You're curious about your habits and want a gentle way to see your progress over time."]

};

// One hub card — FIVE separate branches per scale so a direct edit in one
// breakpoint never bleeds into the others. `scale` accepts:
//   'smallMobile' | 'largeMobile' | 'tablet' | 'desktop' | 'largeDesktop'
// Legacy 'mobile' → largeMobile.
const HubCard = ({ emoji, name, desc, scale = 'desktop' }) => {
  // ── Large Desktop ───────────────────────────────────────────────────────
  if (scale === 'largeDesktop') {
    return (
      <div style={{
        background: '#fff', border: '1px solid #f0e6dc', borderRadius: 24,
        padding: 32, display: 'flex', flexDirection: 'column', gap: 12
      }}>
        <div style={{
          width: 52, height: 52, borderRadius: 14, background: '#f8ebe3',
          display: 'grid', placeItems: 'center', fontSize: 28, lineHeight: 1
        }}>{emoji}</div>
        <div className="serif" style={{
          fontSize: 24, lineHeight: 1.1, letterSpacing: '-0.01em', color: '#101010'
        }}>{name}</div>
        <div style={{
          fontFamily: 'Inter', fontSize: 18, lineHeight: 1.55,
          letterSpacing: '-0.01em', color: '#696a6d', fontWeight: 400
        }}>{desc}</div>
      </div>);

  }

  // ── Desktop ─────────────────────────────────────────────────────────────
  if (scale === 'desktop') {
    return (
      <div style={{
        background: '#fff', border: '1px solid #f0e6dc', borderRadius: 24,
        padding: 32, display: 'flex', flexDirection: 'column', gap: 12
      }}>
        <div style={{
          width: 52, height: 52, borderRadius: 14, background: '#f8ebe3',
          display: 'grid', placeItems: 'center', fontSize: 28, lineHeight: 1
        }}>{emoji}</div>
        <div className="serif" style={{
          fontSize: 24, lineHeight: 1.1, letterSpacing: '-0.01em', color: '#101010'
        }}>{name}</div>
        <div style={{
          fontFamily: 'Inter', fontSize: 18, lineHeight: 1.55,
          letterSpacing: '-0.01em', color: '#696a6d', fontWeight: 400
        }}>{desc}</div>
      </div>);

  }

  // ── Tablet ──────────────────────────────────────────────────────────────
  if (scale === 'tablet') {
    return (
      <div style={{
        background: '#fff', border: '1px solid #f0e6dc', borderRadius: 20,
        padding: 24, display: 'flex', flexDirection: 'column', gap: 12
      }}>
        <div style={{
          width: 44, height: 44, borderRadius: 14, background: '#f8ebe3',
          display: 'grid', placeItems: 'center', fontSize: 24, lineHeight: 1
        }}>{emoji}</div>
        <div className="serif" style={{
          fontSize: 20, lineHeight: 1.1, letterSpacing: '-0.01em', color: '#101010'
        }}>{name}</div>
        <div style={{
          fontFamily: 'Inter', fontSize: 16, lineHeight: 1.55,
          letterSpacing: '-0.01em', color: '#696a6d', fontWeight: 400
        }}>{desc}</div>
      </div>);

  }

  // ── Large Mobile ────────────────────────────────────────────────────────
  if (scale === 'largeMobile' || scale === 'mobile') {
    return (
      <div style={{
        background: '#fff', border: '1px solid #f0e6dc', borderRadius: 20,
        padding: 20, display: 'flex', flexDirection: 'column', gap: 12
      }}>
        <div style={{
          width: 44, height: 44, borderRadius: 14, background: '#f8ebe3',
          display: 'grid', placeItems: 'center', fontSize: 22, lineHeight: 1
        }}>{emoji}</div>
        <div className="serif" style={{
          fontSize: 18, lineHeight: 1.1, letterSpacing: '-0.01em', color: '#101010'
        }}>{name}</div>
        <div style={{
          fontFamily: 'Inter', fontSize: 14, lineHeight: 1.55,
          letterSpacing: '-0.01em', color: '#696a6d', fontWeight: 400
        }}>{desc}</div>
      </div>);

  }

  // ── Small Mobile ────────────────────────────────────────────────────────
  return (
    <div style={{
      background: '#fff', border: '1px solid #f0e6dc', borderRadius: 20,
      padding: 20, display: 'flex', flexDirection: 'column', gap: 12
    }}>
      <div style={{
        width: 44, height: 44, borderRadius: 14, background: '#f8ebe3',
        display: 'grid', placeItems: 'center', fontSize: 22, lineHeight: 1
      }}>{emoji}</div>
      <div className="serif" style={{
        fontSize: 18, lineHeight: 1.1, letterSpacing: '-0.01em', color: '#101010'
      }}>{name}</div>
      <div style={{
        fontFamily: 'Inter', fontSize: 14, lineHeight: 1.55,
        letterSpacing: '-0.01em', color: '#696a6d', fontWeight: 400
      }}>{desc}</div>
    </div>);

};

// Checkmark bullet — peach circle with cream check.
const CheckBullet = ({ size = 28 }) =>
<div style={{
  width: size, height: size, borderRadius: '50%', background: '#f8ebe3',
  display: 'grid', placeItems: 'center', flexShrink: 0, marginTop: 2
}}>
    <svg width={Math.round(size * 0.45)} height={Math.round(size * 0.45)} viewBox="0 0 14 14" fill="none">
      <path d="M3 7.5 6 10.5 11.5 4" stroke="#795f4e" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" />
    </svg>
  </div>;


const TextBlockSection = () => {
  const bp = useBreakpoint();

  // ── Desktop: full bleed cream bg, 1280 px content, 2x2 hub grid ──────────
  // ── Large Desktop ───────────────────────────────────────────────────────
  if (bp === 'largeDesktop') {
    return (
      <section style={{ position: 'relative', width: '100%' }}>
        <div style={{
          position: 'absolute', top: 0, bottom: 0,
          left: 'var(--bg-offset)', width: 'var(--bg-width)',
          background: '#fffbf9', zIndex: 0
        }} />
        <div style={{
          position: 'relative', zIndex: 1, width: 1536, margin: '0 auto',
          padding: '160px 0 160px',
          display: 'flex', flexDirection: 'column', gap: "160px"
        }}>
          {/* Intro — kicker + heading + paragraph */}
          <div style={{ display: 'grid', gridTemplateColumns: '1fr 1.4fr', gap: 96, alignItems: 'start' }}>
            <div style={{ display: 'flex', flexDirection: 'column', gap: 16 }}>
              <div style={{ fontFamily: 'Inter', fontWeight: 500, fontSize: 14, letterSpacing: '0.18em', textTransform: 'uppercase', color: '#795f4e' }}>{EXTRA_TEXT.introKicker}</div>
              <h2 className="serif" style={{ margin: 0, fontSize: 72, lineHeight: 0.95, letterSpacing: '-0.02em', color: '#101010' }}>{EXTRA_TEXT.introHeading}</h2>
            </div>
            <div style={{ fontFamily: 'Inter', fontSize: 22, lineHeight: 1.65, letterSpacing: '-0.01em', color: '#696a6d', paddingTop: 20 }}>{EXTRA_TEXT.introBody}</div>
          </div>

          {/* Hubs — heading + 2x2 grid */}
          <div style={{ display: 'flex', flexDirection: 'column', gap: 48 }}>
            <h3 className="serif" style={{ margin: 0, fontSize: 48, lineHeight: 1.05, letterSpacing: '-0.02em', color: '#101010', maxWidth: 720 }}>{EXTRA_TEXT.hubsHeading}</h3>
            <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 24 }}>
              {EXTRA_TEXT.hubs.map((h) => <HubCard key={h.name} {...h} scale="largeDesktop" />)}
            </div>
          </div>

          {/* Fit list — heading above, checklist below */}
          <div style={{ display: 'flex', flexDirection: 'column', gap: 48, textAlign: "left" }}>
            <h3 className="serif" style={{ margin: 0, fontSize: 56, lineHeight: 1, letterSpacing: '-0.02em', color: '#101010' }}>{EXTRA_TEXT.fitHeading}</h3>
            <ul style={{ margin: 0, padding: 0, listStyle: 'none', display: 'grid', gridTemplateColumns: '1fr 1fr', columnGap: 64, rowGap: 20 }}>
              {EXTRA_TEXT.fitItems.map((it, i) =>
              <li key={i} style={{ display: 'flex', gap: 16, alignItems: 'flex-start' }}>
                  <CheckBullet size={32} />
                  <span style={{ fontFamily: 'Inter', fontSize: 20, lineHeight: 1.55, color: '#101010', letterSpacing: '-0.01em' }}>{it}</span>
                </li>
              )}
            </ul>
          </div>
        </div>
      </section>);

  }

  if (bp === 'desktop') {
    return (
      <section style={{ position: 'relative', width: '100%' }}>
        <div style={{
          position: 'absolute', top: 0, bottom: 0,
          left: 'var(--bg-offset)', width: 'var(--bg-width)',
          background: '#fffbf9', zIndex: 0
        }} />
        <div style={{
          position: 'relative', zIndex: 1, width: 1536, margin: '0 auto',
          padding: '160px 0 160px',
          display: 'flex', flexDirection: 'column', gap: "160px"
        }}>
          {/* Intro — kicker + heading + paragraph */}
          <div style={{ display: 'grid', gridTemplateColumns: '1fr 1.4fr', gap: 96, alignItems: 'start' }}>
            <div style={{ display: 'flex', flexDirection: 'column', gap: 16 }}>
              <div style={{ fontFamily: 'Inter', fontWeight: 500, fontSize: 14, letterSpacing: '0.18em', textTransform: 'uppercase', color: '#795f4e' }}>{EXTRA_TEXT.introKicker}</div>
              <h2 className="serif" style={{ margin: 0, fontSize: 72, lineHeight: 0.95, letterSpacing: '-0.02em', color: '#101010' }}>{EXTRA_TEXT.introHeading}</h2>
            </div>
            <div style={{ fontFamily: 'Inter', fontSize: 22, lineHeight: 1.65, letterSpacing: '-0.01em', color: '#696a6d', paddingTop: 20 }}>{EXTRA_TEXT.introBody}</div>
          </div>

          {/* Hubs — heading + 2x2 grid */}
          <div style={{ display: 'flex', flexDirection: 'column', gap: 48 }}>
            <h3 className="serif" style={{ margin: 0, fontSize: 48, lineHeight: 1.05, letterSpacing: '-0.02em', color: '#101010', maxWidth: 720 }}>{EXTRA_TEXT.hubsHeading}</h3>
            <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 24 }}>
              {EXTRA_TEXT.hubs.map((h) => <HubCard key={h.name} {...h} scale="desktop" />)}
            </div>
          </div>

          {/* Fit list — heading above, checklist below */}
          <div style={{ display: 'flex', flexDirection: 'column', gap: 48, textAlign: "left" }}>
            <h3 className="serif" style={{ margin: 0, fontSize: 56, lineHeight: 1, letterSpacing: '-0.02em', color: '#101010' }}>{EXTRA_TEXT.fitHeading}</h3>
            <ul style={{ margin: 0, padding: 0, listStyle: 'none', display: 'grid', gridTemplateColumns: '1fr 1fr', columnGap: 64, rowGap: 20 }}>
              {EXTRA_TEXT.fitItems.map((it, i) =>
              <li key={i} style={{ display: 'flex', gap: 16, alignItems: 'flex-start' }}>
                  <CheckBullet size={32} />
                  <span style={{ fontFamily: 'Inter', fontSize: 20, lineHeight: 1.55, color: '#101010', letterSpacing: '-0.01em' }}>{it}</span>
                </li>
              )}
            </ul>
          </div>
        </div>
      </section>);

  }

  // ── Tablet: single column, 64 px side padding ────────────────────────────
  if (bp === 'tablet') {
    return (
      <section style={{ position: 'relative', width: '100%' }}>
        <div style={{ position: 'absolute', top: 0, bottom: 0, left: 'var(--bg-offset)', width: 'var(--bg-width)', background: '#fffbf9', zIndex: 0 }} />
        <div style={{ position: 'relative', zIndex: 1, padding: '80px 64px 80px', display: 'flex', flexDirection: 'column', gap: 64 }}>
          <div style={{ display: 'flex', flexDirection: 'column', gap: 20 }}>
            <div style={{ fontFamily: 'Inter', fontWeight: 500, fontSize: 12, letterSpacing: '0.18em', textTransform: 'uppercase', color: '#795f4e' }}>{EXTRA_TEXT.introKicker}</div>
            <h2 className="serif" style={{ margin: 0, fontSize: 48, lineHeight: 1, letterSpacing: '-0.02em', color: '#101010' }}>{EXTRA_TEXT.introHeading}</h2>
            <div style={{ fontFamily: 'Inter', fontSize: 17, lineHeight: 1.65, letterSpacing: '-0.01em', color: '#696a6d' }}>{EXTRA_TEXT.introBody}</div>
          </div>

          <div style={{ display: 'flex', flexDirection: 'column', gap: 28 }}>
            <h3 className="serif" style={{ margin: 0, fontSize: 36, lineHeight: 1.05, letterSpacing: '-0.02em', color: '#101010' }}>{EXTRA_TEXT.hubsHeading}</h3>
            <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 16 }}>
              {EXTRA_TEXT.hubs.map((h) => <HubCard key={h.name} {...h} scale="tablet" />)}
            </div>
          </div>

          <div style={{ display: 'flex', flexDirection: 'column', gap: 24 }}>
            <h3 className="serif" style={{ margin: 0, fontSize: 36, lineHeight: 1.05, letterSpacing: '-0.02em', color: '#101010' }}>{EXTRA_TEXT.fitHeading}</h3>
            <ul style={{ margin: 0, padding: 0, listStyle: 'none', display: 'flex', flexDirection: 'column', gap: 16 }}>
              {EXTRA_TEXT.fitItems.map((it, i) =>
              <li key={i} style={{ display: 'flex', gap: 14, alignItems: 'flex-start' }}>
                  <CheckBullet size={26} />
                  <span style={{ fontFamily: 'Inter', fontSize: 16, lineHeight: 1.55, color: '#101010', letterSpacing: '-0.01em' }}>{it}</span>
                </li>
              )}
            </ul>
          </div>
        </div>
      </section>);

  }

  // ── Mobile: single column, 16 px sides, hubs stack vertically ────────────
  // ── Large Mobile ──────────────────────────────────────────────────────
  if (bp === 'largeMobile') {
    return (
      <section style={{ position: 'relative', width: '100%' }}>
        <div style={{ position: 'absolute', top: 0, bottom: 0, left: 'var(--bg-offset)', width: 'var(--bg-width)', background: '#fffbf9', zIndex: 0 }} />
        <div style={{ position: 'relative', zIndex: 1, padding: '48px 16px 48px', display: 'flex', flexDirection: 'column', gap: 40 }}>
          <div style={{ display: 'flex', flexDirection: 'column', gap: 14 }}>
            <div style={{ fontFamily: 'Inter', fontWeight: 500, fontSize: 11, letterSpacing: '0.18em', textTransform: 'uppercase', color: '#795f4e' }}>{EXTRA_TEXT.introKicker}</div>
            <h2 className="serif" style={{ margin: 0, fontSize: 32, lineHeight: 1.05, letterSpacing: '-0.02em', color: '#101010' }}>{EXTRA_TEXT.introHeading}</h2>
            <div style={{ fontFamily: 'Inter', fontSize: 14, lineHeight: 1.65, letterSpacing: '-0.01em', color: '#696a6d' }}>{EXTRA_TEXT.introBody}</div>
          </div>

          <div style={{ display: 'flex', flexDirection: 'column', gap: 20 }}>
            <div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
              <h3 className="serif" style={{ margin: 0, fontSize: 26, lineHeight: 1.05, letterSpacing: '-0.02em', color: '#101010' }}>{EXTRA_TEXT.hubsHeading}</h3>
            </div>
            <div style={{ display: 'flex', flexDirection: 'column', gap: 12 }}>
              {EXTRA_TEXT.hubs.map((h) => <HubCard key={h.name} {...h} scale="largeMobile" />)}
            </div>
          </div>

          <div style={{ display: 'flex', flexDirection: 'column', gap: 18 }}>
            <h3 className="serif" style={{ margin: 0, fontSize: 26, lineHeight: 1.05, letterSpacing: '-0.02em', color: '#101010' }}>{EXTRA_TEXT.fitHeading}</h3>
            <ul style={{ margin: 0, padding: 0, listStyle: 'none', display: 'flex', flexDirection: 'column', gap: 12 }}>
              {EXTRA_TEXT.fitItems.map((it, i) =>
              <li key={i} style={{ display: 'flex', gap: 12, alignItems: 'flex-start' }}>
                  <CheckBullet size={22} />
                  <span style={{ fontFamily: 'Inter', fontSize: 14, lineHeight: 1.55, color: '#101010', letterSpacing: '-0.01em' }}>{it}</span>
                </li>
              )}
            </ul>
          </div>
        </div>
      </section>);

  }

  // ── Small Mobile ───────────────────────────────────────────────────────
  return (
    <section style={{ position: 'relative', width: '100%' }}>
      <div style={{ position: 'absolute', top: 0, bottom: 0, left: 'var(--bg-offset)', width: 'var(--bg-width)', background: '#fffbf9', zIndex: 0 }} />
      <div style={{ position: 'relative', zIndex: 1, padding: '48px 16px 48px', display: 'flex', flexDirection: 'column', gap: 40 }}>
        <div style={{ display: 'flex', flexDirection: 'column', gap: 14 }}>
          <div style={{ fontFamily: 'Inter', fontWeight: 500, fontSize: 11, letterSpacing: '0.18em', textTransform: 'uppercase', color: '#795f4e' }}>{EXTRA_TEXT.introKicker}</div>
          <h2 className="serif" style={{ margin: 0, fontSize: 32, lineHeight: 1.05, letterSpacing: '-0.02em', color: '#101010' }}>{EXTRA_TEXT.introHeading}</h2>
          <div style={{ fontFamily: 'Inter', fontSize: 14, lineHeight: 1.65, letterSpacing: '-0.01em', color: '#696a6d' }}>{EXTRA_TEXT.introBody}</div>
        </div>

        <div style={{ display: 'flex', flexDirection: 'column', gap: 20 }}>
          <div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
            <h3 className="serif" style={{ margin: 0, fontSize: 26, lineHeight: 1.05, letterSpacing: '-0.02em', color: '#101010' }}>{EXTRA_TEXT.hubsHeading}</h3>
          </div>
          <div style={{ display: 'flex', flexDirection: 'column', gap: 12 }}>
            {EXTRA_TEXT.hubs.map((h) => <HubCard key={h.name} {...h} scale="smallMobile" />)}
          </div>
        </div>

        <div style={{ display: 'flex', flexDirection: 'column', gap: 18 }}>
          <h3 className="serif" style={{ margin: 0, fontSize: 26, lineHeight: 1.05, letterSpacing: '-0.02em', color: '#101010' }}>{EXTRA_TEXT.fitHeading}</h3>
          <ul style={{ margin: 0, padding: 0, listStyle: 'none', display: 'flex', flexDirection: 'column', gap: 12 }}>
            {EXTRA_TEXT.fitItems.map((it, i) =>
            <li key={i} style={{ display: 'flex', gap: 12, alignItems: 'flex-start' }}>
                <CheckBullet size={22} />
                <span style={{ fontFamily: 'Inter', fontSize: 14, lineHeight: 1.55, color: '#101010', letterSpacing: '-0.01em' }}>{it}</span>
              </li>
            )}
          </ul>
        </div>
      </div>
    </section>);

};

// Product with an extra-text section before the Bio. Reuses ProductTemplate's
// render and wraps it: we splice a TextBlockSection into the page by reading
// children. Simpler: render ProductTemplate, then patch the DOM order via
// dedicated component below.
const ProductExtraTextTemplate = (props) => {
  // We render the same chrome but inline the section markup so the text
  // block can sit between the product section and the BioSection.
  const [activeIdx, setActiveIdx] = React.useState(-1);
  const effectiveIdx = activeIdx >= 0 ? activeIdx : 0;
  const mainSrc = PRODUCT_THUMBS[effectiveIdx].src;
  const bp = useBreakpoint();
  const { formState, submitEmail, openLightbox, defaultEmail, forcedError } = props;
  const pricing = React.useContext(PricingContext);

  const sharedForm = pricing.model === 'paid' ? <PaidCTA /> :
  <div style={{ position: 'relative' }}>
      <EmailForm defaultEmail={defaultEmail} forcedError={forcedError} onSubmit={submitEmail} formState={formState}
    copy={{ cta: 'Download', sentCta: 'Sent', disclaimer: PRODUCT_DISCLAIMER }} />
      <SuccessToast visible={formState === 'success'} message="Check your email ! It's waiting for you." />
    </div>;


  // ── Large Desktop ───────────────────────────────────────────────────────
  if (bp === 'largeDesktop') {
    return (
      <main style={{ position: 'relative', background: '#fff' }}>
        <HeroBackdrop />
        <NavBar brand="Yoga with Tara" />
        <section style={{ position: 'relative', display: 'flex', flexDirection: 'column', gap: 56, alignItems: 'center', padding: "256px 128px 80px" }}>
          <PageTitle line1="Get my wellness template" line2="for Free" />
          <div style={{ width: 1536, display: 'flex', gap: 88, alignItems: 'center', justifyContent: 'center' }}>
            <div style={{ display: 'flex', gap: 32, alignItems: 'center' }}>
              <div className="spl-thumbs-x" style={{ display: 'flex', flexDirection: 'column', gap: 14, height: 800, overflowY: 'auto', padding: '0 40px', margin: '0 -40px', scrollbarWidth: 'none' }}>
                <style>{`.spl-thumbs-x::-webkit-scrollbar{display:none}`}</style>
                {PRODUCT_THUMBS.map((p, i) => <Thumb key={i} active={i === activeIdx} onClick={() => setActiveIdx(i)} src={p.src} alt={p.alt} />)}
              </div>
              <IPadImage src={mainSrc} onClick={() => openLightbox({ kind: 'ipad', idx: effectiveIdx })} />
            </div>
            <div style={{ width: 655, padding: '24px 0', display: 'flex', flexDirection: 'column', gap: 48, position: 'relative' }}>
              <div style={{ display: 'flex', flexDirection: 'column', gap: 12, padding: "0px 16px 0px 0px" }}>
                <h2 style={{ margin: 0, fontFamily: 'Inter', fontWeight: 500, fontSize: 32, letterSpacing: '-0.05em', color: '#101010' }}>Wellness Yoga Journey by Tara</h2>
                <PricePill />
              </div>
              <Highlights label="Highlights" items={['Available on Notion', 'Unlimited page duplications', 'Free beginner yoga course included']} />
              {sharedForm}
            </div>
          </div>
        </section>
        <TextBlockSection />
        <BioSection portrait="assets/tara.jpg" headline="I'm Tara !" role="Yoga teacher, recovering overthinker, and lifelong student of the breath." story="I came to yoga ten years ago burned out from a corporate desk job, and what started as a way to stretch my back turned into a complete shift in how I move through the world. Today, I teach slow flow, restorative, and breath-led practices that help you reconnect with the body you've been carrying around all day. Whether you're brand new to a mat or have been practicing for years, my classes meet you exactly where you are. Come join me!" />
        <Footer tagline="A space where you can be fully you" sub="Check my channel Yoga with Tara" />
      </main>);

  }

  if (bp === 'desktop') {
    return (
      <main style={{ position: 'relative', background: '#fff' }}>
        <HeroBackdrop />
        <NavBar brand="Yoga with Tara" />
        <section style={{ position: 'relative', display: 'flex', flexDirection: 'column', gap: 56, alignItems: 'center', padding: "256px 128px 80px" }}>
          <PageTitle line1="Get my wellness template" line2="for Free" />
          <div style={{ width: 1536, display: 'flex', gap: 88, alignItems: 'center', justifyContent: 'center' }}>
            <div style={{ display: 'flex', gap: 32, alignItems: 'center' }}>
              <div className="spl-thumbs-x" style={{ display: 'flex', flexDirection: 'column', gap: 14, height: 800, overflowY: 'auto', padding: '0 40px', margin: '0 -40px', scrollbarWidth: 'none' }}>
                <style>{`.spl-thumbs-x::-webkit-scrollbar{display:none}`}</style>
                {PRODUCT_THUMBS.map((p, i) => <Thumb key={i} active={i === activeIdx} onClick={() => setActiveIdx(i)} src={p.src} alt={p.alt} />)}
              </div>
              <IPadImage src={mainSrc} onClick={() => openLightbox({ kind: 'ipad', idx: effectiveIdx })} />
            </div>
            <div style={{ width: 655, padding: '24px 0', display: 'flex', flexDirection: 'column', gap: 48, position: 'relative' }}>
              <div style={{ display: 'flex', flexDirection: 'column', gap: 12, padding: "0px 16px 0px 0px" }}>
                <h2 style={{ margin: 0, fontFamily: 'Inter', fontWeight: 500, fontSize: 32, letterSpacing: '-0.05em', color: '#101010' }}>Wellness Yoga Journey by Tara</h2>
                <PricePill />
              </div>
              <Highlights label="Highlights" items={['Available on Notion', 'Unlimited page duplications', 'Free beginner yoga course included']} />
              {sharedForm}
            </div>
          </div>
        </section>
        <TextBlockSection />
        <BioSection portrait="assets/tara.jpg" headline="I'm Tara !" role="Yoga teacher, recovering overthinker, and lifelong student of the breath." story="I came to yoga ten years ago burned out from a corporate desk job, and what started as a way to stretch my back turned into a complete shift in how I move through the world. Today, I teach slow flow, restorative, and breath-led practices that help you reconnect with the body you've been carrying around all day. Whether you're brand new to a mat or have been practicing for years, my classes meet you exactly where you are. Come join me!" />
        <Footer tagline="A space where you can be fully you" sub="Check my channel Yoga with Tara" />
      </main>);

  }

  if (bp === 'tablet') {
    return (
      <main style={{ position: 'relative', background: '#fff' }}>
        <HeroBackdrop />
        <NavBar brand="Yoga with Tara" />
        <section style={{ position: 'relative', display: 'flex', flexDirection: 'column', alignItems: 'center', gap: "40px", padding: "192px 64px 32px" }}>
          <PageTitle line1="Get my wellness template" line2="for Free" />
          <div style={{ width: '100%', display: 'flex', flexDirection: 'column', gap: 48 }}>
            <div style={{ display: 'flex', flexDirection: 'column', gap: 32 }}>
              <div style={{ width: '100%', aspectRatio: '1', borderRadius: 32, overflow: 'hidden', boxShadow: '-12px 10px 80px rgba(0,0,0,0.10)' }}>
                <img src={mainSrc} alt="Wellness Yoga Journey"
                style={{ width: '100%', height: '100%', objectFit: 'cover', display: 'block' }} />
              </div>
              <div className="spl-th-tx" style={{ display: 'flex', gap: 16, overflowX: 'auto', padding: '24px 16px 40px', margin: '-24px -16px -24px', scrollbarWidth: 'none' }}>
                <style>{`.spl-th-tx::-webkit-scrollbar{display:none}`}</style>
                {PRODUCT_THUMBS.map((p, i) =>
                <div key={i} onClick={() => setActiveIdx(i)} role="button" aria-label={p.alt}
                style={{ width: 140, height: 140, flexShrink: 0, borderRadius: 16,
                  backgroundImage: `url(${p.src})`, backgroundSize: 'cover', backgroundPosition: '50%',
                  border: `2px solid ${i === effectiveIdx ? '#D3D2D2' : '#F0F0F0'}`,
                  boxShadow: i === effectiveIdx ? '0 10px 28px rgba(0,0,0,0.16)' : 'none',
                  transform: i === effectiveIdx ? 'translateY(-2px)' : 'none',
                  transition: 'all 180ms ease', cursor: 'pointer' }} />
                )}
              </div>
            </div>
            <div style={{ display: 'flex', flexDirection: 'column' }}>
              <div style={{ display: 'flex', flexDirection: 'column', gap: 12, marginBottom: 48 }}>
                <h2 style={{ margin: 0, fontFamily: 'Inter', fontWeight: 500, fontSize: 24, letterSpacing: '-0.05em', color: '#101010' }}>Wellness Yoga Journey by Tara</h2>
                <PricePill />
              </div>
              <div style={{ marginBottom: 32 }}>
                <Highlights label="Highlights" items={['Available on Notion', 'Unlimited page duplications', 'Free beginner yoga course included']} />
              </div>
              {sharedForm}
            </div>
          </div>
        </section>
        <TextBlockSection />
        <BioSection portrait="assets/tara.jpg" headline="I'm Tara !" role="Yoga teacher, recovering overthinker, and lifelong student of the breath." story="I came to yoga ten years ago burned out from a corporate desk job, and what started as a way to stretch my back turned into a complete shift in how I move through the world. Today, I teach slow flow, restorative, and breath-led practices that help you reconnect with the body you've been carrying around all day. Whether you're brand new to a mat or have been practicing for years, my classes meet you exactly where you are. Come join me!" />
        <Footer tagline="A space where you can be fully you" sub="Check my channel Yoga with Tara" />
      </main>);

  }

  // ── Large Mobile ──────────────────────────────────────────────────────
  if (bp === 'largeMobile') {
    return (
      <main style={{ position: 'relative', background: '#fff' }}>
        <HeroBackdrop />
        <NavBar brand="Yoga with Tara" />
        <section style={{ position: 'relative', display: 'flex', flexDirection: 'column', gap: 16, alignItems: 'center', padding: "128px 32px 48px" }}>
          <PageTitle line1="Get my wellness template" line2="for Free" />
          <div style={{ width: '100%', display: 'flex', flexDirection: 'column', gap: 16 }}>
            <div style={{ width: '100%', aspectRatio: '1', borderRadius: 24, overflow: 'hidden', boxShadow: '-8px 8px 48px rgba(0,0,0,0.10)' }}>
              <img src={mainSrc} alt="Wellness Yoga Journey"
              style={{ width: '100%', height: '100%', objectFit: 'cover', display: 'block' }} />
            </div>
            <div className="spl-th-mx" style={{ display: 'flex', gap: 16, overflowX: 'auto', padding: '16px 12px 24px', margin: '-16px -12px -16px', scrollbarWidth: 'none' }}>
              <style>{`.spl-th-mx::-webkit-scrollbar{display:none}`}</style>
              {PRODUCT_THUMBS.map((p, i) =>
              <div key={i} onClick={() => setActiveIdx(i)} role="button" aria-label={p.alt}
              style={{ width: 90, height: 90, flexShrink: 0, borderRadius: 11,
                backgroundImage: `url(${p.src})`, backgroundSize: 'cover', backgroundPosition: '50%',
                border: `2px solid ${i === effectiveIdx ? '#D3D2D2' : '#F0F0F0'}`,
                boxShadow: i === effectiveIdx ? '0 6px 18px rgba(0,0,0,0.14)' : 'none',
                transform: i === effectiveIdx ? 'translateY(-2px)' : 'none',
                transition: 'all 180ms ease', cursor: 'pointer' }} />
              )}
            </div>
            <div style={{ display: 'flex', flexDirection: 'column', gap: 32 }}>
              <div style={{ display: 'flex', flexDirection: 'column', gap: 12 }}>
                <h2 style={{ margin: 0, fontFamily: 'Inter', fontWeight: 500, fontSize: 18, letterSpacing: '-0.04em', color: '#101010' }}>Wellness Yoga Journey by Tara</h2>
                <PricePill />
              </div>
              <Highlights label="Highlights" items={['Available on Notion', 'Unlimited page duplications', 'Free beginner yoga course included']} />
              {sharedForm}
            </div>
          </div>
        </section>
        <TextBlockSection />
        <BioSection portrait="assets/tara.jpg" headline="I'm Tara !" role="Yoga teacher, recovering overthinker, and lifelong student of the breath." story="I came to yoga ten years ago burned out from a corporate desk job, and what started as a way to stretch my back turned into a complete shift in how I move through the world. Today, I teach slow flow, restorative, and breath-led practices that help you reconnect with the body you've been carrying around all day. Whether you're brand new to a mat or have been practicing for years, my classes meet you exactly where you are. Come join me!" />
        <Footer tagline="A space where you can be fully you" sub="Check my channel Yoga with Tara" />
      </main>);

  }

  // ── Small Mobile ───────────────────────────────────────────────────────
  return (
    <main style={{ position: 'relative', background: '#fff' }}>
      <HeroBackdrop />
      <NavBar brand="Yoga with Tara" />
      <section style={{ position: 'relative', display: 'flex', flexDirection: 'column', gap: 16, alignItems: 'center', padding: "128px 16px 48px" }}>
        <PageTitle line1="Get my wellness template" line2="for Free" />
        <div style={{ width: '100%', display: 'flex', flexDirection: 'column', gap: 16 }}>
          <div style={{ width: '100%', aspectRatio: '1', borderRadius: 24, overflow: 'hidden', boxShadow: '-8px 8px 48px rgba(0,0,0,0.10)' }}>
            <img src={mainSrc} alt="Wellness Yoga Journey"
            style={{ width: '100%', height: '100%', objectFit: 'cover', display: 'block' }} />
          </div>
          <div className="spl-th-mx" style={{ display: 'flex', gap: 16, overflowX: 'auto', padding: '16px 12px 24px', margin: '-16px -12px -16px', scrollbarWidth: 'none' }}>
            <style>{`.spl-th-mx::-webkit-scrollbar{display:none}`}</style>
            {PRODUCT_THUMBS.map((p, i) =>
            <div key={i} onClick={() => setActiveIdx(i)} role="button" aria-label={p.alt}
            style={{ width: 90, height: 90, flexShrink: 0, borderRadius: 11,
              backgroundImage: `url(${p.src})`, backgroundSize: 'cover', backgroundPosition: '50%',
              border: `2px solid ${i === effectiveIdx ? '#D3D2D2' : '#F0F0F0'}`,
              boxShadow: i === effectiveIdx ? '0 6px 18px rgba(0,0,0,0.14)' : 'none',
              transform: i === effectiveIdx ? 'translateY(-2px)' : 'none',
              transition: 'all 180ms ease', cursor: 'pointer' }} />
            )}
          </div>
          <div style={{ display: 'flex', flexDirection: 'column', gap: 32 }}>
            <div style={{ display: 'flex', flexDirection: 'column', gap: 12 }}>
              <h2 style={{ margin: 0, fontFamily: 'Inter', fontWeight: 500, fontSize: 18, letterSpacing: '-0.04em', color: '#101010' }}>Wellness Yoga Journey by Tara</h2>
              <PricePill />
            </div>
            <Highlights label="Highlights" items={['Available on Notion', 'Unlimited page duplications', 'Free beginner yoga course included']} />
            {sharedForm}
          </div>
        </div>
      </section>
      <TextBlockSection />
      <BioSection portrait="assets/tara.jpg" headline="I'm Tara !" role="Yoga teacher, recovering overthinker, and lifelong student of the breath." story="I came to yoga ten years ago burned out from a corporate desk job, and what started as a way to stretch my back turned into a complete shift in how I move through the world. Today, I teach slow flow, restorative, and breath-led practices that help you reconnect with the body you've been carrying around all day. Whether you're brand new to a mat or have been practicing for years, my classes meet you exactly where you are. Come join me!" />
      <Footer tagline="A space where you can be fully you" sub="Check my channel Yoga with Tara" />
    </main>);

};

// ─── 2) CONTENT ───────────────────────────────────────────────────────────────

const CONTENT_FRAMES = [
{ kind: 'photo', src: 'assets/content-cover.jpg', label: 'Intro' },
{ kind: 'photo', src: 'assets/content-img-1.jpg', label: 'Module 1' },
{ kind: 'photo', src: 'assets/content-img-2.jpg', label: 'Module 2' },
{ kind: 'photo', src: 'assets/content-img-3.jpg', label: 'Module 3' }];


const CONTENT_DISCLAIMER = "Along with my free template, we'll add you to our newsletter so you're the first to know when we drop new products and insights. By submitting your email, you're opting in. Unsubscribe anytime - no hard feelings.";

const ContentTemplate = ({ formState, submitEmail, openLightbox, defaultEmail, forcedError }) => {
  const [activeIdx, setActiveIdx] = React.useState(0);
  const active = CONTENT_FRAMES[activeIdx];
  const bp = useBreakpoint();
  const pricing = React.useContext(PricingContext);

  const sharedForm = pricing.model === 'paid' ? <PaidCTA /> :
  <div style={{ position: 'relative' }}>
      <EmailForm defaultEmail={defaultEmail} forcedError={forcedError} onSubmit={submitEmail} formState={formState}
    copy={{ cta: 'Download', sentCta: 'Sent', disclaimer: CONTENT_DISCLAIMER }} />
      <SuccessToast visible={formState === 'success'} message="Check your email ! It's waiting for you." />
    </div>;


  // ── Desktop: exact original ────────────────────────────────────────────────
  // ── Large Desktop ───────────────────────────────────────────────────────
  if (bp === 'largeDesktop') {
    return (
      <main style={{ position: 'relative', background: '#fff' }}>
        <HeroBackdrop />
        <NavBar brand="Yoga with Tara" />
        <section style={{ position: 'relative', padding: '256px 128px 80px', display: 'flex', flexDirection: 'column', gap: 56, alignItems: 'center' }}>
          <PageTitle line1="Get my breathwork course" line2="for Free" />
          <div style={{ width: 1536, display: 'flex', alignItems: 'center', justifyContent: 'center', gap: "48px" }}>
            <div style={{ display: 'flex', flexDirection: 'column', gap: 16, alignItems: 'center' }}>
              <div onClick={() => openLightbox({ kind: 'content', src: 'assets/content-cover.jpg' })} style={{ width: 960, height: 540, borderRadius: 24, overflow: 'hidden', boxShadow: '-12px 10px 80px rgba(0,0,0,0.1)', cursor: 'zoom-in', position: 'relative', background: active.kind === 'photo' ? `url(${active.src}) center/cover no-repeat` : active.tint }}>
                {activeIdx === 0 && <div style={{ position: 'absolute', inset: 0, display: 'grid', placeItems: 'center' }}><PlayBadge /></div>}
              </div>
              <div style={{ display: 'flex', gap: 16, width: 960 }}>
                {CONTENT_FRAMES.map((f, i) =>
                <div key={i} onClick={() => setActiveIdx(i)} style={{ flex: 1, height: 212, borderRadius: 24, cursor: 'pointer',
                  background: f.kind === 'photo' ? `url(${f.src}) center/cover no-repeat` : f.tint,
                  border: `2px solid ${i === activeIdx ? '#D3D2D2' : '#F0F0F0'}`,
                  boxShadow: i === activeIdx ? '0 10px 28px rgba(0,0,0,0.16)' : 'none',
                  transform: i === activeIdx ? 'translateY(-2px)' : 'none',
                  transition: 'all 180ms ease' }} />
                )}
              </div>
            </div>
            <div style={{ width: 544, padding: '24px 0', display: 'flex', flexDirection: 'column', gap: 48, position: 'relative' }}>
              <div style={{ display: 'flex', flexDirection: 'column', gap: 12, padding: "0px" }}>
                <h2 style={{ margin: 0, fontFamily: 'Inter', fontWeight: 500, fontSize: 32, letterSpacing: '-0.05em', color: '#101010' }}>10 Hours Breathwork with yoga</h2>
                <PricePill />
              </div>
              <Highlights label="Highlights" items={['Beginner Friendly', 'Yoga guideline included', 'No app download required']} />
              {sharedForm}
            </div>
          </div>
        </section>
        <BioSection portrait="assets/tara.jpg" headline="I'm Tara !" role="Yoga teacher, recovering overthinker, and lifelong student of the breath." story="I came to yoga ten years ago burned out from a corporate desk job, and what started as a way to stretch my back turned into a complete shift in how I move through the world. Today, I teach slow flow, restorative, and breath-led practices that help you reconnect with the body you've been carrying around all day. Whether you're brand new to a mat or have been practicing for years, my classes meet you exactly where you are. Come join me!" />
        <Footer tagline="A space where you can be fully you" sub="Check my channel Yoga with Tara" />
      </main>);

  }

  if (bp === 'desktop') {
    return (
      <main style={{ position: 'relative', background: '#fff' }}>
        <HeroBackdrop />
        <NavBar brand="Yoga with Tara" />
        <section style={{ position: 'relative', padding: '256px 128px 80px', display: 'flex', flexDirection: 'column', gap: 56, alignItems: 'center' }}>
          <PageTitle line1="Get my breathwork course" line2="for Free" />
          <div style={{ width: 1536, display: 'flex', alignItems: 'center', justifyContent: 'center', gap: "48px" }}>
            <div style={{ display: 'flex', flexDirection: 'column', gap: 16, alignItems: 'center' }}>
              <div onClick={() => openLightbox({ kind: 'content', src: 'assets/content-cover.jpg' })} style={{ width: 960, height: 540, borderRadius: 24, overflow: 'hidden', boxShadow: '-12px 10px 80px rgba(0,0,0,0.1)', cursor: 'zoom-in', position: 'relative', background: active.kind === 'photo' ? `url(${active.src}) center/cover no-repeat` : active.tint }}>
                {activeIdx === 0 && <div style={{ position: 'absolute', inset: 0, display: 'grid', placeItems: 'center' }}><PlayBadge /></div>}
              </div>
              <div style={{ display: 'flex', gap: 16, width: 960 }}>
                {CONTENT_FRAMES.map((f, i) =>
                <div key={i} onClick={() => setActiveIdx(i)} style={{ flex: 1, height: 212, borderRadius: 24, cursor: 'pointer',
                  background: f.kind === 'photo' ? `url(${f.src}) center/cover no-repeat` : f.tint,
                  border: `2px solid ${i === activeIdx ? '#D3D2D2' : '#F0F0F0'}`,
                  boxShadow: i === activeIdx ? '0 10px 28px rgba(0,0,0,0.16)' : 'none',
                  transform: i === activeIdx ? 'translateY(-2px)' : 'none',
                  transition: 'all 180ms ease' }} />
                )}
              </div>
            </div>
            <div style={{ width: 544, padding: '24px 0', display: 'flex', flexDirection: 'column', gap: 48, position: 'relative' }}>
              <div style={{ display: 'flex', flexDirection: 'column', gap: 12, padding: "0px" }}>
                <h2 style={{ margin: 0, fontFamily: 'Inter', fontWeight: 500, fontSize: 32, letterSpacing: '-0.05em', color: '#101010' }}>10 Hours Breathwork with yoga</h2>
                <PricePill />
              </div>
              <Highlights label="Highlights" items={['Beginner Friendly', 'Yoga guideline included', 'No app download required']} />
              {sharedForm}
            </div>
          </div>
        </section>
        <BioSection portrait="assets/tara.jpg" headline="I'm Tara !" role="Yoga teacher, recovering overthinker, and lifelong student of the breath." story="I came to yoga ten years ago burned out from a corporate desk job, and what started as a way to stretch my back turned into a complete shift in how I move through the world. Today, I teach slow flow, restorative, and breath-led practices that help you reconnect with the body you've been carrying around all day. Whether you're brand new to a mat or have been practicing for years, my classes meet you exactly where you are. Come join me!" />
        <Footer tagline="A space where you can be fully you" sub="Check my channel Yoga with Tara" />
      </main>);

  }

  // ── Tablet: single column, 128px top padding ──────────────────────────────
  if (bp === 'tablet') {
    return (
      <main style={{ position: 'relative', background: '#fff' }}>
        <HeroBackdrop />
        <NavBar brand="Yoga with Tara" />
        <section style={{ position: 'relative', padding: '224px 64px 32px', display: 'flex', flexDirection: 'column', gap: 40, alignItems: 'center' }}>
          <PageTitle line1="Get my breathwork course" line2="for Free" />
          <div style={{ width: '100%', display: 'flex', flexDirection: 'column', gap: 20 }}>
            {/* Video frame — full width, 16:9 — no zoom on tablet */}
            <div
              data-hero-anchor
              style={{ width: '100%', aspectRatio: '16/9', borderRadius: 24, overflow: 'hidden',
                boxShadow: '-12px 10px 80px rgba(0,0,0,0.10)', position: 'relative',
                background: active.kind === 'photo' ? `url(${active.src}) center/cover no-repeat` : active.tint }}>
              {activeIdx === 0 && <div style={{ position: 'absolute', inset: 0, display: 'grid', placeItems: 'center' }}><PlayBadge /></div>}
            </div>
            {/* Module strip — full-width row of squares, no labels */}
            <div style={{ display: 'flex', gap: 10, padding: '10px 4px 20px', margin: '-10px -4px -16px' }}>
              {CONTENT_FRAMES.map((f, i) =>
              <div key={i} onClick={() => setActiveIdx(i)}
              style={{ flex: 1, aspectRatio: '1', borderRadius: 16, cursor: 'pointer',
                background: f.kind === 'photo' ? `url(${f.src}) center/cover no-repeat` : f.tint,
                border: `2px solid ${i === activeIdx ? '#D3D2D2' : '#F0F0F0'}`,
                boxShadow: i === activeIdx ? '0 10px 24px rgba(0,0,0,0.14)' : 'none',
                transform: i === activeIdx ? 'translateY(-2px)' : 'none',
                transition: 'all 180ms ease' }} />
              )}
            </div>
            {/* Info + Form */}
            <div style={{ display: 'flex', flexDirection: 'column', gap: 28, marginTop: 8 }}>
              <div style={{ display: 'flex', flexDirection: 'column', gap: 12 }}>
                <h2 style={{ margin: 0, fontFamily: 'Inter', fontWeight: 500, fontSize: 24, letterSpacing: '-0.05em', color: '#101010' }}>10 Hours Breathwork with yoga</h2>
                <PricePill />
              </div>
              <Highlights label="Highlights" items={['Beginner Friendly', 'Yoga guideline included', 'No app download required']} />
              {sharedForm}
            </div>
          </div>
        </section>
        <BioSection portrait="assets/tara.jpg" headline="I'm Tara !" role="Yoga teacher, recovering overthinker, and lifelong student of the breath." story="I came to yoga ten years ago burned out from a corporate desk job, and what started as a way to stretch my back turned into a complete shift in how I move through the world. Today, I teach slow flow, restorative, and breath-led practices that help you reconnect with the body you've been carrying around all day. Whether you're brand new to a mat or have been practicing for years, my classes meet you exactly where you are. Come join me!" />
        <Footer tagline="A space where you can be fully you" sub="Check my channel Yoga with Tara" />
      </main>);

  }

  // ── Mobile ────────────────────────────────────────────────────────────────
  // ── Large Mobile ──────────────────────────────────────────────────────
  if (bp === 'largeMobile') {
    return (
      <main style={{ position: 'relative', background: '#fff' }}>
        <HeroBackdrop />
        <NavBar brand="Yoga with Tara" />
        <section style={{ position: 'relative', padding: '128px 32px 48px', display: 'flex', flexDirection: 'column', gap: 16, alignItems: 'center' }}>
          <PageTitle line1="Get my breathwork course" line2="for Free" />
          <div style={{ width: '100%', display: 'flex', flexDirection: 'column', gap: 14 }}>
            <div
              data-hero-anchor
              style={{ width: '100%', aspectRatio: '16/9', borderRadius: 24, overflow: 'hidden',
                boxShadow: '0 8px 32px rgba(0,0,0,0.10)', position: 'relative',
                background: active.kind === 'photo' ? `url(${active.src}) center/cover no-repeat` : active.tint }}>
              <div style={{ position: 'absolute', inset: 0, display: 'grid', placeItems: 'center' }}>{activeIdx === 0 && <PlayBadge size={64} />}</div>
            </div>
            <div style={{ display: 'flex', gap: 8, padding: '8px 4px 14px', margin: '-8px -4px -10px' }}>
              {CONTENT_FRAMES.map((f, i) =>
              <div key={i} onClick={() => setActiveIdx(i)}
              style={{ flex: 1, aspectRatio: '1', borderRadius: 12, cursor: 'pointer',
                background: f.kind === 'photo' ? `url(${f.src}) center/cover no-repeat` : f.tint,
                border: `2px solid ${i === activeIdx ? '#D3D2D2' : '#F0F0F0'}`,
                boxShadow: i === activeIdx ? '0 6px 18px rgba(0,0,0,0.12)' : 'none',
                transform: i === activeIdx ? 'translateY(-2px)' : 'none',
                transition: 'all 180ms ease' }} />
              )}
            </div>
            <div style={{ display: 'flex', flexDirection: 'column', gap: 20, marginTop: 8 }}>
              <div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}>
                <h2 style={{ margin: 0, fontFamily: 'Inter', fontWeight: 500, fontSize: 18, letterSpacing: '-0.04em', color: '#101010' }}>10 Hours Breathwork with yoga</h2>
                <PricePill />
              </div>
              <Highlights label="Highlights" items={['Beginner Friendly', 'Yoga guideline included', 'No app download required']} />
              {sharedForm}
            </div>
          </div>
        </section>
        <BioSection portrait="assets/tara.jpg" headline="I'm Tara !" role="Yoga teacher, recovering overthinker, and lifelong student of the breath." story="I came to yoga ten years ago burned out from a corporate desk job, and what started as a way to stretch my back turned into a complete shift in how I move through the world. Today, I teach slow flow, restorative, and breath-led practices that help you reconnect with the body you've been carrying around all day. Whether you're brand new to a mat or have been practicing for years, my classes meet you exactly where you are. Come join me!" />
        <Footer tagline="A space where you can be fully you" sub="Check my channel Yoga with Tara" />
      </main>);

  }

  // ── Small Mobile ───────────────────────────────────────────────────────
  return (
    <main style={{ position: 'relative', background: '#fff' }}>
      <HeroBackdrop />
      <NavBar brand="Yoga with Tara" />
      <section style={{ position: 'relative', padding: '128px 16px 48px', display: 'flex', flexDirection: 'column', gap: 16, alignItems: 'center' }}>
        <PageTitle line1="Get my breathwork course" line2="for Free" />
        <div style={{ width: '100%', display: 'flex', flexDirection: 'column', gap: 14 }}>
          <div
            data-hero-anchor
            style={{ width: '100%', aspectRatio: '16/9', borderRadius: 24, overflow: 'hidden',
              boxShadow: '0 8px 32px rgba(0,0,0,0.10)', position: 'relative',
              background: active.kind === 'photo' ? `url(${active.src}) center/cover no-repeat` : active.tint }}>
            <div style={{ position: 'absolute', inset: 0, display: 'grid', placeItems: 'center' }}>{activeIdx === 0 && <PlayBadge size={64} />}</div>
          </div>
          <div style={{ display: 'flex', gap: 8, padding: '8px 4px 14px', margin: '-8px -4px -10px' }}>
            {CONTENT_FRAMES.map((f, i) =>
            <div key={i} onClick={() => setActiveIdx(i)}
            style={{ flex: 1, aspectRatio: '1', borderRadius: 12, cursor: 'pointer',
              background: f.kind === 'photo' ? `url(${f.src}) center/cover no-repeat` : f.tint,
              border: `2px solid ${i === activeIdx ? '#D3D2D2' : '#F0F0F0'}`,
              boxShadow: i === activeIdx ? '0 6px 18px rgba(0,0,0,0.12)' : 'none',
              transform: i === activeIdx ? 'translateY(-2px)' : 'none',
              transition: 'all 180ms ease' }} />
            )}
          </div>
          <div style={{ display: 'flex', flexDirection: 'column', gap: 20, marginTop: 8 }}>
            <div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}>
              <h2 style={{ margin: 0, fontFamily: 'Inter', fontWeight: 500, fontSize: 18, letterSpacing: '-0.04em', color: '#101010' }}>10 Hours Breathwork with yoga</h2>
              <PricePill />
            </div>
            <Highlights label="Highlights" items={['Beginner Friendly', 'Yoga guideline included', 'No app download required']} />
            {sharedForm}
          </div>
        </div>
      </section>
      <BioSection portrait="assets/tara.jpg" headline="I'm Tara !" role="Yoga teacher, recovering overthinker, and lifelong student of the breath." story="I came to yoga ten years ago burned out from a corporate desk job, and what started as a way to stretch my back turned into a complete shift in how I move through the world. Today, I teach slow flow, restorative, and breath-led practices that help you reconnect with the body you've been carrying around all day. Whether you're brand new to a mat or have been practicing for years, my classes meet you exactly where you are. Come join me!" />
      <Footer tagline="A space where you can be fully you" sub="Check my channel Yoga with Tara" />
    </main>);

};

// ─── 3) NEWSLETTER ────────────────────────────────────────────────────────────

const IssuePreview = ({ src }) =>
<div style={{ width: 274, aspectRatio: '540/1020', borderRadius: 12, overflow: 'hidden',
  background: `url(${src}) center/cover no-repeat #f5ede4`,
  boxShadow: '0 20px 60px rgba(0,0,0,0.08)', flexShrink: 0 }} />;


const NEWSLETTER_ISSUES = [
{ src: 'assets/newsletter-card-1.jpg' },
{ src: 'assets/newsletter-card-2.jpg' },
{ src: 'assets/newsletter-card-3.jpg' }];


const FeatureCard = ({ num, title, desc }) =>
<div style={{ flex: 1, padding: 24, borderRadius: 24, display: 'flex', flexDirection: 'column', gap: 10, background: 'transparent', border: "3px solid rgb(244, 235, 230)", fontWeight: "600" }}>
    <div style={{ display: 'inline-flex', alignItems: 'center', justifyContent: 'center', fontFamily: 'Inter', fontSize: 12, color: '#998174', fontWeight: 500, lineHeight: 1, background: '#F8EBE3', alignSelf: 'flex-start', margin: "4px 0px 0px", padding: "6px 8px", borderRadius: "8px" }}>{num}</div>
    <div style={{ display: 'flex', flexDirection: 'column', gap: 2 }}>
      <div style={{ fontFamily: 'Inter', fontWeight: 500, fontSize: 22, letterSpacing: '-0.04em', color: '#292929', margin: "0px 0px 8px" }}>{title}</div>
      <div style={{ fontFamily: 'Inter', fontSize: 18, letterSpacing: '-0.03em', color: '#696a6d', lineHeight: 1.2, fontWeight: "400" }}>{desc}</div>
    </div>
  </div>;


const NewsletterTemplate = ({ formState, submitEmail, openLightbox, defaultEmail, forcedError }) => {
  const bp = useBreakpoint();
  const pricing = React.useContext(PricingContext);

  const sharedForm = pricing.model === 'paid' ? <PaidCTA /> :
  <div style={{ position: 'relative' }}>
      <EmailForm defaultEmail={defaultEmail} forcedError={forcedError} onSubmit={submitEmail} formState={formState}
    copy={{ cta: 'Subscribe', sentCta: 'Subscribed', disclaimer: "By submitting your email, you're opting in. Unsubscribe anytime - no hard feelings." }} />
      <SuccessToast visible={formState === 'success'} message="You're in. First issue is on its way." />
    </div>;


  // ── Desktop: exact original ────────────────────────────────────────────────
  // ── Large Desktop ───────────────────────────────────────────────────────
  if (bp === 'largeDesktop') {
    return (
      <main style={{ position: 'relative', background: '#fff' }}>
        <HeroBackdrop />
        <NavBar brand="Yoga with Tara" />
        <section style={{ position: 'relative', display: 'flex', flexDirection: 'column', gap: 56, alignItems: 'center', padding: "256px 128px 80px" }}>
          <PageTitle line1="Follow my monthly" line2="yoga updates" />
          <div style={{ width: 1536, display: 'flex', alignItems: 'center', justifyContent: 'center', gap: "88px" }}>
            <div style={{ display: 'flex', flexDirection: 'column', gap: 24, alignItems: 'center' }}>
              <img src="assets/newsletter-issues.jpg" alt="Newsletter previews"
              style={{ width: 900, height: 'auto', display: 'block', borderRadius: "24px" }} />
              <div style={{ display: 'flex', gap: 16, width: 900 }}>
                <FeatureCard num="01" title="New Technique" desc="Covering new yoga poses" />
                <FeatureCard num="02" title="Deep Meditation Flow" desc="with 3 minutes audio to guide" />
                <FeatureCard num="03" title="Recommendation" desc="new item reviews with all honesty" />
              </div>
            </div>
            <div style={{ width: 544, padding: '24px 0', display: 'flex', flexDirection: 'column', gap: 48, position: 'relative' }}>
              <div style={{ display: 'flex', flexDirection: 'column', gap: 12, padding: "0px" }}>
                <h2 style={{ margin: 0, fontFamily: 'Inter', fontWeight: 500, fontSize: 32, letterSpacing: '-0.05em', color: '#101010' }}>Advanced Yoga Newsletter</h2>
                <PricePill />
              </div>
              <Highlights label="Features" items={['New yoga techniques from top 10 instructors', 'Access to sound meditation video', 'Discount code on the recommendations']} />
              {sharedForm}
            </div>
          </div>
        </section>
        <BioSection portrait="assets/tara.jpg" headline="I'm Tara !" role="Yoga teacher, recovering overthinker, and lifelong student of the breath." story="I came to yoga ten years ago burned out from a corporate desk job, and what started as a way to stretch my back turned into a complete shift in how I move through the world. Today, I teach slow flow, restorative, and breath-led practices that help you reconnect with the body you've been carrying around all day. Whether you're brand new to a mat or have been practicing for years, my classes meet you exactly where you are. Come join me!" />
        <Footer tagline="A space where you can be fully you" sub="Check my channel Yoga with Tara" />
      </main>);

  }

  if (bp === 'desktop') {
    return (
      <main style={{ position: 'relative', background: '#fff' }}>
        <HeroBackdrop />
        <NavBar brand="Yoga with Tara" />
        <section style={{ position: 'relative', display: 'flex', flexDirection: 'column', gap: 56, alignItems: 'center', padding: "256px 128px 80px" }}>
          <PageTitle line1="Follow my monthly" line2="yoga updates" />
          <div style={{ width: 1536, display: 'flex', alignItems: 'center', justifyContent: 'center', gap: "88px" }}>
            <div style={{ display: 'flex', flexDirection: 'column', gap: 24, alignItems: 'center' }}>
              <img src="assets/newsletter-issues.jpg" alt="Newsletter previews"
              style={{ width: 900, height: 'auto', display: 'block', borderRadius: "24px" }} />
              <div style={{ display: 'flex', gap: 16, width: 900 }}>
                <FeatureCard num="01" title="New Technique" desc="Covering new yoga poses" />
                <FeatureCard num="02" title="Deep Meditation Flow" desc="with 3 minutes audio to guide" />
                <FeatureCard num="03" title="Recommendation" desc="new item reviews with all honesty" />
              </div>
            </div>
            <div style={{ width: 544, padding: '24px 0', display: 'flex', flexDirection: 'column', gap: 48, position: 'relative' }}>
              <div style={{ display: 'flex', flexDirection: 'column', gap: 12, padding: "0px" }}>
                <h2 style={{ margin: 0, fontFamily: 'Inter', fontWeight: 500, fontSize: 32, letterSpacing: '-0.05em', color: '#101010' }}>Advanced Yoga Newsletter</h2>
                <PricePill />
              </div>
              <Highlights label="Features" items={['New yoga techniques from top 10 instructors', 'Access to sound meditation video', 'Discount code on the recommendations']} />
              {sharedForm}
            </div>
          </div>
        </section>
        <BioSection portrait="assets/tara.jpg" headline="I'm Tara !" role="Yoga teacher, recovering overthinker, and lifelong student of the breath." story="I came to yoga ten years ago burned out from a corporate desk job, and what started as a way to stretch my back turned into a complete shift in how I move through the world. Today, I teach slow flow, restorative, and breath-led practices that help you reconnect with the body you've been carrying around all day. Whether you're brand new to a mat or have been practicing for years, my classes meet you exactly where you are. Come join me!" />
        <Footer tagline="A space where you can be fully you" sub="Check my channel Yoga with Tara" />
      </main>);

  }

  // ── Tablet: single column, 128 px top padding ─────────────────────────────
  if (bp === 'tablet') {
    return (
      <main style={{ position: 'relative', background: '#fff' }}>
        <HeroBackdrop />
        <NavBar brand="Yoga with Tara" />
        <section style={{ position: 'relative', padding: '224px 64px 32px', display: 'flex', flexDirection: 'column', gap: 40, alignItems: 'center' }}>
          <PageTitle line1="Follow my monthly" line2="yoga updates" />
          <div style={{ width: '100%', display: 'flex', flexDirection: 'column', gap: 24 }}>
            <img src="assets/newsletter-issues.jpg" alt="Newsletter previews"
            style={{ width: '100%', height: 'auto', display: 'block', borderRadius: "24px" }} />
            {/* Feature cards — row */}
            <div style={{ display: 'flex', gap: 10 }}>
              {[['01', 'New Technique', 'Covering new yoga poses'], ['02', 'Deep Meditation Flow', 'with 3 min audio'], ['03', 'Recommendation', 'new item reviews']].map(([n, t, d]) =>
              <div key={n} style={{ flex: 1, padding: 16, borderRadius: 16, border: '2px solid #f4ebe6', display: 'flex', flexDirection: 'column', gap: 8, background: 'transparent' }}>
                  <div style={{ borderRadius: 75, display: 'inline-flex', alignItems: 'center', justifyContent: 'center', fontFamily: 'Inter', fontSize: 10, color: '#998174', fontWeight: 500, lineHeight: 1, background: '#F8EBE3', padding: '4px 8px', alignSelf: 'flex-start' }}>{n}</div>
                  <div style={{ fontFamily: 'Inter', fontWeight: 500, fontSize: 14, letterSpacing: '-0.03em', color: '#292929' }}>{t}</div>
                  <div style={{ fontFamily: 'Inter', fontSize: 13, letterSpacing: '-0.02em', color: '#696a6d', lineHeight: 1.3 }}>{d}</div>
                </div>
              )}
            </div>
            {/* Info + Form */}
            <div style={{ display: 'flex', flexDirection: 'column', gap: 28 }}>
              <div style={{ display: 'flex', flexDirection: 'column', gap: 12 }}>
                <h2 style={{ margin: 0, fontFamily: 'Inter', fontWeight: 500, fontSize: 24, letterSpacing: '-0.05em', color: '#101010' }}>Advanced Yoga Newsletter</h2>
                <PricePill />
              </div>
              <Highlights label="Features" items={['New yoga techniques from top 10 instructors', 'Access to sound meditation video', 'Discount code on the recommendations']} />
              {sharedForm}
            </div>
          </div>
        </section>
        <BioSection portrait="assets/tara.jpg" headline="I'm Tara !" role="Yoga teacher, recovering overthinker, and lifelong student of the breath." story="I came to yoga ten years ago burned out from a corporate desk job, and what started as a way to stretch my back turned into a complete shift in how I move through the world. Today, I teach slow flow, restorative, and breath-led practices that help you reconnect with the body you've been carrying around all day. Whether you're brand new to a mat or have been practicing for years, my classes meet you exactly where you are. Come join me!" />
        <Footer tagline="A space where you can be fully you" sub="Check my channel Yoga with Tara" />
      </main>);

  }

  // ── Mobile ─────────────────────────────────────────────────────────────────
  // ── Large Mobile ──────────────────────────────────────────────────────
  if (bp === 'largeMobile') {
    return (
      <main style={{ position: 'relative', background: '#fff' }}>
        <HeroBackdrop />
        <NavBar brand="Yoga with Tara" />
        <section style={{ position: 'relative', padding: '128px 32px 48px', display: 'flex', flexDirection: 'column', gap: 16, alignItems: 'center' }}>
          <PageTitle line1="Follow my monthly" line2="yoga updates" />
          <div style={{ width: '100%', display: 'flex', flexDirection: 'column', gap: 16 }}>
            <img src="assets/newsletter-issues.jpg" alt="Newsletter previews"
            style={{ width: '100%', height: 'auto', display: 'block' }} />
            <div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
              {[['01', 'New Technique', 'Covering new yoga poses'], ['02', 'Deep Meditation Flow', 'with 3 min audio'], ['03', 'Recommendation', 'new item reviews']].map(([n, t, d]) =>
              <div key={n} style={{ padding: 14, borderRadius: 14, border: '2px solid #f4ebe6', display: 'flex', gap: 12, alignItems: 'flex-start', background: 'transparent' }}>
                  <div style={{ borderRadius: 75, display: 'inline-flex', alignItems: 'center', justifyContent: 'center', fontFamily: 'Inter', fontSize: 9, color: '#998174', fontWeight: 500, lineHeight: 1, background: '#F8EBE3', padding: '4px 8px', flexShrink: 0 }}>{n}</div>
                  <div><div style={{ fontFamily: 'Inter', fontWeight: 500, fontSize: 14, color: '#292929', letterSpacing: '-0.03em' }}>{t}</div><div style={{ fontFamily: 'Inter', fontSize: 13, color: '#696a6d', marginTop: 2 }}>{d}</div></div>
                </div>
              )}
            </div>
            <div style={{ display: 'flex', flexDirection: 'column', gap: 20, marginTop: 4 }}>
              <div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}>
                <h2 style={{ margin: 0, fontFamily: 'Inter', fontWeight: 500, fontSize: 18, letterSpacing: '-0.04em', color: '#101010' }}>Advanced Yoga Newsletter</h2>
                <PricePill />
              </div>
              <Highlights label="Features" items={['New yoga techniques from top 10 instructors', 'Access to sound meditation video', 'Discount code on the recommendations']} />
              {sharedForm}
            </div>
          </div>
        </section>
        <BioSection portrait="assets/tara.jpg" headline="I'm Tara !" role="Yoga teacher, recovering overthinker, and lifelong student of the breath." story="I came to yoga ten years ago burned out from a corporate desk job, and what started as a way to stretch my back turned into a complete shift in how I move through the world. Today, I teach slow flow, restorative, and breath-led practices that help you reconnect with the body you've been carrying around all day. Whether you're brand new to a mat or have been practicing for years, my classes meet you exactly where you are. Come join me!" />
        <Footer tagline="A space where you can be fully you" sub="Check my channel Yoga with Tara" />
      </main>);

  }

  // ── Small Mobile ───────────────────────────────────────────────────────
  return (
    <main style={{ position: 'relative', background: '#fff' }}>
      <HeroBackdrop />
      <NavBar brand="Yoga with Tara" />
      <section style={{ position: 'relative', padding: '128px 16px 48px', display: 'flex', flexDirection: 'column', gap: 16, alignItems: 'center' }}>
        <PageTitle line1="Follow my monthly" line2="yoga updates" />
        <div style={{ width: '100%', display: 'flex', flexDirection: 'column', gap: 16 }}>
          <img src="assets/newsletter-issues.jpg" alt="Newsletter previews"
          style={{ width: '100%', height: 'auto', display: 'block' }} />
          <div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
            {[['01', 'New Technique', 'Covering new yoga poses'], ['02', 'Deep Meditation Flow', 'with 3 min audio'], ['03', 'Recommendation', 'new item reviews']].map(([n, t, d]) =>
            <div key={n} style={{ padding: 14, borderRadius: 14, border: '2px solid #f4ebe6', display: 'flex', gap: 12, alignItems: 'flex-start', background: 'transparent' }}>
                <div style={{ borderRadius: 75, display: 'inline-flex', alignItems: 'center', justifyContent: 'center', fontFamily: 'Inter', fontSize: 9, color: '#998174', fontWeight: 500, lineHeight: 1, background: '#F8EBE3', padding: '4px 8px', flexShrink: 0 }}>{n}</div>
                <div><div style={{ fontFamily: 'Inter', fontWeight: 500, fontSize: 14, color: '#292929', letterSpacing: '-0.03em' }}>{t}</div><div style={{ fontFamily: 'Inter', fontSize: 13, color: '#696a6d', marginTop: 2 }}>{d}</div></div>
              </div>
            )}
          </div>
          <div style={{ display: 'flex', flexDirection: 'column', gap: 20, marginTop: 4 }}>
            <div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}>
              <h2 style={{ margin: 0, fontFamily: 'Inter', fontWeight: 500, fontSize: 18, letterSpacing: '-0.04em', color: '#101010' }}>Advanced Yoga Newsletter</h2>
              <PricePill />
            </div>
            <Highlights label="Features" items={['New yoga techniques from top 10 instructors', 'Access to sound meditation video', 'Discount code on the recommendations']} />
            {sharedForm}
          </div>
        </div>
      </section>
      <BioSection portrait="assets/tara.jpg" headline="I'm Tara !" role="Yoga teacher, recovering overthinker, and lifelong student of the breath." story="I came to yoga ten years ago burned out from a corporate desk job, and what started as a way to stretch my back turned into a complete shift in how I move through the world. Today, I teach slow flow, restorative, and breath-led practices that help you reconnect with the body you've been carrying around all day. Whether you're brand new to a mat or have been practicing for years, my classes meet you exactly where you are. Come join me!" />
      <Footer tagline="A space where you can be fully you" sub="Check my channel Yoga with Tara" />
    </main>);

};

Object.assign(window, {
  ProductTemplate, ProductExtraTextTemplate, ContentTemplate, NewsletterTemplate,
  NotionMockup, IPadImage, IssuePreview, PlayBadge, Thumb, FeatureCard,
  TextBlockSection, HubCard
});

// ─── Drag-to-scroll for thumbnail strips/columns ─────────────────────────────
// Delegated at document level so it survives React rerenders and works for all
// breakpoints (desktop column = vertical, tablet/mobile strip = horizontal).
(function initDragScroll() {
  if (typeof document === 'undefined' || document.__splDragScrollInit) return;
  document.__splDragScrollInit = true;

  const SELECTOR = '.spl-thumbs, .spl-thumbs-x, .spl-th-t, .spl-th-tx, .spl-th-m, .spl-th-mx';
  const THRESHOLD = 5;

  const style = document.createElement('style');
  style.textContent =
  SELECTOR + '{cursor:grab}' +
  '.spl-dragging,.spl-dragging *{cursor:grabbing !important;user-select:none !important}';
  document.head.appendChild(style);

  let active = null;
  let startX = 0,startY = 0;
  let startScrollLeft = 0,startScrollTop = 0;
  let moved = false;

  document.addEventListener('mousedown', (e) => {
    if (e.button !== 0) return;
    const el = e.target.closest && e.target.closest(SELECTOR);
    if (!el) return;
    active = el;
    startX = e.clientX;startY = e.clientY;
    startScrollLeft = el.scrollLeft;startScrollTop = el.scrollTop;
    moved = false;
    el.classList.add('spl-dragging');
  }, true);

  document.addEventListener('mousemove', (e) => {
    if (!active) return;
    const dx = e.clientX - startX;
    const dy = e.clientY - startY;
    if (!moved && (Math.abs(dx) > THRESHOLD || Math.abs(dy) > THRESHOLD)) {
      moved = true;
    }
    if (moved) {
      active.scrollLeft = startScrollLeft - dx;
      active.scrollTop = startScrollTop - dy;
      e.preventDefault();
    }
  }, true);

  function end() {
    if (!active) return;
    const el = active;
    active = null;
    el.classList.remove('spl-dragging');
    if (moved) {
      // Swallow the synthetic click that follows mouseup after a drag so we
      // don't accidentally switch the active thumbnail when the user just
      // wanted to scroll.
      const swallow = (ev) => {
        ev.stopPropagation();
        ev.preventDefault();
        window.removeEventListener('click', swallow, true);
      };
      window.addEventListener('click', swallow, true);
      setTimeout(() => window.removeEventListener('click', swallow, true), 50);
    }
  }

  document.addEventListener('mouseup', end, true);
  // If the pointer leaves the window mid-drag, stop the drag cleanly.
  window.addEventListener('blur', end);
  document.addEventListener('dragstart', (e) => {
    if (e.target.closest && e.target.closest(SELECTOR)) e.preventDefault();
  }, true);
})();