/* global React, Button, Chip, Stamp, Reveal, Sticker */
const { useState } = React;

/* ============================================================
   Memberships / packages
   ============================================================ */
function MembershipSection({ onBook }) {
  const plans = [
  {
    name: 'Triple Bare', jp: '3回パック', price: 144, period: '3 Brazilians',
    tone: 'paper', rot: -2,
    blurb: 'Prepay for 3 Brazilian waxes and your per-visit price drops from $53 to $48.',
    perks: ['3 Brazilian waxes, use anytime', '$48 per appt (vs. $53 drop-in)', 'No autopay, no monthly commitment', 'Just book & go ♡'],
    cta: 'Grab the 3-pack',
    payOverTime: true
  },
  {
    name: 'Smooth Operator', jp: '5回パック', price: 225, period: '5 Brazilians',
    tone: 'pink', rot: 0,
    blurb: 'Prepay for 5 Brazilian waxes and your per-visit price drops from $53 to $45 — our best value.',
    perks: ['5 Brazilian waxes, use anytime', '$45 per appt (vs. $53 drop-in)', 'No autopay, no monthly commitment', 'Biggest savings per wax ✦'],
    cta: 'Grab the 5-pack',
    featured: true,
    payOverTime: true
  },
  {
    name: 'FabuLASH', jp: 'ラッシュ', price: 130, period: 'month',
    tone: 'lime', rot: 2,
    blurb: 'Maintain your lashes with 2 fills per month — or swap for a full set.',
    perks: ['2 lash fills / month (or 1 full set)', 'Rollover credits if you miss', 'Cancel anytime after 3 months', 'Priority lash bookings'],
    cta: 'Join FabuLASH'
  }];

  const toneBg = {
    paper: 'var(--tbb-paper)', pink: 'var(--tbb-hotpink)', lime: 'var(--tbb-lime)'
  };
  const toneFg = {
    paper: 'var(--tbb-ink)', pink: 'var(--tbb-paper)', lime: 'var(--tbb-ink)'
  };
  return (
    <section id="memberships" style={{
      padding: '80px 48px', background: 'var(--tbb-paper-warm)',
      borderTop: '3px solid var(--tbb-ink)', borderBottom: '3px solid var(--tbb-ink)',
      position: 'relative'
    }}>
      <div className="tbb-halftone-light" style={{ position: 'absolute', inset: 0, pointerEvents: 'none' }} />
      <div style={{ position: 'relative', maxWidth: 1300, margin: '0 auto' }}>
        <div style={{ textAlign: 'center', marginBottom: 36 }}>
          <Chip tone="ink" rot={-3} sticker>Memberships</Chip>
          <h2 style={{ fontFamily: 'Olivita, system-ui', fontStyle: 'italic', fontSize: 'clamp(36px, 5vw, 68px)', lineHeight: 0.9, margin: '18px 0 6px' }}>
            Pick your glow pace.
          </h2>
        </div>

        <div className="tbb-memberships-grid" style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(280px, 1fr))', gap: '40px 28px', paddingTop: 24, paddingBottom: 24 }}>
          {plans.map((p, i) =>
          <Reveal key={p.name} delay={i * 100}>
              <div className="tbb-peel" style={{
              background: toneBg[p.tone],
              color: toneFg[p.tone],
              border: '3px solid var(--tbb-ink)',
              borderRadius: 32,
              boxShadow: p.featured ? '10px 10px 0 0 var(--tbb-ink)' : '5px 5px 0 0 var(--tbb-ink)',
              padding: '28px 26px', minHeight: 480,
              display: 'flex', flexDirection: 'column', gap: 14,
              transform: `rotate(${p.rot}deg) ${p.featured ? 'scale(1.04)' : ''}`,
              position: 'relative'
            }}>
                {p.featured &&
              <div style={{ position: 'absolute', top: -18, right: -12 }}>
                    <Stamp tone="butter" rot={8}>★ Most loved</Stamp>
                  </div>
              }
                <div style={{ fontFamily: 'Olivita, system-ui', fontStyle: 'italic', fontSize: 'clamp(40px, 4vw, 60px)', lineHeight: 0.95 }}>{p.name}</div>
                {p.price > 0 &&
              <div style={{ display: 'flex', alignItems: 'baseline', gap: 8 }}>
                    <div style={{ fontFamily: 'Olivita, system-ui', fontStyle: 'italic', fontSize: 64, lineHeight: 1 }}>
                      {`$${p.price}`}
                    </div>
                    <div style={{ fontFamily: 'Nunito Sans', fontWeight: 900, fontSize: 13, letterSpacing: '0.14em', textTransform: 'uppercase', opacity: 0.8 }}>/ {p.period || 'month'}</div>
                  </div>
              }
                <p style={{ fontFamily: 'Nunito', fontWeight: 500, fontSize: 15, lineHeight: 1.5, margin: '0 0 4px' }}>{p.blurb}</p>
                <ul style={{ listStyle: 'none', padding: 0, margin: '4px 0 0', display: 'flex', flexDirection: 'column', gap: 8 }}>
                  {p.perks.map((perk) =>
                <li key={perk} style={{ display: 'flex', gap: 10, fontFamily: 'Nunito', fontWeight: 600, fontSize: 15 }}>
                      <span style={{ fontFamily: 'Olivita, system-ui', fontStyle: 'italic', flexShrink: 0 }}>✦</span>
                      {perk}
                    </li>
                )}
                </ul>
                <div style={{ marginTop: 'auto', paddingTop: 14 }}>
                  <Button
                  variant={p.tone === 'pink' ? 'butter' : 'primary'}
                  size="lg"
                  as="a"
                  href="https://www.vagaro.com/tokyobikinibar/memberships"
                  target="_blank"
                  rel="noreferrer"
                  style={{ width: '100%', justifyContent: 'center' }}>
                  {p.cta} →</Button>
                  {p.payOverTime &&
                <div style={{ textAlign: 'center', fontFamily: 'Nunito', fontWeight: 600, fontSize: 12.5, opacity: 0.75, marginTop: 8 }}>
                      ✦ Or split it with Affirm at checkout
                    </div>
                }
                </div>
              </div>
            </Reveal>
          )}
        </div>
      </div>
    </section>);

}

