// CruiseN'Shine Detailing — Wakefield, MA
// Original design. Premium-modern automotive aesthetic.

const TWEAK_DEFAULTS = /*EDITMODE-BEGIN*/{
  "accent": "#E8B04B",
  "theme": "midnight",
  "heroLayout": "cinematic",
  "serviceStyle": "cards",
  "showPricing": true,
  "density": "regular"
}/*EDITMODE-END*/;

const THEMES = {
  midnight: { bg: '#0B0C0E', surface: '#121317', surface2: '#1A1C22', line: 'rgba(255,255,255,0.08)', text: '#F4F4F5', muted: 'rgba(244,244,245,0.6)', faint: 'rgba(244,244,245,0.4)' },
  graphite: { bg: '#1A1A1A', surface: '#222222', surface2: '#2A2A2A', line: 'rgba(255,255,255,0.08)', text: '#F5F5F4', muted: 'rgba(245,245,244,0.62)', faint: 'rgba(245,245,244,0.42)' },
  paper:    { bg: '#F6F4EF', surface: '#FFFFFF', surface2: '#EDEAE2', line: 'rgba(20,20,20,0.10)', text: '#1A1A1A', muted: 'rgba(26,26,26,0.62)', faint: 'rgba(26,26,26,0.42)' },
};

const SERVICES = [
  { id: 'exterior', name: 'Exterior Detail', time: '30–60 min', price: 40, blurb: 'A complete outside reset by hand — washed, soaped, rinsed, glass cleaned, and tires shined.', includes: ['Base wash', 'Soap & second wash', 'Final soap & rinse', 'Glass cleaner', 'Tire shine'] },
  { id: 'interior', name: 'Interior Detail', time: '~2 hr', price: 80, blurb: 'A deep clean inside — dust blown out, fully vacuumed, rugs and surfaces cleaned.', includes: ['Dust spray-out', 'Full vacuum', 'Rugs cleaned', 'Surfaces wiped down'] },
  { id: 'full', name: 'Full Detail', time: '~3 hr', price: 120, blurb: 'Our most-booked package. Everything in the exterior and interior details — start to finish, by hand.', includes: ['Full exterior detail', 'Full interior detail'], featured: true },
];

const REVIEWS = [
  { name: 'Marcus T.', vehicle: '2019 BMW M340i', stars: 5, text: 'Dropped off a daily-driver, picked up something that felt new. The paint correction on the hood alone was worth the price. Booking again next month.' },
  { name: 'Priya R.', vehicle: '2022 Tesla Model Y', stars: 5, text: 'I have two kids and a dog. The interior was, frankly, a crime scene. He made it disappear. The leather looks better than the day we got the car.' },
  { name: 'Devon K.', vehicle: '2015 Tacoma TRD', stars: 5, text: 'Took the truck after a year of jobsite abuse. He spent eight hours on it and texted me photos through the whole process. Honest pricing, real craft.' },
  { name: 'Sara L.', vehicle: '2024 Porsche Macan', stars: 5, text: 'Ceramic coat on a brand-new car. The water beading is wild and the gloss is unreal. He treats every car like it\u2019s his own.' },
];

const FAQ = [
  { q: 'Where are you located?', a: 'We\u2019re based in Wakefield, MA, and serve the surrounding North Shore towns. Mobile service available within a 15-mile radius — we come to you with water and power on board.' },
  { q: 'How long does each service take?', a: 'An exterior detail takes about 30 minutes to an hour. An interior detail takes about 2 hours. A full detail is about 3 hours. We only book a few cars a day so each one gets the time it deserves.' },
  { q: 'What about pet hair, vomit, smoke, etc.?', a: 'Bring it on. Heavy pet-hair removal is a flat $40 add-on to any interior service. Smoke odor takes an ozone treatment, $60. We\u2019ll quote anything unusual up front.' },
  { q: 'Do you offer a guarantee?', a: 'Every detail comes with a 48-hour satisfaction window. If something isn\u2019t right, we make it right — no charge, no questions.' },
];

const GALLERY = [
  { tag: 'Exterior detail', sub: 'Black sedan, after wash', img: 'https://images.unsplash.com/photo-1605515298946-d5e83ce8b2cb?w=1200&q=80&auto=format&fit=crop' },
  { tag: 'Interior reset', sub: 'SUV, full shampoo',         img: 'https://images.unsplash.com/photo-1607853202273-797f1c22a38e?w=1000&q=80&auto=format&fit=crop' },
  { tag: 'Wheel & tire',    sub: 'Detailed face-out',         img: 'https://images.unsplash.com/photo-1493238792000-8113da705763?w=1000&q=80&auto=format&fit=crop' },
  { tag: 'Leather care',    sub: 'Driver seat, conditioned',  img: 'https://images.unsplash.com/photo-1601362840469-51e4d8d58785?w=1000&q=80&auto=format&fit=crop' },
  { tag: 'Foam bath',       sub: 'Decontamination wash',      img: 'https://images.unsplash.com/photo-1542362567-b07e54358753?w=1000&q=80&auto=format&fit=crop' },
  { tag: 'Final polish',    sub: 'Hand-buffed finish',        img: 'https://images.unsplash.com/photo-1492144534655-ae79c964c9d7?w=1000&q=80&auto=format&fit=crop' },
];

const HERO_IMG = 'https://images.unsplash.com/photo-1503376780353-7e6692767b70?w=1600&q=85&auto=format&fit=crop';

// ─── Atoms ──────────────────────────────────────────────────────────────────

// useMediaQuery hook
function useIsMobile(bp = 760) {
  const [m, setM] = React.useState(typeof window !== 'undefined' ? window.innerWidth < bp : false);
  React.useEffect(() => {
    const on = () => setM(window.innerWidth < bp);
    window.addEventListener('resize', on);
    return () => window.removeEventListener('resize', on);
  }, [bp]);
  return m;
}

function PhotoTile({ label, sub, ratio = '4/3', src, accent = '#E8B04B' }) {
  return (
    <div style={{
      aspectRatio: ratio, width: '100%', background: '#1A1C22',
      backgroundImage: src ? `url(${src})` : undefined,
      backgroundSize: 'cover', backgroundPosition: 'center',
      borderRadius: 6, position: 'relative', overflow: 'hidden',
    }}>
      <div style={{ position: 'absolute', inset: 0, background: 'linear-gradient(180deg, rgba(0,0,0,0) 50%, rgba(0,0,0,0.6) 100%)' }}/>
      <div style={{ position: 'absolute', top: 12, left: 12, fontFamily: 'ui-monospace, "SF Mono", Menlo, monospace', fontSize: 10, color: '#fff', letterSpacing: '0.16em', textTransform: 'uppercase', background: 'rgba(0,0,0,0.55)', padding: '4px 9px', borderRadius: 999, backdropFilter: 'blur(6px)' }}>
        <span style={{ color: accent }}>●</span> {label}
      </div>
      {sub ? <div style={{ position: 'absolute', bottom: 12, left: 14, right: 14, color: 'rgba(255,255,255,0.85)', fontSize: 12, letterSpacing: '0.04em' }}>{sub}</div> : null}
    </div>
  );
}

function StripedPlaceholder({ label, sub, ratio = '4/3', dark = true }) {
  const fg = dark ? 'rgba(255,255,255,0.08)' : 'rgba(0,0,0,0.06)';
  const bg = dark ? '#1A1C22' : '#EDEAE2';
  const text = dark ? 'rgba(255,255,255,0.55)' : 'rgba(0,0,0,0.55)';
  return (
    <div style={{
      aspectRatio: ratio, width: '100%', background: bg,
      backgroundImage: `repeating-linear-gradient(135deg, ${fg} 0 1px, transparent 1px 14px)`,
      borderRadius: 4, position: 'relative', overflow: 'hidden',
      display: 'flex', alignItems: 'flex-end', padding: 16,
    }}>
      <div style={{ fontFamily: 'ui-monospace, "SF Mono", Menlo, monospace', fontSize: 11, color: text, letterSpacing: '0.04em' }}>
        <div style={{ opacity: 0.85 }}>{label}</div>
        {sub ? <div style={{ opacity: 0.55, marginTop: 2 }}>{sub}</div> : null}
      </div>
    </div>
  );
}

