/* The Face Edit, workshops page
   Pre-launch corrections Round 1: duration consistency, WhyKylie replaces fabricated testimonials,
   Inclusions panel, PriceMoment panel, ArrivalRitual section, chapters renumbered. */

const { useState, useEffect, useRef } = React;

/* ==========================================================
   WORKSHOP TWEAKS, page-scoped
   ========================================================== */
const WS_TWEAK_DEFAULTS = /*WS-EDITMODE-BEGIN*/{
  "ws_hero": "bold-type",
  "ws_pitch": "emotional",
  "ws_cta_tone": "warm"
}/*WS-EDITMODE-END*/;

function useWorkshopTweaks(baseTweaks, baseUpdate) {
  const [wt, setWt] = useState(() => ({ ...WS_TWEAK_DEFAULTS, ...(baseTweaks || {}) }));
  useEffect(() => { setWt(p => ({ ...p, ...(baseTweaks || {}) })); }, [baseTweaks]);
  const update = (k, v) => {
    setWt(p => ({ ...p, [k]: v }));
    if (baseUpdate) baseUpdate(k, v);
    window.parent.postMessage({ type: '__edit_mode_set_keys', edits: { [k]: v } }, '*');
  };
  return { wt, update };
}

/* ==========================================================
   HERO, 3 variants
   ========================================================== */
function WsHero({ variant }) {
  return (
    <section>
      <div style={{ display: 'grid', gridTemplateColumns: '1fr auto 1fr', gap: '1.5rem', padding: '1.25rem var(--gutter)', borderBottom: '1px solid var(--hair)' }}>
        <span className="mono">A decision-making system for beauty</span>
        <span className="mono">·</span>
        <span className="mono" style={{ textAlign: 'right' }}>Tickets available · Limited spaces</span>
      </div>
      {variant === 'bold-type' && <HeroBoldType />}
      {variant === 'question'  && <HeroQuestion />}
      {variant === 'editorial' && <HeroEditorial />}
    </section>
  );
}

function HeroBoldType() {
  return (
    <div className="container" style={{ padding: '6rem 0 4rem' }}>
      <div style={{ marginBottom: '2rem' }}>
        <div className="eyebrow">The Signature Experience</div>
      </div>
      <h1 className="display" style={{ fontSize: 'clamp(64px, 13vw, 220px)', lineHeight: 0.88, margin: 0, letterSpacing: '-0.035em' }}>
        <MaskLine delay={1}>The</MaskLine>
        <MaskLine delay={2}>Face <em style={{ fontWeight: 300 }}>Edit.</em></MaskLine>
      </h1>
      <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '4rem', marginTop: '4rem', paddingTop: '2rem', borderTop: '1px solid var(--hair)' }}>
        <Reveal>
          <p style={{ fontSize: '17px', lineHeight: 1.55, maxWidth: '44ch', color: 'var(--ink-soft)' }}>
            A premium, intimate workshop built around a system designed to decode your face, so makeup finally makes sense. You will learn how to understand your face through your colour theory, your contrast, and your natural balance, so you are not just copying a look. You are learning how to build one that belongs to you.
          </p>
        </Reveal>
        <Reveal style={{ display: 'grid', justifyItems: 'end', alignContent: 'end', gap: '1rem' }}>
          <a href="#reserve" className="btn btn-solid">Reserve Your Seat <span className="btn-arrow"/></a>
          <span className="mono">By invitation order</span>
        </Reveal>
      </div>
    </div>
  );
}

function HeroQuestion() {
  return (
    <div className="container" style={{ padding: '8rem 0 5rem' }}>
      <div className="eyebrow" style={{ marginBottom: '3rem' }}>Before we begin</div>
      <h1 className="display" style={{ fontSize: 'clamp(44px, 7vw, 112px)', lineHeight: 1.02, margin: 0, letterSpacing: '-0.02em', maxWidth: '20ch' }}>
        <MaskLine delay={1}>Have you ever followed</MaskLine>
        <MaskLine delay={2}>a tutorial that worked</MaskLine>
        <MaskLine delay={3}>on her, and <em style={{ fontWeight: 300 }}>not on you?</em></MaskLine>
      </h1>
      <Reveal>
        <p style={{ fontSize: '20px', lineHeight: 1.5, color: 'var(--ink-soft)', maxWidth: '44ch', marginTop: '3rem' }}>
          The problem was never your face. It was that no one ever taught you how to read it. This workshop does.
        </p>
      </Reveal>
      <div style={{ display: 'flex', gap: '12px', marginTop: '3rem' }}>
        <a href="#reserve" className="btn btn-solid">Reserve Your Seat <span className="btn-arrow"/></a>
        <a href="#method" className="btn">The Method</a>
      </div>
    </div>
  );
}