/* ============================================================
   FAQ accordion
   ============================================================ */
const FAQS = [
['What kind of wax do you use?', "Premium hard wax, mostly — gentler on skin, kinder on hair, perfect for sensitive bits. Soft wax when it makes sense for the area. Either way, you’re in good hands."],
["Will it hurt?", "Honest answer: the first time is the worst. After that your hairs grow back finer, and your nervous system catches on. Most babes say it's a 4/10 by visit three. I'll talk you through every single pull."],
["How long should my hair be?", "At least a ¼ inch — about a grain of rice. If you shaved within two weeks, we'll need to wait."],
["Can I come in on my period?", "Yes, totally. You'll be a touch more sensitive but it doesn't change the service. Wear a tampon or cup, take an Advil 30 min before, and we're golden."],
["Do you take walk-ins?", "No walk-ins, ever — the studio is private and by-appointment only. Hit the booking button to see my live availability and grab a slot."],
["How do I cancel or reschedule?", "Up to 24 hours before, no charge. Inside 24h there's a 50% fee (rent, you know). Use the link in your confirmation text."],
["Where are you located?", "4840 Calle Alto, Suite A, Camarillo, CA 93012. Park on the street — you'll get a text with how to get in. Call or text (805) 883-0714."]];


function FaqSection() {
  return (
    <section id="faq" style={{
      padding: '80px 48px', background: 'var(--tbb-paper)', position: 'relative'
    }}>
      <div style={{ maxWidth: 980, margin: '0 auto' }}>
        <div style={{ textAlign: 'center', marginBottom: 36 }}>
          <Chip tone="lime" rot={-3} sticker>The asked &amp; answered</Chip>
          <h2 style={{ fontFamily: 'Olivita, system-ui', fontStyle: 'italic', fontSize: 'clamp(36px, 5vw, 68px)', lineHeight: 0.9, margin: '18px 0 6px' }}>
            FAQ for the curious.
          </h2>
        </div>

        <div style={{ display: 'flex', flexDirection: 'column', gap: 14 }}>
          {FAQS.map(([q, a], i) =>
          <Reveal key={q} delay={i * 30}>
              <details className="tbb-faq" style={{
              background: i % 2 === 0 ? 'var(--tbb-paper)' : 'var(--tbb-paper-warm)',
              border: '3px solid var(--tbb-ink)',
              borderRadius: 22,
              boxShadow: '5px 5px 0 0 var(--tbb-ink)'
            }}>
                <summary style={{ padding: '18px 22px', display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 18 }}>
                  <span style={{ fontFamily: 'Nunito Sans', fontWeight: 900, fontSize: 'clamp(16px, 1.6vw, 20px)', letterSpacing: '0.02em' }}>
                    {q}
                  </span>
                  <span className="tbb-faq-plus" style={{
                  width: 36, height: 36, flexShrink: 0,
                  border: '2.5px solid var(--tbb-ink)', borderRadius: 999,
                  background: 'var(--tbb-hotpink)', color: 'var(--tbb-paper)',
                  display: 'flex', alignItems: 'center', justifyContent: 'center',
                  fontFamily: 'Nunito Sans', fontWeight: 900, fontSize: 22, lineHeight: 1,
                  transition: 'transform 220ms var(--bounce)'
                }}>+</span>
                </summary>
                <div style={{ padding: '0 22px 20px', fontFamily: 'Nunito', fontWeight: 500, fontSize: 17, lineHeight: 1.55, color: 'var(--fg2)' }}>
                  {a}
                </div>
              </details>
            </Reveal>
          )}
        </div>
      </div>
    </section>);

}