function Stars({ n = 5, color = '#E8B04B' }) {
  return (
    <div style={{ display: 'flex', gap: 2, color }}>
      {Array.from({ length: n }).map((_, i) => (
        <svg key={i} width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2l3 7 7 .8-5.2 4.7 1.5 7-6.3-3.7-6.3 3.7 1.5-7L2 9.8 9 9z" /></svg>
      ))}
    </div>
  );
}

function ChevDown({ size = 14 }) {
  return <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2"><path d="M6 9l6 6 6-6"/></svg>;
}

// ─── Sections ───────────────────────────────────────────────────────────────

function Nav({ T, accent, onBook }) {
  const [scrolled, setScrolled] = React.useState(false);
  const isMobile = useIsMobile();
  React.useEffect(() => {
    const onScroll = () => setScrolled(window.scrollY > 40);
    window.addEventListener('scroll', onScroll);
    return () => window.removeEventListener('scroll', onScroll);
  }, []);
  return (
    <nav style={{
      position: 'fixed', top: 0, left: 0, right: 0, zIndex: 50,
      padding: scrolled ? (isMobile ? '12px 20px' : '14px 32px') : (isMobile ? '18px 20px' : '22px 32px'), transition: 'all .25s ease',
      background: scrolled ? `${T.bg}cc` : 'transparent',
      backdropFilter: scrolled ? 'blur(18px) saturate(160%)' : 'none',
      borderBottom: scrolled ? `1px solid ${T.line}` : '1px solid transparent',
      display: 'flex', alignItems: 'center', justifyContent: 'space-between',
    }}>
      <div style={{ display: 'flex', alignItems: 'center', gap: 10, color: T.text, minWidth: 0 }}>
        <Logo accent={accent} />
        <span style={{ fontFamily: 'Inter Tight, ui-sans-serif, system-ui', fontWeight: 600, fontSize: 16, letterSpacing: '0.02em' }}>CruiseN’Shine</span>
        {!isMobile && <span style={{ color: T.faint, fontSize: 12, letterSpacing: '0.18em', textTransform: 'uppercase', marginLeft: 4 }}>Wakefield, MA</span>}
      </div>
      <div style={{ display: 'flex', alignItems: 'center', gap: isMobile ? 12 : 28, color: T.muted, fontSize: 13 }}>
        {!isMobile && <a href="#services" style={{ color: 'inherit', textDecoration: 'none' }}>Services</a>}
        {!isMobile && <a href="#work" style={{ color: 'inherit', textDecoration: 'none' }}>Work</a>}
        {!isMobile && <a href="#reviews" style={{ color: 'inherit', textDecoration: 'none' }}>Reviews</a>}
        {!isMobile && <a href="#faq" style={{ color: 'inherit', textDecoration: 'none' }}>FAQ</a>}
        <button onClick={onBook} style={{
          background: accent, color: '#0B0C0E', border: 0, padding: isMobile ? '9px 14px' : '10px 18px',
          borderRadius: 999, fontWeight: 600, fontSize: 13, letterSpacing: '0.01em',
          cursor: 'pointer', fontFamily: 'inherit',
        }}>{isMobile ? 'Book' : 'Book a detail →'}</button>
      </div>
    </nav>
  );
}

function Logo({ accent }) {
  return (
    <svg width="22" height="22" viewBox="0 0 24 24" fill="none">
      <path d="M12 2 L22 20 L2 20 Z" stroke={accent} strokeWidth="1.6" strokeLinejoin="round"/>
      <path d="M12 9 L17 19 L7 19 Z" fill={accent} />
    </svg>
  );
}

function Hero({ T, accent, layout, onBook }) {
  if (layout === 'split') return <HeroSplit T={T} accent={accent} onBook={onBook} />;
  if (layout === 'editorial') return <HeroEditorial T={T} accent={accent} onBook={onBook} />;
  return <HeroCinematic T={T} accent={accent} onBook={onBook} />;
}

function HeroCinematic({ T, accent, onBook }) {
  const isMobile = useIsMobile();
  return (
    <section style={{ position: 'relative', minHeight: '100vh', padding: isMobile ? '120px 20px 60px' : '140px 32px 80px', overflow: 'hidden' }}>
      {/* Backdrop placeholder */}
      <div style={{
        position: 'absolute', inset: 0, zIndex: 0,
        background: `radial-gradient(120% 80% at 70% 30%, ${accent}1A, transparent 55%), linear-gradient(180deg, ${T.bg} 0%, ${T.surface} 100%)`,
      }}/>
      <div aria-hidden style={{
        position: 'absolute', inset: 0, zIndex: 0, opacity: 0.35,
        backgroundImage: `repeating-linear-gradient(135deg, ${T.line} 0 1px, transparent 1px 22px)`,
      }}/>
      {/* Top eyebrow */}
      <div style={{ position: 'relative', zIndex: 2, display: 'flex', justifyContent: 'space-between', alignItems: 'center', color: T.muted, fontSize: 11, letterSpacing: '0.22em', textTransform: 'uppercase' }}>
        <span>Est. 2024 — Wakefield, MA</span>
        <span style={{ display: 'inline-flex', alignItems: 'center', gap: 8 }}>
          <span style={{ width: 6, height: 6, background: '#5BD074', borderRadius: 999, boxShadow: '0 0 0 3px rgba(91,208,116,0.18)' }}/>
          Booking 2 weeks out
        </span>
      </div>

      <div style={{ position: 'relative', zIndex: 2, marginTop: 80, maxWidth: 1180 }}>
        <h1 style={{
          fontFamily: 'Fraunces, "Times New Roman", serif',
          fontWeight: 400, fontSize: 'clamp(44px, 11vw, 144px)', lineHeight: 0.95,
          letterSpacing: '-0.025em', margin: 0, color: T.text,
        }}>
          <Reveal y={32} duration={900}>Mirror finish.</Reveal>
          <Reveal y={32} duration={900} delay={120}><span style={{ fontStyle: 'italic', color: accent }}>Meticulous</span> work.</Reveal>
        </h1>
        <Reveal delay={280} y={16}>
          <p style={{ marginTop: 28, maxWidth: 560, color: T.muted, fontSize: 17, lineHeight: 1.55 }}>
            CruiseN’Shine is a hands-on detail shop in Wakefield, Massachusetts.
            Exterior, interior, full detail — by appointment, by hand, with the
            patience the work actually takes. No upsells, no surprises on the
            invoice.
          </p>
        </Reveal>

        <Reveal delay={420} y={12}>
          <div style={{ marginTop: 40, display: 'flex', gap: 14, alignItems: 'center', flexWrap: 'wrap' }}>
            <MagneticButton onClick={onBook} style={{
              background: accent, color: '#0B0C0E', border: 0, padding: '16px 28px',
              borderRadius: 999, fontWeight: 600, fontSize: 15, cursor: 'pointer', fontFamily: 'inherit',
            }}>Book a detail →</MagneticButton>
            <a href="#services" style={{
              color: T.text, padding: '16px 24px', borderRadius: 999,
              border: `1px solid ${T.line}`, textDecoration: 'none', fontSize: 15,
            }}>See services</a>
            <a href="tel:7815550144" style={{ color: T.muted, fontSize: 14, marginLeft: 8, textDecoration: 'none' }}>
              or call <span style={{ color: T.text, fontVariantNumeric: 'tabular-nums' }}>(781) 555-0144</span>
            </a>
          </div>
        </Reveal>
      </div>

      {/* Stat strip */}
      <div style={{
        position: 'relative', zIndex: 2, marginTop: isMobile ? 60 : 120,
        display: 'grid', gridTemplateColumns: isMobile ? 'repeat(2, 1fr)' : 'repeat(4, 1fr)', gap: 0,
        borderTop: `1px solid ${T.line}`, borderBottom: `1px solid ${T.line}`,
      }}>
        {[
          { v: 312, suffix: '', decimals: 0, label: 'cars detailed' },
          { v: 4.9, suffix: '', decimals: 1, label: 'average rating' },
          { v: 48,  suffix: ' hr', decimals: 0, label: 'satisfaction window' },
          { v: 15,  suffix: ' mi', decimals: 0, label: 'mobile radius' },
        ].map((s, i) => (
          <Reveal key={i} delay={i * 80} y={16} style={{ padding: isMobile ? '20px 16px' : '28px 24px', borderLeft: isMobile ? (i % 2 ? `1px solid ${T.line}` : 'none') : (i ? `1px solid ${T.line}` : 'none'), borderTop: isMobile && i >= 2 ? `1px solid ${T.line}` : 'none' }}>
            <div style={{ fontFamily: 'Fraunces, serif', fontSize: 40, color: T.text, letterSpacing: '-0.02em' }}>
              <CountUp to={s.v} suffix={s.suffix} decimals={s.decimals} />
            </div>
            <div style={{ color: T.faint, fontSize: 11, textTransform: 'uppercase', letterSpacing: '0.18em', marginTop: 4 }}>{s.label}</div>
          </Reveal>
        ))}
      </div>
    </section>
  );
}