function HeroEditorial() {
  return (
    <div style={{ position: 'relative' }}>
      <Photo variant="pink" ratio="21/10" tag="HERO / WORKSHOP" caption="Editorial hero · soft light · hands at work" />
      <div style={{ position: 'absolute', inset: 0, display: 'grid', placeItems: 'end start', padding: 'var(--gutter)' }}>
        <div>
          <div className="eyebrow" style={{ marginBottom: '1.5rem' }}>The Workshop</div>
          <h1 className="display" style={{ fontSize: 'clamp(56px, 9vw, 160px)', lineHeight: 0.92, margin: 0 }}>
            <MaskLine delay={1}>Makeup,</MaskLine>
            <MaskLine delay={2}><em style={{ fontWeight: 300 }}>edited</em> for you.</MaskLine>
          </h1>
        </div>
      </div>
    </div>
  );
}

/* ==========================================================
   THE PITCH, 02
   ========================================================== */
function Pitch({ variant }) {
  if (variant === 'direct')    return <PitchDirect />;
  return <PitchEmotional />;
}

function PitchEmotional() {
  const lines = [
    ['You have tried the tutorials.',     'They worked on her. Not on you.'],
    ['You have bought the products.',     'Half sit unused in the drawer.'],
    ['You have followed the trends.',     'And still don\'t feel like yourself.'],
    ['The problem was never your face.',  'It was that no one taught you how to read it.'],
  ];
  return (
    <section style={{ padding: '9rem 0', background: 'var(--paper)', borderTop: '1px solid var(--hair)' }}>
      <div className="container">
        <div style={{ display: 'grid', gridTemplateColumns: '1fr 1.6fr', gap: '5rem', alignItems: 'start' }}>
          <div style={{ position: 'sticky', top: '100px' }}>
            <div className="eyebrow">Why this workshop</div>
            <div className="display" style={{ fontSize: 'clamp(40px, 5vw, 72px)', lineHeight: 0.98, marginTop: '1.5rem' }}>
              If this sounds <em style={{ fontWeight: 300 }}>like you,</em><br />this is for you.
            </div>
          </div>
          <div style={{ borderTop: '1px solid var(--ink)' }}>
            {lines.map(([a, b], i) => (
              <Reveal key={i} style={{ display: 'grid', gridTemplateColumns: '1fr 1.2fr', gap: '3rem', padding: '2.2rem 0', borderBottom: '1px solid var(--hair)', alignItems: 'baseline' }}>
                <div style={{ fontFamily: 'var(--f-display)', fontSize: 'clamp(24px, 2.8vw, 36px)', lineHeight: 1.1, color: 'var(--ink)' }}>{a}</div>
                <div style={{ fontFamily: 'var(--f-display)', fontSize: 'clamp(24px, 2.8vw, 36px)', lineHeight: 1.1, fontStyle: 'italic', fontWeight: 300, color: 'var(--ink-soft)' }}>{b}</div>
              </Reveal>
            ))}
          </div>
        </div>
      </div>
    </section>
  );
}

function PitchDirect() {
  const bullets = [
    'Stop buying products that never get used.',
    'Stop copying tutorials that weren\'t made for your face.',
    'Stop guessing at the shop counter.',
    'Stop starting over every time a new trend lands.',
    'Start with one system that works on every face, yours.'
  ];
  return (
    <section style={{ padding: '8rem 0', borderTop: '1px solid var(--ink)' }}>
      <div className="container">
        <div className="eyebrow" style={{ marginBottom: '2rem' }}>The case for this workshop</div>
        <h2 className="display" style={{ fontSize: 'clamp(42px, 6vw, 96px)', lineHeight: 0.98, margin: 0, maxWidth: '22ch' }}>
          You don't need more makeup. You need one thing that actually <em style={{ fontWeight: 300 }}>works.</em>
        </h2>
        <div style={{ borderTop: '1px solid var(--ink)', marginTop: '4rem' }}>
          {bullets.map((b, i) => (
            <Reveal key={i} style={{ display: 'grid', gridTemplateColumns: '60px 1fr', gap: '2rem', padding: '1.5rem 0', borderBottom: '1px solid var(--hair)', alignItems: 'center' }}>
              <div className="num">0{i+1}</div>
              <div style={{ fontFamily: 'var(--f-display)', fontSize: '30px' }}>{b}</div>
            </Reveal>
          ))}
        </div>
      </div>
    </section>
  );
}

/* ==========================================================
   TRANSFORMATION, 03
   ========================================================== */