/* ============================================================
   Location & hours
   ============================================================ */
function LocationSection({ onBook }) {
  return (
    <section id="location" style={{
      padding: '80px 48px', background: 'var(--tbb-sky)',
      borderTop: '3px solid var(--tbb-ink)', borderBottom: '3px solid var(--tbb-ink)',
      position: 'relative', overflow: 'hidden'
    }}>
      <div className="tbb-halftone" style={{ position: 'absolute', inset: 0, pointerEvents: 'none', opacity: 0.4 }} />
      <div className="tbb-location-grid" style={{ position: 'relative', maxWidth: 1300, margin: '0 auto', display: 'grid', gridTemplateColumns: '1.1fr 1fr', gap: 48, alignItems: 'center' }}>
        <Reveal>
          <div>
            <Chip tone="ink" rot={-3} sticker>The studio</Chip>
            <h2 style={{ fontFamily: 'Olivita, system-ui', fontStyle: 'italic', fontSize: 'clamp(36px, 5vw, 68px)', lineHeight: 0.9, margin: '18px 0 12px' }}>
              Find me in Camarillo.
            </h2>
            <p style={{ fontFamily: 'Nunito', fontSize: 16, fontWeight: 500, color: 'var(--fg2)', maxWidth: 440, margin: '0 0 22px' }}>
              A private wax studio right off the 101 — easy to reach from Oxnard, Thousand Oaks, Ventura, and anywhere else in Ventura County.
            </p>

            <div style={{ display: 'flex', flexDirection: 'column', gap: 14 }}>
              <Sticker tone="paper" radius={22} style={{ padding: '18px 22px', display: 'flex', flexDirection: 'column', gap: 4 }}>
                <div style={{ fontFamily: 'Nunito Sans', fontWeight: 900, fontSize: 11, letterSpacing: '0.18em', textTransform: 'uppercase', color: 'var(--fg3)' }}>Address</div>
                <div style={{ fontFamily: 'Olivita, system-ui', fontStyle: 'italic', fontSize: 30, lineHeight: 1.05 }}>4840 Calle Alto, Suite A</div>
                <div style={{ fontFamily: 'Nunito', fontWeight: 600, fontSize: 15, color: 'var(--fg2)' }}>Camarillo, CA 93012</div>
              </Sticker>
              <Sticker tone="paper" radius={22} style={{ padding: '18px 22px' }}>
                <div style={{ fontFamily: 'Nunito Sans', fontWeight: 900, fontSize: 11, letterSpacing: '0.18em', textTransform: 'uppercase', color: 'var(--fg3)', marginBottom: 6 }}>Hours</div>
                <div style={{ fontFamily: 'Nunito', fontWeight: 600, fontSize: 15, lineHeight: 1.5, color: 'var(--fg2)' }}>
                  I'm on new-mom hours right now, so the schedule shifts week to week — no set hours, no walk-ins, appointment-only.{' '}
                  <span onClick={onBook} style={{ fontWeight: 800, color: 'var(--tbb-hotpink)', textDecoration: 'underline', textUnderlineOffset: 3, cursor: 'pointer' }}>
                    Check the link for live availability
                  </span>{' '}♡
                </div>
              </Sticker>
              <Sticker tone="paper" radius={22} style={{ padding: '18px 22px', display: 'flex', justifyContent: 'space-between', alignItems: 'center', gap: 14, flexWrap: 'wrap' }}>
                <div>
                  <div style={{ fontFamily: 'Nunito Sans', fontWeight: 900, fontSize: 11, letterSpacing: '0.18em', textTransform: 'uppercase', color: 'var(--fg3)', marginBottom: 4 }}>Say hi</div>
                  <div style={{ fontFamily: 'Nunito Sans', fontWeight: 800, fontSize: 16 }}>(805) 883-0714 · tokyobikinibar@gmail.com</div>
                </div>
                <Button size="md" onClick={onBook}>Book ✦</Button>
              </Sticker>
            </div>
          </div>
        </Reveal>

        <Reveal delay={150}>
          <div style={{ position: 'relative' }}>
            {/* faux map */}
            <div style={{
              width: '100%', aspectRatio: '1/1',
              border: '5px solid var(--tbb-ink)', borderRadius: 32,
              boxShadow: '10px 10px 0 0 var(--tbb-ink)',
              background: 'var(--tbb-paper)',
              overflow: 'hidden', position: 'relative',
              transform: 'rotate(2deg)'
            }}>
              <FauxMap />
              {/* pin */}
              <div style={{ position: 'absolute', top: '53.75%', left: '63.75%', transform: 'translate(-50%, -100%)' }}>
                <div style={{
                  background: 'var(--tbb-hotpink)', color: 'var(--tbb-paper)',
                  border: '2px solid var(--tbb-ink)',
                  padding: '4px 10px', borderRadius: 999,
                  fontFamily: 'Olivita, system-ui', fontStyle: 'italic', fontSize: 14,
                  boxShadow: '2px 2px 0 0 var(--tbb-ink)',
                  whiteSpace: 'nowrap'
                }}>You're here ♡</div>
                <svg viewBox="0 0 24 30" style={{ display: 'block', margin: '-2px auto 0', width: 20, height: 24 }}>
                  <path d="M12 30 L2 14 Q12 2 22 14 Z" fill="#0A0A0A" />
                </svg>
              </div>
            </div>
            <div style={{ position: 'absolute', bottom: -14, left: -14 }}>
              <Stamp tone="butter" rot={-8}>Street parking available ✦</Stamp>
            </div>
          </div>
        </Reveal>
      </div>
    </section>);

}