function HeroSplit({ T, accent, onBook }) {
  const isMobile = useIsMobile();
  return (
    <section style={{ minHeight: isMobile ? 'auto' : '100vh', padding: isMobile ? '120px 20px 40px' : '140px 32px 60px', display: 'grid', gridTemplateColumns: isMobile ? '1fr' : '1.1fr 1fr', gap: isMobile ? 32 : 48, alignItems: 'center' }}>
      <div>
        <Reveal style={{ color: accent, fontSize: 11, letterSpacing: '0.22em', textTransform: 'uppercase', marginBottom: 24 }}>— By appointment</Reveal>
        <h1 style={{ fontFamily: 'Fraunces, serif', fontWeight: 400, fontSize: 'clamp(40px, 7vw, 104px)', lineHeight: 1, letterSpacing: '-0.025em', margin: 0, color: T.text }}>
          <Reveal y={28} duration={900}>The kind of detail</Reveal>
          <Reveal y={28} duration={900} delay={120}>you used to get</Reveal>
          <Reveal y={28} duration={900} delay={240}><span style={{ fontStyle: 'italic', color: accent }}>before everyone got busy.</span></Reveal>
        </h1>
        <Reveal delay={400}>
          <p style={{ marginTop: 24, maxWidth: 480, color: T.muted, fontSize: 16, lineHeight: 1.55 }}>
            Hands-on shop in Wakefield. Same hands every time. Booking out roughly two weeks.
          </p>
        </Reveal>
        <Reveal delay={520}>
          <div style={{ marginTop: 32, display: 'flex', gap: 12, flexWrap: 'wrap' }}>
            <MagneticButton onClick={onBook} style={{ background: accent, color: '#0B0C0E', border: 0, padding: '15px 26px', borderRadius: 999, fontWeight: 600, fontSize: 14, cursor: 'pointer', fontFamily: 'inherit' }}>Book a detail →</MagneticButton>
            <a href="#services" style={{ color: T.text, padding: '15px 22px', borderRadius: 999, border: `1px solid ${T.line}`, textDecoration: 'none', fontSize: 14 }}>See services</a>
          </div>
        </Reveal>
      </div>
      <Reveal delay={300} y={40}>
        <Parallax speed={isMobile ? 0 : 0.06}>
          <PhotoTile label="Hero shot" sub="Hand-finished detail, Wakefield, MA" ratio="4/5" src={HERO_IMG} accent={accent} />
        </Parallax>
      </Reveal>
    </section>
  );
}

function HeroEditorial({ T, accent, onBook }) {
  const isMobile = useIsMobile();
  return (
    <section style={{ minHeight: isMobile ? 'auto' : '100vh', padding: isMobile ? '120px 20px 40px' : '160px 32px 60px', maxWidth: 1280, margin: '0 auto' }}>
      <div style={{ display: 'grid', gridTemplateColumns: isMobile ? '1fr' : '1fr auto 1fr', alignItems: 'baseline', gap: isMobile ? 8 : 32, marginBottom: isMobile ? 32 : 60 }}>
        <Reveal style={{ color: T.faint, fontSize: 11, letterSpacing: '0.22em', textTransform: 'uppercase' }}>№ 001 — Hand-detailing</Reveal>
        <Reveal delay={100} style={{ color: T.muted, fontFamily: 'Fraunces, serif', fontStyle: 'italic', fontSize: 18 }}>est. 2024</Reveal>
        <Reveal delay={200} style={{ textAlign: isMobile ? 'left' : 'right', color: T.faint, fontSize: 11, letterSpacing: '0.22em', textTransform: 'uppercase' }}>Wakefield, MA</Reveal>
      </div>
      <h1 style={{ fontFamily: 'Fraunces, serif', fontWeight: 300, fontSize: 'clamp(56px, 14vw, 180px)', lineHeight: 0.92, letterSpacing: '-0.04em', margin: 0, color: T.text, textAlign: 'center' }}>
        <Reveal y={40} duration={900}>A car</Reveal>
        <Reveal y={40} duration={900} delay={140}>worth</Reveal>
        <Reveal y={40} duration={900} delay={280}><span style={{ fontStyle: 'italic', color: accent }}>keeping.</span></Reveal>
      </h1>
      <div style={{ marginTop: isMobile ? 48 : 80, display: 'grid', gridTemplateColumns: isMobile ? '1fr' : '1fr 1fr', gap: isMobile ? 24 : 48, maxWidth: 880, marginLeft: 'auto', marginRight: 'auto' }}>
        <Reveal delay={500}>
          <p style={{ color: T.muted, fontSize: 15, lineHeight: 1.7, margin: 0 }}>
            CruiseN’Shine is a hands-on detail shop in Wakefield, Massachusetts. Exterior, interior, full detail — by appointment, by hand, with the patience the work actually takes.
          </p>
        </Reveal>
        <Reveal delay={600}>
          <MagneticButton onClick={onBook} style={{ background: accent, color: '#0B0C0E', border: 0, padding: '15px 24px', borderRadius: 999, fontWeight: 600, fontSize: 14, cursor: 'pointer', fontFamily: 'inherit' }}>Book a detail →</MagneticButton>
          <div style={{ marginTop: 16, color: T.faint, fontSize: 13 }}>Or call <span style={{ color: T.text }}>(781) 555-0144</span></div>
        </Reveal>
      </div>
    </section>
  );
}

function Services({ T, accent, style, showPricing, onBook }) {
  const isMobile = useIsMobile();
  return (
    <section id="services" style={{ padding: isMobile ? '80px 20px' : '120px 32px', borderTop: `1px solid ${T.line}` }}>
      <SectionHead T={T} accent={accent} eyebrow="02 / Services" title="Three packages. No upsells." sub="Pick what fits the car. Add anything à la carte. Quote is the price." />
      {style === 'list' ? (
        <ServicesList T={T} accent={accent} showPricing={showPricing} onBook={onBook} />
      ) : style === 'table' ? (
        <ServicesTable T={T} accent={accent} showPricing={showPricing} onBook={onBook} />
      ) : (
        <ServicesCards T={T} accent={accent} showPricing={showPricing} onBook={onBook} />
      )}
    </section>
  );
}

function SectionHead({ T, accent, eyebrow, title, sub }) {
  const isMobile = useIsMobile();
  return (
    <div style={{ display: 'grid', gridTemplateColumns: isMobile ? '1fr' : 'minmax(0, 1fr) minmax(0, 1.5fr)', gap: isMobile ? 16 : 48, marginBottom: isMobile ? 40 : 64, alignItems: 'end' }}>
      <Reveal style={{ color: accent, fontSize: 11, letterSpacing: '0.22em', textTransform: 'uppercase', fontVariantNumeric: 'tabular-nums' }}>{eyebrow}</Reveal>
      <div>
        <h2 style={{ fontFamily: 'Fraunces, serif', fontWeight: 400, fontSize: 'clamp(36px, 4.5vw, 64px)', lineHeight: 1.05, letterSpacing: '-0.02em', margin: 0, color: T.text }}>
          <Reveal y={20} duration={800}>{title}</Reveal>
        </h2>
        {sub ? <Reveal delay={120}><p style={{ marginTop: 16, color: T.muted, fontSize: 16, maxWidth: 520, lineHeight: 1.5 }}>{sub}</p></Reveal> : null}
      </div>
    </div>
  );
}