function Transformation() {
  const rows = [
    ['Copying tutorials',           'Understanding your own face'],
    ['Guessing at the counter',     'Buying with confidence'],
    ['Overwhelmed by trends',       'Calm. Clear. Decided.'],
    ['A drawer full of mistakes',   'A kit edited down to what works'],
    ['Looking like somebody else',  'Looking like you, elevated'],
  ];
  return (
    <section className="container" style={{ padding: '8rem 0' }}>
      <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '3rem', marginBottom: '3rem', alignItems: 'end' }}>
        <div>
          <div className="eyebrow">The shift</div>
          <div className="display" style={{ fontSize: 'clamp(40px, 5.5vw, 80px)', lineHeight: 1, marginTop: '1rem' }}>
            From <em style={{ fontWeight: 300 }}>there,</em><br />to here.
          </div>
        </div>
      </div>
      <div style={{ display: 'grid', gridTemplateColumns: '1fr 80px 1fr', borderTop: '1px solid var(--ink)' }}>
        {rows.map(([a, b], i) => (
          <React.Fragment key={i}>
            <Reveal style={{ padding: '1.8rem 2rem', borderBottom: '1px solid var(--hair)', color: 'var(--ink-muted)', fontFamily: 'var(--f-display)', fontSize: 'clamp(20px, 2.2vw, 30px)', textDecoration: 'line-through', textDecorationThickness: '1px', textDecorationColor: 'rgba(0,0,0,0.3)' }}>{a}</Reveal>
            <Reveal style={{ padding: '1.8rem 0', borderBottom: '1px solid var(--hair)', display: 'grid', placeItems: 'center', fontFamily: 'var(--f-mono)', fontSize: '18px', color: 'var(--ink-muted)' }}>→</Reveal>
            <Reveal style={{ padding: '1.8rem 2rem', borderBottom: '1px solid var(--hair)', background: i % 2 === 0 ? 'var(--pink-bg)' : 'transparent', fontFamily: 'var(--f-display)', fontSize: 'clamp(20px, 2.2vw, 30px)' }}>{b}</Reveal>
          </React.Fragment>
        ))}
      </div>
    </section>
  );
}

/* ==========================================================
   TEACH SECTION, 04
   ========================================================== */
function TeachSection() {
  const items = [
    'The most important, but most overlooked factor that determines your end result.',
    'What colours enhance your features most beautifully.',
    'Where your makeup should bring balance and definition.',
    'How to create a signature look that feels effortless and unmistakably you.',
  ];
  return (
    <section id="method" style={{ borderTop: '1px solid var(--ink)', background: 'var(--paper)' }}>
      <div className="container" style={{ padding: '8rem 0' }}>
        <div style={{ display: 'grid', gridTemplateColumns: '1fr 1.4fr', gap: '5rem', alignItems: 'start' }}>
          <div style={{ position: 'sticky', top: '100px' }}>
            <div className="eyebrow">In this workshop</div>
            <h2 className="display" style={{ fontSize: 'clamp(48px, 6vw, 96px)', lineHeight: 0.95, margin: '1.5rem 0 0', letterSpacing: '-0.02em' }}>
              I'll teach<br /><em style={{ fontWeight: 300 }}>you.</em>
            </h2>
          </div>
          <div style={{ borderTop: '1px solid var(--ink)' }}>
            {items.map((item, i) => (
              <Reveal key={i} style={{ display: 'grid', gridTemplateColumns: '60px 1fr', gap: '2rem', padding: '2.5rem 0', borderBottom: '1px solid var(--hair)', alignItems: 'baseline' }}>
                <div className="num" style={{ paddingTop: '4px' }}>0{i + 1}</div>
                <div style={{ fontFamily: 'var(--f-display)', fontSize: 'clamp(22px, 2.6vw, 34px)', lineHeight: 1.2 }}>
                  {item}
                </div>
              </Reveal>
            ))}
          </div>
        </div>
      </div>
    </section>
  );
}

/* ==========================================================
   ARRIVAL RITUAL, 05
   ========================================================== */
