/* ============================================================
   ABOUT · CONTACT · SERVICES · 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={<>Made by hand, <em style={{ fontStyle: 'italic' }}>with purpose</em></>} sub="Creating beautiful pieces that keep memories alive forever — from celebrations to precious milestones." />

      <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 src={IMG.about.founder} label="Our Story" variant="ph-gold" 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 }}>We craft beautiful pieces with one shared purpose — keeping the memories that matter alive forever.</p>
            <p style={{ fontSize: 16.5, color: 'var(--ink-soft)', lineHeight: 1.75, marginBottom: 16 }}>We handcraft custom party favours, props and decor that turn every celebration into a lasting memory — alongside thoughtfully designed keepsake journals to help you savour life's precious moments.</p>
            <p style={{ fontFamily: 'var(--serif)', fontStyle: 'italic', fontSize: 24, color: 'var(--ink)', marginTop: 24 }}>“Everything we make is filled with care, love, and purpose — all to see you smile.”</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 piece is handcrafted with love, care, and intention. Never mass-produced — always personal.'], [I.gift, 'Uniquely Yours', 'Custom designs that reflect your story, your style, and your celebration. No two pieces are the same.'], [I.globe, 'Always On Time', 'We know timing matters. Wherever you are in the world, we respect your deadlines and deliver on our promise.']].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 make it magical?</h2>
        <p className="muted" style={{ marginTop: 12, fontSize: 16.5 }}>Browse the collection or get in touch about a custom commission.</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 collection</button>
          <button className="btn btn-outline btn-lg" onClick={() => nav('services')}>Our services</button>
        </div>
      </section>
    </>
  );
}

/* ---------- Services ---------- */
function ServicesPage() {
  const { nav, toast } = useStore();
  const [sent, setSent] = useState(false);
  return (
    <>
      <PageHero eyebrow="Bespoke Services" title={<>Custom Events &amp; <em style={{ fontStyle: 'italic' }}>Styling</em> Services</>} sub="Beyond the shop — we offer full custom styling and event decoration services. From concept to install, we make your vision come to life." variant="ph-sage" />

      <section className="container wide" style={{ padding: 'clamp(56px,8vw,100px) var(--gutter)' }}>
        <div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(280px, 1fr))', gap: 28 }}>
          {[
            ['Children\u2019s Party Styling', 'ph-blush', 'We design, deliver and install complete themed party setups — backdrop, balloon installation, table styling, props and signage. You arrive to a finished party.', ['Mood-board & concept design', 'Prop sourcing & custom fabrication', 'Full install, styling & strike']],
            ['Custom Design & Commissions', 'ph-sage', "Have a theme in mind that you don't see in the shop? We take fully custom commissions — any character, any theme, any size. Props, boxes, invitations and full bundles.", ['Free discovery call', 'Fully custom design & production', 'Rush 48-hr turnaround available']],
          ].map(([title, ph, desc, points], i) => (
            <Reveal key={i} delay={i + 1} style={{ background: 'var(--ivory)', borderRadius: 'var(--r-xl)', overflow: 'hidden', boxShadow: 'var(--shadow-sm)' }}>
              <Ph src={i === 0 ? IMG.services.nursery : IMG.services.interior} label={title} variant={ph} style={{ aspectRatio: '16/10' }} />
              <div style={{ padding: 28 }}>
                <h3 style={{ fontSize: 28, marginBottom: 12 }}>{title}</h3>
                <p style={{ fontSize: 15.5, color: 'var(--ink-soft)', lineHeight: 1.65, marginBottom: 18 }}>{desc}</p>
                <ul style={{ listStyle: 'none', display: 'flex', flexDirection: 'column', gap: 10 }}>
                  {points.map(pt => <li key={pt} style={{ display: 'flex', gap: 10, alignItems: 'center', fontSize: 14.5 }}><span style={{ width: 22, height: 22, borderRadius: 100, background: 'var(--sage-soft)', color: 'var(--sage-deep)', display: 'grid', placeItems: 'center', flexShrink: 0 }}><I.check width={13} height={13} /></span>{pt}</li>)}
                </ul>
              </div>
            </Reveal>
          ))}
        </div>
      </section>

      {/* process */}
      <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,50px)', textAlign: 'center', marginBottom: 48 }}>How we <em style={{ fontStyle: 'italic' }}>work</em></h2>
          <div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(200px, 1fr))', gap: 24 }}>
            {[['01', 'Consultation', 'Tell us your theme, guest count & date.'], ['02', 'Concept', 'We design a mood-board & quote within 24 hrs.'], ['03', 'Curate', 'We hand-craft every prop, box & invite.'], ['04', 'Install', 'We deliver, install & you just celebrate.']].map(([n, t, s], i) => (
              <Reveal key={n} delay={i + 1}>
                <div style={{ fontFamily: 'var(--serif)', fontSize: 48, color: 'var(--gold)', lineHeight: 1 }}>{n}</div>
                <h3 style={{ fontSize: 23, margin: '10px 0 8px' }}>{t}</h3>
                <p style={{ fontSize: 14.5, color: 'var(--ink-soft)', lineHeight: 1.55 }}>{s}</p>
              </Reveal>
            ))}
          </div>
        </div>
      </section>

      {/* enquiry */}
      <section className="container" style={{ padding: 'clamp(56px,8vw,100px) var(--gutter)', maxWidth: 640 }}>
        <div style={{ textAlign: 'center', marginBottom: 32 }}>
          <h2 style={{ fontSize: 'clamp(30px,4.5vw,48px)' }}>Enquire about a project</h2>
          <p className="muted" style={{ marginTop: 10 }}>Tell us about your event — we'll respond within 24 hours with a quote.</p>
        </div>
        {sent ? (
          <div style={{ textAlign: 'center', background: 'var(--sage-soft)', borderRadius: 'var(--r-lg)', padding: 40 }}>
            <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' }}>Thank you — we'll be in touch soon.</p>
          </div>
        ) : (
          <form onSubmit={e => { e.preventDefault(); setSent(true); toast('Enquiry sent ✿', 'heart'); }} style={{ display: 'flex', flexDirection: 'column', gap: 16 }}>
            <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>Project type</label><select className="input"><option>Children's Nursery</option><option>Custom Design & Commissions</option><option>Both</option></select></div>
            <div className="field"><label>Tell us about your project</label><textarea className="input" rows="4" placeholder="Room, style, timeline, budget…"></textarea></div>
            <button className="btn btn-gold btn-lg" type="submit">Send enquiry</button>
          </form>
        )}
      </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, a custom commission, or a wholesale enquiry? We'd love to hear from you — 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', BB.BRAND.email + '\n' + BB.BRAND.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="https://www.instagram.com/heportal_nig" target="_blank" rel="noopener noreferrer" aria-label="Instagram" className="btn btn-outline btn-sm"><I.ig width={17} height={17} /> Instagram</a>
              <a href="#" aria-label="TikTok" className="btn btn-outline btn-sm"><I.tiktok width={15} height={15} /> TikTok</a>
              <a href="#" aria-label="Pinterest" className="btn btn-outline btn-sm"><I.pin width={17} height={17} /> Pinterest</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 flat-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: [['Made-to-order & edible items', 'For food-safety and bespoke reasons, edible treats and personalised items are non-returnable. We\u2019ll always make it right if something arrives damaged.'], ['Non-personalised items', 'Unused, non-personalised pieces may be returned within 7 days of delivery in original packaging for a refund or exchange.'], ['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: [['Custom design proofs', 'Personalised and custom orders include two complimentary rounds of digital proofs before production begins.'], ['Additional revisions', 'Further revisions are billed at a modest design 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: [['Edible treats', 'Best enjoyed within 14 days. Store sealed at room temperature, away from heat and direct sunlight.'], ['Linens & textiles', 'Cool hand-wash or gentle machine cycle; warm iron. Store folded away from damp.'], ['Props & decor', 'Wipe acrylic and signage with a soft, dry cloth. Keep balloon garlands out of direct sun to preserve colour.']] },
};

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, ServicesPage, ContactPage, PolicyPage });