function ServicesCards({ T, accent, showPricing, onBook }) {
  const isMobile = useIsMobile();
  return (
    <div style={{ display: 'grid', gridTemplateColumns: isMobile ? '1fr' : `repeat(${SERVICES.length}, 1fr)`, gap: 16 }}>
      {SERVICES.map((s, idx) => (
        <Reveal key={s.id} delay={idx * 100} y={32} duration={800}>
          <Tilt max={3} style={{
          background: s.featured ? T.surface2 : T.surface,
          border: `1px solid ${s.featured ? accent + '55' : T.line}`,
          borderRadius: 8, padding: 24, display: 'flex', flexDirection: 'column', gap: 16,
          position: 'relative', height: '100%',
        }}>
          {s.featured ? (
            <span style={{ position: 'absolute', top: -1, right: 16, transform: 'translateY(-50%)', background: accent, color: '#0B0C0E', fontSize: 10, fontWeight: 700, letterSpacing: '0.12em', textTransform: 'uppercase', padding: '4px 10px', borderRadius: 999 }}>Most booked</span>
          ) : null}
          <div>
            <div style={{ color: T.faint, fontSize: 11, letterSpacing: '0.18em', textTransform: 'uppercase', fontVariantNumeric: 'tabular-nums' }}>{s.time}</div>
            <h3 style={{ fontFamily: 'Fraunces, serif', fontWeight: 400, fontSize: 26, margin: '6px 0 0', color: T.text, letterSpacing: '-0.01em' }}>{s.name}</h3>
          </div>
          <p style={{ color: T.muted, fontSize: 13, lineHeight: 1.55, margin: 0 }}>{s.blurb}</p>
          <ul style={{ listStyle: 'none', padding: 0, margin: 0, display: 'flex', flexDirection: 'column', gap: 8 }}>
            {s.includes.map((inc, i) => (
              <li key={i} style={{ display: 'flex', gap: 10, alignItems: 'flex-start', color: T.muted, fontSize: 13 }}>
                <span style={{ color: accent, marginTop: 2 }}>✓</span> {inc}
              </li>
            ))}
          </ul>
          <div style={{ marginTop: 'auto', paddingTop: 12, borderTop: `1px solid ${T.line}`, display: 'flex', alignItems: 'baseline', justifyContent: 'space-between' }}>
            {showPricing ? (
              <div>
                <span style={{ color: T.faint, fontSize: 11 }}>from</span>
                <div style={{ fontFamily: 'Fraunces, serif', fontSize: 32, color: T.text, letterSpacing: '-0.02em' }}>${s.price}</div>
              </div>
            ) : (
              <div style={{ color: T.muted, fontSize: 13 }}>Quote on request</div>
            )}
            <button onClick={() => onBook(s.id)} style={{ background: 'transparent', color: T.text, border: `1px solid ${T.line}`, padding: '8px 14px', borderRadius: 999, fontSize: 12, cursor: 'pointer', fontFamily: 'inherit' }}>Book →</button>
          </div>
          </Tilt>
        </Reveal>
      ))}
    </div>
  );
}

function ServicesList({ T, accent, showPricing, onBook }) {
  const isMobile = useIsMobile();
  return (
    <div style={{ borderTop: `1px solid ${T.line}` }}>
      {SERVICES.map(s => (
        <div key={s.id} style={{
          display: 'grid', gridTemplateColumns: isMobile ? '1fr auto' : '60px 1.2fr 2fr auto auto', gap: isMobile ? 12 : 24, alignItems: isMobile ? 'flex-start' : 'center',
          padding: '28px 0', borderBottom: `1px solid ${T.line}`,
        }}>
          {!isMobile && <div style={{ color: T.faint, fontFamily: 'ui-monospace, monospace', fontSize: 12 }}>0{SERVICES.indexOf(s) + 1}</div>}
          <div>
            <h3 style={{ fontFamily: 'Fraunces, serif', fontWeight: 400, fontSize: 28, margin: 0, color: T.text, letterSpacing: '-0.01em' }}>{s.name}</h3>
            <div style={{ color: T.faint, fontSize: 11, letterSpacing: '0.18em', textTransform: 'uppercase', marginTop: 6 }}>{s.time}{s.featured ? ' · Most booked' : ''}</div>
          </div>
          {!isMobile && <p style={{ color: T.muted, fontSize: 14, margin: 0, lineHeight: 1.5 }}>{s.blurb}</p>}
          <div style={{ textAlign: 'right' }}>
            {showPricing ? (
              <div style={{ fontFamily: 'Fraunces, serif', fontSize: 26, color: T.text }}>${s.price}</div>
            ) : <div style={{ color: T.muted, fontSize: 13 }}>Quote</div>}
          </div>
          <button onClick={() => onBook(s.id)} style={{ background: accent, color: '#0B0C0E', border: 0, padding: '10px 18px', borderRadius: 999, fontSize: 13, fontWeight: 600, cursor: 'pointer', fontFamily: 'inherit' }}>Book →</button>
        </div>
      ))}
    </div>
  );
}

function ServicesTable({ T, accent, showPricing, onBook }) {
  const allRows = [
    'Hand wash & dry', 'Wheels & tires', 'Vacuum', 'Glass', 'Spray sealant',
    'Interior shampoo', 'Leather condition', 'Clay bar decon', 'Two-stage polish',
    'Engine bay', 'Headlight clarity', '9H ceramic', '5-year warranty',
  ];
  const matrix = {
    exterior: [1,1,1,1,1,0,0,0,0,0,0,0,0],
    interior: [0,0,1,1,0,1,1,0,0,0,0,0,0],
    full:     [1,1,1,1,1,1,1,1,1,1,1,0,0],
  };
  return (
    <div style={{ overflowX: 'auto' }}>
      <table style={{ width: '100%', borderCollapse: 'collapse', color: T.text, fontFamily: 'inherit' }}>
        <thead>
          <tr>
            <th style={{ textAlign: 'left', padding: '16px 12px', borderBottom: `1px solid ${T.line}`, fontWeight: 500, color: T.faint, fontSize: 11, letterSpacing: '0.18em', textTransform: 'uppercase' }}></th>
            {SERVICES.map(s => (
              <th key={s.id} style={{ textAlign: 'left', padding: '16px 12px', borderBottom: `1px solid ${T.line}`, verticalAlign: 'bottom' }}>
                <div style={{ fontFamily: 'Fraunces, serif', fontSize: 22, fontWeight: 400 }}>{s.name}</div>
                {showPricing ? <div style={{ color: accent, fontSize: 13, marginTop: 4 }}>from ${s.price}</div> : null}
              </th>
            ))}
          </tr>
        </thead>
        <tbody>
          {allRows.map((row, i) => (
            <tr key={i}>
              <td style={{ padding: '12px', borderBottom: `1px solid ${T.line}`, color: T.muted, fontSize: 13 }}>{row}</td>
              {SERVICES.map(s => (
                <td key={s.id} style={{ padding: '12px', borderBottom: `1px solid ${T.line}`, color: matrix[s.id][i] ? accent : T.faint, fontSize: 14 }}>
                  {matrix[s.id][i] ? '●' : '—'}
                </td>
              ))}
            </tr>
          ))}
          <tr>
            <td/>
            {SERVICES.map(s => (
              <td key={s.id} style={{ padding: '16px 12px' }}>
                <button onClick={() => onBook(s.id)} style={{ background: accent, color: '#0B0C0E', border: 0, padding: '8px 14px', borderRadius: 999, fontSize: 12, fontWeight: 600, cursor: 'pointer', fontFamily: 'inherit' }}>Book →</button>
              </td>
            ))}
          </tr>
        </tbody>
      </table>
    </div>
  );
}

