// Visit.jsx — schedule a studio visit (Google Calendar appointment schedule embed)
// Not in the nav. Reached from VisitButton on About, Contact, series pages, painting detail, footer.
// Set STUDIO.bookingUrl in data.jsx to the appointment schedule link to switch the calendar on.
const Visit = ({ onNav }) => {
  const { Reveal, InquiryForm, STUDIO } = window;
  const url = (STUDIO.bookingUrl || '').trim();
  const embedUrl = url ? url + (url.includes('?') ? '&' : '?') + 'gv=true' : '';

  const notes = [
    { k:'Where', v:<>3500 Parkdale Ave, Baltimore<br/>Studios 132 &amp; 133</> },
    { k:'What you’ll see', v:'The newest Seraphic Veil paintings at full size, plus smaller work from the other series.' },
    { k:'Who it’s for', v:'Collectors, designers, and anyone who wants a closer look. Bring someone.' },
  ];

  return (
    <div>
      {/* hero */}
      <section className="band-ink" style={{padding:'88px 0 64px'}}>
        <div className="wrap rg-2col" style={{display:'grid', gridTemplateColumns:'1.1fr 0.9fr', gap:64, alignItems:'end'}}>
          <div>
            <div className="kicker-row" style={{marginBottom:20}}>
              <span className="flare-dot"></span><span className="eyebrow on-dark">Studio visits</span>
            </div>
            <h1 style={{fontFamily:'var(--font-display)', fontWeight:900, color:'var(--veil)',
                        fontSize:'clamp(38px,6vw,84px)', letterSpacing:'-0.025em', lineHeight:0.96}}>
              Come see them at full size.
            </h1>
            <p className="lead on-dark" style={{marginTop:24, maxWidth:560}}>
              A phone screen flattens collage. In the studio you can stand close enough to see where the
              paper was torn and the chalk was dragged across it. Pick a time below and the paintings
              will be out when you arrive.
            </p>
          </div>
          <div className="meta on-dark" style={{lineHeight:2, borderLeft:'1px solid var(--veil-line)', paddingLeft:28}}>
            {notes.map(n => (
              <div key={n.k} style={{marginBottom:14}}>
                <div style={{color:'var(--flare)', textTransform:'uppercase', letterSpacing:'0.12em'}}>{n.k}</div>
                <div style={{color:'var(--veil)'}}>{n.v}</div>
              </div>
            ))}
          </div>
        </div>
      </section>

      {/* calendar */}
      <section className="section band-veil" style={{'--sp':'72px'}}>
        <div className="wrap">
          <div style={{display:'flex', justifyContent:'space-between', alignItems:'baseline', flexWrap:'wrap', gap:12, marginBottom:24}}>
            <h2 style={{fontFamily:'var(--font-display)', fontWeight:900, fontSize:'clamp(24px,2.6vw,34px)',
                        letterSpacing:'-0.015em'}}>Pick a time</h2>
            {embedUrl && <span className="meta">Times shown in your time zone · confirmation arrives by email</span>}
          </div>

          {embedUrl ? (
            <Reveal style={{background:'#fff', border:'1px solid var(--ink-line)'}}>
              <iframe src={embedUrl} title="Studio visit calendar"
                      style={{border:0, width:'100%', height:720, display:'block'}} />
            </Reveal>
          ) : (
            <Reveal className="band-ink rg-2col" style={{display:'grid', gridTemplateColumns:'0.8fr 1.2fr', gap:56, padding:'48px 44px'}}>
              <div>
                <div className="eyebrow on-dark" style={{marginBottom:14}}>Calendar coming online</div>
                <p className="body on-dark">
                  The booking calendar isn't switched on yet. In the meantime, tell the studio a few days and
                  times that work for you, and Drury will confirm one personally.
                </p>
              </div>
              <InquiryForm presetMessage={"I'd like to schedule a studio visit. Days and times that work for me:\n"} />
            </Reveal>
          )}

          <p className="meta" style={{marginTop:22}}>
            Rather write first? <a onClick={() => onNav('contact')} style={{color:'var(--flare)', cursor:'pointer', borderBottom:'1px solid var(--flare)'}}>Contact the studio</a>
            {' '}or download the <a href={STUDIO.portfolioPdf} download style={{color:'var(--flare)', borderBottom:'1px solid var(--flare)'}}>complete portfolio</a>.
          </p>
        </div>
      </section>
    </div>
  );
};
Object.assign(window, { Visit });
