/* ============================================================
   ABOUT · CONTACT · POLICIES
   ============================================================ */
function PageHero({ eyebrow, title, sub, variant = 'ph-blush' }) {
  return (
    <section style={{ background: 'linear-gradient(160deg, var(--cream-deep), var(--blush-soft))', padding: 'clamp(48px,7vw,96px) var(--gutter)' }}>
      <div className="container" style={{ maxWidth: 760 }}>
        <p className="eyebrow">{eyebrow}</p>
        <h1 style={{ fontSize: 'clamp(40px,6vw,80px)', margin: '14px 0 16px' }}>{title}</h1>
        {sub && <p style={{ fontSize: 'clamp(16px,2vw,20px)', color: 'var(--ink-soft)', lineHeight: 1.6, maxWidth: 560 }}>{sub}</p>}
      </div>
    </section>
  );
}

/* ---------- About ---------- */
function AboutPage() {
  const { nav } = useStore();
  return (
    <>
      <PageHero eyebrow="Our Story" title={<>Beautifully curated, <em style={{ fontStyle: 'italic' }}>made for them</em></>} sub="We design and hand-finish personalised party favor and gable boxes for car, circus, princess and milestone-birthday celebrations — every box carrying the guest of honour's real name and age." />

      <section className="container wide" style={{ padding: 'clamp(56px,8vw,100px) var(--gutter)' }}>
        <div className="edit-split" style={{ display: 'grid', gridTemplateColumns: '.95fr 1.05fr', gap: 'clamp(28px,5vw,72px)', alignItems: 'center' }}>
          <Reveal style={{ position: 'relative' }}>
            <Ph label="Our Story" variant="ph-gold" src={BB.IMG.about.founder.poster} style={{ aspectRatio: '4/5', borderRadius: 'var(--r-xl)' }} />
          </Reveal>
          <Reveal delay={2}>
            <p className="eyebrow">Who we are</p>
            <h2 style={{ fontSize: 'clamp(30px,4vw,48px)', margin: '14px 0 20px' }}>{BB.BRAND.name}</h2>
            <p style={{ fontSize: 16.5, color: 'var(--ink-soft)', lineHeight: 1.75, marginBottom: 16 }}>{BB.BRAND.tagline}. We handcraft personalised party favor and gable boxes for car, circus, princess and milestone-birthday celebrations, made to order and shipped worldwide.</p>
            <p style={{ fontSize: 16.5, color: 'var(--ink-soft)', lineHeight: 1.75, marginBottom: 16 }}>Every box carries the guest of honour's real name and age — no two orders are quite the same, because no two celebrations are.</p>
            <p style={{ fontFamily: 'var(--serif)', fontStyle: 'italic', fontSize: 24, color: 'var(--ink)', marginTop: 24 }}>“Beautifully curated favors for ALL occasions.”</p>
          </Reveal>
        </div>
      </section>

      {/* values */}
      <section style={{ background: 'var(--cream-deep)' }}>
        <div className="container wide" style={{ padding: 'clamp(56px,8vw,100px) var(--gutter)' }}>
          <h2 style={{ fontSize: 'clamp(30px,4.5vw,52px)', textAlign: 'center', marginBottom: 48 }}>What we <em style={{ fontStyle: 'italic' }}>stand for</em></h2>
          <div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(240px, 1fr))', gap: 24 }}>
            {[[I.heart, 'Made with Heart', 'Every box is handmade with love, care, and intention. Never mass-produced — always personal.'], [I.gift, 'Personalised, Always', 'Every box carries a real name and age. No two orders are the same, because no two celebrations are.'], [I.globe, 'Shipped Worldwide', 'Wherever you are, we pack every order carefully and get it to your door in time for the party.']].map(([Ic, t, s], i) => (
              <Reveal key={i} delay={i + 1} style={{ background: 'var(--ivory)', borderRadius: 'var(--r-lg)', padding: 30, boxShadow: 'var(--shadow-sm)' }}>
                <span style={{ width: 54, height: 54, borderRadius: 100, background: 'var(--blush-soft)', color: 'var(--blush-deep)', display: 'grid', placeItems: 'center', marginBottom: 18 }}>{Ic({ width: 26, height: 26 })}</span>
                <h3 style={{ fontSize: 25, marginBottom: 10 }}>{t}</h3>
                <p style={{ fontSize: 15, color: 'var(--ink-soft)', lineHeight: 1.6 }}>{s}</p>
              </Reveal>
            ))}
          </div>
        </div>
      </section>

      <section className="container" style={{ padding: 'clamp(56px,8vw,90px) var(--gutter)', textAlign: 'center', maxWidth: 620 }}>
        <h2 style={{ fontSize: 'clamp(30px,4.5vw,48px)' }}>Ready to plan the party?</h2>
        <p className="muted" style={{ marginTop: 12, fontSize: 16.5 }}>Browse the boxes or start a custom order for your exact theme.</p>
        <div style={{ display: 'flex', gap: 12, justifyContent: 'center', marginTop: 26, flexWrap: 'wrap' }}>
          <button className="btn btn-gold btn-lg" onClick={() => nav('shop')}>Shop the boxes</button>
          <button className="btn btn-outline btn-lg" onClick={() => nav('custom-order')}>Start a custom order</button>
        </div>
      </section>
    </>
  );
}