function FauxMap() {
  // sticker-shop pretend map, mirroring the actual 4840 Calle Alto layout
  return (
    <svg viewBox="0 0 400 400" style={{ width: '100%', height: '100%' }}>
      <rect width="400" height="400" fill="#F6EBDA" />
      {/* halftone dots */}
      <defs>
        <pattern id="ht" x="0" y="0" width="14" height="14" patternUnits="userSpaceOnUse">
          <circle cx="2" cy="2" r="1.2" fill="rgba(10,10,10,0.10)" />
        </pattern>
      </defs>
      <rect width="400" height="400" fill="url(#ht)" />

      {/* Calle Alto — main road, dead-ends on the east (right) */}
      <g stroke="#0A0A0A" strokeWidth="14" fill="none" strokeLinecap="round">
        <line x1="-20" y1="150" x2="340" y2="150" />
      </g>
      <g stroke="#FBF6EE" strokeWidth="4" strokeDasharray="6 8" fill="none">
        <line x1="-20" y1="150" x2="330" y2="150" />
      </g>
      {/* dead-end bar */}
      <g stroke="#0A0A0A" strokeWidth="5" fill="none" strokeLinecap="round">
        <line x1="340" y1="132" x2="340" y2="168" />
        <line x1="345" y1="138" x2="345" y2="162" />
      </g>
      <text x="332" y="125" textAnchor="end" fontFamily="Nunito Sans" fontWeight="900" fontSize="9" letterSpacing="0.14em" fill="#0A0A0A">DEAD END →</text>

      {/* All buildings as horizontal rectangles, parallel to Calle Alto — pulled up close to the road */}
      {/* Row 1: blank | Tokyo Bikini Bar (pin) */}
      <rect x="60" y="190" width="110" height="50" fill="#C7E94B" stroke="#0A0A0A" strokeWidth="3" rx="6" />
      <rect x="200" y="190" width="110" height="50" fill="#FF8FBE" stroke="#0A0A0A" strokeWidth="3.5" rx="7" />

      {/* Row 2: blank | 4840 */}
      <rect x="60" y="258" width="110" height="42" fill="#FF7A45" stroke="#0A0A0A" strokeWidth="3" rx="6" />
      <rect x="200" y="258" width="110" height="42" fill="#F7E26B" stroke="#0A0A0A" strokeWidth="3" rx="6" />

      {/* Row 3: blank | blank */}
      <rect x="60" y="318" width="110" height="38" fill="#2EC5FF" stroke="#0A0A0A" strokeWidth="3" rx="6" />
      <rect x="200" y="318" width="110" height="38" fill="#E9B6E1" stroke="#0A0A0A" strokeWidth="3" rx="6" />

      {/* street label */}
      <text x="160" y="142" textAnchor="middle" fontFamily="Olivita, system-ui" fontStyle="italic" fontSize="22" fill="#0A0A0A">Calle Alto</text>
    </svg>);

}