function ArrivalRitual() {
  return (
    <section style={{ background: 'var(--pink-bg)', padding: '9rem 0', borderTop: '1px solid var(--hair-soft)', borderBottom: '1px solid var(--hair-soft)' }}>
      <div className="container">
        <div style={{ display: 'grid', gridTemplateColumns: '1fr 1.1fr', gap: '5rem', alignItems: 'center' }}>
          <Reveal>
            <figure style={{ margin: 0 }}>
              <img
                src="/assets/arrival-ritual.png"
                alt="Arrival setup at a Face Edit workshop, sparkling on tray, charcuterie board and signage"
                loading="lazy"
                style={{
                  display: 'block',
                  width: '100%',
                  aspectRatio: '5/4',
                  objectFit: 'cover',
                  background: 'var(--pink-bg)'
                }}
              />
            </figure>
          </Reveal>
          <div>
            <div className="eyebrow" style={{ marginBottom: '2rem' }}>Arrival</div>
            <h2 className="display" style={{ fontSize: 'clamp(48px, 7vw, 112px)', lineHeight: 0.92, margin: 0, letterSpacing: '-0.02em' }}>
              Walk in.<br /><em style={{ fontWeight: 300 }}>Slow down.</em>
            </h2>
            <p style={{ fontFamily: 'var(--f-display)', fontSize: 'clamp(20px, 2.2vw, 28px)', lineHeight: 1.4, marginTop: '3rem', maxWidth: '38ch' }}>
              Drinks on arrival. Soft music. A name card at your seat. A beautifully prepared grazing board. Kylie greets you herself.
            </p>
            <p style={{ fontFamily: 'var(--f-display)', fontStyle: 'italic', fontWeight: 300, fontSize: 'clamp(20px, 2.2vw, 28px)', lineHeight: 1.4, marginTop: '1.5rem', color: 'var(--ink-soft)', maxWidth: '38ch' }}>
              These are the small details that make the experience feel considered, personal and quietly premium.
            </p>
            <div className="mono" style={{ marginTop: '3rem' }}>
              Held in Toowoomba · Address shared on booking
            </div>
          </div>
        </div>
      </div>
    </section>
  );
}

/* ==========================================================
   LEAVE WITH, 07 (was 06)
   ========================================================== */
function LeaveWith() {
  const items = [
    ['Your signature look',           'Not Kylie\'s. Not TikTok\'s. Yours, built from the system.'],
    ['A personal system',             'Contrast, Colour, Balance, calibrated to your face.'],
    ['The workbook',                  'Your decision-making tool to carry the work forward.'],
    ['Confidence in decisions',       'In-store, on-camera, in the mirror. You know why.'],
    ['A room of like-minded women',   'Small group. Real conversation. Quietly, a community.'],
  ];
  return (
    <section style={{ background: 'var(--ink)', color: 'white', padding: '8rem 0' }}>
      <div className="container">
        <div style={{ display: 'grid', gridTemplateColumns: '1fr 1.3fr', gap: '4rem', marginBottom: '3rem', alignItems: 'end' }}>
          <div></div>
          <h2 className="display" style={{ color: 'white', fontSize: 'clamp(40px, 6vw, 96px)', margin: 0 }}>
            Who you'll <em style={{ fontWeight: 300 }}>become.</em>
          </h2>
        </div>
        <div style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', borderTop: '1px solid rgba(255,255,255,0.2)' }}>
          {items.map(([h, b], i) => (
            <Reveal key={i} style={{ display: 'block', padding: '2.5rem 2rem', borderBottom: '1px solid rgba(255,255,255,0.12)', borderRight: (i % 3) !== 2 ? '1px solid rgba(255,255,255,0.12)' : '0' }}>
              <div className="num" style={{ color: 'rgba(255,255,255,0.4)', marginBottom: '1.4rem' }}>0{i+1}</div>
              <div className="display" style={{ fontSize: '32px', color: 'white', lineHeight: 1.1, marginBottom: '1.2rem', overflowWrap: 'break-word' }}>{h}</div>
              <div style={{ color: 'rgba(255,255,255,0.7)', fontSize: '14.5px', lineHeight: 1.55 }}>{b}</div>
            </Reveal>
          ))}
        </div>
      </div>
    </section>
  );
}

/* ==========================================================
   INCLUSIONS, 08 (NEW)
   ========================================================== */