function Process({ T, accent }) {
  const isMobile = useIsMobile();
  const steps = [
    { n: '01', t: 'Walk-around', d: 'I look at the car with you. We talk about what bothers you, what you want, and what\u2019s realistic.' },
    { n: '02', t: 'Decon & wash', d: 'Foam bath, iron remover, surface decontamination. We get the car chemically and physically clean before anything else touches it.' },
    { n: '03', t: 'The detail', d: 'Hand wash, interior shampoo, leather conditioning — whatever the package calls for. Done by hand, no skipping steps.' },
    { n: '04', t: 'Final pass', d: 'Inspection under LED. Door jambs, badge edges, glass. You walk around it with me before you sign anything.' },
  ];
  return (
    <section style={{ padding: isMobile ? '80px 20px' : '120px 32px', borderTop: `1px solid ${T.line}`, background: T.surface }}>
      <SectionHead T={T} accent={accent} eyebrow="03 / Process" title="Four steps. No shortcuts." />
      <div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(220px, 1fr))', gap: 32 }}>
        {steps.map((s, idx) => (
          <Reveal key={s.n} delay={idx * 120} y={28}>
            <div style={{ fontFamily: 'Fraunces, serif', fontSize: 56, color: accent, lineHeight: 1, letterSpacing: '-0.03em' }}>{s.n}</div>
            <div style={{ height: 1, background: T.line, margin: '20px 0' }}/>
            <h3 style={{ fontFamily: 'Inter Tight, ui-sans-serif, system-ui', fontWeight: 600, fontSize: 18, color: T.text, margin: 0 }}>{s.t}</h3>
            <p style={{ color: T.muted, fontSize: 14, lineHeight: 1.55, marginTop: 10 }}>{s.d}</p>
          </Reveal>
        ))}
      </div>
    </section>
  );
}

function Gallery({ T, accent }) {
  const isMobile = useIsMobile();
  const [active, setActive] = React.useState(0);
  return (
    <section id="work" style={{ padding: isMobile ? '80px 20px' : '120px 32px', borderTop: `1px solid ${T.line}` }}>
      <SectionHead T={T} accent={accent} eyebrow="04 / Recent work" title="Before, after, and a lot of pad changes." sub="Tap any tile to see the breakdown. New work goes up every Friday." />
      <div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(260px, 1fr))', gap: 12 }}>
        {GALLERY.map((g, i) => (
          <Reveal key={i} delay={i * 80} y={32} duration={800}>
            <button onClick={() => setActive(i)} style={{ all: 'unset', cursor: 'pointer', borderRadius: 4, position: 'relative', display: 'block', width: '100%', outline: active === i ? `2px solid ${accent}` : 'none', outlineOffset: 2, transition: 'transform .35s ease' }} onMouseEnter={e => e.currentTarget.style.transform = 'translateY(-4px)'} onMouseLeave={e => e.currentTarget.style.transform = 'translateY(0)'}>
              <PhotoTile label={g.tag} sub={g.sub} ratio="4/3" src={g.img} accent={accent} />
            </button>
          </Reveal>
        ))}
      </div>
      <div style={{ marginTop: 16, display: 'flex', gap: 16, alignItems: 'center', color: T.muted, fontSize: 13 }}>
        <span style={{ color: accent }}>●</span>
        <span style={{ color: T.text, fontWeight: 500 }}>{GALLERY[active].tag}</span>
        <span style={{ color: T.faint }}>—</span>
        <span>{GALLERY[active].sub}</span>
      </div>
    </section>
  );
}

function Reviews({ T, accent }) {
  const isMobile = useIsMobile();
  return (
    <section id="reviews" style={{ padding: isMobile ? '80px 20px' : '120px 32px', borderTop: `1px solid ${T.line}`, background: T.surface }}>
      <SectionHead T={T} accent={accent} eyebrow="05 / What people say" title="Repeat customers. Mostly word of mouth." />
      <div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(320px, 1fr))', gap: 24 }}>
        {REVIEWS.map((r, i) => (
          <Reveal key={i} delay={i * 100} y={32}>
            <div style={{ background: T.bg, border: `1px solid ${T.line}`, borderRadius: 8, padding: 28, height: '100%' }}>
              <Stars n={r.stars} color={accent} />
              <p style={{ fontFamily: 'Fraunces, serif', fontWeight: 300, fontSize: 22, lineHeight: 1.4, color: T.text, marginTop: 16, letterSpacing: '-0.005em' }}>“{r.text}”</p>
              <div style={{ marginTop: 20, display: 'flex', alignItems: 'center', gap: 12, color: T.muted, fontSize: 13 }}>
                <div style={{ width: 32, height: 32, borderRadius: 999, background: T.surface2, display: 'flex', alignItems: 'center', justifyContent: 'center', fontSize: 12, color: T.text }}>{r.name[0]}</div>
                <div>
                  <div style={{ color: T.text }}>{r.name}</div>
                  <div style={{ color: T.faint, fontSize: 12 }}>{r.vehicle}</div>
                </div>
              </div>
            </div>
          </Reveal>
        ))}
      </div>
    </section>
  );
}

function FAQSection({ T, accent }) {
  const isMobile = useIsMobile();
  const [open, setOpen] = React.useState(0);
  return (
    <section id="faq" style={{ padding: isMobile ? '80px 20px' : '120px 32px', borderTop: `1px solid ${T.line}` }}>
      <SectionHead T={T} accent={accent} eyebrow="06 / FAQ" title="Honest answers." />
      <div style={{ maxWidth: 880 }}>
        {FAQ.map((f, i) => (
          <Reveal key={i} delay={i * 70}>
            <div style={{ borderTop: `1px solid ${T.line}`, borderBottom: i === FAQ.length - 1 ? `1px solid ${T.line}` : 'none' }}>
              <button onClick={() => setOpen(open === i ? -1 : i)} style={{ all: 'unset', cursor: 'pointer', display: 'flex', justifyContent: 'space-between', alignItems: 'center', width: '100%', padding: '24px 0', color: T.text, gap: 16 }}>
                <span style={{ fontFamily: 'Fraunces, serif', fontWeight: 400, fontSize: 22, letterSpacing: '-0.01em' }}>{f.q}</span>
                <span style={{ color: accent, transform: open === i ? 'rotate(180deg)' : 'none', transition: 'transform .3s cubic-bezier(.2,.7,.2,1)', flexShrink: 0 }}><ChevDown size={18}/></span>
              </button>
              <div style={{
                maxHeight: open === i ? 240 : 0, overflow: 'hidden', transition: 'max-height .4s cubic-bezier(.2,.7,.2,1), opacity .25s',
                opacity: open === i ? 1 : 0,
              }}>
                <p style={{ color: T.muted, fontSize: 15, lineHeight: 1.6, margin: 0, paddingBottom: 24, maxWidth: 700 }}>{f.a}</p>
              </div>
            </div>
          </Reveal>
        ))}
      </div>
    </section>
  );
}

function CTA({ T, accent, onBook }) {
  const isMobile = useIsMobile();
  return (
    <section style={{ padding: isMobile ? '80px 20px' : '120px 32px', borderTop: `1px solid ${T.line}`, background: T.surface, position: 'relative', overflow: 'hidden' }}>
      <div aria-hidden style={{ position: 'absolute', inset: 0, opacity: 0.4, backgroundImage: `repeating-linear-gradient(135deg, ${T.line} 0 1px, transparent 1px 22px)` }}/>
      <div style={{ position: 'relative', maxWidth: 1100, margin: '0 auto', textAlign: 'center' }}>
        <Reveal y={20}>
          <div style={{ color: accent, fontSize: 11, letterSpacing: '0.22em', textTransform: 'uppercase' }}>Ready when you are</div>
        </Reveal>
        <h2 style={{ fontFamily: 'Fraunces, serif', fontWeight: 300, fontSize: 'clamp(48px, 7vw, 96px)', lineHeight: 1, letterSpacing: '-0.025em', margin: '24px 0 0', color: T.text }}>
          <Reveal y={28} duration={900}>Bring it in <span style={{ fontStyle: 'italic', color: accent }}>dirty.</span></Reveal>
        </h2>
        <Reveal delay={180}>
          <p style={{ color: T.muted, fontSize: 17, marginTop: 24, maxWidth: 540, marginLeft: 'auto', marginRight: 'auto' }}>
            Booking takes about 90 seconds. Mobile service within 15 miles of Wakefield. Drop-off appointments welcome.
          </p>
        </Reveal>
        <Reveal delay={320}>
          <MagneticButton onClick={onBook} style={{ marginTop: 36, background: accent, color: '#0B0C0E', border: 0, padding: '18px 32px', borderRadius: 999, fontWeight: 600, fontSize: 16, cursor: 'pointer', fontFamily: 'inherit' }}>Book a detail →</MagneticButton>
        </Reveal>
      </div>
    </section>
  );
}

