// Contact.jsx -- portfolio download, studio visits, write to the studio, FAQ
const Contact = ({ onNav, presetWork }) => {
  const { Reveal, InquiryForm, VisitButton, STUDIO } = window;
  const faqs = [
    { q:'Is shipping included in the price?', a:'Yes. For US domestic orders, shipping and handling is included in the checkout total. The cost is calculated by piece size and shown in your cart before you pay.' },
    { q:'How long does shipping take?', a:'Originals ship within 3–9 business days of purchase. Each piece is packed by hand with archival materials and ships fully tracked and insured.' },
    { q:'Do you ship internationally?', a:'International shipping is available -- contact the studio before purchasing and we will arrange a quote. Duties and taxes for international destinations are the buyer\'s responsibility.' },
    { q:'What is your return policy?', a:'All sales are final. Every piece is packed with great care -- but if a work arrives damaged, keep all packaging and email the studio with your order number and we\'ll make it right.' },
    { q:'Can I see the work in person?', a:'Yes. The studio is at 3500 Parkdale Ave in Baltimore. Schedule a studio visit and the paintings will be out when you arrive.' },
    { q:'How do I keep up with new work?', a:'Join the studio list at the bottom of any page for first access to new pieces and collector previews, or follow along on Instagram and Facebook.' },
  ];
  const [open, setOpen] = React.useState(0);

  const formRef = React.useRef(null);
  React.useEffect(() => {
    if (presetWork && formRef.current) formRef.current.scrollIntoView({ behavior:'smooth', block:'start' });
  }, [presetWork]);

  return (
    <div>
      <section className="band-ink" style={{padding:'88px 0 72px'}}>
        <div className="wrap">
          <div className="kicker-row" style={{marginBottom:20}}>
            <span className="flare-dot"></span><span className="eyebrow on-dark">Contact</span>
          </div>
          <h1 style={{fontFamily:'var(--font-display)', fontWeight:900, color:'var(--veil)',
                      fontSize:'clamp(38px,6vw,84px)', letterSpacing:'-0.025em', lineHeight:0.96, maxWidth:880}}>
            Three ways into the studio.
          </h1>
          <p className="lead on-dark" style={{marginTop:24, maxWidth:560}}>
            Take the full portfolio home, come see the paintings in person, or write.
            You don't need to know anything about the art world to do any of the three.
          </p>
        </div>
      </section>

      {/* portfolio + visit */}
      <section className="section band-veil" style={{'--sp':'80px'}}>
        <div className="wrap">
          <div className="rg-2col" style={{display:'grid', gridTemplateColumns:'1fr 1fr', gap:1,
                       background:'var(--ink-line)', border:'1px solid var(--ink-line)'}}>
            <Reveal className="band-veil" style={{padding:'48px 44px', display:'flex', flexDirection:'column', gap:16}}>
              <div className="meta" style={{color:'var(--flare)'}}>01 · Portfolio</div>
              <h2 style={{fontFamily:'var(--font-display)', fontWeight:900, fontSize:'clamp(24px,2.6vw,34px)',
                          letterSpacing:'-0.015em', lineHeight:1.05}}>The complete portfolio</h2>
              <p className="body dim" style={{fontSize:16}}>
                Every current painting in one PDF: images, materials, dimensions, and pricing, with what's
                still available marked clearly. Easy to forward to a partner, a designer, or a client.
              </p>
              <div style={{marginTop:'auto', paddingTop:12}}>
                <a className="btn btn-ink" href={STUDIO.portfolioPdf} download="Drury-Bynum-Portfolio.pdf">
                  Download the portfolio (PDF) ↓
                </a>
              </div>
            </Reveal>
            <Reveal className="band-veil" delay={80} style={{padding:'48px 44px', display:'flex', flexDirection:'column', gap:16}}>
              <div className="meta" style={{color:'var(--flare)'}}>02 · Studio visit</div>
              <h2 style={{fontFamily:'var(--font-display)', fontWeight:900, fontSize:'clamp(24px,2.6vw,34px)',
                          letterSpacing:'-0.015em', lineHeight:1.05}}>See it at full size</h2>
              <p className="body dim" style={{fontSize:16}}>
                Collage doesn't photograph the way it hangs. Pick a time on the studio calendar and see the
                seams, the chalk, and the torn edges up close at {STUDIO.studio}.
              </p>
              <div style={{marginTop:'auto', paddingTop:12}}>
                <VisitButton className="btn btn-flare" />
              </div>
            </Reveal>
          </div>
        </div>
      </section>

      {/* inquiry form */}
      <section className="section band-ink" style={{'--sp':'88px', scrollMarginTop:80}} ref={formRef}>
        <div className="wrap rg-2col" style={{display:'grid', gridTemplateColumns:'0.85fr 1.15fr', gap:72, alignItems:'start'}}>
          <div>
            <div className="kicker-row" style={{marginBottom:18}}>
              <span className="flare-dot"></span><span className="eyebrow on-dark">03 · Inquiries &amp; press</span>
            </div>
            <h2 style={{fontFamily:'var(--font-display)', fontWeight:900, color:'var(--veil)',
                        fontSize:'clamp(24px,2.6vw,34px)', letterSpacing:'-0.015em', marginBottom:20}}>
              Write to the studio
            </h2>
            <p className="body on-dark" style={{marginBottom:24}}>
              Every message reaches Drury directly. Whether you're ready to collect or just curious about
              a piece, this is the place to start.
            </p>
            <div className="meta on-dark" style={{lineHeight:2}}>
              <div>{STUDIO.email}</div>
              <div>{STUDIO.studio}</div>
              <div>Instagram {STUDIO.instagram}</div>
            </div>
          </div>
          <div>
            {presetWork && (
              <div style={{display:'flex', alignItems:'center', gap:14, marginBottom:22,
                           padding:'14px 16px', border:'1px solid var(--ink-line)'}}>
                {presetWork.img
                  ? <img src={presetWork.img} alt="" style={{width:54, height:54, objectFit:'cover'}}/>
                  : <div style={{width:54, height:54, background:'var(--flare)'}}/>}
                <div>
                  <div style={{fontFamily:'var(--font-display)', fontWeight:600, color:'var(--veil)', fontSize:13, letterSpacing:'0.04em', textTransform:'uppercase'}}>{presetWork.title}</div>
                  <div className="meta on-dark">{presetWork.size} · {window.fmtPrice(presetWork)}</div>
                </div>
              </div>
            )}
            <InquiryForm presetWork={presetWork} />
          </div>
        </div>
      </section>

      {/* FAQ */}
      <section className="section band-veil" style={{'--sp':'88px'}}>
        <div className="wrap">
          <div className="rg-sidebar" style={{display:'grid', gridTemplateColumns:'260px 1fr', gap:64, alignItems:'start'}}>
            <div>
              <div className="eyebrow" style={{marginBottom:14}}>Good to know</div>
              <h2 style={{fontFamily:'var(--font-display)', fontWeight:900, fontSize:'clamp(24px,2.6vw,34px)',
                          letterSpacing:'-0.015em'}}>Shipping &amp; FAQ</h2>
            </div>
            <div className="faq">
              {faqs.map((f, i) => (
                <div className="faq-item" key={i}>
                  <button className="faq-q" onClick={() => setOpen(open === i ? -1 : i)}>
                    <span className="qt">{f.q}</span>
                    <span className="qi">{open === i ? '–' : '+'}</span>
                  </button>
                  <div className="faq-a" style={{maxHeight: open === i ? 320 : 0}}>
                    <div className="inner"><p className="body dim">{f.a}</p></div>
                  </div>
                </div>
              ))}
            </div>
          </div>
        </div>
      </section>
    </div>
  );
};
Object.assign(window, { Contact });