/* ============================================================
   Footer
   ============================================================ */
function Footer() {
  return (
    <footer style={{
      background: 'var(--tbb-ink)', color: 'var(--tbb-paper)',
      padding: '56px 48px 24px', position: 'relative', overflow: 'hidden'
    }}>
      <div style={{ position: 'relative', maxWidth: 1400, margin: '0 auto' }}>
        <div className="tbb-footer-grid" style={{ display: 'grid', gridTemplateColumns: '2fr 1fr 1fr 1fr', gap: 32, marginBottom: 36 }}>
          <div>
            <img src="assets/logo-wordmark.png" alt="Tokyo Bikini Bar" style={{ display: 'block', width: 260, maxWidth: '100%', height: 'auto', marginBottom: 18, filter: 'invert(1)' }} />
            <p style={{ fontFamily: 'Nunito', fontWeight: 500, maxWidth: 380, color: '#E9E2D6', fontSize: 15, lineHeight: 1.55 }}>
              Camarillo’s cutest little wax studio. Booked &amp; ran by Leia — see you here ♡
            </p>
          </div>
          <FooterCol title="Visit" items={[
            { label: '4840 Calle Alto, Suite A', href: 'https://maps.google.com/?q=4840+Calle+Alto+Suite+A+Camarillo+CA+93012' },
            { label: 'Camarillo, CA 93012', href: 'https://maps.google.com/?q=4840+Calle+Alto+Suite+A+Camarillo+CA+93012' },
            { label: '(805) 883-0714', href: 'tel:+18058830714' },
            { label: 'tokyobikinibar@gmail.com', href: 'mailto:tokyobikinibar@gmail.com' }
          ]} />
          <FooterCol title="Explore" items={[
            { label: 'Full service menu', href: '/menu' },
            { label: 'Pre-wax tips', href: '/#care' },
            { label: 'Cancel policy', href: '/#faq' },
            { label: 'Brand partnerships', href: '/collab' },
            { label: 'Gift cards', href: 'https://www.vagaro.com/tokyobikinibar/gift-certificates', external: true }
          ]} />
          <FooterCol title="Follow" items={[
            { label: 'Instagram', href: 'https://www.instagram.com/tokyobikinibar/', external: true },
            { label: 'Facebook', href: 'https://www.facebook.com/tokyobikinibar/', external: true },
            { label: 'TikTok', href: 'https://www.tiktok.com/@tokyobikinibar', external: true },
            { label: 'Book on Vagaro', href: 'https://www.vagaro.com/tokyobikinibar/services', external: true },
            { label: 'Leave a Google review', href: 'https://g.page/r/CfeK5k5OVsVfEBM/review', external: true },
            { label: 'Text Leia', href: 'sms:+18058830714' }
          ]} />
        </div>
        <div style={{
          display: 'flex', justifyContent: 'space-between', alignItems: 'center',
          borderTop: '3px solid #2A2A2A', paddingTop: 18, flexWrap: 'wrap', gap: 10,
          fontFamily: 'Nunito Sans', fontWeight: 700, fontSize: 11, letterSpacing: '0.14em', textTransform: 'uppercase', color: '#9C968B'
        }}>
          <span>© 2026 Tokyo Bikini Bar</span>
          <span>MADE BY TONO STUDIO ✦ POWERED BY VAGARO</span>
        </div>
      </div>
    </footer>);

}