function Footer({ T, accent }) {
  const isMobile = useIsMobile();
  return (
    <footer style={{ padding: isMobile ? '40px 20px' : '60px 32px 40px', borderTop: `1px solid ${T.line}`, color: T.muted }}>
      <div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(200px, 1fr))', gap: 40, paddingBottom: 40, borderBottom: `1px solid ${T.line}` }}>
        <div>
          <div style={{ display: 'flex', alignItems: 'center', gap: 10, color: T.text }}>
            <Logo accent={accent} />
            <span style={{ fontFamily: 'Inter Tight, ui-sans-serif, system-ui', fontWeight: 600, fontSize: 16 }}>CRUISEN’SHINE</span>
          </div>
          <p style={{ marginTop: 16, fontSize: 13, lineHeight: 1.55, maxWidth: 360 }}>
            One-person detail shop. Hand-finished work, by appointment, in the West End.
          </p>
        </div>
        <FooterCol T={T} title="Visit" lines={['Wakefield, MA 01880', 'By appointment', 'Tue–Sat, 8a–6p']} />
        <FooterCol T={T} title="Reach us" lines={['(781) 555-0144', 'hello@cruisenshine.com', '@cruisenshine']} />
        <FooterCol T={T} title="Service area" lines={['Wakefield', 'Reading & Stoneham', 'Melrose & Lynnfield', '15 mi mobile radius']} />
      </div>
      <div style={{ marginTop: 24, display: 'flex', justifyContent: 'space-between', fontSize: 12, color: T.faint }}>
        <span>© 2026 CruiseN’Shine Detailing. Wakefield, MA.</span>
        <span>Built by hand, like the work.</span>
      </div>
    </footer>
  );
}

function FooterCol({ T, title, lines }) {
  return (
    <div>
      <div style={{ color: T.faint, fontSize: 11, letterSpacing: '0.18em', textTransform: 'uppercase', marginBottom: 14 }}>{title}</div>
      {lines.map((l, i) => <div key={i} style={{ fontSize: 14, marginBottom: 6, color: i === 0 ? 'inherit' : 'inherit' }}>{l}</div>)}
    </div>
  );
}

function MarqueeStrip({ T, accent }) {
  const words = ['Exterior detail', 'Interior detail', 'Full detail', 'Pet hair removal', 'Headlight clarity', 'Hand-finished', 'By appointment', 'Wakefield, MA'];
  return (
    <div style={{ borderTop: `1px solid ${T.line}`, borderBottom: `1px solid ${T.line}`, padding: '24px 0', background: T.bg, overflow: 'hidden' }}>
      <Marquee speed={45} gap={56}>
        {words.map((w, i) => (
          <span key={i} style={{ display: 'inline-flex', alignItems: 'center', gap: 56, fontFamily: 'Fraunces, serif', fontStyle: 'italic', fontWeight: 300, fontSize: 'clamp(28px, 5vw, 56px)', color: T.text, letterSpacing: '-0.01em', whiteSpace: 'nowrap' }}>
            {w}
            <span style={{ color: accent, fontStyle: 'normal', fontSize: '0.5em' }}>◆</span>
          </span>
        ))}
      </Marquee>
    </div>
  );
}

// ─── Booking modal (multi-step) ─────────────────────────────────────────────