function Inclusions() {
  const items = [
    ['The workbook',           'Bound, branded, designed to be written in. Yours to keep, your decision-making tool for life.'],
    ['A makeup goody bag',      'A curated selection of makeup tools and essentials, yours to keep. The contents vary each intake, always chosen to complement what you have learned.'],
    ['Sparkling on arrival',   'Or a non-alcoholic alternative. A glass in your hand before we begin, the way every good gathering starts.'],
    ['A grazing board',        'Shared during the social hour. Unhurried conversation, real food, no rush.'],
    ['The social hour',        'One full hour with Kylie, after the teaching. Ask anything. Stay as long as you like.'],
    ['Limited seating',        'Seats are intentionally limited to ensure the experience works the way it should: genuine attention, real conversation, and a room that feels considered.'],
  ];
  return (
    <section style={{ padding: '8rem 0', background: 'var(--paper)', borderTop: '1px solid var(--hair)' }}>
      <div className="container">
        <div style={{ display: 'grid', gridTemplateColumns: '1fr 1.3fr', gap: '4rem', marginBottom: '3rem', alignItems: 'end' }}>
          <div>
            <div className="eyebrow">What you take home</div>
            <h2 className="display" style={{ fontSize: 'clamp(40px, 6vw, 96px)', lineHeight: 0.95, margin: '1rem 0 0' }}>
              And the things you<br /><em style={{ fontWeight: 300 }}>carry with you.</em>
            </h2>
          </div>
          <div className="mono" style={{ textAlign: 'right' }}>Every detail, considered.</div>
        </div>
        <div style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', borderTop: '1px solid var(--ink)' }}>
          {items.map(([h, b], i) => (
            <Reveal key={i} style={{
              display: 'block',
              padding: '2.4rem 2rem',
              borderBottom: '1px solid var(--hair)',
              borderRight: (i % 3) !== 2 ? '1px solid var(--hair)' : '0',
              background: 'white'
            }}>
              <div className="display" style={{ fontSize: '26px', lineHeight: 1.15, marginBottom: '1rem' }}>{h}</div>
              <div style={{ color: 'var(--ink-soft)', fontSize: '14.5px', lineHeight: 1.55 }}>{b}</div>
            </Reveal>
          ))}
        </div>
      </div>
    </section>
  );
}

/* ==========================================================
   PRICE MOMENT, 09 (NEW)
   ========================================================== */
function PriceMoment() {
  return (
    <section style={{ background: 'var(--pink-bg)', padding: '9rem 0', borderTop: '1px solid var(--hair-soft)', borderBottom: '1px solid var(--hair-soft)' }}>
      <div className="container" style={{ textAlign: 'center', maxWidth: '900px' }}>
        <div className="eyebrow" style={{ marginBottom: '2.5rem' }}>The investment</div>
        <h2 className="display" style={{ fontSize: 'clamp(48px, 7vw, 104px)', lineHeight: 0.95, margin: 0, letterSpacing: '-0.02em' }}>
          <MaskLine delay={1}>Founding cohort,</MaskLine>
          <MaskLine delay={2}><em style={{ fontWeight: 300 }}>intro</em> price.</MaskLine>
        </h2>
        <div className="display" style={{ fontSize: 'clamp(120px, 18vw, 280px)', lineHeight: 0.9, margin: '4rem 0 1rem', letterSpacing: '-0.04em' }}>
          $199
        </div>
        <div className="mono" style={{ marginBottom: '3rem' }}>AUD · Per seat · Pilot pricing</div>
        <p style={{ fontSize: '17px', lineHeight: 1.55, color: 'var(--ink-soft)', maxWidth: '44ch', margin: '0 auto' }}>
          Pilot pricing is offered to the founding cohort, the women who shape what this workshop becomes. From the next intake, the price reflects the full programme. Reserve once. We will not run this price again.
        </p>
      </div>
    </section>
  );
}

/* ==========================================================
   WHY KYLIE, 10 (replaces fabricated testimonials)
   ========================================================== */