/* ---------- Contact ---------- */
function ContactPage() {
  const { toast } = useStore();
  const [sent, setSent] = useState(false);
  return (
    <>
      <PageHero eyebrow="Say hello" title={<>Let's <em style={{ fontStyle: 'italic' }}>talk</em></>} sub="Questions about an order or a custom theme? Send us a message below — no DMs needed." />
      <section className="container wide" style={{ padding: 'clamp(48px,7vw,90px) var(--gutter)' }}>
        <div className="contact-grid">
          <div>
            {[[I.pin, 'Find us', BB.BRAND.address], [I.truck, 'Order support', "We reply to every enquiry within 48 hours"], [I.globe, 'Worldwide orders', 'We ship internationally with tracked delivery']].map(([Ic, t, s], i) => (
              <div key={i} style={{ display: 'flex', gap: 16, padding: '20px 0', borderBottom: i < 2 ? '1px solid var(--line)' : 'none' }}>
                <span style={{ width: 48, height: 48, flexShrink: 0, borderRadius: 100, background: 'var(--cream-deep)', color: 'var(--gold-deep)', display: 'grid', placeItems: 'center' }}>{Ic({ width: 22, height: 22 })}</span>
                <div><h3 style={{ fontSize: 21, marginBottom: 4 }}>{t}</h3><p style={{ fontSize: 14.5, color: 'var(--ink-soft)', whiteSpace: 'pre-line', lineHeight: 1.5 }}>{s}</p></div>
              </div>
            ))}
            <div style={{ display: 'flex', gap: 12, marginTop: 24, flexWrap: 'wrap' }}>
              <a href="#" aria-label="Instagram" className="btn btn-outline btn-sm"><I.ig width={17} height={17} /> {BB.BRAND.social}</a>
            </div>
          </div>
          <div style={{ background: 'var(--ivory)', borderRadius: 'var(--r-xl)', padding: 'clamp(24px,4vw,40px)', boxShadow: 'var(--shadow-sm)' }}>
            {sent ? (
              <div style={{ textAlign: 'center', padding: '40px 0' }}>
                <div style={{ width: 60, height: 60, borderRadius: 100, background: 'var(--sage)', color: '#fff', display: 'grid', placeItems: 'center', margin: '0 auto 16px' }}><I.check width={30} height={30} /></div>
                <p style={{ fontFamily: 'var(--serif)', fontSize: 26, fontStyle: 'italic' }}>Message sent — talk soon!</p>
              </div>
            ) : (
              <form onSubmit={e => { e.preventDefault(); setSent(true); toast('Message sent', 'heart'); }} style={{ display: 'flex', flexDirection: 'column', gap: 16 }}>
                <h3 style={{ fontSize: 26 }}>Send a message</h3>
                <div className="form-row">
                  <div className="field"><label>Name</label><input className="input" required /></div>
                  <div className="field"><label>Email</label><input className="input" type="email" required /></div>
                </div>
                <div className="field"><label>Subject</label><input className="input" /></div>
                <div className="field"><label>Message</label><textarea className="input" rows="5" required></textarea></div>
                <button className="btn btn-gold btn-lg" type="submit">Send message</button>
              </form>
            )}
          </div>
        </div>
      </section>
    </>
  );
}

/* ---------- Policies ---------- */
const POLICIES = {
  shipping: { title: 'Shipping Policy', body: [['Domestic & nationwide', 'Orders dispatch within 3–5 working days. Complimentary delivery on orders over the free-shipping threshold; a flat rate applies below that. Courier is calculated at checkout.'], ['International', 'We ship worldwide via tracked courier. Orders are carefully packed for safe travel. Duties and taxes may apply on arrival and are the recipient\u2019s responsibility.'], ['Tracking', 'Every order includes tracking. Follow your order live from your account — Order Received through to Delivered.']] },
  returns: { title: 'Returns Policy', body: [['Personalised items', 'Because every box is made to order with a real name and age, personalised items are non-returnable. We\u2019ll always make it right if something arrives damaged.'], ['Damaged on arrival', 'Email a photo within 48 hours of delivery and we\u2019ll arrange a replacement or refund promptly.']] },
  revisions: { title: 'Revisions Policy', body: [['Personalisation proofs', 'Every custom order includes a complimentary digital proof of the name & age layout before production begins.'], ['Additional revisions', 'Further design changes are billed at a modest rate, quoted upfront. We won\u2019t proceed without your approval.'], ['Approval', 'Production only begins once you\u2019ve approved your final proof in writing — no surprises.']] },
  privacy: { title: 'Privacy Policy', body: [['What we collect', 'We collect only what we need to fulfil your order: name, contact details, delivery address and payment confirmation.'], ['How we use it', 'To process orders, arrange delivery and — only with consent — send you our newsletter. We never sell your data.'], ['Your rights', 'You may request access to, or deletion of, your data at any time by emailing our support team.']] },
  care: { title: 'Craft & Product Care', body: [['Handling', 'Boxes are made from card, ribbon and foil detailing — handle gently and keep away from moisture until the day of the party.'], ['Storage', 'Store flat-packed boxes somewhere dry and out of direct sunlight to keep colours and foiling crisp.'], ['Fill day', 'For best presentation, fill boxes with treats the day before or morning of the event.']] },
};

function PolicyPage({ params }) {
  const { nav } = useStore();
  const id = params.id || 'shipping';
  const pol = POLICIES[id] || POLICIES.shipping;
  return (
    <>
      <PageHero eyebrow="Policies" title={pol.title} variant="ph-sage" />
      <section className="container wide" style={{ padding: 'clamp(40px,6vw,72px) var(--gutter) clamp(64px,9vw,110px)' }}>
        <div className="policy-layout">
          <aside>
            <p className="eyebrow" style={{ marginBottom: 14 }}>All policies</p>
            <nav style={{ display: 'flex', flexDirection: 'column', gap: 2 }}>
              {Object.entries(POLICIES).map(([k, v]) => (
                <button key={k} onClick={() => nav('policy', { id: k })} style={{ textAlign: 'left', padding: '11px 14px', borderRadius: 'var(--r-md)', fontSize: 14.5, fontWeight: 500, background: k === id ? 'var(--cream-deep)' : 'transparent', color: k === id ? 'var(--ink)' : 'var(--ink-soft)', transition: 'all .2s' }}>{v.title}</button>
              ))}
            </nav>
          </aside>
          <div style={{ maxWidth: 680 }}>
            {pol.body.map(([h, t], i) => (
              <div key={i} style={{ marginBottom: 32 }}>
                <h3 style={{ fontSize: 26, marginBottom: 10 }}>{h}</h3>
                <p style={{ fontSize: 16, color: 'var(--ink-soft)', lineHeight: 1.75 }}>{t}</p>
              </div>
            ))}
            <div style={{ background: 'var(--cream-deep)', borderRadius: 'var(--r-lg)', padding: 24, marginTop: 8, display: 'flex', gap: 14, alignItems: 'center', flexWrap: 'wrap' }}>
              <span style={{ flex: 1, minWidth: 200, fontSize: 15 }}>Still have a question? We're here to help.</span>
              <button className="btn btn-primary btn-sm" onClick={() => nav('contact')}>Contact us</button>
            </div>
          </div>
        </div>
      </section>
    </>
  );
}

Object.assign(window, { AboutPage, ContactPage, PolicyPage });