function BookingModal({ T, accent, open, onClose, initialService }) {
  const [step, setStep] = React.useState(0);
  const isMobile = useIsMobile();
  const [data, setData] = React.useState({
    service: initialService || 'signature',
    addons: [],
    vehicle: { year: '', make: '', model: '', color: '' },
    location: 'shop',
    date: '',
    time: '',
    name: '', email: '', phone: '', notes: '',
  });

  React.useEffect(() => {
    if (open) {
      setStep(0);
      setData(d => ({ ...d, service: initialService || d.service || 'signature' }));
    }
  }, [open, initialService]);

  if (!open) return null;
  const set = (patch) => setData(d => ({ ...d, ...patch }));
  const setVeh = (patch) => setData(d => ({ ...d, vehicle: { ...d.vehicle, ...patch } }));

  const steps = ['Service', 'Vehicle', 'When & where', 'Your info', 'Review'];
  const svc = SERVICES.find(s => s.id === data.service);

  const ADDONS = [
    { id: 'pet', label: 'Pet hair removal', price: 60 },
    { id: 'ozone', label: 'Ozone smoke treatment', price: 90 },
    { id: 'engine', label: 'Engine bay degrease', price: 50 },
    { id: 'headlights', label: 'Headlight restoration', price: 80 },
  ];

  const total = (svc?.price || 0) + data.addons.reduce((sum, id) => sum + (ADDONS.find(a => a.id === id)?.price || 0), 0);

  const canNext = (() => {
    if (step === 0) return !!data.service;
    if (step === 1) return data.vehicle.year && data.vehicle.make && data.vehicle.model;
    if (step === 2) return data.date && data.time;
    if (step === 3) return data.name && data.email && data.phone;
    return true;
  })();

  return (
    <div style={{ position: 'fixed', inset: 0, zIndex: 100, background: 'rgba(0,0,0,0.6)', backdropFilter: 'blur(8px)', display: 'flex', alignItems: 'center', justifyContent: 'center', padding: 24 }} onClick={onClose}>
      <div onClick={e => e.stopPropagation()} style={{ width: '100%', maxWidth: 720, maxHeight: '90vh', background: T.bg, border: `1px solid ${T.line}`, borderRadius: 12, overflow: 'hidden', display: 'flex', flexDirection: 'column' }}>
        {/* Header */}
        <div style={{ padding: '20px 28px', borderBottom: `1px solid ${T.line}`, display: 'flex', justifyContent: 'space-between', alignItems: 'center', gap: 16 }}>
          <div style={{ minWidth: 0 }}>
            <div style={{ color: accent, fontSize: 11, letterSpacing: '0.22em', textTransform: 'uppercase', whiteSpace: 'nowrap' }}>Book a detail</div>
            <div style={{ color: T.text, fontFamily: 'Fraunces, serif', fontSize: 22, marginTop: 6, lineHeight: 1.1 }}>{steps[step]}</div>
          </div>
          <button onClick={onClose} style={{ background: 'transparent', border: 0, color: T.muted, fontSize: 24, cursor: 'pointer', padding: 8 }}>×</button>
        </div>

        {/* Progress */}
        <div style={{ padding: '14px 28px', display: 'flex', gap: 6 }}>
          {steps.map((_, i) => (
            <div key={i} style={{ flex: 1, height: 3, background: i <= step ? accent : T.line, borderRadius: 2, transition: 'background .25s' }}/>
          ))}
        </div>

        {/* Body */}
        <div style={{ padding: '12px 28px 28px', overflowY: 'auto', flex: 1 }}>
          {step === 0 && (
            <div>
              <div style={{ display: 'grid', gap: 10 }}>
                {SERVICES.map(s => (
                  <label key={s.id} style={{ display: 'grid', gridTemplateColumns: '20px 1fr auto', gap: 14, alignItems: 'center', padding: 16, border: `1px solid ${data.service === s.id ? accent : T.line}`, borderRadius: 8, cursor: 'pointer', background: data.service === s.id ? accent + '10' : 'transparent' }}>
                    <input type="radio" checked={data.service === s.id} onChange={() => set({ service: s.id })} style={{ accentColor: accent }}/>
                    <div>
                      <div style={{ color: T.text, fontFamily: 'Fraunces, serif', fontSize: 18 }}>{s.name}</div>
                      <div style={{ color: T.muted, fontSize: 12, marginTop: 2 }}>{s.time} · {s.blurb.split('.')[0]}.</div>
                    </div>
                    <div style={{ color: T.text, fontFamily: 'Fraunces, serif', fontSize: 22 }}>${s.price}</div>
                  </label>
                ))}
              </div>
              <div style={{ marginTop: 24 }}>
                <div style={{ color: T.faint, fontSize: 11, letterSpacing: '0.18em', textTransform: 'uppercase', marginBottom: 12 }}>Add-ons</div>
                <div style={{ display: 'grid', gridTemplateColumns: 'repeat(2, 1fr)', gap: 8 }}>
                  {ADDONS.map(a => {
                    const on = data.addons.includes(a.id);
                    return (
                      <button key={a.id} onClick={() => set({ addons: on ? data.addons.filter(x => x !== a.id) : [...data.addons, a.id] })} style={{ all: 'unset', cursor: 'pointer', padding: '12px 14px', border: `1px solid ${on ? accent : T.line}`, borderRadius: 8, display: 'flex', justifyContent: 'space-between', alignItems: 'center', background: on ? accent + '15' : 'transparent' }}>
                        <span style={{ color: T.text, fontSize: 14 }}>{on ? '✓ ' : '+ '}{a.label}</span>
                        <span style={{ color: T.muted, fontSize: 13 }}>+${a.price}</span>
                      </button>
                    );
                  })}
                </div>
              </div>
            </div>
          )}

          {step === 1 && (
            <div style={{ display: 'grid', gap: 14 }}>
              <div style={{ display: 'grid', gridTemplateColumns: isMobile ? '1fr' : '1fr 1fr', gap: 14 }}>
                <Field T={T} label="Year" value={data.vehicle.year} onChange={v => setVeh({ year: v })} placeholder="2022" />
                <Field T={T} label="Color" value={data.vehicle.color} onChange={v => setVeh({ color: v })} placeholder="Frozen black" />
              </div>
              <Field T={T} label="Make" value={data.vehicle.make} onChange={v => setVeh({ make: v })} placeholder="BMW" />
              <Field T={T} label="Model" value={data.vehicle.model} onChange={v => setVeh({ model: v })} placeholder="M340i" />
              <div>
                <div style={{ color: T.faint, fontSize: 11, letterSpacing: '0.18em', textTransform: 'uppercase', marginBottom: 8 }}>Condition</div>
                <div style={{ display: 'flex', gap: 8 }}>
                  {['Light maintenance', 'Average', 'Needs love'].map(c => (
                    <button key={c} onClick={() => setVeh({ condition: c })} style={{ all: 'unset', cursor: 'pointer', padding: '10px 16px', border: `1px solid ${data.vehicle.condition === c ? accent : T.line}`, borderRadius: 999, color: T.text, fontSize: 13, background: data.vehicle.condition === c ? accent + '15' : 'transparent' }}>{c}</button>
                  ))}
                </div>
              </div>
            </div>
          )}

          {step === 2 && (
            <div style={{ display: 'grid', gap: 18 }}>
              <div>
                <div style={{ color: T.faint, fontSize: 11, letterSpacing: '0.18em', textTransform: 'uppercase', marginBottom: 8 }}>Where</div>
                <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 8 }}>
                  {[['shop', 'Drop-off', 'Wakefield, MA'], ['mobile', 'Mobile', 'Within 15 mi']].map(([id, label, sub]) => (
                    <button key={id} onClick={() => set({ location: id })} style={{ all: 'unset', cursor: 'pointer', padding: 16, border: `1px solid ${data.location === id ? accent : T.line}`, borderRadius: 8, background: data.location === id ? accent + '15' : 'transparent' }}>
                      <div style={{ color: T.text, fontSize: 14, fontWeight: 500 }}>{label}</div>
                      <div style={{ color: T.muted, fontSize: 12, marginTop: 4 }}>{sub}</div>
                    </button>
                  ))}
                </div>
              </div>
              <div>
                <div style={{ color: T.faint, fontSize: 11, letterSpacing: '0.18em', textTransform: 'uppercase', marginBottom: 8 }}>Date</div>
                <DatePicker T={T} accent={accent} value={data.date} onChange={v => set({ date: v })} />
              </div>
              <div>
                <div style={{ color: T.faint, fontSize: 11, letterSpacing: '0.18em', textTransform: 'uppercase', marginBottom: 8 }}>Time</div>
                <div style={{ display: 'flex', gap: 8, flexWrap: 'wrap' }}>
                  {['8:00a', '9:30a', '11:00a', '1:00p', '2:30p', '4:00p'].map(t => (
                    <button key={t} onClick={() => set({ time: t })} style={{ all: 'unset', cursor: 'pointer', padding: '10px 16px', border: `1px solid ${data.time === t ? accent : T.line}`, borderRadius: 999, color: T.text, fontSize: 13, fontVariantNumeric: 'tabular-nums', background: data.time === t ? accent + '15' : 'transparent' }}>{t}</button>
                  ))}
                </div>
              </div>
            </div>
          )}

          {step === 3 && (
            <div style={{ display: 'grid', gap: 14 }}>
              <Field T={T} label="Name" value={data.name} onChange={v => set({ name: v })} placeholder="Alex Rivera"/>
              <div style={{ display: 'grid', gridTemplateColumns: isMobile ? '1fr' : '1fr 1fr', gap: 14 }}>
                <Field T={T} label="Email" value={data.email} onChange={v => set({ email: v })} placeholder="alex@example.com" type="email"/>
                <Field T={T} label="Phone" value={data.phone} onChange={v => set({ phone: v })} placeholder="(555) 555-0144" type="tel"/>
              </div>
              <Field T={T} label="Notes (optional)" value={data.notes} onChange={v => set({ notes: v })} placeholder="Anything we should know? Pet hair, smoker, specific paint chips, etc." multiline/>
            </div>
          )}

          {step === 4 && (
            <div>
              <div style={{ background: T.surface, border: `1px solid ${T.line}`, borderRadius: 8, padding: 20 }}>
                <Row T={T} k="Service" v={svc.name} />
                {data.addons.length > 0 && <Row T={T} k="Add-ons" v={data.addons.map(id => ADDONS.find(a => a.id === id)?.label).join(', ')} />}
                <Row T={T} k="Vehicle" v={`${data.vehicle.year} ${data.vehicle.make} ${data.vehicle.model}${data.vehicle.color ? ' · ' + data.vehicle.color : ''}`} />
                <Row T={T} k="Where" v={data.location === 'shop' ? 'Drop-off · Wakefield, MA' : 'Mobile (within 15 mi)'} />
                <Row T={T} k="When" v={`${data.date} · ${data.time}`} />
                <Row T={T} k="Contact" v={`${data.name} · ${data.email} · ${data.phone}`} />
                <div style={{ borderTop: `1px solid ${T.line}`, marginTop: 14, paddingTop: 14, display: 'flex', justifyContent: 'space-between', alignItems: 'baseline' }}>
                  <span style={{ color: T.muted, fontSize: 13 }}>Estimated total</span>
                  <span style={{ color: T.text, fontFamily: 'Fraunces, serif', fontSize: 32 }}>${total}</span>
                </div>
              </div>
              <p style={{ color: T.faint, fontSize: 12, lineHeight: 1.55, marginTop: 14 }}>
                No card on file. We confirm by text within 4 hours and collect payment after the work is done. Cancel free up to 24 hours before.
              </p>
            </div>
          )}
        </div>

        {/* Footer */}
        <div style={{ padding: '16px 28px', borderTop: `1px solid ${T.line}`, display: 'flex', justifyContent: 'space-between', alignItems: 'center', background: T.surface }}>
          <div style={{ color: T.muted, fontSize: 13 }}>
            {step < 4 ? <>Step <span style={{ color: T.text }}>{step + 1}</span> of {steps.length}</> : <>Almost done</>}
            {svc && <span style={{ marginLeft: 16, color: T.faint }}>· running total <span style={{ color: T.text }}>${total}</span></span>}
          </div>
          <div style={{ display: 'flex', gap: 8 }}>
            {step > 0 && <button onClick={() => setStep(step - 1)} style={{ background: 'transparent', color: T.text, border: `1px solid ${T.line}`, padding: '10px 18px', borderRadius: 999, fontSize: 13, cursor: 'pointer', fontFamily: 'inherit' }}>← Back</button>}
            {step < steps.length - 1 ? (
              <button disabled={!canNext} onClick={() => setStep(step + 1)} style={{ background: canNext ? accent : T.line, color: canNext ? '#0B0C0E' : T.faint, border: 0, padding: '10px 22px', borderRadius: 999, fontSize: 13, fontWeight: 600, cursor: canNext ? 'pointer' : 'not-allowed', fontFamily: 'inherit' }}>Continue →</button>
            ) : (
              <button onClick={() => { setStep(5); }} style={{ background: accent, color: '#0B0C0E', border: 0, padding: '10px 22px', borderRadius: 999, fontSize: 13, fontWeight: 600, cursor: 'pointer', fontFamily: 'inherit' }}>Confirm booking</button>
            )}
          </div>
        </div>

        {step === 5 && (
          <div style={{ position: 'absolute', inset: 0, background: T.bg, display: 'flex', alignItems: 'center', justifyContent: 'center', padding: 32 }}>
            <div style={{ textAlign: 'center', maxWidth: 480 }}>
              <div style={{ width: 56, height: 56, borderRadius: 999, background: accent, color: '#0B0C0E', display: 'flex', alignItems: 'center', justifyContent: 'center', margin: '0 auto', fontSize: 28 }}>✓</div>
              <h3 style={{ fontFamily: 'Fraunces, serif', fontWeight: 400, fontSize: 36, color: T.text, marginTop: 24, letterSpacing: '-0.02em' }}>Booking received.</h3>
              <p style={{ color: T.muted, fontSize: 15, lineHeight: 1.55, marginTop: 12 }}>
                We\u2019ll text {data.phone || 'you'} within 4 hours to confirm {data.date} at {data.time}.
              </p>
              <button onClick={onClose} style={{ marginTop: 28, background: 'transparent', color: T.text, border: `1px solid ${T.line}`, padding: '12px 22px', borderRadius: 999, fontSize: 13, cursor: 'pointer', fontFamily: 'inherit' }}>Close</button>
            </div>
          </div>
        )}
      </div>
    </div>
  );
}