function FooterCol({ title, items }) {
  return (
    <div>
      <div style={{ fontFamily: 'Nunito Sans', fontWeight: 900, fontSize: 12, letterSpacing: '0.18em', textTransform: 'uppercase', color: 'var(--tbb-paper)', marginBottom: 12 }}>{title}</div>
      <ul style={{ listStyle: 'none', padding: 0, margin: 0, display: 'flex', flexDirection: 'column', gap: 8 }}>
        {items.map((it) => {
          const label = typeof it === 'string' ? it : it.label;
          const href  = typeof it === 'string' ? null : it.href;
          const external = typeof it === 'object' && it.external;
          return (
            <li key={label} style={{ fontFamily: 'Nunito', fontWeight: 600, fontSize: 15 }}>
              {href ? (
                <a
                  href={href}
                  target={external ? '_blank' : undefined}
                  rel={external ? 'noreferrer' : undefined}
                  style={{ color: '#E9E2D6', textDecoration: 'none', transition: 'color 120ms ease' }}
                  onMouseEnter={(e) => { e.currentTarget.style.color = 'var(--tbb-hotpink)'; }}
                  onMouseLeave={(e) => { e.currentTarget.style.color = '#E9E2D6'; }}
                >{label}</a>
              ) : (
                <span style={{ color: '#E9E2D6' }}>{label}</span>
              )}
            </li>
          );
        })}
      </ul>
    </div>);

}

/* ============================================================
   Collab / Sponsorship form
   ============================================================ */