function WhyKylie() {
  return (
    <section style={{ background: 'var(--pink-bg)', padding: '9rem 0' }}>
      <div className="container">
        <div style={{ display: 'grid', gridTemplateColumns: '1fr 1.2fr', gap: '5rem', alignItems: 'start' }}>
          <Reveal>
            <figure style={{ margin: 0 }}>
              <img
                src="/assets/updated-kylie-headshot.webp"
                alt="Portrait of Kylie Nolan, makeup artist and educator, in studio"
                loading="lazy"
                style={{
                  display: 'block',
                  width: '100%',
                  aspectRatio: '1/1',
                  objectFit: 'cover',
                  background: 'var(--pink-bg)'
                }}
              />
            </figure>
          </Reveal>
          <div>
            <div className="eyebrow" style={{ marginBottom: '2rem' }}>Why Kylie</div>
            <h2 className="display" style={{ fontSize: 'clamp(48px, 7vw, 112px)', lineHeight: 0.92, margin: 0, letterSpacing: '-0.02em' }}>
              Twenty years<br /><em style={{ fontWeight: 300 }}>of understanding.</em>
            </h2>
            <p style={{ fontSize: '17px', lineHeight: 1.6, marginTop: '3rem', maxWidth: '44ch' }}>
              After more than twenty years working in makeup, Kylie Nolan has seen the same pattern again and again. Women do not need more makeup trends. They need to understand their own face.
            </p>
            <p style={{ fontSize: '17px', lineHeight: 1.6, marginTop: '1.5rem', maxWidth: '44ch' }}>
              They need to know why certain colours work, why some techniques feel wrong, why balance matters, and why copying someone else's look rarely gives them the result they hoped for.
            </p>
            <p style={{ fontSize: '17px', lineHeight: 1.6, marginTop: '1.5rem', maxWidth: '44ch' }}>
              The Face Edit was created from those gaps. It is Kylie's way of turning two decades of artistry, observation and experience into a system that helps women finally understand their face, their colour, their contrast and their makeup.
            </p>
            <p style={{ fontFamily: 'var(--f-display)', fontStyle: 'italic', fontWeight: 300, fontSize: '24px', lineHeight: 1.4, marginTop: '2rem', color: 'var(--ink-soft)', maxWidth: '40ch' }}>
              Most artists apply makeup. Kylie teaches you how to read your face, so makeup finally makes sense.
            </p>
            <div className="mono" style={{ marginTop: '2.5rem' }}>
              Beauty educator · Face specialist · The Face Edit method
            </div>

            <div style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: '2rem', marginTop: '3.5rem', borderTop: '1px solid var(--ink)', paddingTop: '2rem' }}>
              <div>
                <div className="display" style={{ fontSize: 'clamp(40px, 4vw, 56px)', lineHeight: 0.9 }}>20+</div>
                <div className="mono" style={{ marginTop: '0.5rem' }}>Years working with faces</div>
              </div>
              <div>
                <div className="display" style={{ fontSize: 'clamp(40px, 4vw, 56px)', lineHeight: 0.9 }}>3</div>
                <div className="mono" style={{ marginTop: '0.5rem' }}>Pillars · the method</div>
              </div>
              <div>
                <div className="display" style={{ fontSize: 'clamp(40px, 4vw, 56px)', lineHeight: 0.9, fontStyle: 'italic', fontWeight: 300 }}>Small</div>
                <div className="mono" style={{ marginTop: '0.5rem' }}>Group format · by design</div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </section>
  );
}

/* ==========================================================
   FAQ, 11
   ========================================================== */
function FAQ() {
  const faq = [
    ['Is this a tutorial?',                            ['Yes, it is a tutorial, but not the ordinary kind.', 'Most tutorials teach you how to copy someone else\'s face.', 'The Face Edit teaches you how to understand your own.']],
    ['Do I need to be good at makeup?',                'No. Beginners and long-time enthusiasts both leave with the same thing: clarity.'],
    ['I don\'t wear much makeup. Is this still for me?', ['This workshop is not about teaching you to wear more makeup. It is about helping you understand why certain makeup feels right, why some choices feel wrong, and what actually works for your face.', 'If you have always kept things minimal, The Face Edit helps you understand the reason behind that, so your makeup choices become more conscious, confident and personal.']],
    ['What do I bring?',                                ['Bring yourself, and a clear, well-lit photo of your face without makeup.', 'This can be on your phone or printed. The photo helps you see your face as the starting point: your natural colour, contrast, balance and features.', 'The Face Edit begins with your own beauty. Your face is the canvas. This workshop helps you understand how to work with it, not against it.']],
    ['How many people attend?',                         'Intentionally small. The point is personalisation, not scale.'],
    ['When is the next workshop?',                      'Dates are announced to the waitlist first. Join to be notified before public release.'],
    ['How much is the workshop?',                       'The Foundation workshop is $199 for the founding cohort. This is pilot pricing offered to the women who shape the programme. The price reflects the full programme from the next intake onwards.'],
    ['Is there a refund policy?',                       'Seats transfer. If you cannot attend, you can gift or reassign your seat up to 7 days prior.'],
  ];
  return (
    <section className="container" style={{ padding: '8rem 0' }}>
      <div style={{ display: 'grid', gridTemplateColumns: '1fr 2fr', gap: '4rem', alignItems: 'start' }}>
        <div style={{ position: 'sticky', top: '100px' }}>
          <div className="display" style={{ fontSize: 'clamp(36px, 4.5vw, 64px)', lineHeight: 1, marginTop: '1rem' }}>
            Before you <em style={{ fontWeight: 300 }}>ask.</em>
          </div>
          <p style={{ marginTop: '2rem', color: 'var(--ink-soft)', maxWidth: '30ch', fontSize: '14.5px', lineHeight: 1.55 }}>
            Still unsure? Join the waitlist. Kylie replies personally.
          </p>
        </div>
        <div style={{ borderTop: '1px solid var(--ink)' }}>
          {faq.map((f, i) => <FAQItem key={i} q={f[0]} a={f[1]} n={i+1} />)}
        </div>
      </div>
    </section>
  );
}