function Field({ T, label, value, onChange, placeholder, type = 'text', multiline }) {
  const Cmp = multiline ? 'textarea' : 'input';
  return (
    <label style={{ display: 'block' }}>
      <div style={{ color: T.faint, fontSize: 11, letterSpacing: '0.18em', textTransform: 'uppercase', marginBottom: 8 }}>{label}</div>
      <Cmp
        type={type}
        value={value}
        onChange={e => onChange(e.target.value)}
        placeholder={placeholder}
        rows={multiline ? 3 : undefined}
        style={{
          width: '100%', boxSizing: 'border-box',
          background: T.surface, border: `1px solid ${T.line}`, borderRadius: 8,
          padding: '12px 14px', color: T.text, fontSize: 14, fontFamily: 'inherit',
          resize: multiline ? 'vertical' : 'none', outline: 'none',
        }}
      />
    </label>
  );
}

function Row({ T, k, v }) {
  return (
    <div style={{ display: 'flex', justifyContent: 'space-between', gap: 16, padding: '8px 0' }}>
      <span style={{ color: T.muted, fontSize: 13 }}>{k}</span>
      <span style={{ color: T.text, fontSize: 13, textAlign: 'right' }}>{v}</span>
    </div>
  );
}

function DatePicker({ T, accent, value, onChange }) {
  const today = new Date(2026, 4, 7); // May 7 2026
  const days = Array.from({ length: 14 }).map((_, i) => {
    const d = new Date(today);
    d.setDate(today.getDate() + i + 2); // start booking ~2 days out
    return d;
  });
  const fmt = (d) => `${d.toLocaleString('en', { month: 'short' })} ${d.getDate()}`;
  return (
    <div style={{ display: 'grid', gridTemplateColumns: 'repeat(7, 1fr)', gap: 6 }}>
      {days.map((d, i) => {
        const key = fmt(d);
        const dow = d.toLocaleString('en', { weekday: 'short' });
        const sel = value === key;
        const sunday = d.getDay() === 0 || d.getDay() === 1;
        return (
          <button key={i} disabled={sunday} onClick={() => onChange(key)} style={{
            all: 'unset', cursor: sunday ? 'not-allowed' : 'pointer', padding: '10px 0',
            textAlign: 'center', border: `1px solid ${sel ? accent : T.line}`, borderRadius: 6,
            background: sel ? accent + '20' : 'transparent', opacity: sunday ? 0.3 : 1,
          }}>
            <div style={{ color: T.faint, fontSize: 10, letterSpacing: '0.12em', textTransform: 'uppercase' }}>{dow}</div>
            <div style={{ color: T.text, fontSize: 14, marginTop: 2, fontVariantNumeric: 'tabular-nums' }}>{d.getDate()}</div>
          </button>
        );
      })}
    </div>
  );
}

// ─── App ────────────────────────────────────────────────────────────────────

function App() {
  const [t, setTweak] = useTweaks(TWEAK_DEFAULTS);
  const [bookingOpen, setBookingOpen] = React.useState(false);
  const [bookingService, setBookingService] = React.useState(null);
  const isMobile = useIsMobile(760);

  const T = THEMES[t.theme] || THEMES.midnight;
  const openBooking = (sid) => { setBookingService(typeof sid === 'string' ? sid : null); setBookingOpen(true); };

  React.useEffect(() => {
    document.body.style.background = T.bg;
    document.body.style.color = T.text;
  }, [T]);

  return (
    <div style={{
      minHeight: '100vh', background: T.bg, color: T.text,
      fontFamily: 'Inter Tight, ui-sans-serif, system-ui, -apple-system, sans-serif',
      fontSize: t.density === 'compact' ? 14 : t.density === 'comfy' ? 17 : 15,
    }}>
      <Nav T={T} accent={t.accent} onBook={() => openBooking()} />
      <Hero T={T} accent={t.accent} layout={t.heroLayout} onBook={() => openBooking()} />
      <MarqueeStrip T={T} accent={t.accent} />
      <Services T={T} accent={t.accent} style={t.serviceStyle} showPricing={t.showPricing} onBook={openBooking} />
      <Process T={T} accent={t.accent} />
      <Gallery T={T} accent={t.accent} />
      <Reviews T={T} accent={t.accent} />
      <FAQSection T={T} accent={t.accent} />
      <CTA T={T} accent={t.accent} onBook={() => openBooking()} />
      <Footer T={T} accent={t.accent} />

      <BookingModal T={T} accent={t.accent} open={bookingOpen} onClose={() => setBookingOpen(false)} initialService={bookingService} />

      <TweaksPanel>
        <TweakSection label="Theme" />
        <TweakRadio label="Mode" value={t.theme} options={['midnight', 'graphite', 'paper']} onChange={(v) => setTweak('theme', v)} />
        <TweakColor label="Accent" value={t.accent} options={['#E8B04B', '#D9483B', '#4A8FD9', '#5DA46B', '#C9A875', '#EAEAEA']} onChange={(v) => setTweak('accent', v)} />
        <TweakSection label="Layout" />
        <TweakSelect label="Hero" value={t.heroLayout} options={['cinematic', 'split', 'editorial']} onChange={(v) => setTweak('heroLayout', v)} />
        <TweakSelect label="Services" value={t.serviceStyle} options={['cards', 'list', 'table']} onChange={(v) => setTweak('serviceStyle', v)} />
        <TweakToggle label="Show pricing" value={t.showPricing} onChange={(v) => setTweak('showPricing', v)} />
        <TweakRadio label="Density" value={t.density} options={['compact', 'regular', 'comfy']} onChange={(v) => setTweak('density', v)} />
        <TweakSection label="Booking" />
        <TweakButton onClick={() => setBookingOpen(true)}>Open booking flow →</TweakButton>
      </TweaksPanel>
    </div>
  );
}

ReactDOM.createRoot(document.getElementById('root')).render(<App />);