function CollabSection() {
  const [form, setForm] = React.useState({
    name: '',
    brand: '',
    email: '',
    handle: '',
    type: 'Paid social post',
    budget: '',
    pitch: ''
  });
  const [submitted, setSubmitted] = React.useState(false);
  const [submitting, setSubmitting] = React.useState(false);
  const [error, setError] = React.useState('');

  const types = ['Paid social post', 'Gifted collab', 'Brand partnership', 'UGC / content trade', 'Event / pop-up', 'Other ✦'];

  function update(key, value) {
    setForm((f) => ({ ...f, [key]: value }));
  }

  async function handleSubmit(e) {
    e.preventDefault();
    if (submitting) return;

    const fd = new FormData(e.target);
    const pick = (key) => ((fd.get(key) ?? '') + '').trim() || ((form[key] ?? '') + '').trim();
    const data = {
      name: pick('name'),
      brand: pick('brand'),
      email: pick('email'),
      handle: pick('handle'),
      type: pick('type'),
      budget: pick('budget'),
      pitch: pick('pitch')
    };

    if (!data.name || !data.email || !data.pitch) {
      console.warn('[collab form] missing required fields', { data, formState: form });
      setError("Please fill in your name, email, and pitch.");
      return;
    }

    setSubmitting(true);
    setError('');
    try {
      const res = await fetch('https://formspree.io/f/xnjrdorq', {
        method: 'POST',
        headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' },
        body: JSON.stringify({
          _subject: `Collab pitch from ${data.name || data.brand || 'a babe'} ✦`,
          ...data
        })
      });
      if (!res.ok) {
        const body = await res.json().catch(() => ({}));
        throw new Error(body.error || 'Submission failed');
      }
      setSubmitted(true);
    } catch (err) {
      setError("Something glitched — try again, or email tokyobikinibar@gmail.com directly.");
    } finally {
      setSubmitting(false);
    }
  }

  const fieldStyle = {
    fontFamily: 'Nunito, system-ui',
    fontWeight: 600,
    fontSize: 16,
    padding: '12px 16px',
    borderRadius: 14,
    border: '3px solid var(--tbb-ink)',
    background: 'var(--tbb-paper)',
    color: 'var(--tbb-ink)',
    boxShadow: '3px 3px 0 0 var(--tbb-ink)',
    outline: 'none',
    width: '100%',
    fontFamily: 'inherit'
  };

  return (
    <section id="collab" style={{
      padding: '120px 48px 80px',
      background: 'var(--tbb-lime)',
      borderTop: '3px solid var(--tbb-ink)',
      borderBottom: '3px solid var(--tbb-ink)',
      position: 'relative',
      overflow: 'hidden'
    }}>
      <div className="tbb-halftone" style={{ position: 'absolute', inset: 0, pointerEvents: 'none', opacity: 0.35 }} />
      <a href="/#top" style={{ position: 'relative', maxWidth: 1100, margin: '0 auto 18px', display: 'block', fontFamily: 'Nunito Sans, system-ui', fontWeight: 900, fontSize: 12, letterSpacing: '0.12em', textTransform: 'uppercase', color: 'var(--tbb-ink)', textDecoration: 'none' }}>← Back home</a>
      <div style={{ position: 'relative', maxWidth: 1100, margin: '0 auto', display: 'grid', gridTemplateColumns: '1fr 1.2fr', gap: 48, alignItems: 'start' }} className="tbb-collab-grid">
        <Reveal>
          <div>
            <Chip tone="pink" rot={-3} sticker>Brand babes</Chip>
            <h2 style={{ fontFamily: 'Olivita, system-ui', fontStyle: 'italic', fontSize: 'clamp(34px, 4.6vw, 62px)', lineHeight: 0.95, margin: '18px 0 14px' }}>
              Got a collab in mind?
            </h2>
            <p style={{ fontFamily: 'Nunito', fontWeight: 500, fontSize: 17, lineHeight: 1.55, color: 'var(--fg2)', marginBottom: 18 }}>
              I'm open to paid social posts, brand partnerships, UGC trades, pop-ups, and anything fun in between. Pitch me below and I'll get back within a few days. ♡
            </p>
            <div style={{ display: 'flex', flexDirection: 'column', gap: 10, fontFamily: 'Nunito Sans', fontWeight: 800, fontSize: 13, letterSpacing: '0.08em', textTransform: 'uppercase' }}>
              <div>✦ 90K+ combined followers across platforms</div>
              <div>✦ 380+ regulars in the Camarillo area</div>
              <div>✦ Authentic, on-brand storytelling</div>
            </div>
          </div>
        </Reveal>

        <Reveal delay={150}>
          {!submitted ?
          <form onSubmit={handleSubmit} style={{
            background: 'var(--tbb-paper)',
            border: '3px solid var(--tbb-ink)',
            borderRadius: 28,
            boxShadow: '8px 8px 0 0 var(--tbb-ink)',
            padding: '28px 28px 24px',
            display: 'flex',
            flexDirection: 'column',
            gap: 14
          }}>
              <div className="tbb-collab-row" style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 12 }}>
                <CollabField label="Your name" required>
                  <input name="name" style={fieldStyle} value={form.name} onChange={(e) => update('name', e.target.value)} required />
                </CollabField>
                <CollabField label="Brand / company">
                  <input name="brand" style={fieldStyle} value={form.brand} onChange={(e) => update('brand', e.target.value)} placeholder="(if applicable)" />
                </CollabField>
              </div>
              <div className="tbb-collab-row" style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 12 }}>
                <CollabField label="Email" required>
                  <input name="email" type="email" style={fieldStyle} value={form.email} onChange={(e) => update('email', e.target.value)} required />
                </CollabField>
                <CollabField label="Instagram / TikTok">
                  <input name="handle" style={fieldStyle} value={form.handle} onChange={(e) => update('handle', e.target.value)} placeholder="@yourbrand" />
                </CollabField>
              </div>
              <input type="hidden" name="type" value={form.type} />
              <CollabField label="Opportunity type">
                <div style={{ display: 'flex', flexWrap: 'wrap', gap: 8 }}>
                  {types.map((t) =>
                <button
                  type="button"
                  key={t}
                  onClick={() => update('type', t)}
                  style={{
                    fontFamily: 'Nunito Sans, system-ui',
                    fontWeight: 900, fontSize: 12, letterSpacing: '0.08em', textTransform: 'uppercase',
                    padding: '10px 14px', borderRadius: 999,
                    border: '2.5px solid var(--tbb-ink)',
                    background: form.type === t ? 'var(--tbb-hotpink)' : 'var(--tbb-white)',
                    color: form.type === t ? 'var(--tbb-paper)' : 'var(--tbb-ink)',
                    boxShadow: form.type === t ? '3px 3px 0 0 var(--tbb-ink)' : '2px 2px 0 0 var(--tbb-ink)',
                    cursor: 'pointer',
                    transition: 'all 160ms var(--bounce)'
                  }}>
                  {t}
                </button>
                )}
                </div>
              </CollabField>
              <CollabField label="Budget / timing">
                <input name="budget" style={fieldStyle} value={form.budget} onChange={(e) => update('budget', e.target.value)} placeholder="$500–$2k, end of June, etc." />
              </CollabField>
              <CollabField label="The pitch" required>
                <textarea
                  name="pitch"
                  style={{ ...fieldStyle, resize: 'vertical', minHeight: 100 }}
                  value={form.pitch}
                  onChange={(e) => update('pitch', e.target.value)}
                  placeholder="Tell me the gist — product, deliverables, vibes you're going for…"
                  required />
              </CollabField>
              <Button size="lg" type="submit" disabled={submitting} onClick={() => {}} style={{ width: '100%', justifyContent: 'center', marginTop: 6, opacity: submitting ? 0.6 : 1, cursor: submitting ? 'wait' : 'pointer' }}>
                {submitting ? 'Sending…' : 'Send the pitch ✦'}
              </Button>
              {error &&
              <div style={{ fontFamily: 'Nunito', fontWeight: 700, fontSize: 13, color: 'var(--tbb-hotpink)', textAlign: 'center' }}>
                  {error}
                </div>
              }
              <div style={{ fontFamily: 'Nunito', fontWeight: 500, fontSize: 12, color: 'var(--fg3)', textAlign: 'center' }}>
                Sent straight to my inbox — promise I read every one.
              </div>
            </form> :

          <div style={{
            background: 'var(--tbb-paper)',
            border: '3px solid var(--tbb-ink)',
            borderRadius: 28,
            boxShadow: '8px 8px 0 0 var(--tbb-ink)',
            padding: 40,
            textAlign: 'center'
          }}>
              <div style={{ fontFamily: 'Olivita, system-ui', fontStyle: 'italic', fontSize: 56, lineHeight: 1, marginBottom: 12 }}>Got it ♡</div>
              <p style={{ fontFamily: 'Nunito', fontWeight: 500, fontSize: 16, color: 'var(--fg2)', maxWidth: 360, margin: '0 auto' }}>
                Pitch landed in my inbox. I'll get back to you within a few days.
              </p>
              <div style={{ marginTop: 18 }}>
                <Button size="md" variant="secondary" onClick={() => setSubmitted(false)}>Send another</Button>
              </div>
            </div>
          }
        </Reveal>
      </div>
    </section>);

}

function CollabField({ label, required, children }) {
  return (
    <label style={{ display: 'flex', flexDirection: 'column', gap: 6 }}>
      <span style={{ fontFamily: 'Nunito Sans', fontWeight: 900, fontSize: 11, letterSpacing: '0.18em', textTransform: 'uppercase', color: 'var(--fg2)' }}>
        {label}{required && <span style={{ color: 'var(--tbb-hotpink)' }}> *</span>}
      </span>
      {children}
    </label>);

}

Object.assign(window, { MembershipSection, FaqSection, LocationSection, CollabSection, Footer });