function FAQItem({ q, a, n }) {
  const [open, setOpen] = useState(false);
  return (
    <div style={{ borderBottom: '1px solid var(--hair)' }}>
      <button onClick={() => setOpen(o => !o)} style={{ width: '100%', textAlign: 'left', padding: '1.4rem 0', display: 'grid', gridTemplateColumns: 'auto 1fr auto', gap: '1.5rem', alignItems: 'center' }}>
        <span className="mono">{String(n).padStart(2,'0')}</span>
        <span style={{ fontFamily: 'var(--f-display)', fontSize: '24px' }}>{q}</span>
        <span style={{ fontFamily: 'var(--f-mono)', fontSize: '16px', transition: 'transform 0.3s', transform: open ? 'rotate(45deg)' : 'none' }}>+</span>
      </button>
      <div style={{ maxHeight: open ? '600px' : '0', overflow: 'hidden', transition: 'max-height 0.6s var(--ease-out), opacity 0.4s var(--ease-out)', opacity: open ? 1 : 0 }}>
        <div style={{ padding: '0 0 1.4rem', fontSize: '16px', lineHeight: 1.55, color: 'var(--ink-soft)', maxWidth: '60ch' }}>
          {Array.isArray(a) ? a.map((p, i) => <p key={i} style={{ margin: i > 0 ? '0.8rem 0 0' : 0 }}>{p}</p>) : a}
        </div>
      </div>
    </div>
  );
}

/* ==========================================================
   RESERVE, 12
   ========================================================== */
function Reserve({ tone }) {
  const isWarm = tone === 'warm';
  const bg = isWarm ? 'var(--pink-bg)' : 'var(--ink)';
  const fg = isWarm ? 'var(--ink)' : 'white';
  const headline = isWarm
    ? <>By <em style={{ fontWeight: 300 }}>invitation</em><br />order.</>
    : <>Reserve <em style={{ fontWeight: 300 }}>your</em><br />seat.</>;
  const blurb = isWarm
    ? 'The workshop opens to the waitlist before anyone else. Enter once. Kylie reads every name.'
    : 'Spaces are intentionally limited. Waitlist members are offered seats before public release.';
  return (
    <section id="reserve" style={{ background: bg, color: fg, padding: '9rem 0' }}>
      <div className="container" style={{ display: 'grid', gridTemplateColumns: '1.1fr 1fr', gap: '6rem', alignItems: 'start' }}>
        <div>
          <div className="eyebrow" style={{ color: isWarm ? 'var(--ink-muted)' : 'rgba(255,255,255,0.5)', marginBottom: '2rem' }}>Reserve your seat</div>
          <h2 className="display" style={{ fontSize: 'clamp(54px, 8vw, 128px)', lineHeight: 0.9, margin: 0, color: fg }}>
            <MaskLine delay={1}>{headline}</MaskLine>
          </h2>
          <p style={{ fontSize: '17px', lineHeight: 1.55, color: isWarm ? 'var(--ink-soft)' : 'rgba(255,255,255,0.75)', marginTop: '2.5rem', maxWidth: '42ch' }}>{blurb}</p>
          <div style={{ display: 'grid', gridTemplateColumns: 'repeat(4, auto)', gap: '2rem', marginTop: '3rem' }}>
            <ReserveStat n="2h"      l="Workshop"     tone={tone} />
            <ReserveStat n="1h"      l="Social Hour"  tone={tone} />
            <ReserveStat n="3h"      l="Total"        tone={tone} />
            <ReserveStat n="Limited" l="Seating"      tone={tone} />
          </div>
        </div>
        <div style={{ background: 'white', color: 'var(--ink)', padding: '3rem' }}>
          <div className="mono" style={{ marginBottom: '1.5rem' }}>Tickets · Book now</div>
          <div className="display" style={{ fontSize: '28px', lineHeight: 1.1, marginBottom: '2rem' }}>
            <em style={{ fontWeight: 300 }}>Click here to view</em> current available sessions
          </div>
          <a href="https://events.humanitix.com/the-face-edit-foundation-workshop" target="_blank" rel="noopener" className="btn btn-solid" style={{ display: 'flex', justifyContent: 'center', width: '100%', marginBottom: '1rem' }}>
            Book your seat <span className="btn-arrow"/>
          </a>
          <a href="https://thefaceedit.us17.list-manage.com/subscribe?u=49dfda9ebf8b3039b6d013d27&id=2804d4f9bf" target="_blank" rel="noopener" className="btn" style={{ display: 'flex', justifyContent: 'center', width: '100%', marginBottom: '2rem' }}>
            Join the waitlist
          </a>
          <p style={{ fontSize: '14px', lineHeight: 1.6, color: 'var(--ink-soft)', margin: 0 }}>
            If no sessions are available or booked out please join the waitlist. The Face Edit fills from the inside out. Waitlist members hear first, always. Drop your details below and we'll be in touch the moment new dates are confirmed.
          </p>
        </div>
      </div>
    </section>
  );
}

function ReserveStat({ n, l, tone }) {
  const isWarm = tone === 'warm';
  return (
    <div>
      <div className="display" style={{ fontSize: '38px', color: isWarm ? 'var(--ink)' : 'white' }}>{n}</div>
      <div className="mono" style={{ color: isWarm ? 'var(--ink-muted)' : 'rgba(255,255,255,0.5)', marginTop: '4px' }}>{l}</div>
    </div>
  );
}

function FormField({ label, value, onChange, type = 'text' }) {
  return (
    <div className={`field ${value ? 'filled' : ''}`} style={{ marginBottom: '1.5rem' }}>
      <input
        type={type}
        value={value}
        onChange={(e) => onChange(e.target.value)}
        onFocus={(e) => e.target.parentElement.classList.add('filled')}
        onBlur={(e) => { if (!e.target.value) e.target.parentElement.classList.remove('filled'); }}
      />
      <label>{label}</label>
    </div>
  );
}

/* ==========================================================
   TWEAKS PANEL
   ========================================================== */
function WorkshopTweaksPanel({ tweaks, update, wt, wupdate }) {
  const opt = (label, key, val, onClick) => (
    <button key={val} className={(wt[key] || tweaks[key]) === val ? 'on' : ''} onClick={() => onClick(key, val)}>{label}</button>
  );
  return (
    <div className="tweaks" style={{ maxHeight: '80vh', overflowY: 'auto' }}>
      <div className="tweaks-title"><span>Tweaks · The Face Edit</span></div>

      <div className="tweak-row">
        <span className="tweak-label">Hero</span>
        <div className="tweak-opts">
          {opt('Bold type', 'ws_hero', 'bold-type', wupdate)}
          {opt('Question', 'ws_hero', 'question', wupdate)}
          {opt('Editorial', 'ws_hero', 'editorial', wupdate)}
        </div>
      </div>

      <div className="tweak-row">
        <span className="tweak-label">The pitch</span>
        <div className="tweak-opts">
          {opt('Emotional', 'ws_pitch', 'emotional', wupdate)}
          {opt('Direct', 'ws_pitch', 'direct', wupdate)}
        </div>
      </div>

      <div className="tweak-row">
        <span className="tweak-label">Reserve tone</span>
        <div className="tweak-opts">
          {opt('Warm (pink)', 'ws_cta_tone', 'warm', wupdate)}
          {opt('Authority (black)', 'ws_cta_tone', 'authority', wupdate)}
        </div>
      </div>

      <div style={{ borderTop: '1px solid var(--hair)', marginTop: '14px', paddingTop: '14px' }}>
        <div className="tweak-row">
          <span className="tweak-label">Type pairing</span>
          <div className="tweak-opts">
            {opt('Editorial', 'type', 'editorial', update)}
            {opt('Didone', 'type', 'didone', update)}
            {opt('All-sans', 'type', 'all-sans', update)}
            {opt('Serif+Sans', 'type', 'serif-sans', update)}
          </div>
        </div>
        <div className="tweak-row">
          <span className="tweak-label">Pink intensity</span>
          <div className="tweak-opts">
            {opt('Off', 'pink', 'off', update)}
            {opt('Whisper', 'pink', 'whisper', update)}
            {opt('Soft', 'pink', 'soft', update)}
            {opt('Anchor', 'pink', 'anchor', update)}
          </div>
        </div>
      </div>
    </div>
  );
}

/* ==========================================================
   PAGE
   ========================================================== */
function WorkshopsPage() {
  const { tweaks, editMode, update } = useTweaks();
  const { wt, update: wupdate } = useWorkshopTweaks(tweaks, null);

  return (
    <div data-screen-label="The Face Edit / Workshop" className="page">
      <Nav current="workshops" />
      <WsHero variant={wt.ws_hero} />
      <Marquee items={['Editing over adding', 'Understanding over copying', 'Skin over coverage', 'Individual over trend', 'Feeling over perfection']} />
      <Pitch variant={wt.ws_pitch} />
      <Transformation />
      <TeachSection />
      <ArrivalRitual />
      <LeaveWith />
      <Inclusions />
      <WhyKylie />
      <FAQ />
      <Reserve tone={wt.ws_cta_tone} />
      <Footer />
      {editMode && <WorkshopTweaksPanel tweaks={tweaks} update={update} wt={wt} wupdate={wupdate} />}
    </div>
  );
}

Object.assign(window, { WorkshopsPage });
